Activity-Lang: investigate / fix string conversion
...turns out that util::toString does not explicitly handle pointers differently, for very good reasons; this function must always work, always produce a simple and compact representation, and it must be possible to instantiate the template and take a function reference (which precludes adding an overload for pointers)
This commit is contained in:
parent
3784bd7252
commit
49435c8aca
3 changed files with 41 additions and 7 deletions
|
|
@ -170,6 +170,10 @@ namespace util {
|
|||
* a predictable display of printed unit-test results.
|
||||
* @remark while the actual parameter is passed by const-ref,
|
||||
* cv-qualifiactions and references are stripped from the type
|
||||
* @note Deliberately there is no magic detection/support for pointers.
|
||||
* This function _must not be overloaded_ (to avoid ambiguities
|
||||
* in more elaborate template instantiations). If you want pointers
|
||||
* to be indicated (with address), please use util::showPtr explicitly.
|
||||
*/
|
||||
template<typename TY>
|
||||
inline std::string
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ namespace gear {
|
|||
+ util::toString(data_.feed.two)
|
||||
+ "}";
|
||||
case HOOK:
|
||||
return util::toString(data_.callback.hook)
|
||||
return util::showPtr (data_.callback.hook)
|
||||
+ "("
|
||||
+ util::toString(data_.callback.arg)
|
||||
+ ")";
|
||||
|
|
|
|||
|
|
@ -82196,16 +82196,46 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node CREATED="1692372445273" ID="ID_1169755490" MODIFIED="1692372481928" TEXT="reicht Aktivierung an die überwachte Activity weiter"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1692380008794" ID="ID_1667310608" MODIFIED="1692380053308" TEXT="diagnostic / toString">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1692380099390" ID="ID_851484000" MODIFIED="1692380120878" TEXT="soll die angegebene ID mit ausgeben">
|
||||
<node COLOR="#338800" CREATED="1692380008794" ID="ID_1667310608" MODIFIED="1692404518110" TEXT="diagnostic / toString">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#435e98" CREATED="1692380099390" ID="ID_851484000" MODIFIED="1692404522200" TEXT="soll die angegebene ID mit ausgeben">
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1692380024576" ID="ID_1476915138" MODIFIED="1692380051034" TEXT="custom string-conv wird nicht aufgerufen">
|
||||
<node COLOR="#435e98" CREATED="1692380024576" ID="ID_1476915138" MODIFIED="1692404468016" TEXT="custom string-conv wird nicht aufgerufen">
|
||||
<icon BUILTIN="broken-line"/>
|
||||
<node BACKGROUND_COLOR="#f0d5c5" COLOR="#990033" CREATED="1692380071745" ID="ID_708893412" MODIFIED="1692380087144" TEXT="das enable_if greift nicht... warum?">
|
||||
<icon BUILTIN="help"/>
|
||||
<node CREATED="1692380071745" ID="ID_708893412" MODIFIED="1692404214990" TEXT="offensichtlicher Grund: es ist ein Pointer">
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
<node COLOR="#5b280f" CREATED="1692404216754" ID="ID_1806024569" MODIFIED="1692404238247" TEXT="util::toString sollte sich bei Pointern sinnvoll verhalten">
|
||||
<icon BUILTIN="button_cancel"/>
|
||||
<node COLOR="#5b280f" CREATED="1692404252108" ID="ID_842776495" MODIFIED="1692404264513" TEXT="versucht und gescheitert">
|
||||
<icon BUILTIN="stop-sign"/>
|
||||
</node>
|
||||
<node CREATED="1692404266082" ID="ID_1798178914" MODIFIED="1692404288005" TEXT="toString / StringConf ist ein fragiles Gebilde">
|
||||
<icon BUILTIN="clanbomber"/>
|
||||
<node CREATED="1692404302525" ID="ID_1518807306" MODIFIED="1692404316103" TEXT="StringConf hat zwei Ausbaustufen">
|
||||
<node CREATED="1692404316739" ID="ID_1804131943" MODIFIED="1692404332165" TEXT="Stufe II (format-obj) hat explizite overloads"/>
|
||||
<node CREATED="1692404333345" ID="ID_239552325" MODIFIED="1692404357873" TEXT="Vorraussetzung: CV / Referenzen / Pointer müssen schon gestrippt sein"/>
|
||||
</node>
|
||||
<node CREATED="1692404362158" ID="ID_354642887" MODIFIED="1692404379103" TEXT="toString wird aus Template-Code als Funktor instantiiert">
|
||||
<node CREATED="1692404383955" ID="ID_1821292277" MODIFIED="1692404392797" TEXT="das bedeutet: es muß stets eindeutig sein"/>
|
||||
<node CREATED="1692404394113" ID="ID_6338024" MODIFIED="1692404400867" TEXT="daher darf es keinen Overload geben"/>
|
||||
</node>
|
||||
<node CREATED="1692404404327" ID="ID_1956071960" MODIFIED="1692404416281" TEXT="das ist auch der Grund, warum format-cout explizit definiert ist">
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1692404424229" ID="ID_183530423" MODIFIED="1692404431008" TEXT="Ist auch gut so...">
|
||||
<node CREATED="1692404432332" ID="ID_1781762482" MODIFIED="1692404442926" TEXT="toString soll zuverlässig und minimal sein"/>
|
||||
<node CREATED="1692404446027" ID="ID_108331302" MODIFIED="1692404462356" TEXT="Spezialbehandlung für Pointer ist nicht immer erwünscht"/>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1692404471311" ID="ID_437668247" MODIFIED="1692404494054" TEXT="in diesem Fall einfach utill::showPtr() verwenden">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1692404501851" ID="ID_1339093549" MODIFIED="1692404517254" TEXT="custom operator string() eingebaut">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue