LCOV - code coverage report
Current view: top level - dom/xslt/xml - txXMLUtils.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 8 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /* This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : /**
       7             :  * An XML Utility class
       8             : **/
       9             : 
      10             : #ifndef MITRE_XMLUTILS_H
      11             : #define MITRE_XMLUTILS_H
      12             : 
      13             : #include "txCore.h"
      14             : #include "nsDependentSubstring.h"
      15             : #include "txXPathNode.h"
      16             : 
      17             : #define kExpatSeparatorChar 0xFFFF
      18             : 
      19             : extern "C" int MOZ_XMLIsLetter(const char* ptr);
      20             : extern "C" int MOZ_XMLIsNCNameChar(const char* ptr);
      21             : 
      22             : class nsIAtom;
      23             : 
      24             : class XMLUtils {
      25             : 
      26             : public:
      27             :     static nsresult splitExpatName(const char16_t *aExpatName,
      28             :                                    nsIAtom **aPrefix, nsIAtom **aLocalName,
      29             :                                    int32_t* aNameSpaceID);
      30             :     static nsresult splitQName(const nsAString& aName, nsIAtom** aPrefix,
      31             :                                nsIAtom** aLocalName);
      32             : 
      33             :     /*
      34             :      * Returns true if the given character is whitespace.
      35             :      */
      36           0 :     static bool isWhitespace(const char16_t& aChar)
      37             :     {
      38           0 :         return (aChar <= ' ' &&
      39           0 :                 (aChar == ' ' || aChar == '\r' ||
      40           0 :                  aChar == '\n'|| aChar == '\t'));
      41             :     }
      42             : 
      43             :     /**
      44             :      * Returns true if the given string has only whitespace characters
      45             :      */
      46             :     static bool isWhitespace(const nsString& aText);
      47             : 
      48             :     /**
      49             :      * Normalizes the value of a XML processingInstruction
      50             :     **/
      51             :     static void normalizePIValue(nsAString& attValue);
      52             : 
      53             :     /**
      54             :      * Returns true if the given string is a valid XML QName
      55             :      */
      56             :     static bool isValidQName(const nsString& aQName, const char16_t** aColon);
      57             : 
      58             :     /**
      59             :      * Returns true if the given character represents an Alpha letter
      60             :      */
      61           0 :     static bool isLetter(char16_t aChar)
      62             :     {
      63           0 :         return !!MOZ_XMLIsLetter(reinterpret_cast<const char*>(&aChar));
      64             :     }
      65             : 
      66             :     /**
      67             :      * Returns true if the given character is an allowable NCName character
      68             :      */
      69           0 :     static bool isNCNameChar(char16_t aChar)
      70             :     {
      71           0 :         return !!MOZ_XMLIsNCNameChar(reinterpret_cast<const char*>(&aChar));
      72             :     }
      73             : 
      74             :     /*
      75             :      * Walks up the document tree and returns true if the closest xml:space
      76             :      * attribute is "preserve"
      77             :      */
      78             :     static bool getXMLSpacePreserve(const txXPathNode& aNode);
      79             : };
      80             : 
      81             : #endif

Generated by: LCOV version 1.13