SAGA API  v9.6
CSG_File Class Reference

#include <api_core.h>

Inheritance diagram for CSG_File:
CSG_File_Zip

Public Member Functions

 CSG_File (void)
 
virtual ~CSG_File (void)
 
 CSG_File (const CSG_String &FileName, int Mode=SG_FILE_R, bool bBinary=true, int Encoding=SG_FILE_ENCODING_ANSI)
 
virtual bool Open (const CSG_String &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
 
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 &sLine) 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 1123 of file api_core.h.

Constructor & Destructor Documentation

◆ CSG_File() [1/2]

CSG_File::CSG_File ( void  )

Definition at line 86 of file api_file.cpp.

References On_Construction().

◆ ~CSG_File()

CSG_File::~CSG_File ( void  )
virtual

Definition at line 100 of file api_file.cpp.

References Close().

◆ CSG_File() [2/2]

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

Definition at line 92 of file api_file.cpp.

References On_Construction(), and Open().

Member Function Documentation

◆ Close()

bool CSG_File::Close ( void  )
virtual

Reimplemented in CSG_File_Zip.

Definition at line 160 of file api_file.cpp.

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

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

◆ Get_Encoding()

int CSG_File::Get_Encoding ( void  ) const
inline

Definition at line 1141 of file api_core.h.

◆ Get_File_Name()

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

Definition at line 1135 of file api_core.h.

Referenced by CSG_Grid_File_Info::Create(), and CSG_File_Zip::Get_File().

◆ Get_File_Type()

virtual TSG_File_Type CSG_File::Get_File_Type ( void  ) const
inlinevirtual

Reimplemented in CSG_File_Zip.

Definition at line 1136 of file api_core.h.

References SG_FILE_TYPE_NORMAL.

◆ Get_Stream()

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

Definition at line 1138 of file api_core.h.

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

◆ is_EOF()

bool CSG_File::is_EOF ( void  ) const

Definition at line 232 of file api_file.cpp.

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

Referenced by CSG_Grid_File_Info::Create(), Read_Line(), and Scan().

◆ is_Open()

bool CSG_File::is_Open ( void  ) const
inline

Definition at line 1143 of file api_core.h.

Referenced by CSG_Colors::Serialize(), and CSG_Parameters::Serialize_Compatibility().

◆ is_Reading()

◆ is_Writing()

◆ Length()

sLong CSG_File::Length ( void  ) const

Definition at line 226 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 180 of file api_file.cpp.

References m_Encoding, m_pConvert, m_pStream, and SG_FILE_ENCODING_UNDEFINED.

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

◆ 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 302 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 336 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 423 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 455 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 429 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 525 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 503 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 481 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 548 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 543 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 553 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 258 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 257 of file api_file.cpp.

References Seek().

Referenced by CSG_Colors::Load().

◆ Set_Encoding()

◆ Tell()

sLong CSG_File::Tell ( void  ) const

Definition at line 261 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 470 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 444 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 1183 of file api_core.h.

Referenced by On_Construction(), and Set_Encoding().

◆ m_FileName

CSG_String CSG_File::m_FileName
protected

Definition at line 1185 of file api_core.h.

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

◆ m_Mode

int CSG_File::m_Mode
protected

Definition at line 1183 of file api_core.h.

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

◆ m_pConvert

void * CSG_File::m_pConvert
protected

Definition at line 1187 of file api_core.h.

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

◆ m_pStream


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