#include <ExCFile.h>
Inheritance diagram for ExCFileReader:
Public Methods | |
ExCFileReader () | |
ExCFileReader (string) | |
Data Fields | |
ExCFileData | getContent (void) |
Private Attributes | |
ExCFileData * | file_data |
|
Definition at line 111 of file ExCFile.h.
00111 : ExCFile () { file_data = new ExCFileData; }; |
|
Definition at line 99 of file ExCFile.cpp.
00099 : ExCFile (s, RO) { 00100 file_data = new ExCFileData; 00101 } |
|
Definition at line 109 of file ExCFile.h. Referenced by ExCFileReader(). |
|
Definition at line 103 of file ExCFile.cpp. Referenced by ExManagerCommand::LoadCommandFile(), and ExManagerConsole::LoadStringActionFile().
00103 { 00104 Guard(ExCFileData ExCFileReader::getContent (void)) 00105 fstream file; 00106 if (file_data->getType() == FILE_EMPTY) { 00107 file.open (filename.data(), getOpenMode (RO)); 00108 if (file.is_open ()) { 00109 string d; 00110 ExCFileDataAction ds; 00111 bool first = true; 00112 string action; 00113 while (! getline (file, d).eof ()) { 00114 if (first == false && (file_data->getType() != FILE_EMPTY || file_data->getType() != FILE_UNKNOWN)) { 00115 action = d.substr (0, d.find ("#")); 00116 #ifdef DEBUG_HIGH 00117 cout << "end of -> " << action.find ("end of") << endl; 00118 #endif 00119 if (action.find ("end of") != 0) { 00120 ds.setAction (action); 00121 #ifdef DEBUG_HIGH 00122 cout << "action -> " << d.substr (0, d.find ("#")) << endl; 00123 #endif 00124 if (file_data->getType() == FILE_COMMAND) { 00125 string dds = d.substr (d.find ("#") + 1, d.length()); 00126 string dds1 = dds.substr (0, d.find ("#")); 00127 ds.setCommand (atoi ((dds1).data())); 00128 #ifdef DEBUG_HIGH 00129 cout << "command -> " << atoi (dds1.data()) << endl; 00130 #endif 00131 ds.setParam (dds.substr (dds.find ("#") + 1, d.length())); 00132 #ifdef DEBUG_HIGH 00133 cout << "param -> " << dds.substr (dds.find ("#") + 1, d.length()) << endl; 00134 #endif 00135 } else { 00136 string dds = d.substr (d.find ("#") + 1, d.length()); 00137 ds.setCommand (atoi ((dds).data())); 00138 #ifdef DEBUG_HIGH 00139 cout << "command -> " << atoi (d.substr (d.find ("#") + 1, d.length()).data()) << endl; 00140 #endif 00141 } 00142 file_data->addElement (ds); 00143 } 00144 } else { 00145 // erk 00146 int t = FILE_UNKNOWN; 00147 if (d == "#exec#") t = FILE_BATCH; 00148 else if (d == "#command#") t = FILE_COMMAND; 00149 else if (d == "#console#") t = FILE_CONSOLE; 00150 else if (d == "#set#") t = FILE_SET; 00151 else if (d == "#particulesystem#") t = FILE_PARTICULE; 00152 else if (d == "#interface#") t = FILE_INTERFACE; 00153 file_data->setType (t); 00154 #ifdef DEBUG_HIGH 00155 cout << "type -> " << d << " " << t << endl; 00156 #endif 00157 first = false; 00158 } 00159 } 00160 file.close (); 00161 } else { cout << "pika plop !" << endl; } 00162 } else { cout << "plok ? plop !" << endl; } 00163 return *file_data; 00164 UnGuard 00165 } |