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


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

本文整理汇总了C++中wxInputStream::GetC方法的典型用法代码示例。如果您正苦于以下问题:C++ wxInputStream::GetC方法的具体用法?C++ wxInputStream::GetC怎么用?C++ wxInputStream::GetC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wxInputStream的用法示例。


在下文中一共展示了wxInputStream::GetC方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DoCanRead

bool wxPNMHandler::DoCanRead( wxInputStream& stream )
{
    Skip_Comment(stream);

    if ( stream.GetC() == 'P' )
    {
        switch (stream.GetC())
        {
            case '3':
            case '6':
                return true;
        }
    }

    return false;
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:16,代码来源:imagpnm.cpp

示例2: DoCanRead

bool wxPNMHandler::DoCanRead( wxInputStream& stream )
{
    Skip_Comment(stream);

    // it's ok to modify the stream position here
    if ( stream.GetC() == 'P' )
    {
        switch ( stream.GetC() )
        {
            case '2': // ASCII Grey
            case '3': // ASCII RGB
            case '5': // RAW Grey
            case '6': // RAW RGB
                return true;
        }
    }

    return false;
}
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:19,代码来源:imagpnm.cpp

示例3: ReadToken

wxString IACFile::ReadToken(wxInputStream &file) {
    // 0 = read chars until digit
    // 1 = read digits until no digit
    // 2 = token found
    wxString token = wxEmptyString;

    int mode = 0;

    while (file.IsOk() && mode != 2) {
        int c = file.GetC();

        if (c != wxEOF && c <= 128) {
            if (c == '\n' && m_tokensI > 0) {
                m_newlineTokens.push_back(m_tokensI + 1);
            }
            m_RawData.Append((char)c);
            switch (mode) {
                case 0:
                    if (isdigit(c)) {
                        token.Append((char)c);
                        mode = 1;
                    }
                    break;
                case 1:
                    if (isdigit(c) || c == '/') {
                        token.Append((char)c);
                    } else {
                        if (token.Len() == 5) {
                            // token found!!
                            mode = 2;
                        } else {
                            token.Empty();
                        }
                    }
                    break;
                    /* this is dead code
                                case 2:
                                    mode = 0;
                                    break;
                    */
            }  // case
        }
    }  // while
    if (mode != 2) {
        token.Empty();
    }

    return token;
}
开发者ID:rgleason,项目名称:iacfleet_pi,代码行数:49,代码来源:iacfile.cpp

示例4: 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

示例5: 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

示例6: DoLoadDib


//.........这里部分代码省略.........
        //       load even non-seekable streams (see wxInputStream::SeekI docs)!
        const wxFileOffset pos = stream.TellI();
        if (pos != wxInvalidOffset && bmpOffset > pos)
            if (stream.SeekI(bmpOffset - pos, wxFromCurrent) == wxInvalidOffset)
                return false;
        //else: icon, just carry on
    }

    unsigned char *data = ptr;

    /* set the whole image to the background color */
    if ( bpp < 16 && (comp == BI_RLE4 || comp == BI_RLE8) )
    {
        for (int i = 0; i < width * height; i++)
        {
            *ptr++ = cmap[0].r;
            *ptr++ = cmap[0].g;
            *ptr++ = cmap[0].b;
        }
        ptr = data;
    }

    int linesize = ((width * bpp + 31) / 32) * 4;

    /* BMPs are stored upside down */
    for ( int line = (height - 1); line >= 0; line-- )
    {
        int linepos = 0;
        for ( int column = 0; column < width ; )
        {
            if ( bpp < 16 )
            {
                linepos++;
                aByte = stream.GetC();
                if ( bpp == 1 )
                {
                    for (int bit = 0; bit < 8 && column < width; bit++)
                    {
                        int index = ((aByte & (0x80 >> bit)) ? 1 : 0);
                        ptr[poffset] = cmap[index].r;
                        ptr[poffset + 1] = cmap[index].g;
                        ptr[poffset + 2] = cmap[index].b;
                        column++;
                    }
                }
                else if ( bpp == 4 )
                {
                    if ( comp == BI_RLE4 )
                    {
                        wxUint8 first;
                        first = aByte;
                        aByte = stream.GetC();
                        if ( first == 0 )
                        {
                            if ( aByte == 0 )
                            {
                                if ( column > 0 )
                                    column = width;
                            }
                            else if ( aByte == 1 )
                            {
                                column = width;
                                line = -1;
                            }
                            else if ( aByte == 2 )
                            {
开发者ID:DumaGit,项目名称:winsparkle,代码行数:67,代码来源:imagbmp.cpp


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