diff --git a/src/lib/diff/record.hpp b/src/lib/diff/record.hpp index 4cedb08c5..7b83023b0 100644 --- a/src/lib/diff/record.hpp +++ b/src/lib/diff/record.hpp @@ -538,53 +538,62 @@ namespace diff{ /* === Specialisations to define the handling of attributes === */ - template<> - inline bool - Record::isAttribute (string const& v) - { - return false; ////TODO - } - - template<> - inline bool - Record::isTypeID (string const& v) - { - return false; ////TODO - } - - template<> - inline string - Record::extractTypeID (string const& v) - { - return "todo"; ////TODO - } - - template<> - inline string - Record::buildTypeAttribute (string const& typeID) - { - return string(); ///TODO - } - template<> inline string Record::extractKey (string const& v) { - return "todo"; ////TODO + size_t pos = v.find('='); + if (string::npos == pos) + return ""; + else + return v.substr(0,pos); //////////////////////////////TODO should trim here } template<> inline string Record::extractVal (string const& v) { - return string(); ///TODO + size_t pos = v.find('='); + if (string::npos == pos) + return v; + else + return v.substr(pos+1, v.length() - pos); ////////////TODO should trim here + } + + template<> + inline bool + Record::isAttribute (string const& v) + { + return string::npos != v.find('='); + } + + template<> + inline bool + Record::isTypeID (string const& v) + { + return isAttribute(v) + && "type" == extractKey(v); + } + + template<> + inline string + Record::extractTypeID (string const& v) + { + return "todo"; //////////////////////////////////////////TODO do we really need this function? + } + + template<> + inline string + Record::buildTypeAttribute (string const& typeID) + { + return "type = "+typeID; } template<> inline string Record::renderAttribute (string const& attrib) { - return extractKey(attrib) + " = " + string(extractVal(attrib)); + return extractKey(attrib) + " = " + extractVal(attrib); } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index d2fe9bbb6..603e1d74a 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -69,8 +69,7 @@ eine Referenz oder einen konstanten Wert verwenden

- - + @@ -89,8 +88,7 @@ aber hat eine Builder-Mechanik

- - +
@@ -104,8 +102,7 @@ eigentlich fehlte nur die get()-Operation

- - + @@ -125,8 +122,7 @@ aber nicht wirklich; der workaround könnte schon die Lösung sein #963

- - + @@ -148,8 +144,7 @@ Und ich wollte keine Zeit auf einen exzessiven Unit-Test verwenden

- - +
@@ -161,8 +156,7 @@ generische Lösung verschoben #963

- -
+
@@ -176,8 +170,7 @@ C++11 erlaubt =default

- - + @@ -223,8 +216,7 @@ Object builder

- - + @@ -241,8 +233,7 @@ Und die Builder-Funktionen brauchen eigentlich spezielles Wissen über den zu konstruierenden Zieltyp

- -
+ @@ -257,8 +248,7 @@ Mutator selber is noncopyable

- - +
@@ -274,8 +264,7 @@ pro / contra

- - + @@ -294,8 +283,7 @@ Nicht sicher, ob der Optimiser das hinbekommt

- -
+ @@ -306,8 +294,7 @@ nur auf dem Mutator

- -
+
@@ -322,16 +309,49 @@ und muß dediziert erstellt werden

- -
+
- + + + + + + + + + + +

+ möglicherweise schon gelöst, +

+

+ denn Record ist insgesamt immutable. +

+

+ Also können wir einen Find mit einem const_iterator machen +

+ + +
+
+ + + + + + + + + + + +
@@ -352,8 +372,7 @@ scheidet aus, wegen Wertsemantik

- - +
@@ -403,8 +422,7 @@ heißt: in der Diff-Verarbeitung wird dieser spezielle check verwendet

- - + @@ -425,8 +443,7 @@ m.E. die einzig saubere Desgin-Variante!

- - +
@@ -456,8 +473,7 @@ - - + @@ -475,8 +491,7 @@ heißt: wird direkt von standard-equality so behandelt

- - +