Int main() { MetaInfoInterface info; //insert meta data info.setMetaValue("color", String("#ff0000")); info.setMetaValue("id", 112131415); //access id by index UInt id_index = info.metaRegistry().getIndex("id"); cout << "id : " << (UInt)(info.getMetaValue(id_index)) << endl; //access color by name cout << "color: " << (String)(info.getMetaValue("color")) << endl; return 0; } //end of main
START_SECTION((MetaInfoInterface())) test = new MetaInfoInterface; TEST_NOT_EQUAL(test, nullPointer) END_SECTION START_SECTION((~MetaInfoInterface())) delete test; END_SECTION MetaInfoInterface mi; START_SECTION((static MetaInfoRegistry& metaRegistry())) MetaInfoInterface mi2; mi2.metaRegistry().registerName("testname","testdesc","testunit"); TEST_EQUAL(mi2.metaRegistry().getIndex("testname"),1024); TEST_EQUAL(mi.metaRegistry().getIndex("testname"),1024); END_SECTION START_SECTION((void setMetaValue(const String& name, const DataValue& value))) NOT_TESTABLE //tested in the get method END_SECTION START_SECTION((void setMetaValue(UInt index, const DataValue& value))) NOT_TESTABLE //tested in the get method END_SECTION START_SECTION((const DataValue& getMetaValue(UInt index) const)) mi.setMetaValue(1024,String("testtesttest")); TEST_STRING_EQUAL(mi.getMetaValue(1024),"testtesttest"); END_SECTION