diff options
Diffstat (limited to 'Source/Scripting/angelscript/add_on/scriptfile/scriptfile.h')
-rw-r--r-- | Source/Scripting/angelscript/add_on/scriptfile/scriptfile.h | 94 |
1 files changed, 45 insertions, 49 deletions
diff --git a/Source/Scripting/angelscript/add_on/scriptfile/scriptfile.h b/Source/Scripting/angelscript/add_on/scriptfile/scriptfile.h index 748bba77..0c6b71af 100644 --- a/Source/Scripting/angelscript/add_on/scriptfile/scriptfile.h +++ b/Source/Scripting/angelscript/add_on/scriptfile/scriptfile.h @@ -20,14 +20,11 @@ #define AS_WRITE_OPS 1 #endif - - - //--------------------------- // Declaration // -#ifndef ANGELSCRIPT_H +#ifndef ANGELSCRIPT_H // Avoid having to inform include path if header is already include before #include <angelscript.h> #endif @@ -37,51 +34,50 @@ BEGIN_AS_NAMESPACE -class CScriptFile -{ -public: - CScriptFile(); - - void AddRef() const; - void Release() const; - - // TODO: Implement the "r+", "w+" and "a+" modes - // mode = "r" -> open the file for reading - // "w" -> open the file for writing (overwrites existing file) - // "a" -> open the file for appending - int Open(const std::string &filename, const std::string &mode); - int Close(); - int GetSize() const; - bool IsEOF() const; - - // Reading - std::string ReadString(unsigned int length); - std::string ReadLine(); - asINT64 ReadInt(asUINT bytes); - asQWORD ReadUInt(asUINT bytes); - float ReadFloat(); - double ReadDouble(); - - // Writing - int WriteString(const std::string &str); - int WriteInt(asINT64 v, asUINT bytes); - int WriteUInt(asQWORD v, asUINT bytes); - int WriteFloat(float v); - int WriteDouble(double v); - - // Cursor - int GetPos() const; - int SetPos(int pos); - int MovePos(int delta); - - // Big-endian = most significant byte first - bool mostSignificantByteFirst; - -protected: - ~CScriptFile(); - - mutable int refCount; - FILE *file; +class CScriptFile { + public: + CScriptFile(); + + void AddRef() const; + void Release() const; + + // TODO: Implement the "r+", "w+" and "a+" modes + // mode = "r" -> open the file for reading + // "w" -> open the file for writing (overwrites existing file) + // "a" -> open the file for appending + int Open(const std::string &filename, const std::string &mode); + int Close(); + int GetSize() const; + bool IsEOF() const; + + // Reading + std::string ReadString(unsigned int length); + std::string ReadLine(); + asINT64 ReadInt(asUINT bytes); + asQWORD ReadUInt(asUINT bytes); + float ReadFloat(); + double ReadDouble(); + + // Writing + int WriteString(const std::string &str); + int WriteInt(asINT64 v, asUINT bytes); + int WriteUInt(asQWORD v, asUINT bytes); + int WriteFloat(float v); + int WriteDouble(double v); + + // Cursor + int GetPos() const; + int SetPos(int pos); + int MovePos(int delta); + + // Big-endian = most significant byte first + bool mostSignificantByteFirst; + + protected: + ~CScriptFile(); + + mutable int refCount; + FILE *file; }; // This function will determine the configuration of the engine |