Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Static Public Member Functions
nsMathMLOperators Class Reference

#include <nsMathMLOperators.h>

List of all members.

Public Types

enum  eMATHVARIANT {
  eMATHVARIANT_NONE = -1, eMATHVARIANT_normal = 0, eMATHVARIANT_bold, eMATHVARIANT_italic,
  eMATHVARIANT_bold_italic, eMATHVARIANT_sans_serif, eMATHVARIANT_bold_sans_serif, eMATHVARIANT_sans_serif_italic,
  eMATHVARIANT_sans_serif_bold_italic, eMATHVARIANT_monospace, eMATHVARIANT_script, eMATHVARIANT_bold_script,
  eMATHVARIANT_fraktur, eMATHVARIANT_bold_fraktur, eMATHVARIANT_double_struck, eMATHVARIANT_COUNT
}

Static Public Member Functions

static void AddRefTable (void)
static void ReleaseTable (void)
static PRBool LookupOperator (const nsString &aOperator, const nsOperatorFlags aForm, nsOperatorFlags *aFlags, float *aLeftSpace, float *aRightSpace)
static void LookupOperators (const nsString &aOperator, nsOperatorFlags *aFlags, float *aLeftSpace, float *aRightSpace)
static PRBool IsMutableOperator (const nsString &aOperator)
static PRInt32 CountStretchyOperator ()
static PRInt32 FindStretchyOperator (PRUnichar aOperator)
static nsStretchDirection GetStretchyDirectionAt (PRInt32 aIndex)
static void DisableStretchyOperatorAt (PRInt32 aIndex)
static PRBool LookupInvariantChar (PRUnichar aChar, eMATHVARIANT *aType=nsnull)

Detailed Description

Definition at line 83 of file nsMathMLOperators.h.


Member Enumeration Documentation

Enumerator:
eMATHVARIANT_NONE 
eMATHVARIANT_normal 
eMATHVARIANT_bold 
eMATHVARIANT_italic 
eMATHVARIANT_bold_italic 
eMATHVARIANT_sans_serif 
eMATHVARIANT_bold_sans_serif 
eMATHVARIANT_sans_serif_italic 
eMATHVARIANT_sans_serif_bold_italic 
eMATHVARIANT_monospace 
eMATHVARIANT_script 
eMATHVARIANT_bold_script 
eMATHVARIANT_fraktur 
eMATHVARIANT_bold_fraktur 
eMATHVARIANT_double_struck 
eMATHVARIANT_COUNT 

Definition at line 129 of file nsMathMLOperators.h.


Member Function Documentation

Definition at line 407 of file nsMathMLOperators.cpp.

Here is the caller graph for this function:

Definition at line 567 of file nsMathMLOperators.cpp.

