fileOpNode.h
Ir a la documentación de este archivo.
1 //fileOpNode.h
2 //-------------------------------------------------------------------------------------------
3 /*
4  * Fco. Javier Bohórquez Ogalla
5  * 75766599-E
6  * Puerto Real (Cádiz)
7  * powersgame@gmail.com
8  */
9 //-------------------------------------------------------------------------------------------
10 
11 //-------------------------------------------------------------------------------------------
12 /*
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
26  * MA 02110-1301, USA.
27  */
28 //-------------------------------------------------------------------------------------------
29 
30 //-------------------------------------------------------------------------------------------
39 //-------------------------------------------------------------------------------------------
40 
41 //-------------------------------------------------------------------------------------------
42 #ifndef _RUN_OPERATORS_FILEOPNODE_
43 #define _RUN_OPERATORS_FILEOPNODE_
44 
45 #include "../tree/typeNode.h"
46 //-------------------------------------------------------------------------------------------
47 
48 //-------------------------------------------------------------------------------------------
64 class fileNode : public logicNode {
65  public:
71  fileNode (runNode * file, runNode * mode = NULL);
75  void run ();
80  inline fstream *get () const {
81  return f_;
82  }
87  inline string getMode () {
88  return stringNode::to_str(mode_);
89  }
90  private:
91  runNode *file_, *mode_;
92  fstream *f_;
93  bool exec;
94 };
95 //----------------------------------------------------------------------
96 
97 //----------------------------------------------------------------------
105 class fputNode : public arithNode {
106  public:
112  fputNode (runNode * file, runNode * val);
119  void run ();
120  private:
121  runNode *file_, *val_;
122 };
123 //----------------------------------------------------------------------
124 
125 //----------------------------------------------------------------------
133 class fgetNode : public stringNode {
134  public:
141  fgetNode (runNode * file, runNode *size = NULL);
146  void run ();
147  private:
148  runNode *file_, *size_;
149 };
150 //----------------------------------------------------------------------
151 
152 //----------------------------------------------------------------------
160 class freadNode : public stringNode {
161  public:
166  freadNode (runNode * file);
172  void run ();
173  private:
174  runNode *file_;
175 };
176 //----------------------------------------------------------------------
177 
178 //----------------------------------------------------------------------
186 class fwriteNode : public stringNode {
187  public:
193  fwriteNode (runNode * file, runNode* str);
198  void run ();
199  private:
200  runNode *file_, *str_;
201 };
202 //----------------------------------------------------------------------
203 
204 //----------------------------------------------------------------------
212 class fappendNode : public stringNode {
213  public:
219  fappendNode (runNode * file, runNode* str);
224  void run ();
225  private:
226  runNode *file_, *str_;
227 };
228 //----------------------------------------------------------------------
229 
230 //----------------------------------------------------------------------
239  class fseekNode : public logicNode {
240  public:
247  fseekNode (runNode * file, runNode* offset, int pos = 0);
254  void run ();
255  private:
256  runNode *file_, *offset_;
257  int pos_;
258 };
259 //----------------------------------------------------------------------
260 
261 //----------------------------------------------------------------------
269 class ftellNode : public arithNode {
270  public:
275  ftellNode (runNode * file);
280  void run ();
281  private:
282  runNode *file_;
283 };
284 //----------------------------------------------------------------------
285 
286 //----------------------------------------------------------------------
293 class fcloseNode : public logicNode {
294  public:
299  fcloseNode (runNode * file);
305  void run ();
306  private:
307  runNode *file_;
308 };
309 //-------------------------------------------------------------------------------------------
310 
311 //-------------------------------------------------------------------------------------------
312 #endif
313 //-------------------------------------------------------------------------------------------
314 //Fco. Javier Bohórquez Ogalla
Node función leer fichero.
Definition: fileOpNode.h:160
Nodos lógicos.
Definition: expNode.h:279
Nodo función que cierra un descriptor de fichero.
Definition: fileOpNode.h:293
void run()
Definition: fileOpNode.cpp:191
void run()
Definition: fileOpNode.cpp:37
fputNode(runNode *file, runNode *val)
Definition: fileOpNode.cpp:94
freadNode(runNode *file)
Definition: fileOpNode.cpp:189
Nodo función cambiar puntero de descriptor de fichero.
Definition: fileOpNode.h:239
Nodos aritméticos.
Definition: expNode.h:351
Node función escribir fichero .
Definition: fileOpNode.h:186
void run()
Definition: fileOpNode.cpp:243
Nodo fichero .
Definition: fileOpNode.h:64
void run()
Definition: fileOpNode.cpp:96
Nodo ejecutable.
Definition: runTree.h:123
void run()
Definition: fileOpNode.cpp:377
ftellNode(runNode *file)
Definition: fileOpNode.cpp:353
fgetNode(runNode *file, runNode *size=NULL)
Definition: fileOpNode.cpp:127
string getMode()
Definition: fileOpNode.h:87
fwriteNode(runNode *file, runNode *str)
Definition: fileOpNode.cpp:241
void run()
Definition: fileOpNode.cpp:282
fappendNode(runNode *file, runNode *str)
Definition: fileOpNode.cpp:280
Nodo función obtener puntero de descriptor de fichero.
Definition: fileOpNode.h:269
Node función escribir en descriptor de fichero .
Definition: fileOpNode.h:105
fileNode(runNode *file, runNode *mode=NULL)
Definition: fileOpNode.cpp:35
Nodos cadenas de texto.
Definition: expNode.h:418
void run()
Definition: fileOpNode.cpp:355
void run()
Definition: fileOpNode.cpp:129
Nodo función añadir a fichero .
Definition: fileOpNode.h:212
Nodo función leer de descriptor de fichero.
Definition: fileOpNode.h:133
fcloseNode(runNode *file)
Definition: fileOpNode.cpp:375
fseekNode(runNode *file, runNode *offset, int pos=0)
Definition: fileOpNode.cpp:322
void run()
Definition: fileOpNode.cpp:324