TorqueScript  0.2
Public Member Functions | Static Public Member Functions | List of all members
TorqueScript::FileObject Class Reference

A FileObject is a class that may be used to interact with the filesystem provided by the PlatformContext configured with the interpreter. More...

#include <fileobject.hpp>

Inheritance diagram for TorqueScript::FileObject:
Inheritance graph
[legend]
Collaboration diagram for TorqueScript::FileObject:
Collaboration graph
[legend]

Public Member Functions

 FileObject (Interpreter *interpreter)
 
bool openForWrite (const std::string &path)
 Opens a file at the specified path in write-only mode. More...
 
bool openForRead (const std::string &path)
 
bool isEOF ()
 
std::string readLine ()
 
void write (const std::string &written)
 Writes a string to the file, if the FileObject has been opened with write mode enabled. More...
 
void close ()
 
- Public Member Functions inherited from TorqueScript::ConsoleObject
 ConsoleObject (Interpreter *interpreter)
 
StoredValuegetTaggedField (const std::string &name)
 Retrieves a tagged field by name from the object. More...
 
void setTaggedField (const std::string &name, StoredValue value)
 Sets a tagged field by name on the object. More...
 
virtual std::string getClassName ()=0
 Retrieves the class name of this ConsoleObject instance. More...
 
virtual bool addChild (std::shared_ptr< ConsoleObject > child)
 

Static Public Member Functions

static void initializeMemberFields (ConsoleObjectDescriptor *descriptor)
 
static ConsoleObjectinstantiateFromDescriptor (Interpreter *interpreter, ObjectInstantiationDescriptor &descriptor)
 

Additional Inherited Members

- Protected Attributes inherited from TorqueScript::ConsoleObject
InterpretermInterpreter
 
std::unordered_map< std::string, StoredValuemTaggedFields
 A mapping of tagged field names to their stored values.
 

Detailed Description

A FileObject is a class that may be used to interact with the filesystem provided by the PlatformContext configured with the interpreter.

Member Function Documentation

◆ openForWrite()

bool TorqueScript::FileObject::openForWrite ( const std::string &  path)

Opens a file at the specified path in write-only mode.

Parameters
pathThe file to open.
Returns
True if successful, false otherwise.

◆ write()

void TorqueScript::FileObject::write ( const std::string &  written)

Writes a string to the file, if the FileObject has been opened with write mode enabled.

Parameters
writtenThe string data to write to the file.

The documentation for this class was generated from the following file: