SAGA API  v9.7
CSG_File Class Reference

#include <api_core.h>

Inheritance diagram for CSG_File:
CSG_Archive

Public Member Functions

 CSG_File (void)
 
virtual ~CSG_File (void)
 
 CSG_File (const SG_Char *FileName, int Mode=SG_FILE_R, bool bBinary=true, int Encoding=SG_FILE_ENCODING_ANSI)
 
virtual bool Open (const SG_Char *FileName, int Mode=SG_FILE_R, bool bBinary=true, int Encoding=SG_FILE_ENCODING_ANSI)
 
virtual bool Close (void)
 
virtual const CSG_StringGet_File_Name (void) const
 
virtual TSG_File_Type Get_File_Type (void) const
 
class wxStreamBase * Get_Stream (void) const
 
bool Set_Encoding (int Encoding)
 
int Get_Encoding (void) const
 
bool is_Open (void) const
 
bool is_Reading (void) const
 
bool is_Writing (void) const
 
bool is_EOF (void) const
 
sLong Length (void) const
 
bool Seek (sLong Offset, int Origin=SG_FILE_START) const
 
bool Seek_Start (void) const
 
bool Seek_End (void) const
 
sLong Tell (void) const
 
bool Flush (void)
 
int Printf (const char *Format,...)
 
int Printf (const wchar_t *Format,...)
 
size_t Read (void *Buffer, size_t Size, size_t Count=1) const
 
size_t Write (void *Buffer, size_t Size, size_t Count=1) const
 
size_t Read (CSG_String &Buffer, size_t Size) const
 
size_t Write (const CSG_String &Buffer) const
 
bool Read_Line (CSG_String &Line) const
 
int Read_Char (void) const
 
int Read_Int (bool bBigEndian=false) const
 
bool Write_Int (int Value, bool bBigEndian=false)
 
double Read_Double (bool bBigEndian=false) const
 
bool Write_Double (double Value, bool bBigEndian=false)
 
bool Scan (int &Value) const
 
bool Scan (double &Value) const
 
bool Scan (CSG_String &Value, SG_Char Separator) const
 
int Scan_Int (void) const
 
double Scan_Double (void) const
 
CSG_String Scan_String (SG_Char Separator) const
 

Protected Member Functions

void On_Construction (void)
 

Protected Attributes

int m_Mode
 
int m_Encoding
 
CSG_String m_FileName
 
void * m_pStream
 
void * m_pConvert
 

Detailed Description

Definition at line 1125 of file api_core.h.

Constructor & Destructor Documentation

◆ CSG_File() [1/2]

CSG_File::CSG_File ( void  )

Definition at line 87 of file api_file.cpp.

References On_Construction().

◆ ~CSG_File()

CSG_File::~CSG_File ( void  )
virtual

Definition at line 101 of file api_file.cpp.

References Close().

◆ CSG_File() [2/2]

CSG_File::CSG_File ( const SG_Char FileName,
int  Mode = SG_FILE_R,
bool  bBinary = true,
int  Encoding = SG_FILE_ENCODING_ANSI 
)

Definition at line 93 of file api_file.cpp.

References On_Construction(), and Open().

Member Function Documentation

◆ Close()

bool CSG_File::Close ( void  )
virtual

Reimplemented in CSG_Archive.

Definition at line 163 of file api_file.cpp.

References m_pStream, m_pStream_Base, Set_Encoding(), and SG_FILE_ENCODING_UNDEFINED.

Referenced by CSG_Archive::Close(), Open(), and ~CSG_File().

◆ Flush()

bool CSG_File::Flush ( void  )

Definition at line 280 of file api_file.cpp.

References m_pStream_O.

Referenced by CSG_Archive::Extract().

◆ Get_Encoding()

int CSG_File::Get_Encoding ( void  ) const
inline

Definition at line 1143 of file api_core.h.

◆ Get_File_Name()

virtual const CSG_String& CSG_File::Get_File_Name ( void  ) const
inlinevirtual

◆ Get_File_Type()

virtual TSG_File_Type CSG_File::Get_File_Type ( void  ) const
inlinevirtual

Reimplemented in CSG_Archive.

Definition at line 1138 of file api_core.h.

References SG_FILE_TYPE_NORMAL.

◆ Get_Stream()

class wxStreamBase* CSG_File::Get_Stream ( void  ) const
inline

Definition at line 1140 of file api_core.h.

Referenced by CSG_MetaData::Load(), and CSG_MetaData::Save().

◆ is_EOF()

bool CSG_File::is_EOF ( void  ) const

◆ is_Open()

bool CSG_File::is_Open ( void  ) const
inline

◆ is_Reading()

◆ is_Writing()

bool CSG_File::is_Writing ( void  ) const
inline

◆ Length()

sLong CSG_File::Length ( void  ) const

Definition at line 229 of file api_file.cpp.

References m_pStream, and m_pStream_Base.

Referenced by CSG_Colors::Load(), CSG_Projection::Load(), and CSG_MetaData::Load_JSON().

◆ On_Construction()

void CSG_File::On_Construction ( void  )
protected

Definition at line 183 of file api_file.cpp.

References m_Encoding, m_pConvert, m_pStream, and SG_FILE_ENCODING_UNDEFINED.

