- Timestamp:
- May 30, 2007, 12:08:56 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_open_file.cpp
r26 r32 4 4 */ 5 5 #include "Tools/Viewer/Parser/include/parser.h" 6 6 #include "qfileinfo.h" 7 7 namespace morpheo{ 8 8 namespace tools{ … … 11 11 12 12 int Parse::open_file(string name,int level){ 13 13 bool pere=false; 14 14 QFile file(QString::fromStdString(name)); 15 QString testname,testname2; 16 QString tmppath=QString::fromStdString(name); 17 QString path=tmppath.left(tmppath.lastIndexOf('/',-1,Qt::CaseSensitive)+1); 18 absolutePath=path.toStdString(); 19 testname=tmppath.right(tmppath.lastIndexOf('.',-1,Qt::CaseSensitive)-1); 20 testname2=testname.left(testname.lastIndexOf('.',-1,Qt::CaseSensitive)); 21 22 if(tmppath.contains('-') && level==0) //file not top level (first open file) 15 QFileInfo info(file); 16 QString testname; 17 absolutePath=info.absolutePath().toStdString(); 18 absolutePath.append("/"); 19 testname=info.baseName(); 20 if(testname.contains('-') && level==0) //file not top level (first open file) 23 21 { 24 testname 2=testname2.left(testname2.lastIndexOf('-',-1,Qt::CaseSensitive));22 testname=testname.left(testname.lastIndexOf('-',-1,Qt::CaseSensitive)); 25 23 } 24 else 25 pere=true; 26 26 27 27 28 28 if( !file.open( QIODevice::ReadOnly ) ) 29 29 { 30 c out << "Failed to load file. 1\n";30 cerr << "Position File :: Failed to load file. \n"; 31 31 return -1; 32 32 } … … 35 35 if( !doc.setContent( &file ) ) 36 36 { 37 c out << "Failed to load file.2\n";37 cerr << "Failed XML parse file.\n"; 38 38 file.close(); 39 39 return -1; … … 43 43 if( root.tagName() != "description" ) 44 44 { 45 c out<<"Invalid file.\n";45 cerr <<"Invalid file.\n"; 46 46 return -1; 47 47 } … … 54 54 if(!base){ 55 55 base=new morpheo::tools::viewer::bdd::BaseV(); 56 toplevel=testname2.toStdString(); 56 toplevel=info.baseName().toStdString(); 57 if(pere==true) 58 { 59 string op=""; 60 op.append(absolutePath); 61 op.append(toplevel); 62 open_file_param(op); 63 } 57 64 } 58 65 pos=new morpheo::tools::viewer::bdd::BaseP(); 59 //base->addBaseP(pos);60 66 parser_pos(root.firstChild(),level); 67 61 68 62 69 } 63 64 // delete pos;65 //delete ctemp;66 70 return 0; 67 71 }
Note: See TracChangeset
for help on using the changeset viewer.