Exemplo n.º 1
0
bool CResParser::ParseValue(CUniString& strValue)
{
    switch (CurrentToken())
    {
    case tokenStringLiteral:
    case tokenIdentifier:
        strValue=GetStringLiteral();
        NextToken();
        break;

    case tokenDoubleLiteral:
        strValue=GetTokenText();
        NextToken();
        break;

    case tokenInt32Literal:
        if (GetTypeQualifier()==tqRgb)
        {
            strValue=GetTokenText();
            NextToken();
        }
        else
        {
            int iValue=GetInt32Literal();
            NextToken();
            while (CurrentToken()==tokenOr)
            {
                NextToken();
                if (!Check(tokenInt32Literal))
                    return false;
                iValue|=GetInt32Literal();
                NextToken();
            }

            strValue=Format(L"%i", iValue);
        }
        break;

    case tokenInt64Literal:
        strValue=Format(L"%I64i", GetInt64Literal());
        NextToken();
        break;

    default:
        Unexpected(L"when parsing value ");
        return false;
    }

    return true;
}
Exemplo n.º 2
0
wxString DSNLEXER::GetTokenString( int aTok )
{
    wxString    ret;

    ret << wxT("'") << wxString::FromUTF8( GetTokenText(aTok) ) << wxT("'");

    return ret;
}
Exemplo n.º 3
0
// -----------------------------------------------------------------------------
// CWPPushMessage::GetConstrainedEncoding
// -----------------------------------------------------------------------------
//
TUint CWPPushMessage::GetConstrainedEncoding( TLex8& aPointer ) const
    {
    // Constrained encoding can be extension media or short integer
    TUint result( 0 );

    if( !aPointer.Eos() )
        {
        TUint first( aPointer.Peek() );

        if( first > KShortIntegerMask )
            {
            result = GetShortInteger( aPointer );
            }
        else
            {
            // Just skip the text version
            GetTokenText( aPointer );
            }
        }

    return result;
    }
Exemplo n.º 4
0
// -----------------------------------------------------------------------------
// CWPPushMessage::GetFieldName
// -----------------------------------------------------------------------------
//
TUint CWPPushMessage::GetFieldName( TLex8& aPointer ) const
    {
    // Field name can be a short integer or text.
    TUint result( 0 );

    if( !aPointer.Eos() )
        {
        TUint first( aPointer.Peek() );

        if( first > KShortIntegerMask )
            {
            result = GetShortInteger( aPointer );
            }
        else
            {
            // Only well-known fields are read
            GetTokenText( aPointer );
            }
        }

    return result;
    }
Exemplo n.º 5
0
// -----------------------------------------------------------------------------
// CWPPushMessage::ParseContentType
// -----------------------------------------------------------------------------
//
void CWPPushMessage::ParseContentType( TLex8& aPointer )
    {
    // Go through the whole content type header.
    while( !aPointer.Eos() )
        {
        // Each parameter might be well-known (integer) or unknown (text)
        if( IsIntegerValue( aPointer ) )
            {
            // For well-known parameters, the token is an integer value
            TUint paramToken( I64LOW( GetIntegerValue( aPointer ) ) );

            // These are filled with results from parsing.
            TInt resultInteger( 0 );
            TPtrC8 resultString;
            
            // Make sure paramToken fits into KParameterTypes table
            if( paramToken 
                < sizeof(KParameterTypes)/sizeof(TParameterCodingType))
                {
                // Get the coding and use it to determine how we should decode 
                // the next parameter value. We actually ignore all results 
                // except short integer (SEC) and text-value (MAC), but the 
                // rest of the parameters have to be parsed anyway.
                TParameterCodingType coding( KParameterTypes[paramToken] );

                switch( coding )
                    {
                    case EQValue:
                        GetQValue( aPointer );
                        break;

                    case EWellKnownCharset:
                        GetWellKnownCharset( aPointer );
                        break;

                    case EVersionValue:
                        GetVersionValue( aPointer );
                        break;

                    case EIntegerValue:
                        GetIntegerValue( aPointer );
                        break;

                    case ETextString:
                        GetTextString( aPointer );
                        break;

                    case EFieldName:
                        GetFieldName( aPointer );
                        break;

                    case EShortInteger:
                        resultInteger = GetShortInteger( aPointer );
                        break;

                    case EConstrainedEncoding:
                        GetConstrainedEncoding( aPointer );
                        break;

                    case EDeltaSecondsValue:
                        GetDeltaSecondsValue( aPointer );
                        break;

                    case ENoValue:
                        GetNoValue( aPointer );
                        break;

                    case ETextValue:
                        resultString.Set( GetTextValue( aPointer ) );
                        break;

                    case EDateValue:
                        GetDateValue( aPointer );
                        break;

                    default:
                        break;
                    }

                // We have a result. We're actually only interested in
                // SEC and MAC parameters, so we save them here.
                switch( paramToken )
                    {
                    case KWSPHeaderSEC:
                        iSEC = resultInteger;
                        break;

                    case KWSPHeaderMAC:
                        iMAC.Set( resultString );
                        break;

                    default:
                        break;
                    }
                }
            }
        else
            {
            // Unknown parameter. Its name is in text, and the value
            // might be an integer or text.
            GetTokenText( aPointer );
            if( IsIntegerValue( aPointer ) )
                {
                GetIntegerValue( aPointer );
                }
            else
                {
                GetTextValue( aPointer );
                }
            }
        }
    }