diff --git a/include/xo/object2/DArray.hpp b/include/xo/object2/DArray.hpp index 879bb76c..55d5e068 100644 --- a/include/xo/object2/DArray.hpp +++ b/include/xo/object2/DArray.hpp @@ -5,8 +5,8 @@ #pragma once -#include -#include +#include +#include #include #include #include diff --git a/include/xo/object2/DBoolean.hpp b/include/xo/object2/DBoolean.hpp index 69dd1c16..ee9fe3be 100644 --- a/include/xo/object2/DBoolean.hpp +++ b/include/xo/object2/DBoolean.hpp @@ -5,7 +5,7 @@ #pragma once -#include +#include #include #include #include diff --git a/include/xo/object2/DDictionary.hpp b/include/xo/object2/DDictionary.hpp index 1f028434..f5844088 100644 --- a/include/xo/object2/DDictionary.hpp +++ b/include/xo/object2/DDictionary.hpp @@ -7,8 +7,8 @@ #include "DArray.hpp" #include "DString.hpp" -#include -#include +#include +#include #include #include #include diff --git a/include/xo/object2/DFloat.hpp b/include/xo/object2/DFloat.hpp index a46a990d..4e4be861 100644 --- a/include/xo/object2/DFloat.hpp +++ b/include/xo/object2/DFloat.hpp @@ -6,7 +6,7 @@ #pragma once #include -#include +#include #include #include diff --git a/include/xo/object2/DInteger.hpp b/include/xo/object2/DInteger.hpp index b03693be..3fd13672 100644 --- a/include/xo/object2/DInteger.hpp +++ b/include/xo/object2/DInteger.hpp @@ -5,7 +5,7 @@ #pragma once -#include +#include #include #include #include diff --git a/include/xo/object2/DList.hpp b/include/xo/object2/DList.hpp index 39e0b584..50ab8dd7 100644 --- a/include/xo/object2/DList.hpp +++ b/include/xo/object2/DList.hpp @@ -5,7 +5,7 @@ #pragma once -#include +#include #include #include diff --git a/include/xo/object2/DString.hpp b/include/xo/object2/DString.hpp index a6cedb00..bb57e3da 100644 --- a/include/xo/object2/DString.hpp +++ b/include/xo/object2/DString.hpp @@ -6,7 +6,7 @@ #pragma once #include -#include +#include #include #include #include @@ -15,6 +15,8 @@ //#include 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 mm, size_type cap, const char * fmt, - Args&&... args) - { - DString * result = DString::empty(mm, cap); - if (result) { - result->sprintf(fmt, std::forward(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 mm) const noexcept; - /** fixup child pointers (trivial for DString, no children) **/ size_type forward_children(obj 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 + DString * DString::printf(obj mm, + size_type cap, + const char * fmt, + Args&&... args) + { + DString * result = DString::empty(mm, cap); + if (result) { + result->sprintf(fmt, std::forward(args)...); + } + return result; + } + inline std::ostream & operator<<(std::ostream & os, const DString * x) { if (x) { os << std::string_view(*x); diff --git a/include/xo/object2/String.hpp b/include/xo/object2/String.hpp index 111b04fb..f3d0527b 100644 --- a/include/xo/object2/String.hpp +++ b/include/xo/object2/String.hpp @@ -9,4 +9,6 @@ #include "string/IGCObject_DString.hpp" #include "string/IPrintable_DString.hpp" +#include + /* end String.hpp */ diff --git a/include/xo/object2/array/IGCObject_DArray.hpp b/include/xo/object2/array/IGCObject_DArray.hpp index 9af6d3c7..08f78aa8 100644 --- a/include/xo/object2/array/IGCObject_DArray.hpp +++ b/include/xo/object2/array/IGCObject_DArray.hpp @@ -14,7 +14,7 @@ #pragma once #include "GCObject.hpp" -#include +#include #include #include "DArray.hpp" @@ -64,4 +64,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end */ \ No newline at end of file +/* end */ diff --git a/include/xo/object2/boolean/IGCObject_DBoolean.hpp b/include/xo/object2/boolean/IGCObject_DBoolean.hpp index 1d90b60e..358aad18 100644 --- a/include/xo/object2/boolean/IGCObject_DBoolean.hpp +++ b/include/xo/object2/boolean/IGCObject_DBoolean.hpp @@ -14,7 +14,7 @@ #pragma once #include "GCObject.hpp" -#include +#include #include #include "DBoolean.hpp" @@ -64,4 +64,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end */ \ No newline at end of file +/* end */ diff --git a/include/xo/object2/dictionary/IGCObject_DDictionary.hpp b/include/xo/object2/dictionary/IGCObject_DDictionary.hpp index 7f2e0ad9..7fe1bc55 100644 --- a/include/xo/object2/dictionary/IGCObject_DDictionary.hpp +++ b/include/xo/object2/dictionary/IGCObject_DDictionary.hpp @@ -14,7 +14,7 @@ #pragma once #include "GCObject.hpp" -#include +#include #include #include "DDictionary.hpp" @@ -64,4 +64,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end */ \ No newline at end of file +/* end */ diff --git a/include/xo/object2/number/IGCObject_DFloat.hpp b/include/xo/object2/number/IGCObject_DFloat.hpp index 9a1dcbdc..b8e15b73 100644 --- a/include/xo/object2/number/IGCObject_DFloat.hpp +++ b/include/xo/object2/number/IGCObject_DFloat.hpp @@ -15,7 +15,7 @@ #include "GCObject.hpp" #include -#include +#include #include #include "DFloat.hpp" @@ -65,4 +65,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end */ \ No newline at end of file +/* end */ diff --git a/include/xo/object2/number/IGCObject_DInteger.hpp b/include/xo/object2/number/IGCObject_DInteger.hpp index 1136b577..fd2ea642 100644 --- a/include/xo/object2/number/IGCObject_DInteger.hpp +++ b/include/xo/object2/number/IGCObject_DInteger.hpp @@ -14,7 +14,7 @@ #pragma once #include "GCObject.hpp" -#include +#include #include #include "DInteger.hpp" @@ -64,4 +64,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end */ \ No newline at end of file +/* end */ diff --git a/include/xo/object2/object2_register_facets.hpp b/include/xo/object2/object2_register_facets.hpp index e419b794..7f42d5a0 100644 --- a/include/xo/object2/object2_register_facets.hpp +++ b/include/xo/object2/object2_register_facets.hpp @@ -5,7 +5,7 @@ #pragma once -#include +#include namespace xo { namespace scm { diff --git a/include/xo/object2/object2_register_types.hpp b/include/xo/object2/object2_register_types.hpp index 5c61692d..5663b086 100644 --- a/include/xo/object2/object2_register_types.hpp +++ b/include/xo/object2/object2_register_types.hpp @@ -5,7 +5,7 @@ #pragma once -#include +#include namespace xo { namespace scm { diff --git a/include/xo/object2/sequence/ASequence.hpp b/include/xo/object2/sequence/ASequence.hpp index 53d112e7..44f1d1cb 100644 --- a/include/xo/object2/sequence/ASequence.hpp +++ b/include/xo/object2/sequence/ASequence.hpp @@ -14,7 +14,7 @@ #pragma once // includes (via {facet_includes}) -#include +#include #include #include #include diff --git a/include/xo/object2/sequence/ISequence_Xfer.hpp b/include/xo/object2/sequence/ISequence_Xfer.hpp index 42d6cb1b..e0511e41 100644 --- a/include/xo/object2/sequence/ISequence_Xfer.hpp +++ b/include/xo/object2/sequence/ISequence_Xfer.hpp @@ -13,7 +13,7 @@ #pragma once -#include +#include namespace xo { namespace scm { diff --git a/include/xo/object2/string/IGCObject_DString.hpp b/include/xo/object2/string/IGCObject_DString.hpp index 159b9e49..2a907f37 100644 --- a/include/xo/object2/string/IGCObject_DString.hpp +++ b/include/xo/object2/string/IGCObject_DString.hpp @@ -14,7 +14,7 @@ #pragma once #include "GCObject.hpp" -#include +#include #include #include "DString.hpp" @@ -64,4 +64,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end */ \ No newline at end of file +/* end */ diff --git a/src/object2/DList.cpp b/src/object2/DList.cpp index 01d01d61..25770d01 100644 --- a/src/object2/DList.cpp +++ b/src/object2/DList.cpp @@ -6,7 +6,7 @@ #include "DList.hpp" #include "list/IPrintable_DList.hpp" #include "list/IGCObject_DList.hpp" -#include +#include #include #include #include diff --git a/src/object2/DString.cpp b/src/object2/DString.cpp index 69baa5d6..230fa4a4 100644 --- a/src/object2/DString.cpp +++ b/src/object2/DString.cpp @@ -4,12 +4,13 @@ **/ #include "DString.hpp" +#include #include #include #include namespace xo { - using xo::facet::typeseq; + using xo::reflect::typeseq; using xo::print::ppdetail_atomic; namespace scm { diff --git a/utest/DString.test.cpp b/utest/DString.test.cpp index 39dffef5..53db8e7f 100644 --- a/utest/DString.test.cpp +++ b/utest/DString.test.cpp @@ -5,6 +5,7 @@ #include "init_object2.hpp" #include "StringOps.hpp" +#include #include #include #include diff --git a/utest/Printable.test.cpp b/utest/Printable.test.cpp index 64736d22..2ca792fa 100644 --- a/utest/Printable.test.cpp +++ b/utest/Printable.test.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include #include diff --git a/utest/X1Collector.test.cpp b/utest/X1Collector.test.cpp index 90122c25..a2a2dec5 100644 --- a/utest/X1Collector.test.cpp +++ b/utest/X1Collector.test.cpp @@ -16,7 +16,7 @@ #include "list/IGCObject_DList.hpp" #include -#include +#include #include #include