Skip to content
Snippets Groups Projects
Commit 3a2d5212 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

string parsing and composing of unique objects

parent 9154da7e
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@
#include <alib/string>
#include <alib/memory>
#include <alib/algorithm>
#include <alib/istream>
 
#include <object/Object.h>
#include <object/AnyObject.h>
......@@ -108,7 +109,14 @@ public:
if ( pos != input.tellg ( ) )
throw exception::CommonException ( "First function of registered callback moved the stream." );
 
return callback->second->parse ( input );
object::Object res = callback->second->parse ( input );
input.clear();
while ( input >> ext::string ( "'" ) )
++ res;
input.clear();
return res;
}
 
static bool first ( std::istream & input ) {
......@@ -127,6 +135,8 @@ public:
if ( callback == composeFunctions ( ).end ( ) ) throw exception::CommonException ( "Compose callback for " + type + " tag not registered." );
 
callback->second->compose ( output, data );
for ( unsigned i = 0; i < data.getId ( ); ++ i )
output << "'";
}
 
};
......
......@@ -15,7 +15,7 @@ void ObjectTest::tearDown() {
}
 
void ObjectTest::testComposing() {
std::string input = "(1, 2)";
std::string input = "(1, 2)'";
object::Object label = factory::StringDataFactory::fromString (input);
 
std::string output = factory::StringDataFactory::toString(label);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment