From ea0cf35e10c4a1488de4e043de3540c1ae7bbf08 Mon Sep 17 00:00:00 2001 From: micio Date: Sun, 11 Sep 2011 15:47:58 +0000 Subject: [PATCH] Bazaar/PolyXMLTest : updated with latest PolyXML changes git-svn-id: svn://ultimatepp.org/upp/trunk@3854 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- bazaar/PolyXMLTest/Main.cpp | 74 ++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/bazaar/PolyXMLTest/Main.cpp b/bazaar/PolyXMLTest/Main.cpp index cc87c92c1..c13de6921 100644 --- a/bazaar/PolyXMLTest/Main.cpp +++ b/bazaar/PolyXMLTest/Main.cpp @@ -109,33 +109,33 @@ void DumpMap(PolyXMLArrayMap &polyMap) } } -void DumpMapPtr(PolyXMLArrayMapPtr &polyMap) +void DumpMapOne(PolyXMLArrayMapOne &polyMap) { for(int i = 0; i < polyMap.GetCount(); i++) { Cerr() << " class with key '" << polyMap.GetKey(i) << "' is a '" << polyMap[i]->IsA() << "'\n"; if(polyMap[i]->IsA() == "Base") - Cerr() << " BaseData = '" << ((Ptr &)polyMap[i])->BaseData << "'\n"; + Cerr() << " BaseData = '" << ((One &)polyMap[i])->BaseData << "'\n"; else if(polyMap[i]->IsA() == "Derived") { - Cerr() << " BaseData = '" << ((Ptr &)polyMap[i])->BaseData << "'\n"; - Cerr() << " DerivedData = '" << ((Ptr &)polyMap[i])->DerivedData << "'\n"; + Cerr() << " BaseData = '" << ((One &)polyMap[i])->BaseData << "'\n"; + Cerr() << " DerivedData = '" << ((One &)polyMap[i])->DerivedData << "'\n"; } else if(polyMap[i]->IsA() == "Another") { - Cerr() << " BaseData = '" << ((Ptr &)polyMap[i])->BaseData << "'\n"; - Cerr() << " DerivedData = '" << ((Ptr &)polyMap[i])->DerivedData << "'\n"; - Cerr() << " AnotherData = '" << ((Ptr &)polyMap[i])->AnotherData << "'\n"; + Cerr() << " BaseData = '" << ((One &)polyMap[i])->BaseData << "'\n"; + Cerr() << " DerivedData = '" << ((One &)polyMap[i])->DerivedData << "'\n"; + Cerr() << " AnotherData = '" << ((One &)polyMap[i])->AnotherData << "'\n"; } else if(polyMap[i]->IsA() == "OneMore") { - Cerr() << " BaseData = '" << ((Ptr &)polyMap[i])->BaseData << "'\n"; - Cerr() << " DerivedData = '" << ((Ptr &)polyMap[i])->DerivedData << "'\n"; - Cerr() << " AnotherData = '" << ((Ptr &)polyMap[i])->AnotherData << "'\n"; - Cerr() << " OneMoreData = '" << ((Ptr &)polyMap[i])->OneMoreData << "'\n"; + Cerr() << " BaseData = '" << ((One &)polyMap[i])->BaseData << "'\n"; + Cerr() << " DerivedData = '" << ((One &)polyMap[i])->DerivedData << "'\n"; + Cerr() << " AnotherData = '" << ((One &)polyMap[i])->AnotherData << "'\n"; + Cerr() << " OneMoreData = '" << ((One &)polyMap[i])->OneMoreData << "'\n"; } else if(polyMap[i]->IsA() == "*UNKNOWN*") - Cerr() << " Original class is '" << ((Ptr > &)polyMap[i])->GetUnknownClassName() << "' -- STREAMED IN AS RAW XML\n"; + Cerr() << " Original class is '" << ((One > &)polyMap[i])->GetUnknownClassName() << "' -- STREAMED IN AS RAW XML\n"; else Cerr() << "oops... known class, but I don't know how to handle it\n"; } @@ -288,44 +288,44 @@ CONSOLE_APP_MAIN { Cerr() << "\n/////////////////////////////////////////////////////////////////////////////////////////"; - Cerr() << "\nPolyXMLArrayMapPtr tests"; + Cerr() << "\nPolyXMLArrayMapOne tests"; Cerr() << "\n/////////////////////////////////////////////////////////////////////////////////////////"; - PolyXMLArrayMapPtr polyMapPtr; + PolyXMLArrayMapOne polyMapOne; - Ptr b = new Base; + One b = new Base; b->BaseData = "Sample data in base class"; - polyMapPtr.Add("BaseKey", b); + polyMapOne.Add("BaseKey", b); - Ptr d = new Derived; + One d = new Derived; d->BaseData = "Sample data in derived class"; d->DerivedData = "Another sample data in derived class"; - polyMapPtr.Add("DerivedKey", (Ptr&)d); + polyMapOne.Add("DerivedKey", (One&)d); - Ptr a = dynamic_cast(Base::CreatePtr("Another")); + One a = dynamic_cast(Base::CreatePtr("Another")); a->BaseData = "Sample data in Derived class"; a->DerivedData = "Another sample data in Derived class"; a->AnotherData = 12345; - polyMapPtr.Add("AnotherKey", (Ptr&)a); + polyMapOne.Add("AnotherKey", (One&)a); - Ptr o = new OneMore; + One o = new OneMore; o->BaseData = "Sample data in OneMore class"; o->DerivedData = "Another sample data in OneMore class"; o->AnotherData = 12; o->OneMoreData = 3.1418; - polyMapPtr.Add("OneMoreKey", (Ptr&)o); + polyMapOne.Add("OneMoreKey", (One&)o); - Cerr() << "\nMap content before streaming out: " << polyMapPtr.GetCount() << " classes:\n"; - DumpMapPtr(polyMapPtr); + Cerr() << "\nMap content before streaming out: " << polyMapOne.GetCount() << " classes:\n"; + DumpMapOne(polyMapOne); - String s = StoreAsXML(polyMapPtr, "PolyXMLTest"); + String s = StoreAsXML(polyMapOne, "PolyXMLTest"); Cerr() << "\nStreamed XML : \n\n" << s ; - polyMapPtr.Clear(); - LoadFromXML(polyMapPtr, s); + polyMapOne.Clear(); + LoadFromXML(polyMapOne, s); - Cerr() << "\nMap content after streaming in : " << polyMapPtr.GetCount() << " classes:\n"; - DumpMapPtr(polyMapPtr); + Cerr() << "\nMap content after streaming in : " << polyMapOne.GetCount() << " classes:\n"; + DumpMapOne(polyMapOne); // Now we de-register all classes and re-register all of them BESIDES one // to test in-streaming with an unknown class @@ -336,20 +336,20 @@ CONSOLE_APP_MAIN Cerr() << "\nStreaming in XML with an unknown class : \n\n"; - polyMapPtr.Clear(); - LoadFromXML(polyMapPtr, s); + polyMapOne.Clear(); + LoadFromXML(polyMapOne, s); - Cerr() << "\nMap content after streaming in : " << polyMapPtr.GetCount() << " classes:\n"; - DumpMapPtr(polyMapPtr); + Cerr() << "\nMap content after streaming in : " << polyMapOne.GetCount() << " classes:\n"; + DumpMapOne(polyMapOne); Cerr() << "\nStreaming out XML with an unknown class : \n\n"; - s = StoreAsXML(polyMapPtr, "PolyXMLTest"); + s = StoreAsXML(polyMapOne, "PolyXMLTest"); Cerr() << "\nRedefining missing class and streaming it the whole stuff again : \n\n"; Another::Register("Another", "you can add a description and also an index", 10); - polyMapPtr.Clear(); - LoadFromXML(polyMapPtr, s); - DumpMapPtr(polyMapPtr); + polyMapOne.Clear(); + LoadFromXML(polyMapOne, s); + DumpMapOne(polyMapOne); } }