secureswitools/swisistools/source/xmlparser/xerces/include/xercesc/dom/DOMException.hpp
changeset 0 ba25891c3a9e
child 1 c42dffbd5b4f
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 #ifndef DOMException_HEADER_GUARD_
       
    18 #define DOMException_HEADER_GUARD_
       
    19 
       
    20 /*
       
    21  * Licensed to the Apache Software Foundation (ASF) under one or more
       
    22  * contributor license agreements.  See the NOTICE file distributed with
       
    23  * this work for additional information regarding copyright ownership.
       
    24  * The ASF licenses this file to You under the Apache License, Version 2.0
       
    25  * (the "License"); you may not use this file except in compliance with
       
    26  * the License.  You may obtain a copy of the License at
       
    27  * 
       
    28  *      http://www.apache.org/licenses/LICENSE-2.0
       
    29  * 
       
    30  * Unless required by applicable law or agreed to in writing, software
       
    31  * distributed under the License is distributed on an "AS IS" BASIS,
       
    32  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    33  * See the License for the specific language governing permissions and
       
    34  * limitations under the License.
       
    35  */
       
    36 
       
    37 /*
       
    38  * $Id: DOMException.hpp 568078 2007-08-21 11:43:25Z amassari $
       
    39  */
       
    40 
       
    41 #include <xercesc/util/XercesDefs.hpp>
       
    42 #include <xercesc/util/PlatformUtils.hpp>
       
    43 
       
    44 XERCES_CPP_NAMESPACE_BEGIN
       
    45 
       
    46 
       
    47 /**
       
    48  * DOM operations only raise exceptions in "exceptional" circumstances, i.e.,
       
    49  * when an operation is impossible to perform (either for logical reasons,
       
    50  * because data is lost, or because the implementation has become unstable).
       
    51  * In general, DOM methods return specific error values in ordinary
       
    52  * processing situations, such as out-of-bound errors when using
       
    53  * <code>DOMNodeList</code>.
       
    54  * <p>Implementations should raise other exceptions under other circumstances.
       
    55  * For example, implementations should raise an implementation-dependent
       
    56  * exception if a <code>null</code> argument is passed.
       
    57  * <p>Some languages and object systems do not support the concept of
       
    58  * exceptions. For such systems, error conditions may be indicated using
       
    59  * native error reporting mechanisms. For some bindings, for example,
       
    60  * methods may return error codes similar to those listed in the
       
    61  * corresponding method descriptions.
       
    62  * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
       
    63  * @since DOM Level 1
       
    64  */
       
    65 
       
    66 class MemoryManager;
       
    67 
       
    68 class CDOM_EXPORT DOMException  {
       
    69 public:
       
    70     // -----------------------------------------------------------------------
       
    71     //  Constructors
       
    72     // -----------------------------------------------------------------------
       
    73     /** @name Constructors */
       
    74     //@{
       
    75     /**
       
    76       * Default constructor for DOMException.
       
    77       *
       
    78       */
       
    79     DOMException();
       
    80 
       
    81     /**
       
    82       * Constructor which takes an error code and a message.
       
    83       *
       
    84       * @param code           The error code which indicates the exception
       
    85       * @param message        The string containing the error message
       
    86       * @param memoryManager  The memory manager used to (de)allocate memory
       
    87       */
       
    88     DOMException(      
       
    89                        short                 code
       
    90                , const XMLCh*                message
       
    91                ,       MemoryManager* const  memoryManager = XMLPlatformUtils::fgMemoryManager
       
    92                 );
       
    93 
       
    94     /**
       
    95       * Copy constructor.
       
    96       *
       
    97       * @param other The object to be copied.
       
    98       */
       
    99     DOMException(const DOMException &other);
       
   100 
       
   101     //@}
       
   102 
       
   103     // -----------------------------------------------------------------------
       
   104     //  Destructors
       
   105     // -----------------------------------------------------------------------
       
   106     /** @name Destructor. */
       
   107     //@{
       
   108 	 /**
       
   109 	  * Destructor for DOMException.
       
   110 	  *
       
   111 	  */
       
   112     virtual ~DOMException();
       
   113     //@}
       
   114 
       
   115 public:
       
   116     // -----------------------------------------------------------------------
       
   117     //  Class Types
       
   118     // -----------------------------------------------------------------------
       
   119     /** @name Public Contants */
       
   120     //@{
       
   121     /**
       
   122      * ExceptionCode
       
   123      *
       
   124      * <p><code>INDEX_SIZE_ERR:</code>
       
   125      * If index or size is negative, or greater than the allowed value.</p>
       
   126      *
       
   127      * <p><code>DOMSTRING_SIZE_ERR:</code>
       
   128      * If the specified range of text does not fit into a DOMString.</p>
       
   129      *
       
   130      * <p><code>HIERARCHY_REQUEST_ERR:</code>
       
   131      * If any node is inserted somewhere it doesn't belong.</p>
       
   132      *
       
   133      * <p><code>WRONG_DOCUMENT_ERR:</code>
       
   134      * If a node is used in a different document than the one that created it
       
   135      * (that doesn't support it).</p>
       
   136      *
       
   137      * <p><code>INVALID_CHARACTER_ERR:</code>
       
   138      * If an invalid or illegal character is specified, such as in a name. See
       
   139      * production 2 in the XML specification for the definition of a legal
       
   140      * character, and production 5 for the definition of a legal name
       
   141      * character.</p>
       
   142      *
       
   143      * <p><code>NO_DATA_ALLOWED_ERR:</code>
       
   144      * If data is specified for a node which does not support data.</p>
       
   145      *
       
   146      * <p><code>NO_MODIFICATION_ALLOWED_ERR:</code>
       
   147      * If an attempt is made to modify an object where modifications are not
       
   148      * allowed.</p>
       
   149      *
       
   150      * <p><code>NOT_FOUND_ERR:</code>
       
   151      * If an attempt is made to reference a node in a context where it does
       
   152      * not exist.</p>
       
   153      *
       
   154      * <p><code>NOT_SUPPORTED_ERR:</code>
       
   155      * If the implementation does not support the requested type of object or
       
   156      * operation.</p>
       
   157      *
       
   158      * <p><code>INUSE_ATTRIBUTE_ERR:</code>
       
   159      * If an attempt is made to add an attribute that is already in use
       
   160      * elsewhere.</p>
       
   161      *
       
   162      * The above are since DOM Level 1
       
   163      * @since DOM Level 1
       
   164      *
       
   165      * <p><code>INVALID_STATE_ERR:</code>
       
   166      * If an attempt is made to use an object that is not, or is no longer,
       
   167      * usable.</p>
       
   168      *
       
   169      * <p><code>SYNTAX_ERR:</code>
       
   170      * If an invalid or illegal string is specified.</p>
       
   171      *
       
   172      * <p><code>INVALID_MODIFICATION_ERR:</code>
       
   173      * If an attempt is made to modify the type of the underlying object.</p>
       
   174      *
       
   175      * <p><code>NAMESPACE_ERR:</code>
       
   176      * If an attempt is made to create or change an object in a way which is
       
   177      * incorrect with regard to namespaces.</p>
       
   178      *
       
   179      * <p><code>INVALID_ACCESS_ERR:</code>
       
   180      * If a parameter or an operation is not supported by the underlying
       
   181      * object.
       
   182      *
       
   183      * The above are since DOM Level 2
       
   184      * @since DOM Level 2
       
   185      *
       
   186      * <p><code>VALIDATION_ERR:</code>
       
   187      * If a call to a method such as <code>insertBefore</code> or
       
   188      * <code>removeChild</code> would make the <code>Node</code> invalid
       
   189      * with respect to "partial validity", this exception would be raised
       
   190      * and the operation would not be done.
       
   191      *
       
   192      * The above is since DOM Level 2
       
   193      * @since DOM Level 3
       
   194      */
       
   195     enum ExceptionCode {
       
   196          INDEX_SIZE_ERR       = 1,
       
   197          DOMSTRING_SIZE_ERR   = 2,
       
   198          HIERARCHY_REQUEST_ERR = 3,
       
   199          WRONG_DOCUMENT_ERR   = 4,
       
   200          INVALID_CHARACTER_ERR = 5,
       
   201          NO_DATA_ALLOWED_ERR  = 6,
       
   202          NO_MODIFICATION_ALLOWED_ERR = 7,
       
   203          NOT_FOUND_ERR        = 8,
       
   204          NOT_SUPPORTED_ERR    = 9,
       
   205          INUSE_ATTRIBUTE_ERR  = 10,
       
   206          INVALID_STATE_ERR    = 11,
       
   207          SYNTAX_ERR     = 12,
       
   208          INVALID_MODIFICATION_ERR    = 13,
       
   209          NAMESPACE_ERR     = 14,
       
   210          INVALID_ACCESS_ERR   = 15,
       
   211          VALIDATION_ERR       = 16
       
   212         };
       
   213     //@}
       
   214 
       
   215     // -----------------------------------------------------------------------
       
   216     //  Getter
       
   217     // -----------------------------------------------------------------------
       
   218     inline const XMLCh* getMessage()    const;
       
   219 
       
   220     // -----------------------------------------------------------------------
       
   221     //  Class Types
       
   222     // -----------------------------------------------------------------------
       
   223     /** @name Public variables */
       
   224     //@{
       
   225 	 /**
       
   226 	  * A code value, from the set defined by the ExceptionCode enum,
       
   227      * indicating the type of error that occured.
       
   228      */
       
   229     ExceptionCode   code;
       
   230 
       
   231 	 /**
       
   232 	  * A string value.  Applications may use this field to hold an error
       
   233      *  message.  The field value is not set by the DOM implementation,
       
   234      *  meaning that the string will be empty when an exception is first
       
   235      *  thrown.
       
   236 	  */
       
   237     const XMLCh *msg;
       
   238     //@}
       
   239 
       
   240 protected:
       
   241 
       
   242     MemoryManager*  fMemoryManager;
       
   243 
       
   244 private:
       
   245 
       
   246 	 /**
       
   247 	  * A boolean value.  
       
   248       *   If the message is provided by the applications, it is not 
       
   249       *   adopted.
       
   250       *   If the message is resolved by the DOM implementation, it is
       
   251       *   owned.
       
   252 	  */
       
   253     bool            fMsgOwned;
       
   254 
       
   255 private:
       
   256     // -----------------------------------------------------------------------
       
   257     // Unimplemented constructors and operators
       
   258     // -----------------------------------------------------------------------    
       
   259     DOMException & operator = (const DOMException &);
       
   260 };
       
   261 
       
   262 inline const XMLCh* DOMException::getMessage() const
       
   263 {
       
   264     return msg;
       
   265 }
       
   266 
       
   267 XERCES_CPP_NAMESPACE_END
       
   268 
       
   269 #endif
       
   270