Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
nsCSSToken Struct Reference

#include <nsCSSScanner.h>

Collaboration diagram for nsCSSToken:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsCSSToken ()
PRBool IsDimension ()
PRBool IsSymbol (PRUnichar aSymbol)
void AppendToString (nsString &aBuffer)

Public Attributes

nsCSSTokenType mType
PRPackedBool mIntegerValid
nsAutoString mIdent
float mNumber
PRInt32 mInteger
PRUnichar mSymbol

Detailed Description

Definition at line 101 of file nsCSSScanner.h.


Constructor & Destructor Documentation

Definition at line 113 of file nsCSSScanner.cpp.


Member Function Documentation

Definition at line 119 of file nsCSSScanner.cpp.

{
  switch (mType) {
    case eCSSToken_AtKeyword:
      aBuffer.Append(PRUnichar('@')); // fall through intentional
    case eCSSToken_Ident:
    case eCSSToken_WhiteSpace:
    case eCSSToken_Function:
    case eCSSToken_URL:
    case eCSSToken_InvalidURL:
    case eCSSToken_HTMLComment:
      aBuffer.Append(mIdent);
      break;
    case eCSSToken_Number:
      if (mIntegerValid) {
        aBuffer.AppendInt(mInteger, 10);
      }
      else {
        aBuffer.AppendFloat(mNumber);
      }
      break;
    case eCSSToken_Percentage:
      NS_ASSERTION(!mIntegerValid, "How did a percentage token get this set?");
      aBuffer.AppendFloat(mNumber * 100.0f);
      aBuffer.Append(PRUnichar('%')); // STRING USE WARNING: technically, this should be |AppendWithConversion|
      break;
    case eCSSToken_Dimension:
      if (mIntegerValid) {
        aBuffer.AppendInt(mInteger, 10);
      }
      else {
        aBuffer.AppendFloat(mNumber);
      }
      aBuffer.Append(mIdent);
      break;
    case eCSSToken_String:
      aBuffer.Append(mSymbol);
      aBuffer.Append(mIdent); // fall through intentional
    case eCSSToken_Symbol:
      aBuffer.Append(mSymbol);
      break;
    case eCSSToken_ID:
    case eCSSToken_Ref:
      aBuffer.Append(PRUnichar('#'));
      aBuffer.Append(mIdent);
      break;
    case eCSSToken_Includes:
      aBuffer.AppendLiteral("~=");
      break;
    case eCSSToken_Dashmatch:
      aBuffer.AppendLiteral("|=");
      break;
    case eCSSToken_Error:
      aBuffer.Append(mSymbol);
      aBuffer.Append(mIdent);
      break;
    default:
      NS_ERROR("invalid token type");
      break;
  }
}

Definition at line 111 of file nsCSSScanner.h.

                       {
    return PRBool((eCSSToken_Dimension == mType) ||
                  ((eCSSToken_Number == mType) && (mNumber == 0.0f)));
  }

Here is the caller graph for this function:

PRBool nsCSSToken::IsSymbol ( PRUnichar  aSymbol) [inline]

Definition at line 116 of file nsCSSScanner.h.

                                     {
    return PRBool((eCSSToken_Symbol == mType) && (mSymbol == aSymbol));
  }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 104 of file nsCSSScanner.h.

Definition at line 106 of file nsCSSScanner.h.

Definition at line 103 of file nsCSSScanner.h.

Definition at line 105 of file nsCSSScanner.h.

Definition at line 107 of file nsCSSScanner.h.

Definition at line 102 of file nsCSSScanner.h.


The documentation for this struct was generated from the following files: