Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Attributes
nsXFormsXPathEvaluator::XFormsParseContextImpl Class Reference
Inheritance diagram for nsXFormsXPathEvaluator::XFormsParseContextImpl:
Inheritance graph
[legend]
Collaboration diagram for nsXFormsXPathEvaluator::XFormsParseContextImpl:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 XFormsParseContextImpl (nsIDOMNode *aResolverNode, nsIDOMNode *aOrigCtxt)
 ~XFormsParseContextImpl ()
nsresult getError ()
nsresult resolveNamespacePrefix (nsIAtom *aPrefix, PRInt32 &aID)
nsresult resolveFunctionCall (nsIAtom *aName, PRInt32 aID, FunctionCall *&aFunction)
PRBool caseInsensitiveNameTests ()
 Should nametests parsed in this context be case-sensitive.
void SetErrorOffset (PRUint32 aOffset)

Private Attributes

nsIDOMNodemResolverNode
nsIDOMNodemOriginalContext
nsresult mLastError

Detailed Description

Definition at line 70 of file nsXFormsXPathEvaluator.h.


Constructor & Destructor Documentation

Definition at line 73 of file nsXFormsXPathEvaluator.h.

              : mResolverNode(aResolverNode),
                mOriginalContext(aOrigCtxt),
                mLastError(NS_OK)
        {
        }

Definition at line 80 of file nsXFormsXPathEvaluator.h.

        {
        }

Member Function Documentation

Should nametests parsed in this context be case-sensitive.

Implements txIParseContext.

Definition at line 310 of file nsXFormsXPathEvaluator.cpp.

{
  // This will always be false since this handles XForms, which is XML-based,
  //   so case sensitive.
  return PR_FALSE;
}

Definition at line 84 of file nsXFormsXPathEvaluator.h.

        {
            return mLastError;
        }

Implements txIParseContext.

Definition at line 196 of file nsXFormsXPathEvaluator.cpp.

{
  if (aNamespaceID == kNameSpaceID_None) {
    PRBool isOutOfMem = PR_TRUE;

    if (aName == txXPathAtoms::avg) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::AVG);
    }
    else if (aName == txXPathAtoms::booleanFromString) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::BOOLEANFROMSTRING);
    }
    else if (aName == txXPathAtoms::countNonEmpty) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::COUNTNONEMPTY);
    }
    else if (aName == txXPathAtoms::daysFromDate) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::DAYSFROMDATE);
    }
    else if (aName == txXPathAtoms::ifFunc) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::IF);
    }
    else if (aName == txXPathAtoms::index) {
      NS_ENSURE_TRUE(mResolverNode, NS_ERROR_FAILURE);
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::INDEX,
                                       mResolverNode); 
    }
    else if (aName == txXPathAtoms::instance) {
      NS_ENSURE_TRUE(mResolverNode, NS_ERROR_FAILURE);
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::INSTANCE, 
                                       mResolverNode);
    }
    else if (aName == txXPathAtoms::max) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::MAX);
    }
    else if (aName == txXPathAtoms::min) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::MIN);
    }
    else if (aName == txXPathAtoms::months) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::MONTHS);
    }
    else if (aName == txXPathAtoms::now) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::NOW);
    }
    else if (aName == txXPathAtoms::localDateTime) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::LOCALDATETIME);
    }
    else if (aName == txXPathAtoms::localDate) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::LOCALDATE);
    }
    else if (aName == txXPathAtoms::property) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::PROPERTY);
    }
    else if (aName == txXPathAtoms::seconds) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::SECONDS);
    }
    else if (aName == txXPathAtoms::secondsFromDateTime) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::SECONDSFROMDATETIME);
    }
    else if (aName == txXPathAtoms::current) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::CURRENT,
                                       mOriginalContext);
    }
    else if (aName == txXPathAtoms::event) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::EVENT,
                                       mResolverNode);
    }
    else if (aName == txXPathAtoms::power) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::POWER);
    }
    else if (aName == txXPathAtoms::random) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::RANDOM);
    }
    else if (aName == txXPathAtoms::compare) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::COMPARE);
    }
    else if (aName == txXPathAtoms::context) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::CONTEXT,
                                       mResolverNode);
    }
    else if (aName == txXPathAtoms::daysToDate) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::DAYSTODATE);
    }
    else if (aName == txXPathAtoms::secondsToDateTime) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::SECONDSTODATETIME);
    }
    else if (aName == txXPathAtoms::isCardNumber) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::ISCARDNUMBER);
    }
    else if (aName == txXPathAtoms::digest) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::DIGEST,
                                       mResolverNode);
    }
    else if (aName == txXPathAtoms::adjustDateTimeToTimezone) {
      aFnCall = new XFormsFunctionCall(XFormsFunctionCall::ADJUSTDATETIMETOTIMEZONE);
    }
    else {
      // didn't find functioncall here, aFnCall should be null
      isOutOfMem = PR_FALSE;
    }

    if (aFnCall)
    {
      return NS_OK;
    }
    else if (isOutOfMem) {
      NS_ERROR("XPath FunctionLib failed on out-of-memory");
      return NS_ERROR_OUT_OF_MEMORY;
    }
  }
  return NS_ERROR_XPATH_UNKNOWN_FUNCTION;
}

Here is the call graph for this function:

Implements txIParseContext.

Definition at line 148 of file nsXFormsXPathEvaluator.cpp.

{
  aID = kNameSpaceID_Unknown;

  if (!mResolverNode) {
    return NS_ERROR_DOM_NAMESPACE_ERR;
  }

  nsAutoString prefix;
  if (aPrefix) {
    aPrefix->ToString(prefix);
  }

  nsVoidableString ns;
  nsresult rv;
  // begin - taken directly from nsXPathNSResolver::LookupNamespaceURI
  if (prefix.EqualsLiteral("xml")) {
      ns.AssignLiteral("http://www.w3.org/XML/1998/namespace");
      rv = NS_OK;
  }
  else {
    nsCOMPtr<nsIDOM3Node> dom3Node = do_QueryInterface(mResolverNode);
    NS_ASSERTION(dom3Node, "Need a node to resolve namespaces.");
    if( dom3Node ) {
      rv = dom3Node->LookupNamespaceURI(prefix, ns);
    }
    else {
      SetDOMStringToNull(ns);
      rv = NS_OK;
    }
  }
  // end - taken directly from nsXPathNSResolver::LookupNamespaceURI
  NS_ENSURE_SUCCESS(rv, rv);

  if (DOMStringIsNull(ns)) {
    return NS_ERROR_DOM_NAMESPACE_ERR;
  }

  if (ns.IsEmpty()) {
    aID = kNameSpaceID_None;
    return NS_OK;
  }

  // get the namespaceID for the URI
  return gTxNameSpaceManager->RegisterNameSpace(ns, aID);
}

Here is the call graph for this function:

Implements txIParseContext.

Definition at line 318 of file nsXFormsXPathEvaluator.cpp.

{
}

Member Data Documentation

Definition at line 98 of file nsXFormsXPathEvaluator.h.

Definition at line 97 of file nsXFormsXPathEvaluator.h.

Definition at line 96 of file nsXFormsXPathEvaluator.h.


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