Class for generic text read/write. More...
#include <mi32/genrcrwtxt.h>

Classes | |
| class | POSN |
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_TEXT & | operator<< (const STRUTF8 &str) |
| GENERICRW_TEXT & | operator<< (const MISTRING &str) |
| GENERICRW_TEXT & | operator<< (const char *str) |
| GENERICRW_TEXT & | operator<< (double value) |
| GENERICRW_TEXT & | operator<< (unsigned value) |
| GENERICRW_TEXT & | operator<< (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 | |
| GENERICRW_TEXT () | |
| virtual | ~GENERICRW_TEXT () |
| LINETERMINATOR | DetectLineTerminator () |
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 |
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.
| GENERICRW_TEXT::GENERICRW_TEXT | ( | ) | [protected] |
Abstract base class cannot be constructed externally.
| virtual GENERICRW_TEXT::~GENERICRW_TEXT | ( | ) | [protected, virtual] |
| 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.
| 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<< | ( | unsigned | value | ) |
Write unsigned integer to data (iostream design).
| GENERICRW_TEXT& GENERICRW_TEXT::operator<< | ( | int | value | ) |
Write integer to data (iostream design).
Read all available data into MISTRING.
Lines will be separated by newline '
' character.
| maxlength | Maximum number of bytes to read (-1 if no maximum) |
Read line into STRUTF8.
| string | String to contain result | |
| stripnewline | Remove line terminator(s) if any from the end of the string |
Read line into MISTRING Returns length of line up to maxlength characters, or -1 at EOF.
Should eventually replace other ReadLine method
| 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) |
Read line into MISTRING.
Returns length of line or -1 at EOF.
| 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.
| 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.
| 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).
| string | String to write | |
| appendnewline | Append line terminator after writing string |
Write STRUTF8 to output.
The string to be written may include line breaks (newline characters).
| string | String to write | |
| appendnewline | Append line terminator after writing string |
Write MISTRING to output.
The string to be written may include line breaks (newline characters).
| string | String to write | |
| appendnewline | Append line terminator after writing string |
1.6.1