source: NonGTP/Xerces/xerces-c_2_8_0/include/xercesc/framework/psvi/XSObject.hpp @ 2674

Revision 2674, 4.3 KB checked in by mattausch, 16 years ago (diff)
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (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 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id: XSObject.hpp 568078 2007-08-21 11:43:25Z amassari $
20 */
21
22#if !defined(XSOBJECT_HPP)
23#define XSOBJECT_HPP
24
25#include <xercesc/util/PlatformUtils.hpp>
26#include <xercesc/framework/psvi/XSConstants.hpp>
27
28XERCES_CPP_NAMESPACE_BEGIN
29
30/**
31 * The XSObject forms the base of the Schema Component Model.  It contains
32 * all properties common to the majority of XML Schema components.
33 * This is *always* owned by the validator /parser object from which
34 * it is obtained.  It is designed to be subclassed; subclasses will
35 * specify under what conditions it may be relied upon to have meaningful contents.
36 */
37
38// forward declarations
39class XSNamespaceItem;
40class XSModel;
41
42class XMLPARSER_EXPORT XSObject : public XMemory
43{
44public:
45
46    //  Constructors and Destructor
47    // -----------------------------------------------------------------------
48    /** @name Constructors */
49    //@{
50
51    /**
52      * The default constructor
53      *
54      * @param  compType
55      * @param  xsModel
56      * @param  manager     The configurable memory manager
57      */
58    XSObject
59    (
60        XSConstants::COMPONENT_TYPE compType
61        , XSModel* const xsModel
62        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
63    );
64
65    //@};
66
67    /** @name Destructor */
68    //@{
69    virtual ~XSObject();
70    //@}
71
72    //---------------------
73    /** @name XSObject methods */
74
75    //@{
76
77    /**
78     *  The <code>type</code> of this object, i.e.
79     * <code>ELEMENT_DECLARATION</code>.
80     */
81    XSConstants::COMPONENT_TYPE getType() const;
82
83    /**
84     * The name of type <code>NCName</code> of this declaration as defined in
85     * XML Namespaces.
86     */
87    virtual const XMLCh* getName();
88
89    /**
90     *  The [target namespace] of this object, or <code>null</code> if it is
91     * unspecified.
92     */
93    virtual const XMLCh* getNamespace();
94
95    /**
96     * A namespace schema information item corresponding to the target
97     * namespace of the component, if it's globally declared; or null
98     * otherwise.
99     */
100    virtual XSNamespaceItem *getNamespaceItem();
101
102    /**
103      * Optional.  Return a unique identifier for a component within this XSModel, to
104      * optimize querying.  May not be defined for all types of component.
105      * @return id unique for this type of component within this XSModel or 0
106      *     to indicate that this is not supported for this type of component.
107      */
108    virtual unsigned int getId() const;
109
110    //@}
111
112    //----------------------------------
113    /** methods needed by implementation */
114
115    //@{
116    /**
117      * Set the id to be returned on getId().
118      */
119    void setId(unsigned int id);
120    //@}
121
122private:
123
124    // -----------------------------------------------------------------------
125    //  Unimplemented constructors and operators
126    // -----------------------------------------------------------------------
127    XSObject(const XSObject&);
128    XSObject & operator=(const XSObject &);
129
130protected:
131
132    // -----------------------------------------------------------------------
133    //  data members
134    // -----------------------------------------------------------------------
135    // fMemoryManager:
136    //  used for any memory allocations
137    // fComponentType
138    //  the type of the actual component
139    XSConstants::COMPONENT_TYPE fComponentType;
140    XSModel*                    fXSModel;
141    MemoryManager*              fMemoryManager;
142    unsigned int                fId;
143};
144
145inline XSConstants::COMPONENT_TYPE XSObject::getType() const
146{
147    return fComponentType;
148}
149
150XERCES_CPP_NAMESPACE_END
151
152#endif
Note: See TracBrowser for help on using the repository browser.