本文整理汇总了C++中wxInputStream::Peek方法的典型用法代码示例。如果您正苦于以下问题:C++ wxInputStream::Peek方法的具体用法?C++ wxInputStream::Peek怎么用?C++ wxInputStream::Peek使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxInputStream
的用法示例。
在下文中一共展示了wxInputStream::Peek方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Skip_Comment
void Skip_Comment(wxInputStream &stream)
{
wxTextInputStream text_stream(stream);
if (stream.Peek()==wxT('#'))
{
text_stream.ReadLine();
Skip_Comment(stream);
}
}
示例2: SkipWhitespace
static void SkipWhitespace(wxInputStream& input, unsigned int& lineNumber)
{
char c;
while (!input.Eof())
{
c = input.Peek();
if (c == '\n')
{
++lineNumber;
}
else if (c == '-')
{
input.GetC();
char c2 = input.Peek();
if (c2 == '-')
{
// Lua single line comment.
while (!input.Eof() && input.GetC() != '\n')
{
}
++lineNumber;
continue;
}
}
else if (c == '/')
{
input.GetC();
char c2 = input.Peek();
if (c2 == '*')
{
// C++ block comment.
input.GetC();
while (!input.Eof())
{
c = input.GetC();
if (c == '\n')
{
++lineNumber;
}
if (c == '*' && input.Peek() == '/')
{
input.GetC();
break;
}
}
continue;
}
else if (c2 == '/')
{
// C++ single line comment.
while (!input.Eof() && input.GetC() != '\n')
{
}
++lineNumber;
continue;
}
else
{
input.Ungetch(c);
break;
}
}
if (!IsSpace(c))
{
break;
}
input.GetC();
}
}
示例3: GetToken
bool GetToken(wxInputStream& input, wxString& result, unsigned int& lineNumber)
{
result.Empty();
SkipWhitespace(input, lineNumber);
// Reached the end of the file.
if (input.Eof())
{
return false;
}
char c = input.GetC();
if (c == '\"')
{
// Quoted string, search for the end quote.
do
{
result += c;
c = input.GetC();
}
while (input.IsOk() && c != '\"');
result += c;
return true;
}
char n = input.Peek();
if (IsDigit(c) || (c == '.' && IsDigit(n)) || (c == '-' && IsDigit(n)))
{
bool hasDecimal = false;
while (!IsSpace(c))
{
result.Append(c);
if (input.Eof())
{
return true;
}
c = input.Peek();
if (!IsDigit(c) && c != '.')
{
return true;
}
input.GetC();
if (c == '\n')
{
++lineNumber;
return true;
}
}
}
else
{
if (IsSymbol(c))
{
result = c;
return true;
}
while (!IsSpace(c) && !input.Eof())
{
result.Append(c);
if (IsSymbol(input.Peek()))
{
break;
}
c = input.GetC();
if (c == '\n')
{
++lineNumber;
return true;
}
}
}
return true;
//.........这里部分代码省略.........