当前位置: 首页>>代码示例>>C++>>正文


C++ wxInputStream::Peek方法代码示例

本文整理汇总了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);
    }
}
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:10,代码来源:imagpnm.cpp

示例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();
    }

}
开发者ID:AlexHayton,项目名称:decoda,代码行数:72,代码来源:Tokenizer.cpp

示例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;

//.........这里部分代码省略.........
开发者ID:AlexHayton,项目名称:decoda,代码行数:101,代码来源:Tokenizer.cpp


注:本文中的wxInputStream::Peek方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。