GENERICRW_TEXT Class Reference

Class for generic text read/write. More...

#include <mi32/genrcrwtxt.h>

Inheritance diagram for GENERICRW_TEXT:

Inheritance graph
FILE_TEXT
[legend]
List of all members.

Public Types

enum  CAPABILITIES {
  CAPABILITY_None = 0x000, CAPABILITY_Read = 0x001, CAPABILITY_Write = 0x002, CAPABILITY_Size = 0x004,
  CAPABILITIES_All = 0x00F
}
enum  LINETERMINATOR {
  LINETERMINATOR_CR = 0, LINETERMINATOR_LF, LINETERMINATOR_CRLF, LINETERMINATOR_LFCR,
  LINETERMINATOR_Default
}

Public Member Functions

CHAR_ENCODING GetEncoding () const
INT64 GetSize () const
GENERICRW_TEXToperator<< (const STRUTF8 &str)
GENERICRW_TEXToperator<< (const MISTRING &str)
GENERICRW_TEXToperator<< (const char *str)
GENERICRW_TEXToperator<< (double value)
GENERICRW_TEXToperator<< (int value)
ERRVALUE ReadAll (MISTRING &string)
ERRVALUE ReadLine (STRUTF8 &string, bool stripnewline, INT32 maxlength)
ERRVALUE ReadLine (STRUTF8 &string, bool stripnewline=true)
INT32 ReadLine (MISTRING &string, bool stripnewline, INT32 maxlength)
INT32 ReadLine (MISTRING &string, bool stripnewline=true)
ERRVALUE Rewind ()
POSN Seek (const POSN &posn)
ERRVALUE SeekToEnd ()
void SetEncoding (CHAR_ENCODING encoding)
void SetLineTerminator (LINETERMINATOR terminator)
POSN Tell () const
ERRVALUE Write (const char *string, bool appendnewline=false)
ERRVALUE Write (const STRUTF8 &string, bool appendnewline=false)
ERRVALUE Write (const MISTRING &string, bool appendnewline=false)

Protected Member Functions

LINETERMINATOR DetectLineTerminator ()
 GENERICRW_TEXT ()
virtual ~GENERICRW_TEXT ()

Private Member Functions

virtual CAPABILITIES v_GetCapabilities ()=0
virtual INT64 v_GetSize () const=0
virtual INT64 v_Read (void *buf, INT32 numbytes, bool AllowPartial)=0
virtual INT64 v_Seek (INT64 offset, GENERICRW::SEEKFROM from=GENERICRW::SEEKFROM_Beginning)=0
virtual INT64 v_Tell () const=0
virtual ERRVALUE v_Write (const void *buffer, INT32 numbytes)=0

Classes

class  POSN

Detailed Description

Class for generic text read/write.

This class is not thread safe. Most of the time the instance is specific to a thread therefore the resource sharing issues are not involved. If this class is a shared resource, it is up to the user of the class to guard it using the appropriate locking method.

Definition at line 75 of file genrcrwtxt.h.


Member Enumeration Documentation

enum GENERICRW_TEXT::CAPABILITIES

Enumerator:
CAPABILITY_None 
CAPABILITY_Read 
CAPABILITY_Write 
CAPABILITY_Size 
CAPABILITIES_All 

Definition at line 85 of file genrcrwtxt.h.

enum GENERICRW_TEXT::LINETERMINATOR

Enumerator:
LINETERMINATOR_CR 
LINETERMINATOR_LF 
LINETERMINATOR_CRLF 
LINETERMINATOR_LFCR 
LINETERMINATOR_Default 

Definition at line 77 of file genrcrwtxt.h.


Constructor & Destructor Documentation

GENERICRW_TEXT::GENERICRW_TEXT (  )  [protected]

Abstract base class cannot be constructed externally.

virtual GENERICRW_TEXT::~GENERICRW_TEXT (  )  [protected, virtual]


Member Function Documentation

LINETERMINATOR GENERICRW_TEXT::DetectLineTerminator (  )  [protected]

Detect the line terminator type.

To be called by derived classes when opening for reading.

CHAR_ENCODING GENERICRW_TEXT::GetEncoding (  )  const

INT64 GENERICRW_TEXT::GetSize (  )  const

Get current size of data.

Returns:
Current size of data or error < 0.

GENERICRW_TEXT& GENERICRW_TEXT::operator<< ( const STRUTF8 str  ) 

Write STRUTF8 string to data (iostream design).

GENERICRW_TEXT& GENERICRW_TEXT::operator<< ( const MISTRING str  ) 

Write MISTRING string to data (iostream design).

