source: NonGTP/Xerces/xerces/include/xercesc/validators/common/AllContentModel.hpp @ 358

Revision 358, 6.1 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: AllContentModel.hpp,v $
19 * Revision 1.8  2004/09/16 13:32:03  amassari
20 * Updated error message for UPA to also state the complex type that is failing the test
21 *
22 * Revision 1.7  2004/09/08 13:56:51  peiyongz
23 * Apache License Version 2.0
24 *
25 * Revision 1.6  2004/01/29 11:51:21  cargilld
26 * Code cleanup changes to get rid of various compiler diagnostic messages.
27 *
28 * Revision 1.5  2003/05/16 21:43:20  knoaman
29 * Memory manager implementation: Modify constructors to pass in the memory manager.
30 *
31 * Revision 1.4  2003/05/15 18:48:27  knoaman
32 * Partial implementation of the configurable memory manager.
33 *
34 * Revision 1.3  2003/03/07 18:16:57  tng
35 * Return a reference instead of void for operator=
36 *
37 * Revision 1.2  2002/11/04 14:54:58  tng
38 * C++ Namespace Support.
39 *
40 * Revision 1.1.1.1  2002/02/01 22:22:37  peiyongz
41 * sane_include
42 *
43 * Revision 1.2  2001/11/21 14:30:13  knoaman
44 * Fix for UPA checking.
45 *
46 * Revision 1.1  2001/08/24 12:48:48  tng
47 * Schema: AllContentModel
48 *
49 */
50
51
52#if !defined(ALLCONTENTMODEL_HPP)
53#define ALLCONTENTMODEL_HPP
54
55#include <xercesc/framework/XMLContentModel.hpp>
56#include <xercesc/util/ValueVectorOf.hpp>
57#include <xercesc/validators/common/ContentLeafNameTypeVector.hpp>
58
59XERCES_CPP_NAMESPACE_BEGIN
60
61class ContentSpecNode;
62
63//
64//  AllContentModel is a derivative of the abstract content model base
65//  class that handles the special case of <all> feature in schema. If a model
66//  is <all>, all non-optional children must appear
67//
68//  So, all we have to do is to keep an array of the possible children and
69//  validate by just looking up each child being validated by looking it up
70//  in the list, and make sure all non-optional children appear.
71//
72class AllContentModel : public XMLContentModel
73{
74public :
75    // -----------------------------------------------------------------------
76    //  Constructors and Destructor
77    // -----------------------------------------------------------------------
78    AllContentModel
79    (
80          ContentSpecNode* const parentContentSpec
81                , const bool             isMixed
82        , MemoryManager* const   manager = XMLPlatformUtils::fgMemoryManager
83    );
84
85    ~AllContentModel();
86
87    // -----------------------------------------------------------------------
88    //  Implementation of the ContentModel virtual interface
89    // -----------------------------------------------------------------------
90    virtual int validateContent
91    (
92        QName** const         children
93      , const unsigned int    childCount
94      , const unsigned int    emptyNamespaceId
95    )   const;
96
97        virtual int validateContentSpecial
98    (
99        QName** const         children
100      , const unsigned int    childCount
101      , const unsigned int    emptyNamespaceId
102      , GrammarResolver*  const pGrammarResolver
103      , XMLStringPool*    const pStringPool
104    ) const;
105
106    virtual ContentLeafNameTypeVector* getContentLeafNameTypeVector() const ;
107
108    virtual unsigned int getNextState(const unsigned int currentState,
109                                      const unsigned int elementIndex) const;
110
111    virtual void checkUniqueParticleAttribution
112    (
113        SchemaGrammar*    const pGrammar
114      , GrammarResolver*  const pGrammarResolver
115      , XMLStringPool*    const pStringPool
116      , XMLValidator*     const pValidator
117      , unsigned int*     const pContentSpecOrgURI
118      , const XMLCh*            pComplexTypeName = 0
119    ) ;
120
121private :
122    // -----------------------------------------------------------------------
123    //  Private helper methods
124    // -----------------------------------------------------------------------
125    void buildChildList
126    (
127        ContentSpecNode* const                     curNode
128      , ValueVectorOf<QName*>&                     toFill
129      , ValueVectorOf<bool>&                       toType
130    );
131
132    // -----------------------------------------------------------------------
133    //  Unimplemented constructors and operators
134    // -----------------------------------------------------------------------
135    AllContentModel();
136    AllContentModel(const AllContentModel&);
137    AllContentModel& operator=(const AllContentModel&);
138
139
140    // -----------------------------------------------------------------------
141    //  Private data members
142    //
143    //  fCount
144    //      The count of possible children in the fChildren member.
145    //
146    //  fChildren
147    //      The list of possible children that we have to accept. This array
148    //      is allocated as large as needed in the constructor.
149    //
150    //  fChildOptional
151    //      The corresponding list of optional state of each child in fChildren
152    //      True if the child is optional (i.e. minOccurs = 0).
153    //
154    //  fNumRequired
155    //      The number of required children in <all> (i.e. minOccurs = 1)
156    //
157    //  fIsMixed
158    //      AllContentModel with mixed PCDATA.
159    // -----------------------------------------------------------------------
160    MemoryManager* fMemoryManager;
161    unsigned int    fCount;
162    QName**         fChildren;
163    bool*           fChildOptional;
164    unsigned int    fNumRequired;
165    bool            fIsMixed;
166
167};
168
169inline ContentLeafNameTypeVector* AllContentModel::getContentLeafNameTypeVector() const
170{
171        return 0;
172}
173
174inline unsigned int
175AllContentModel::getNextState(const unsigned int,
176                              const unsigned int) const {
177
178    return XMLContentModel::gInvalidTrans;
179}
180
181XERCES_CPP_NAMESPACE_END
182
183#endif
184
Note: See TracBrowser for help on using the repository browser.