The DkInStream class

The DkInStream class provides methods that read an input text stream and populate an instance of the object (an opaque type if invoked by server code or an ActiveX value object if invoked by client code). This class has a built-in cursor that tracks how much of the input stream has been read.

All of the read methods return an mi_boolean value: mi_true if the read is successful or mi_false if it is not. In addition, all read methods except ReadChar, ReadGLWChar, and ReadWChar skip field and string delimiters before reading.

The gl_wchar data type is configurable, but it is a 4-byte character by default.

The DkInStream class provides the following methods.
Method Description
DkInStream(mi_lvarchar* inputString) DkInStream(const char* inputString) Reads inputString, which can be a multibyte string.
char* CurString() Returns a pointer to the string at the current cursor position.
mi_boolean Match(char* str) Returns mi_true if the exact sequence of characters specified in str is found in the input string.

This method is the opposite of DkOutStream.WriteLiteral.

mi_boolean operator+=(size_t skip) Returns mi_true if the number of characters specified in skip is successfully skipped.
mi_boolean operator-=(size_t rew) Returns mi_true if the number of characters specified in rew is successfully rewound (skipped backwards).
mi_boolean ReadBoolean(mi_boolean* value) Returns mi_true if one of the following values is successfully read: TRUE, True, true, FALSE, False, false.
mi_boolean ReadChar(mi_char* value) Returns mi_true if a value of type mi_char is successfully read. Field and string delimiters are not skipped before reading.
mi_boolean ReadDate(mi_date* value) Returns mi_true if a date value is successfully read. If the date value contains spaces or field delimiters, enclose it in string delimiters.
mi_boolean ReadDateTime( mi_datetime* value) Returns mi_true if a date-time value is successfully read. If the date-time value contains spaces or field delimiters, enclose it in string delimiters.
mi_boolean ReadDecimal(mi_decimal* value) Returns mi_true if a decimal or numeric value is successfully read.
mi_boolean ReadDoublePrecision( mi_double_precision* value) Returns mi_true if a double-precision value is successfully read.
mi_boolean ReadGLWChar(gl_wchar_t* value) Returns mi_true if a value of type gl_wchar (a 4-byte character, by default) is successfully read. Field and string delimiters are not skipped before reading.
mi_boolean ReadGLWString( gl_wchar_t* value, size_t length) Returns mi_true if a string of gl_wchar values, size length, is successfully read. If the string is longer than length, it is truncated and not null-terminated. To include a string-delimiter character in the string, precede it with the backslash character (\).
mi_boolean ReadInt1(mi_int1* value) Returns mi_true if a 1-byte integer value is successfully read.
mi_boolean ReadInt8(mi_int8* value) Returns mi_true if an 8-byte integer value is successfully read.
mi_boolean ReadInteger(mi_integer* value) Returns mi_true if a 4-byte integer value is successfully read.
mi_boolean ReadInterval(mi_interval* value) Returns mi_true if an interval value is successfully read.
mi_boolean ReadMoney(mi_money* value) Returns mi_true if a money value is successfully read.
mi_boolean ReadReal(mi_real* value) Returns mi_true if a real value is successfully read.
mi_boolean ReadSmallInt(mi_smallint* value) Returns mi_true if a 2-byte integer value is successfully read.
mi_boolean ReadString(const mi_string* value, size_t length) Returns mi_true if a string of mi_string values, size length, is successfully read. If the string is longer than length, it is truncated and not null-terminated. To include a string-delimiter character in the string, precede it with the backslash character (\).
mi_boolean ReadUChar1( mi_unsigned_char1* value) Returns mi_true if a 1-byte unsigned integer value is successfully read. (Integer is correct; the data type is misnamed.)
mi_boolean ReadUInt8( mi_unsigned_int8* value) Returns mi_true if an 8-byte unsigned integer value is successfully read.
mi_boolean ReadUInteger( mi_unsigned_integer* value) Returns mi_true if a 4-byte unsigned integer value is successfully read.
mi_boolean ReadUSmallInt( mi_unsigned_smallint* value) Returns mi_true if a 2-byte unsigned integer value is successfully read.
mi_boolean ReadWChar(mi_wchar* value) Returns mi_true if a 2-byte character is successfully read. Field and string delimiters are not skipped before reading.
mi_boolean ReadWString(mi_wchar* value, size_t length) Returns mi_true if a string of mi_wchar values, size length, is successfully read. If the string is longer than length, it is truncated and not null-terminated. To include a string-delimiter character in the string, precede it with the backslash character (\).
void SetFieldDelimiters(const char* delim) By default, the space character is a field delimiter; this method adds delim as another delimiter. delim can be a multibyte string, but it cannot be longer than DK_MAXDELIMBYTES (default value of 20).
void SetStringDelimiters(char begin, char end) Sets string delimiters to two, single-byte characters (begin and end). Default values are the open-quote character () and the close-quote character ().
void Skip(char* delim) Skips only the sequence of characters specified by delim.
void SkipBlanks() Skips all space characters.
void SkipDelimiters() Skips the characters specified by delim in the SetFieldDelimiters method and space characters.