LCOV - code coverage report
Current view: directory - content/xul/templates/src - nsXULContentUtils.h (source / functions) Found Hit Coverage
Test: app.info Lines: 2 0 0.0 %
Date: 2012-06-02 Functions: 1 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is Mozilla Communicator client code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * Netscape Communications Corporation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 1998
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   Chris Waterson <waterson@netscape.com>
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      27                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : /*
      40                 : 
      41                 :   A package of routines shared by the XUL content code.
      42                 : 
      43                 :  */
      44                 : 
      45                 : #ifndef nsXULContentUtils_h__
      46                 : #define nsXULContentUtils_h__
      47                 : 
      48                 : #include "nsISupports.h"
      49                 : 
      50                 : class nsIAtom;
      51                 : class nsIContent;
      52                 : class nsIDocument;
      53                 : class nsIDOMNodeList;
      54                 : class nsIRDFNode;
      55                 : class nsCString;
      56                 : class nsString;
      57                 : class nsIRDFResource;
      58                 : class nsIRDFLiteral;
      59                 : class nsIRDFService;
      60                 : class nsINameSpaceManager;
      61                 : class nsIDateTimeFormat;
      62                 : class nsICollation;
      63                 : 
      64                 : // errors to pass to LogTemplateError
      65                 : #define ERROR_TEMPLATE_INVALID_QUERYPROCESSOR                           \
      66                 :         "querytype attribute doesn't specify a valid query processor"
      67                 : #define ERROR_TEMPLATE_INVALID_QUERYSET                                 \
      68                 :         "unexpected <queryset> element"
      69                 : #define ERROR_TEMPLATE_NO_MEMBERVAR                                     \
      70                 :         "no member variable found. Action body should have an element with uri attribute"
      71                 : #define ERROR_TEMPLATE_WHERE_NO_SUBJECT                                 \
      72                 :         "<where> element is missing a subject attribute"
      73                 : #define ERROR_TEMPLATE_WHERE_NO_RELATION                                \
      74                 :         "<where> element is missing a rel attribute"
      75                 : #define ERROR_TEMPLATE_WHERE_NO_VALUE                                   \
      76                 :         "<where> element is missing a value attribute"
      77                 : #define ERROR_TEMPLATE_WHERE_NO_VAR                                     \
      78                 :         "<where> element must have at least one variable as a subject or value"
      79                 : #define ERROR_TEMPLATE_BINDING_BAD_SUBJECT                              \
      80                 :         "<binding> requires a variable for its subject attribute"
      81                 : #define ERROR_TEMPLATE_BINDING_BAD_PREDICATE                            \
      82                 :         "<binding> element is missing a predicate attribute"
      83                 : #define ERROR_TEMPLATE_BINDING_BAD_OBJECT                               \
      84                 :         "<binding> requires a variable for its object attribute"
      85                 : #define ERROR_TEMPLATE_CONTENT_NOT_FIRST                                \
      86                 :         "expected <content> to be first"
      87                 : #define ERROR_TEMPLATE_MEMBER_NOCONTAINERVAR                            \
      88                 :         "<member> requires a variable for its container attribute"
      89                 : #define ERROR_TEMPLATE_MEMBER_NOCHILDVAR                                \
      90                 :         "<member> requires a variable for its child attribute"
      91                 : #define ERROR_TEMPLATE_TRIPLE_NO_VAR                                    \
      92                 :         "<triple> should have at least one variable as a subject or object"
      93                 : #define ERROR_TEMPLATE_TRIPLE_BAD_SUBJECT                               \
      94                 :         "<triple> requires a variable for its subject attribute"
      95                 : #define ERROR_TEMPLATE_TRIPLE_BAD_PREDICATE                             \
      96                 :         "<triple> should have a non-variable value as a predicate"
      97                 : #define ERROR_TEMPLATE_TRIPLE_BAD_OBJECT                                \
      98                 :         "<triple> requires a variable for its object attribute"
      99                 : #define ERROR_TEMPLATE_MEMBER_UNBOUND                                   \
     100                 :         "neither container or child variables of <member> has a value"
     101                 : #define ERROR_TEMPLATE_TRIPLE_UNBOUND                                   \
     102                 :         "neither subject or object variables of <triple> has a value"
     103                 : #define ERROR_TEMPLATE_BAD_XPATH                                        \
     104                 :         "XPath expression in query could not be parsed"
     105                 : #define ERROR_TEMPLATE_BAD_ASSIGN_XPATH                                 \
     106                 :         "XPath expression in <assign> could not be parsed"
     107                 : #define ERROR_TEMPLATE_BAD_BINDING_XPATH                                \
     108                 :         "XPath expression in <binding> could not be parsed"
     109                 : #define ERROR_TEMPLATE_STORAGE_BAD_URI                                  \
     110                 :         "only profile: or file URI are allowed"
     111                 : #define ERROR_TEMPLATE_STORAGE_CANNOT_OPEN_DATABASE                     \
     112                 :         "cannot open given database"
     113                 : #define ERROR_TEMPLATE_STORAGE_BAD_QUERY                                \
     114                 :         "syntax error in the SQL query"
     115                 : #define ERROR_TEMPLATE_STORAGE_UNKNOWN_QUERY_PARAMETER                   \
     116                 :         "the given named parameter is unknown in the SQL query"
     117                 : #define ERROR_TEMPLATE_STORAGE_WRONG_TYPE_QUERY_PARAMETER               \
     118                 :         "the type of a query parameter is wrong"
     119                 : #define ERROR_TEMPLATE_STORAGE_QUERY_PARAMETER_NOT_BOUND                \
     120                 :         "a query parameter cannot be bound to the SQL query"
     121                 : 
     122                 : class nsXULContentUtils
     123                 : {
     124                 : protected:
     125                 :     static nsIRDFService* gRDF;
     126                 :     static nsIDateTimeFormat* gFormat;
     127                 :     static nsICollation *gCollation;
     128                 : 
     129                 :     static bool gDisableXULCache;
     130                 : 
     131                 :     static int
     132                 :     DisableXULCacheChangedCallback(const char* aPrefName, void* aClosure);
     133                 : 
     134                 : public:
     135                 :     static nsresult
     136                 :     Init();
     137                 : 
     138                 :     static nsresult
     139                 :     Finish();
     140                 : 
     141                 :     static nsresult
     142                 :     FindChildByTag(nsIContent *aElement,
     143                 :                    PRInt32 aNameSpaceID,
     144                 :                    nsIAtom* aTag,
     145                 :                    nsIContent **aResult);
     146                 : 
     147                 :     static nsresult
     148                 :     FindChildByResource(nsIContent* aElement,
     149                 :                         nsIRDFResource* aResource,
     150                 :                         nsIContent** aResult);
     151                 : 
     152                 :     static nsresult
     153                 :     GetElementResource(nsIContent* aElement, nsIRDFResource** aResult);
     154                 : 
     155                 :     static nsresult
     156                 :     GetTextForNode(nsIRDFNode* aNode, nsAString& aResult);
     157                 : 
     158                 :     /**
     159                 :      * Construct a URI from the element ID given.  This uses aElement as the
     160                 :      * ref and aDocument's document URI as the base.  If aDocument's document
     161                 :      * URI does not support refs, this will throw NS_ERROR_NOT_AVAILABLE.
     162                 :      */
     163                 :     static nsresult
     164                 :     MakeElementURI(nsIDocument* aDocument, const nsAString& aElementID, nsCString& aURI);
     165                 : 
     166                 :     static nsresult
     167                 :     MakeElementResource(nsIDocument* aDocument, const nsAString& aElementID, nsIRDFResource** aResult);
     168                 : 
     169                 :     /**
     170                 :      * Extract the element ID from aURI.  Note that aURI must be an absolute
     171                 :      * URI string in UTF8; the element ID is the ref from the URI.  If the
     172                 :      * scheme does not support refs, then the ID will be empty.
     173                 :      */
     174                 :     static nsresult
     175                 :     MakeElementID(nsIDocument* aDocument, const nsACString& aURI, nsAString& aElementID);
     176                 : 
     177                 :     static nsresult
     178                 :     GetResource(PRInt32 aNameSpaceID, nsIAtom* aAttribute, nsIRDFResource** aResult);
     179                 : 
     180                 :     static nsresult
     181                 :     GetResource(PRInt32 aNameSpaceID, const nsAString& aAttribute, nsIRDFResource** aResult);
     182                 : 
     183                 :     static nsresult
     184                 :     SetCommandUpdater(nsIDocument* aDocument, nsIContent* aElement);
     185                 : 
     186                 :     /**
     187                 :      * Log a message to the error console
     188                 :      */
     189                 :     static void
     190                 :     LogTemplateError(const char* aMsg);
     191                 : 
     192                 :     static nsIRDFService*
     193               0 :     RDFService()
     194                 :     {
     195               0 :         return gRDF;
     196                 :     }
     197                 : 
     198                 :     static nsICollation*
     199                 :     GetCollation();
     200                 : 
     201                 : #define XUL_RESOURCE(ident, uri) static nsIRDFResource* ident
     202                 : #define XUL_LITERAL(ident, val)  static nsIRDFLiteral*  ident
     203                 : #include "nsXULResourceList.h"
     204                 : #undef XUL_RESOURCE
     205                 : #undef XUL_LITERAL
     206                 : };
     207                 : 
     208                 : #endif // nsXULContentUtils_h__

Generated by: LCOV version 1.7