xo-gc xo-alloc2: move Collector faceet gc/ -> alloc2/ for levelling

This commit is contained in:
Roland Conybeare 2026-03-04 22:26:31 +11:00
commit c8a76d23bd
23 changed files with 57 additions and 38 deletions

View file

@ -5,8 +5,8 @@
#pragma once
#include <xo/gc/GCObject.hpp>
#include <xo/gc/Collector.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/alloc2/Collector.hpp>
#include <xo/alloc2/Allocator.hpp>
#include <xo/facet/obj.hpp>
#include <xo/indentlog/print/ppindentinfo.hpp>

View file

@ -5,7 +5,7 @@
#pragma once
#include <xo/gc/Collector.hpp>
#include <xo/alloc2/Collector.hpp>
#include <xo/alloc2/Allocator.hpp>
#include <xo/indentlog/print/ppindentinfo.hpp>
#include <xo/facet/obj.hpp>

View file

@ -7,8 +7,8 @@
#include "DArray.hpp"
#include "DString.hpp"
#include <xo/gc/GCObject.hpp>
#include <xo/gc/Collector.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/alloc2/Collector.hpp>
#include <xo/alloc2/Allocator.hpp>
#include <xo/facet/obj.hpp>
#include <xo/indentlog/print/ppindentinfo.hpp>

View file

@ -6,7 +6,7 @@
#pragma once
#include <xo/alloc2/Allocator.hpp>
#include <xo/gc/Collector.hpp>
#include <xo/alloc2/Collector.hpp>
#include <xo/facet/obj.hpp>
#include <xo/indentlog/print/ppindentinfo.hpp>

View file

@ -5,7 +5,7 @@
#pragma once
#include <xo/gc/Collector.hpp>
#include <xo/alloc2/Collector.hpp>
#include <xo/alloc2/Allocator.hpp>
#include <xo/indentlog/print/ppindentinfo.hpp>
#include <xo/facet/obj.hpp>

View file

@ -5,7 +5,7 @@
#pragma once
#include <xo/gc/GCObject.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/facet/obj.hpp>
#include <xo/indentlog/print/ppindentinfo.hpp>

View file

@ -6,7 +6,7 @@
#pragma once
#include <xo/alloc2/Allocator.hpp>
#include <xo/gc/Collector.hpp>
#include <xo/alloc2/Collector.hpp>
#include <xo/facet/obj.hpp>
#include <xo/indentlog/print/ppindentinfo.hpp>
#include <string_view>
@ -15,6 +15,8 @@
//#include <cstdio>
namespace xo {
namespace mm { class ACollector; }
namespace scm {
/** @class DString
* @brief String implementation with gc hooks
@ -111,14 +113,7 @@ namespace xo {
static DString * printf(obj<AAllocator> mm,
size_type cap,
const char * fmt,
Args&&... args)
{
DString * result = DString::empty(mm, cap);
if (result) {
result->sprintf(fmt, std::forward<Args>(args)...);
}
return result;
}
Args&&... args);
///@}
/** @defgroup dstring-access access methods **/
@ -252,8 +247,10 @@ namespace xo {
/** clone string, using memory from allocator @p mm **/
DString * shallow_copy(obj<AAllocator> mm) const noexcept;
/** fixup child pointers (trivial for DString, no children) **/
size_type forward_children(obj<ACollector> gc) noexcept;
/** fixup child pointers (trivial for DString, no children)
* note: cref so we can use forward decl
**/
///@}
@ -285,6 +282,24 @@ namespace xo {
///@}
};
/** create string using printf-style formatting.
* Use memory from allocator @p mm with capacity @p cap.
* Truncates if result exceeds capacity.
* @return pointer to newly created DString
**/
template <typename... Args>
DString * DString::printf(obj<AAllocator> mm,
size_type cap,
const char * fmt,
Args&&... args)
{
DString * result = DString::empty(mm, cap);
if (result) {
result->sprintf(fmt, std::forward<Args>(args)...);
}
return result;
}
inline std::ostream & operator<<(std::ostream & os, const DString * x) {
if (x) {
os << std::string_view(*x);

View file

@ -9,4 +9,6 @@
#include "string/IGCObject_DString.hpp"
#include "string/IPrintable_DString.hpp"
#include <xo/alloc2/Allocator.hpp>
/* end String.hpp */

View file

@ -14,7 +14,7 @@
#pragma once
#include "GCObject.hpp"
#include <xo/gc/GCObject.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/alloc2/Allocator.hpp>
#include "DArray.hpp"
@ -64,4 +64,4 @@ namespace xo {
} /*namespace scm*/
} /*namespace xo*/
/* end */
/* end */

View file

@ -14,7 +14,7 @@
#pragma once
#include "GCObject.hpp"
#include <xo/gc/GCObject.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/alloc2/Allocator.hpp>
#include "DBoolean.hpp"
@ -64,4 +64,4 @@ namespace xo {
} /*namespace scm*/
} /*namespace xo*/
/* end */
/* end */

View file

@ -14,7 +14,7 @@
#pragma once
#include "GCObject.hpp"
#include <xo/gc/GCObject.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/alloc2/Allocator.hpp>
#include "DDictionary.hpp"
@ -64,4 +64,4 @@ namespace xo {
} /*namespace scm*/
} /*namespace xo*/
/* end */
/* end */

View file

@ -15,7 +15,7 @@
#include "GCObject.hpp"
#include <xo/object2/number/GCObjectConversion_DFloat.hpp>
#include <xo/gc/GCObject.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/alloc2/Allocator.hpp>
#include "DFloat.hpp"
@ -65,4 +65,4 @@ namespace xo {
} /*namespace scm*/
} /*namespace xo*/
/* end */
/* end */

View file

@ -14,7 +14,7 @@
#pragma once
#include "GCObject.hpp"
#include <xo/gc/GCObject.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/alloc2/Allocator.hpp>
#include "DInteger.hpp"
@ -64,4 +64,4 @@ namespace xo {
} /*namespace scm*/
} /*namespace xo*/
/* end */
/* end */

View file

@ -5,7 +5,7 @@
#pragma once
#include <xo/gc/Collector.hpp>
#include <xo/alloc2/Collector.hpp>
namespace xo {
namespace scm {

View file

@ -5,7 +5,7 @@
#pragma once
#include <xo/gc/Collector.hpp>
#include <xo/alloc2/Collector.hpp>
namespace xo {
namespace scm {

View file

@ -14,7 +14,7 @@
#pragma once
// includes (via {facet_includes})
#include <xo/gc/GCObject.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/facet/obj.hpp>
#include <xo/facet/facet_implementation.hpp>
#include <xo/facet/typeseq.hpp>

View file

@ -13,7 +13,7 @@
#pragma once
#include <xo/gc/GCObject.hpp>
#include <xo/alloc2/GCObject.hpp>
namespace xo {
namespace scm {

View file

@ -14,7 +14,7 @@
#pragma once
#include "GCObject.hpp"
#include <xo/gc/GCObject.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/alloc2/Allocator.hpp>
#include "DString.hpp"
@ -64,4 +64,4 @@ namespace xo {
} /*namespace scm*/
} /*namespace xo*/
/* end */
/* end */