本文整理汇总了C++中CBuffer::WriteChar方法的典型用法代码示例。如果您正苦于以下问题:C++ CBuffer::WriteChar方法的具体用法?C++ CBuffer::WriteChar怎么用?C++ CBuffer::WriteChar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBuffer
的用法示例。
在下文中一共展示了CBuffer::WriteChar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseRow
bool CCSVParser::ParseRow (TArray<CString> &Row, CString *retsError)
// ParseRow
//
// Parses a row
{
enum EStates
{
stateStart,
stateSingleQuote,
stateDoubleQuote,
stateInPlainValue,
stateEndOfValue,
stateCR,
stateLF,
};
Row.DeleteAll();
// Parse the BOM, if any
if (m_iFormat == formatUnknown)
m_iFormat = ParseBOM();
// Keep reading until we hit the end of the line.
EStates iState = stateStart;
CBuffer Value;
while (true)
{
switch (iState)
{
case stateStart:
{
switch (GetCurChar())
{
case '\0':
return true;
case ' ':
case '\t':
break;
case ',':
Row.Insert(NULL_STR);
break;
case '\r':
iState = stateCR;
break;
case '\n':
iState = stateLF;
break;
case '\'':
iState = stateSingleQuote;
break;
case '\"':
iState = stateDoubleQuote;
break;
default:
Value.WriteChar(GetCurChar());
iState = stateInPlainValue;
break;
}
break;
}
case stateSingleQuote:
{
switch (GetCurChar())
{
case '\0':
Row.Insert(CString(Value.GetPointer(), Value.GetLength()));
return true;
case '\'':
Row.Insert(CString(Value.GetPointer(), Value.GetLength()));
Value.SetLength(0);
iState = stateEndOfValue;
break;
default:
Value.WriteChar(GetCurChar());
break;
}
break;
}
case stateDoubleQuote:
{
switch (GetCurChar())
{
case '\0':
Row.Insert(CString(Value.GetPointer(), Value.GetLength()));
return true;
//.........这里部分代码省略.........