// Copyright 2005, The Tanoshi development team // Assigned to public domain, Use as you wish withou restriction. #include #include int main() { Tanoshi::ByteArray test; Tanoshi::ByteArray test2((unsigned int)100); printf("test size: %d\n", test.size()); printf("test2 size: %d\n", test2.size()); test.append("asdf", 4); printf("test size: %d\n", test.size()); printf("test2 size: %d\n", test2.size()); test2 = test; test2.append("fdsa", 4); printf("test size: %d\n", test.size()); printf("test2 size: %d\n", test2.size()); Tanoshi::Protocol ptest; ptest.add("testing", test); ptest.add("another", test2); Tanoshi::ByteArray result = ptest.pack(); result.dump(); Tanoshi::Protocol ptest2; if(ptest2.unpack(result) == -1) printf("did not parse correctly\n"); if(ptest2.exists("testing")) ptest2.getInfo("testing").dump(); if(ptest2.exists("another")) ptest2.getInfo("another").dump(); if(ptest2.exists("random")) ptest2.getInfo("random").dump(); else printf("\"random\" does not exist\n"); return 0; }