Last change
on this file since 120 was
81,
checked in by rosiere, 16 years ago
|
- Finish Environment (and test)
- Continue predictor_unit
- Add external tools
- svn keyword "Id" set
|
-
Property svn:keywords set to
Id
|
File size:
1.6 KB
|
Line | |
---|
1 | /* |
---|
2 | * |
---|
3 | * [desc.] |
---|
4 | */ |
---|
5 | #include "Tools/Viewer/Parser/include/parser.h" |
---|
6 | #include "qfileinfo.h" |
---|
7 | namespace morpheo{ |
---|
8 | namespace tools{ |
---|
9 | namespace viewer{ |
---|
10 | namespace parser{ |
---|
11 | |
---|
12 | int Parse::open_file(string name,int level){ |
---|
13 | |
---|
14 | bool pere=false; |
---|
15 | QFile file(QString::fromStdString(name)); |
---|
16 | QFileInfo info(file); |
---|
17 | QString testname; |
---|
18 | absolutePath=info.absolutePath().toStdString(); |
---|
19 | absolutePath.append("/"); |
---|
20 | testname=info.baseName(); |
---|
21 | if(testname.contains('-') && level==0) //file not top level (first open file) |
---|
22 | { |
---|
23 | testname=testname.left(testname.lastIndexOf('-',-1,Qt::CaseSensitive)); |
---|
24 | } |
---|
25 | else |
---|
26 | pere=true; |
---|
27 | |
---|
28 | |
---|
29 | if( !file.open( QIODevice::ReadOnly ) ) |
---|
30 | { |
---|
31 | cerr << "Position File :: Failed to load file : \"" << name << "\".\n"; |
---|
32 | return -1; |
---|
33 | } |
---|
34 | |
---|
35 | QDomDocument doc( "pos" ); |
---|
36 | if( !doc.setContent( &file ) ) |
---|
37 | { |
---|
38 | cerr << "Failed XML parse file.\n"; |
---|
39 | file.close(); |
---|
40 | return -1; |
---|
41 | } |
---|
42 | file.close(); |
---|
43 | QDomElement root = doc.documentElement(); |
---|
44 | if( root.tagName() != "description" ) |
---|
45 | { |
---|
46 | cerr <<"Invalid file.\n"; |
---|
47 | return -1; |
---|
48 | } |
---|
49 | else |
---|
50 | { |
---|
51 | #ifdef DBUG_PARSE |
---|
52 | cout << "description" <<endl; |
---|
53 | #endif |
---|
54 | //BaseP |
---|
55 | if(!base){ |
---|
56 | base=new morpheo::tools::viewer::bdd::BaseV(); |
---|
57 | toplevel=info.baseName().toStdString(); |
---|
58 | if(pere==true) |
---|
59 | { |
---|
60 | string op=""; |
---|
61 | op.append(absolutePath); |
---|
62 | op.append(toplevel); |
---|
63 | open_file_param(op); |
---|
64 | } |
---|
65 | } |
---|
66 | pos=new morpheo::tools::viewer::bdd::BaseP(); |
---|
67 | parser_pos(root.firstChild(),level); |
---|
68 | } |
---|
69 | return 0; |
---|
70 | } |
---|
71 | |
---|
72 | |
---|
73 | };//end parser |
---|
74 | };//end viewer |
---|
75 | };//end tools |
---|
76 | };//end morpheo |
---|
77 | |
---|
Note: See
TracBrowser
for help on using the repository browser.