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

Revision 2674, 5.2 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: PSVIAttribute.hpp 568078 2007-08-21 11:43:25Z amassari $
20 */
21
22#if !defined(PSVIATTRIBUTE_HPP)
23#define PSVIATTRIBUTE_HPP
24
25#include <xercesc/framework/psvi/PSVIItem.hpp>
26#include <xercesc/framework/psvi/XSSimpleTypeDefinition.hpp>
27#include <xercesc/validators/datatype/DatatypeValidator.hpp>
28
29XERCES_CPP_NAMESPACE_BEGIN
30
31/**
32 * Represent the PSVI contributions for one attribute information item.
33 * This is *always* owned by the scanner/parser object from which
34 * it is obtained.  The validator will specify
35 * under what conditions it may be relied upon to have meaningful contents.
36 */
37
38// forward declarations
39class XSAttributeDeclaration;
40
41class XMLPARSER_EXPORT PSVIAttribute : public PSVIItem 
42{
43public:
44
45    //  Constructors and Destructor
46    // -----------------------------------------------------------------------
47    /** @name Constructors */
48    //@{
49
50    /**
51      * The default constructor
52      *
53      * @param  manager     The configurable memory manager
54      */
55    PSVIAttribute( MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
56
57    //@};
58
59    /** @name Destructor */
60    //@{
61    ~PSVIAttribute();
62    //@}
63
64    //---------------------
65    /** @name PSVIAttribute methods */
66
67    //@{
68
69    /**
70     * An item isomorphic to the attribute declaration used to validate
71     * this attribute.
72     *
73     * @return  an attribute declaration
74     */
75    XSAttributeDeclaration *getAttributeDeclaration();
76   
77    /**
78     * An item isomorphic to the type definition used to validate this element.
79     *
80     * @return  a type declaration
81     */
82    XSTypeDefinition *getTypeDefinition();
83   
84    /**
85     * If and only if that type definition is a simple type definition
86     * with {variety} union, or a complex type definition whose {content type}
87     * is a simple thype definition with {variety} union, then an item isomorphic
88     * to that member of the union's {member type definitions} which actually
89     * validated the element item's normalized value.
90     *
91     * @return  a simple type declaration
92     */
93    XSSimpleTypeDefinition *getMemberTypeDefinition();
94   
95    //@}
96
97    //----------------------------------
98    /** methods needed by implementation */
99
100    //@{
101
102    /**
103      * reset this object.  Intended to be called by
104      * the implementation.
105      */
106    void reset(
107            const XMLCh * const         valContext
108            , PSVIItem::VALIDITY_STATE  state
109            , PSVIItem::ASSESSMENT_TYPE assessmentType
110            , XSSimpleTypeDefinition *  validatingType
111            , XSSimpleTypeDefinition *  memberType
112            , const XMLCh * const       defaultValue
113            , const bool                isSpecified
114            , XSAttributeDeclaration *  attrDecl
115            , DatatypeValidator *       dv
116        );
117
118    /**
119      * set the schema normalized value (and
120      * implicitly the canonical value) of this object; intended to be used
121      * by the implementation.
122      */
123    void setValue(const XMLCh * const       normalizedValue);
124
125    /**
126      * set VALIDITY_STATE to specified value; intended to be
127      * called by implementation.
128      */
129    void updateValidity(VALIDITY_STATE newValue);
130
131    //@}
132
133private:
134
135    // -----------------------------------------------------------------------
136    //  Unimplemented constructors and operators
137    // -----------------------------------------------------------------------
138    PSVIAttribute(const PSVIAttribute&);
139    PSVIAttribute & operator=(const PSVIAttribute &);
140
141
142    // -----------------------------------------------------------------------
143    //  data members
144    // -----------------------------------------------------------------------
145    // fAttributeDecl
146    //      attribute declaration component that validated this attribute
147    // fDV
148    //      implementation-specific datatype validator used to validate this attribute
149    XSAttributeDeclaration *    fAttributeDecl;
150    DatatypeValidator *         fDV;
151};
152inline PSVIAttribute::~PSVIAttribute()
153{
154    fMemoryManager->deallocate((void *)fCanonicalValue);
155}
156
157inline XSAttributeDeclaration *PSVIAttribute::getAttributeDeclaration()
158{
159    return fAttributeDecl;
160}
161
162inline XSTypeDefinition* PSVIAttribute::getTypeDefinition()
163{
164    return fType;
165}
166
167inline XSSimpleTypeDefinition* PSVIAttribute::getMemberTypeDefinition()
168{
169    return fMemberType;
170}
171
172inline void PSVIAttribute::updateValidity(VALIDITY_STATE newValue)
173{
174    fValidityState = newValue;
175}
176
177XERCES_CPP_NAMESPACE_END
178
179#endif
Note: See TracBrowser for help on using the repository browser.