Files Classes Functions Hierarchy
#include <scopedependentfunctions.h>
Public Member Functions | |
| load () | |
| load (deque< rpnbase * > &ds, bool const evaluate=true) | |
| ~load () | |
| rpnbase * | copy () const |
| void | visit (deque< rpnbase * > &ds, rpnstring &fname) |
| string const | name () const |
| void | eval (deque< rpnbase * > &ds) |
Definition at line 69 of file scopedependentfunctions.h.
| load::load | ( | ) | [inline] |
Definition at line 117 of file scopedependentfunctions.cpp.
References eval().
00118 { 00119 if (evaluate) 00120 eval(ds); 00121 else 00122 ds.push_front(this); 00123 }
| load::~load | ( | ) | [inline] |
| rpnbase * load::copy | ( | ) | const [virtual] |
Reimplemented from rpnfunction.
Definition at line 125 of file scopedependentfunctions.cpp.
References load().
00126 { 00127 return new load(); 00128 }
| void load::eval | ( | deque< rpnbase * > & | ds | ) | [virtual] |
Reimplemented from rpnfunction.
Definition at line 130 of file scopedependentfunctions.cpp.
References rpnbase::dec().
Referenced by load().
00131 { 00132 if(ds.empty()) 00133 return; 00134 00135 ds[0]->accept(ds,*this); 00136 00137 dec(); 00138 }
| string const load::name | ( | ) | const [inline, virtual] |
Reimplemented from rpnfunction.
Definition at line 142 of file scopedependentfunctions.cpp.
References rpnbase::dec(), and rpnstring::str.
00143 { 00144 rpnbase* x0 = ds.front(); 00145 ds.pop_front(); 00146 00147 ifstream input( fname.str.c_str() ); 00148 if (!input) 00149 { 00150 ds.push_front(x0); 00151 return; 00152 } 00153 00154 SingletonPtr<inputstatescope>()->fd.reset(); 00155 00156 bool const preservedmode = SingletonPtr<inputstatescope>()->evalimmediate; 00157 00158 //istream & is(input); 00159 SingletonPtr<inputstatescope>()->fd.process2_silent(input); 00160 00161 00162 /* // Killed 21/11/04 because using streams explicitly. 00163 bool getinput=true; 00164 string s; 00165 while ( getinput ) 00166 { 00167 if (!input) 00168 break; 00169 00170 getline(input,s); 00171 SingletonPtr<inputstatescope>()->fd.process(getinput,s); 00172 } 00173 */ 00174 00175 00176 /* // Preserved because it works. 21/12/03 00177 string s; 00178 bool getinput=true; 00179 00180 vector<string> tokens; 00181 for ( ; getinput ; ) 00182 { 00183 if (!input) 00184 break; 00185 00186 getline(input,s); 00187 00188 linesplit(tokens,s," "); 00189 if (!tokens.empty()) 00190 { 00191 for (unsigned int i=0, imax=tokens.size(); i<imax; ++i) 00192 { 00193 if (tokens[i]=="quit") 00194 { 00195 getinput=false; 00196 break; 00197 } 00198 00199 SingletonPtr<inputstatescope>()->eval(tokens[i]); 00200 00201 } 00202 } 00203 } 00204 */ 00205 00206 SingletonPtr<inputstatescope>()->evalimmediate = preservedmode; 00207 00208 // Load the user settings. 00209 bin(); 00210 00211 x0->dec(); 00212 }
1.5.8