Debian Codegraph @

testsuite/test_old/parsetest.cc

raw
1 // Länkas ståendes i katalogin music/utils:
2 //
3 // g++ -o parsetest -I .. parsetest.cc -L ../rudeconfig/.libs -l rudeconfig
4 //
5 // Användning:
6 // Behvovs inte,... typ
7 // export LD_LIBRARY_PATH=/home/hjorth/music/rudeconfig/.libs
8 //
9 // LD_LIBRARY_PATH=/home/hjorth/music/rudeconfig/.libs ./parsetest ../test/launchtest.music
10
11 #include "rudeconfig/src/config.h"
12 #include <iostream>
13
14 int
15 main (int argc, char** argv)
16 {
17 rude::Config* cfile = new rude::Config ();
18 cfile->load (argv[1]);
19 int n_sections = cfile->getNumSections ();
20 for (int s = 0; s < n_sections; ++s)
21 {
22 const char* name = cfile->getSectionNameAt (s);
23 cfile->setSection (name);
24 std::cout << "Section \"" << name << "\":" << std::endl;
25
26 int n_members = cfile->getNumDataMembers ();
27 for (int m = 0; m < n_members; ++m)
28 {
29 const char* name = cfile->getDataNameAt (m);
30 std::cout << name << '\t' << cfile->getStringValue (name) << std::endl;
31 }
32
33 int n_sd = cfile->getNumSourceDestMembers();
34
35 for (int i = 0; i < n_sd; i++)
36 {
37 const char* srcApp = cfile->getSrcAppAt(i);
38 const char* srcObj = cfile->getSrcObjAt(i);
39 const char* destApp = cfile->getDestAppAt(i);
40 const char* destObj = cfile->getDestObjAt(i);
41 const char* width = cfile->getWidthAt(i);
42
43 std::cout << srcApp << "." << srcObj
44 << " -> " << destApp << "." << destObj
45 << " [" << width << "]\n";
46 }
47 }
48 }