GENERICRW_TEXT& GENERICRW_TEXT::operator<< ( const char *  str  ) 

Write character string to data (iostream design).

GENERICRW_TEXT& GENERICRW_TEXT::operator<< ( double  value  ) 

Write floating-point value to data (iostream design).

GENERICRW_TEXT& GENERICRW_TEXT::operator<< ( int  value  ) 

Write integer to data (iostream design).

ERRVALUE GENERICRW_TEXT::ReadAll ( MISTRING string  ) 

Read all available data into MISTRING.

Lines will be separated by newline '
' character.

ERRVALUE GENERICRW_TEXT::ReadLine ( STRUTF8 string,
bool  stripnewline,
INT32  maxlength 
)

Parameters:
maxlength  Maximum number of bytes to read (-1 if no maximum)

ERRVALUE GENERICRW_TEXT::ReadLine ( STRUTF8 string,
bool  stripnewline = true 
)

Read line into STRUTF8.

Returns:
-1 at EOF.
Parameters:
string  String to contain result
stripnewline  Remove line terminator(s) if any from the end of the string

INT32 GENERICRW_TEXT::ReadLine ( MISTRING string,
bool  stripnewline,
INT32  maxlength 
)

Read line into MISTRING Returns length of line up to maxlength characters, or -1 at EOF.

Should eventually replace other ReadLine method

Parameters:
string  String to contain result
stripnewline  Remove line terminator(s) if any from the end of the string
maxlength  Maximum number of bytes to read (-1 if no maximum)

INT32 GENERICRW_TEXT::ReadLine ( MISTRING string,
bool  stripnewline = true 
)

Read line into MISTRING.

Returns length of line or -1 at EOF.

Parameters:
string  String to contain result
stripnewline  Remove line terminator(s) if any from the end of the string

ERRVALUE GENERICRW_TEXT::Rewind (  ) 

Rewind data pointer back to beginning.

POSN GENERICRW_TEXT::Seek ( const POSN posn  ) 

Seek into data.

Returns:
Position in data after seek

ERRVALUE GENERICRW_TEXT::SeekToEnd (  ) 

Seek to end of data.

void GENERICRW_TEXT::SetEncoding ( CHAR_ENCODING  encoding  ) 

Set the encoding used for reading.

void GENERICRW_TEXT::SetLineTerminator ( LINETERMINATOR  terminator  ) 

Set line terminator to use for subsequent writes.

POSN GENERICRW_TEXT::Tell (  )  const

Get current data position.

Returns:
Current position in data or error < 0.

virtual CAPABILITIES GENERICRW_TEXT::v_GetCapabilities (  )  [private, pure virtual]

Override to get capabilities.

Implemented in FILE_TEXT.

virtual INT64 GENERICRW_TEXT::v_GetSize (  )  const [private, pure virtual]

Override to get current size of data.

Implemented in FILE_TEXT.

virtual INT64 GENERICRW_TEXT::v_Read ( void *  buf,
INT32  numbytes,
bool  AllowPartial 
) [private, pure virtual]

Override to read a line of text.

Implemented in FILE_TEXT.

virtual INT64 GENERICRW_TEXT::v_Seek ( INT64  offset,
GENERICRW::SEEKFROM  from = GENERICRW::SEEKFROM_Beginning 
) [private, pure virtual]

Override to seek.

Implemented in FILE_TEXT.

virtual INT64 GENERICRW_TEXT::v_Tell (  )  const [private, pure virtual]

Override to return current position.

Implemented in FILE_TEXT.

virtual ERRVALUE GENERICRW_TEXT::v_Write ( const void *  buffer,
INT32  numbytes 
) [private, pure virtual]

Override to write data.

Implemented in FILE_TEXT.

ERRVALUE GENERICRW_TEXT::Write ( const char *  string,
bool  appendnewline = false 
)

Write ascii encoded string.

The string to be written may include line breaks (newline characters).

Parameters:
string  String to write
appendnewline  Append line terminator after writing string

ERRVALUE GENERICRW_TEXT::Write ( const STRUTF8 string,
bool  appendnewline = false 
)

Write STRUTF8 to output.

The string to be written may include line breaks (newline characters).

Parameters:
string  String to write
appendnewline  Append line terminator after writing string

ERRVALUE GENERICRW_TEXT::Write ( const MISTRING string,
bool  appendnewline = false 
)

Write MISTRING to output.

The string to be written may include line breaks (newline characters).

Parameters:
string  String to write
appendnewline  Append line terminator after writing string


The documentation for this class was generated from the following file:
Generated on Thu Apr 26 04:47:09 2007 for TNTsdk by  doxygen 1.5.2