source: tags/VUT/0.4/GtpVisibilityPreprocessor/support/xerces/include/xercesc/validators/common/ContentLeafNameTypeVector.hpp @ 358

Revision 358, 5.2 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1/*
2 * Copyright 2001,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * $Log: ContentLeafNameTypeVector.hpp,v $
19 * Revision 1.6  2004/09/08 13:56:51  peiyongz
20 * Apache License Version 2.0
21 *
22 * Revision 1.5  2003/05/16 21:43:20  knoaman
23 * Memory manager implementation: Modify constructors to pass in the memory manager.
24 *
25 * Revision 1.4  2003/05/15 18:48:27  knoaman
26 * Partial implementation of the configurable memory manager.
27 *
28 * Revision 1.3  2003/03/07 18:16:57  tng
29 * Return a reference instead of void for operator=
30 *
31 * Revision 1.2  2002/11/04 14:54:58  tng
32 * C++ Namespace Support.
33 *
34 * Revision 1.1.1.1  2002/02/01 22:22:38  peiyongz
35 * sane_include
36 *
37 * Revision 1.4  2001/08/07 15:21:20  knoaman
38 * The value of 'fLeafCount' was not set.
39 *
40 * Revision 1.3  2001/05/11 13:27:17  tng
41 * Copyright update.
42 *
43 * Revision 1.2  2001/04/19 18:17:28  tng
44 * Schema: SchemaValidator update, and use QName in Content Model
45 *
46 * Revision 1.1  2001/02/27 14:48:49  tng
47 * Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
48 *
49 */
50
51
52#if !defined(CONTENTLEAFNAMETYPEVECTOR_HPP)
53#define CONTENTLEAFNAMETYPEVECTOR_HPP
54
55#include <xercesc/validators/common/ContentSpecNode.hpp>
56#include <xercesc/framework/MemoryManager.hpp>
57
58XERCES_CPP_NAMESPACE_BEGIN
59
60class ContentLeafNameTypeVector : public XMemory
61{
62public :
63    // -----------------------------------------------------------------------
64    //  Class specific types
65    // -----------------------------------------------------------------------
66
67
68    // -----------------------------------------------------------------------
69    //  Constructors and Destructor
70    // -----------------------------------------------------------------------
71    ContentLeafNameTypeVector
72    (
73        MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
74    );
75    ContentLeafNameTypeVector
76    (
77        QName** const                     qName
78      , ContentSpecNode::NodeTypes* const types
79      , const unsigned int                count
80      , MemoryManager* const              manager = XMLPlatformUtils::fgMemoryManager
81    );
82
83    ~ContentLeafNameTypeVector();
84
85    ContentLeafNameTypeVector(const ContentLeafNameTypeVector&);
86
87    // -----------------------------------------------------------------------
88    //  Getter methods
89    // -----------------------------------------------------------------------
90    QName* getLeafNameAt(const unsigned int pos) const;
91
92    const ContentSpecNode::NodeTypes getLeafTypeAt(const unsigned int pos) const;
93    const unsigned int getLeafCount() const;
94
95    // -----------------------------------------------------------------------
96    //  Setter methods
97    // -----------------------------------------------------------------------
98    void setValues
99    (
100        QName** const                      qName
101      , ContentSpecNode::NodeTypes* const  types
102      , const unsigned int                       count
103    );
104
105    // -----------------------------------------------------------------------
106    //  Miscellaneous
107    // -----------------------------------------------------------------------
108
109private :
110    // -----------------------------------------------------------------------
111    //  Unimplemented constructors and operators
112    // -----------------------------------------------------------------------
113    ContentLeafNameTypeVector& operator=(const ContentLeafNameTypeVector&);
114
115    // -----------------------------------------------------------------------
116    //  helper methods
117    // -----------------------------------------------------------------------
118    void cleanUp();
119    void init(const unsigned int);
120
121    // -----------------------------------------------------------------------
122    //  Private Data Members
123    //
124    // -----------------------------------------------------------------------
125    MemoryManager*                fMemoryManager;
126    QName**                       fLeafNames;
127    ContentSpecNode::NodeTypes   *fLeafTypes;
128    unsigned int                  fLeafCount;
129};
130
131inline void ContentLeafNameTypeVector::cleanUp()
132{
133        fMemoryManager->deallocate(fLeafNames); //delete [] fLeafNames;
134        fMemoryManager->deallocate(fLeafTypes); //delete [] fLeafTypes;
135}
136
137inline void ContentLeafNameTypeVector::init(const unsigned int size)
138{
139    fLeafNames = (QName**) fMemoryManager->allocate(size * sizeof(QName*));//new QName*[size];
140    fLeafTypes = (ContentSpecNode::NodeTypes *) fMemoryManager->allocate
141    (
142        size * sizeof(ContentSpecNode::NodeTypes)
143    ); //new ContentSpecNode::NodeTypes [size];
144    fLeafCount = size;
145}
146
147XERCES_CPP_NAMESPACE_END
148
149#endif
Note: See TracBrowser for help on using the repository browser.