[Zrouter-src] ZRouter.org: push to zconf++ zconf++/tests/test_model.cc

zrouter-src at zrouter.org zrouter-src at zrouter.org
Thu Dec 15 07:53:07 UTC 2011


details:   /rev/22b5670a571b
changeset: 28:22b5670a571b
user:      "Nicolai Petri <nicolai at petri.dk>"
date:      Thu Dec 15 08:52:36 2011 +0100
description:
Make output slightly nicer to look at.

diffstat:

 zconf++/tests/test_model.cc |  16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diffs (52 lines):

diff -r 48621451aa1e -r 22b5670a571b zconf++/tests/test_model.cc
--- a/zconf++/tests/test_model.cc	Thu Dec 15 08:52:00 2011 +0100
+++ b/zconf++/tests/test_model.cc	Thu Dec 15 08:52:36 2011 +0100
@@ -9,7 +9,8 @@
 
 using namespace ZRouter;
 using namespace std;
-	
+
+/*	
 	template <class TClass> 
 		class TModelActionHandler : public IModelActionHandler {
 			protected:
@@ -28,7 +29,7 @@
 			virtual LeafRef describe() {
 				return (*m_obj.*m_describer)();
 			}
-	};	
+	};	*/
 	class TestHandler {
 		protected:
 			Leaf m_description;
@@ -81,23 +82,24 @@
 	L2[6]["goraf"][3] = Leaf("Dyt byt");
 
 	TestHandler *f = new TestHandler();
-	M["system"]["handlers"]["testhandler"] = Leaf(new TModelActionHandler<TestHandler>(f, &TestHandler::handle, &TestHandler::describe));
+	//M["system"]["handlers"]["testhandler"] = Leaf(new TModelActionHandler<TestHandler>(f, &TestHandler::handle, &TestHandler::describe));
+	M["system"]["handlers"]["testhandler"] = ACTION_HANDLER(TestHandler, f, handle, describe);
 	//Leaf Req();
 	Leaf BB;
 	BB["nodeid"] = 3;
 	LeafRef Req =  M["nodeid"];
 	Leaf resp = M["system"]["handlers"]["testhandler"].call(Req);
 	cout << "Output of testhandler() action :" << ModelWriter::write(resp, " RESPONSE: ") << endl;
-	cout << "TestHandler description is : " << ModelWriter::write(M["system"]["handlers"]["testhandler"].describe(), " DESCR: ") << endl;
+	cout << "TestHandler description is : " << endl << ModelWriter::write(M["system"]["handlers"]["testhandler"].describe(), " DESCR: ") << endl;
 	std::string ModelAsText = ModelWriter::write(M, "") + "\n";
-	cout << "Output PREPARSED :" << ModelWriter::write(M, " PREPARSED: ") << endl;
+	cout << "Output PREPARSED :" << endl << ModelWriter::write(M, " PREPARSED: ") << endl;
    Json::Reader reader;
 		Leaf NewM;
    bool parsingSuccessful = reader.parse( ModelAsText, NewM );
-	cout << "Output of PARSER :" << ModelWriter::write(NewM, " PARSED: ") << endl;
+	cout << "Output of PARSER :" << endl << ModelWriter::write(NewM, " PARSED: ") << endl;
 	std::stringstream ss;
 	ModelWriter::write(ss, NewM, " PARSED2: ");
-	cout << "Output of PARSER2 :" << ss.str() << endl;
+	cout << "Output of PARSER2 :" << endl << ss.str() << endl;
 
 //	for (int c=0; c < L2.numChildren(); c++) {
 //		cout << "  dumping " << c << " => " << L2[c] << endl;


More information about the Zrouter-src mailing list