Referenced by CSG_Archive::CSG_Archive(), and CSG_File().

◆ Open()

◆ Printf() [1/2]

int CSG_File::Printf ( const char *  Format,
  ... 
)

◆ Printf() [2/2]

int CSG_File::Printf ( const wchar_t *  Format,
  ... 
)

Definition at line 311 of file api_file.cpp.

References is_Writing(), and Write().

◆ Read() [1/2]

size_t CSG_File::Read ( CSG_String Buffer,
size_t  Size 
) const

Definition at line 345 of file api_file.cpp.

References CSG_String::Clear(), CSG_Buffer::Get_Data(), is_Reading(), and Read().

◆ Read() [2/2]

size_t CSG_File::Read ( void *  Buffer,
size_t  Size,
size_t  Count = 1 
) const

◆ Read_Char()

int CSG_File::Read_Char ( void  ) const

Definition at line 432 of file api_file.cpp.

References is_Reading(), m_Mode, m_pStream_I, m_pStream_IO, and SG_FILE_R.

Referenced by Scan().

◆ Read_Double()

double CSG_File::Read_Double ( bool  bBigEndian = false) const

Definition at line 464 of file api_file.cpp.

References Read(), and SG_Swap_Bytes().

◆ Read_Int()

int CSG_File::Read_Int ( bool  bBigEndian = false) const

Definition at line 438 of file api_file.cpp.

References Read(), and SG_Swap_Bytes().

◆ Read_Line()

◆ Scan() [1/3]

bool CSG_File::Scan ( CSG_String Value,
SG_Char  Separator 
) const

Definition at line 534 of file api_file.cpp.

References CSG_String::Clear(), is_EOF(), is_Reading(), and Read_Char().

◆ Scan() [2/3]

bool CSG_File::Scan ( double &  Value) const

Definition at line 512 of file api_file.cpp.

References CSG_String::asDouble(), is_EOF(), is_Reading(), and Read_Char().

◆ Scan() [3/3]

bool CSG_File::Scan ( int &  Value) const

Definition at line 490 of file api_file.cpp.

References CSG_String::asInt(), is_EOF(), is_Reading(), and Read_Char().

Referenced by Scan_Double(), Scan_Int(), and Scan_String().

◆ Scan_Double()

double CSG_File::Scan_Double ( void  ) const

Definition at line 557 of file api_file.cpp.

References Scan().

Referenced by CSG_Parameters::Serialize_Compatibility().

◆ Scan_Int()

int CSG_File::Scan_Int ( void  ) const

Definition at line 552 of file api_file.cpp.

References Scan().

Referenced by CSG_Parameters::Serialize_Compatibility().

◆ Scan_String()

CSG_String CSG_File::Scan_String ( SG_Char  Separator) const

Definition at line 562 of file api_file.cpp.

References Scan().

◆ Seek()

bool CSG_File::Seek ( sLong  Offset,
int  Origin = SG_FILE_START 
) const

◆ Seek_End()

bool CSG_File::Seek_End ( void  ) const

Definition at line 261 of file api_file.cpp.

References Seek().

Referenced by CSG_Tool_Library_Manager::Create_Python_ToolBox().

◆ Seek_Start()

bool CSG_File::Seek_Start ( void  ) const

Definition at line 260 of file api_file.cpp.

References Seek().

Referenced by CSG_Colors::Load().

◆ Set_Encoding()

◆ Tell()

sLong CSG_File::Tell ( void  ) const

Definition at line 264 of file api_file.cpp.

References m_Mode, m_pStream, m_pStream_I, m_pStream_IO, m_pStream_O, SG_FILE_R, and SG_FILE_W.

◆ Write() [1/2]

size_t CSG_File::Write ( const CSG_String Buffer) const

◆ Write() [2/2]

◆ Write_Double()

bool CSG_File::Write_Double ( double  Value,
bool  bBigEndian = false 
)

Definition at line 479 of file api_file.cpp.

References SG_Swap_Bytes(), and Write().

◆ Write_Int()

bool CSG_File::Write_Int ( int  Value,
bool  bBigEndian = false 
)

Definition at line 453 of file api_file.cpp.

References SG_Swap_Bytes(), and Write().

Member Data Documentation

◆ m_Encoding

int CSG_File::m_Encoding
protected

Definition at line 1187 of file api_core.h.

Referenced by CSG_Archive::Extract(), On_Construction(), and Set_Encoding().

◆ m_FileName

CSG_String CSG_File::m_FileName
protected

Definition at line 1189 of file api_core.h.

Referenced by CSG_Archive::Add_File(), CSG_Archive::Get_File(), and Open().

◆ m_Mode

int CSG_File::m_Mode
protected

Definition at line 1187 of file api_core.h.

Referenced by is_EOF(), Open(), CSG_Archive::Open(), Read(), Read_Char(), Read_Line(), Seek(), Tell(), and Write().

◆ m_pConvert

void * CSG_File::m_pConvert
protected

Definition at line 1191 of file api_core.h.

Referenced by On_Construction(), Read_Line(), Set_Encoding(), and Write().

◆ m_pStream

void* CSG_File::m_pStream
protected

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