{
  if (!gInitialized) {
    InitGlobals();
  }
  return (gStretchyOperatorArray) ? gStretchyOperatorArray->Count() : 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 611 of file nsMathMLOperators.cpp.

{
  NS_ASSERTION(gStretchyOperatorArray, "invalid call");
  if (gStretchyOperatorArray) {
    NS_ASSERTION(aIndex < gStretchyOperatorArray->Count(), "invalid call");
    gStretchyOperatorArray->ReplaceElementAt(nsnull, aIndex);
  }
}

Here is the caller graph for this function:

Definition at line 576 of file nsMathMLOperators.cpp.

{
  if (!gInitialized) {
    InitGlobals();
  }
  if (gStretchyOperatorArray) {
    for (PRInt32 k = 0; k < gStretchyOperatorArray->Count(); k++) {
      OperatorData* data = (OperatorData*)gStretchyOperatorArray->ElementAt(k);
      if (data && (aOperator == data->mStr[0])) {
        return k;
      }
    }
  }
  return kNotFound;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 593 of file nsMathMLOperators.cpp.

{
  NS_ASSERTION(gStretchyOperatorArray, "invalid call");
  if (gStretchyOperatorArray) {
    NS_ASSERTION(aIndex < gStretchyOperatorArray->Count(), "invalid call");
    OperatorData* data = (OperatorData*)gStretchyOperatorArray->ElementAt(aIndex);
    if (data) {
      if (NS_MATHML_OPERATOR_IS_STRETCHY_VERT(data->mFlags))
        return NS_STRETCH_DIRECTION_VERTICAL;
      else if (NS_MATHML_OPERATOR_IS_STRETCHY_HORIZ(data->mFlags))
        return NS_STRETCH_DIRECTION_HORIZONTAL;
      NS_ASSERTION(PR_FALSE, "*** bad setup ***");
    }
  }
  return NS_STRETCH_DIRECTION_UNSUPPORTED;
}

Here is the caller graph for this function:

Definition at line 548 of file nsMathMLOperators.cpp.

{
  if (!gInitialized) {
    InitGlobals();
  }
  // lookup all the variants of the operator and return true if there
  // is a variant that is stretchy or largeop
  nsOperatorFlags flags[4];
  float lspace[4], rspace[4];
  nsMathMLOperators::LookupOperators(aOperator, flags, lspace, rspace);
  nsOperatorFlags allFlags =
    flags[NS_MATHML_OPERATOR_FORM_INFIX] |
    flags[NS_MATHML_OPERATOR_FORM_POSTFIX] |
    flags[NS_MATHML_OPERATOR_FORM_PREFIX];
  return NS_MATHML_OPERATOR_IS_STRETCHY(allFlags) ||
         NS_MATHML_OPERATOR_IS_LARGEOP(allFlags);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 621 of file nsMathMLOperators.cpp.

{
  if (!gInitialized) {
    InitGlobals();
  }
  if (aType) *aType = eMATHVARIANT_NONE;
  if (gInvariantCharArray) {
    for (PRInt32 i = gInvariantCharArray->Count()-1; i >= 0; --i) {
      nsString* list = gInvariantCharArray->StringAt(i);
      if (kNotFound != list->FindChar(aChar)) {
        if (aType) *aType = eMATHVARIANT(i);
        return PR_TRUE;
      }
    }
  }
  return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsMathMLOperators::LookupOperator ( const nsString aOperator,
const nsOperatorFlags  aForm,
nsOperatorFlags aFlags,
float *  aLeftSpace,
float *  aRightSpace 
) [static]

Definition at line 432 of file nsMathMLOperators.cpp.

{
  if (!gInitialized) {
    InitGlobals();
  }
  if (gOperatorTable) {
    NS_ASSERTION(aFlags && aLeftSpace && aRightSpace, "bad usage");
    NS_ASSERTION(aForm>=0 && aForm<4, "*** invalid call ***");

    OperatorData* found;
    PRInt32 form = NS_MATHML_OPERATOR_GET_FORM(aForm);
    gOperatorFound[NS_MATHML_OPERATOR_FORM_INFIX] = nsnull;
    gOperatorFound[NS_MATHML_OPERATOR_FORM_POSTFIX] = nsnull;
    gOperatorFound[NS_MATHML_OPERATOR_FORM_PREFIX] = nsnull;

    nsAutoString key(aOperator);
    key.AppendInt(form, 10);
    nsStringKey hkey(key);
    gOperatorFound[form] = found = (OperatorData*)gOperatorTable->Get(&hkey);

    // If not found, check if the operator exists perhaps in a different form,
    // in the order of preference: infix, postfix, prefix
    if (!found) {
      if (form != NS_MATHML_OPERATOR_FORM_INFIX) {
        form = NS_MATHML_OPERATOR_FORM_INFIX;
        key.Assign(aOperator);
        key.AppendInt(form, 10);
        nsStringKey hashkey(key);
        gOperatorFound[form] = found = (OperatorData*)gOperatorTable->Get(&hashkey);
      }
      if (!found) {
        if (form != NS_MATHML_OPERATOR_FORM_POSTFIX) {
          form = NS_MATHML_OPERATOR_FORM_POSTFIX;
          key.Assign(aOperator);
          key.AppendInt(form, 10);
          nsStringKey hashkey(key);
          gOperatorFound[form] = found = (OperatorData*)gOperatorTable->Get(&hashkey);
        }
        if (!found) {
          if (form != NS_MATHML_OPERATOR_FORM_PREFIX) {
            form = NS_MATHML_OPERATOR_FORM_PREFIX;
            key.Assign(aOperator);
            key.AppendInt(form, 10);
            nsStringKey hashkey(key);
            gOperatorFound[form] = found = (OperatorData*)gOperatorTable->Get(&hashkey);
          }
        }
      }
    }
    if (found) {
      NS_ASSERTION(found->mStr.Equals(aOperator), "bad setup");
      *aLeftSpace = found->mLeftSpace;
      *aRightSpace = found->mRightSpace;
      *aFlags &= ~NS_MATHML_OPERATOR_FORM; // clear the form bits
      *aFlags |= found->mFlags; // just add bits without overwriting
      return PR_TRUE;
    }
  }
  return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsMathMLOperators::LookupOperators ( const nsString aOperator,
nsOperatorFlags aFlags,
float *  aLeftSpace,
float *  aRightSpace 
) [static]

Definition at line 498 of file nsMathMLOperators.cpp.

{
  if (!gInitialized) {
    InitGlobals();
  }

  aFlags[NS_MATHML_OPERATOR_FORM_INFIX] = 0;
  aLeftSpace[NS_MATHML_OPERATOR_FORM_INFIX] = 0.0f;
  aRightSpace[NS_MATHML_OPERATOR_FORM_INFIX] = 0.0f;

  aFlags[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0;
  aLeftSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0.0f;
  aRightSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0.0f;

  aFlags[NS_MATHML_OPERATOR_FORM_PREFIX] = 0;
  aLeftSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = 0.0f;
  aRightSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = 0.0f;

  if (gOperatorTable) {
    // a lookup with form=0 will put all the variants in gOperatorFound[]
    float dummy;
    nsOperatorFlags flags = 0;
    LookupOperator(aOperator, /*form=*/0, &flags, &dummy, &dummy);
    // if the operator was found, gOperatorFound contains all its variants
    OperatorData* found;
    found = gOperatorFound[NS_MATHML_OPERATOR_FORM_INFIX];
    if (found) {
      aFlags[NS_MATHML_OPERATOR_FORM_INFIX] = found->mFlags;
      aLeftSpace[NS_MATHML_OPERATOR_FORM_INFIX] = found->mLeftSpace;
      aRightSpace[NS_MATHML_OPERATOR_FORM_INFIX] = found->mRightSpace;
    }
    found = gOperatorFound[NS_MATHML_OPERATOR_FORM_POSTFIX];
    if (found) {
      aFlags[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mFlags;
      aLeftSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mLeftSpace;
      aRightSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mRightSpace;
    }
    found = gOperatorFound[NS_MATHML_OPERATOR_FORM_PREFIX];
    if (found) {
      aFlags[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mFlags;
      aLeftSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mLeftSpace;
      aRightSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mRightSpace;
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 413 of file nsMathMLOperators.cpp.

Here is the caller graph for this function:


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