Xerces-C++  3.1.3
XSSimpleTypeDefinition.hpp
Go to the documentation of this file.
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: XSSimpleTypeDefinition.hpp 527149 2007-04-10 14:56:39Z amassari $
20  */
21 
22 #if !defined(XERCESC_INCLUDE_GUARD_XSSIMPLETYPEDEFINITION_HPP)
23 #define XERCESC_INCLUDE_GUARD_XSSIMPLETYPEDEFINITION_HPP
24 
26 
28 
37 // forward declarations
38 class XSAnnotation;
39 class XSFacet;
40 class XSMultiValueFacet;
41 class DatatypeValidator;
42 
44 {
45 public:
46 
47  // Variety definitions
48  enum VARIETY {
52  VARIETY_ABSENT = 0,
56  VARIETY_ATOMIC = 1,
60  VARIETY_LIST = 2,
64  VARIETY_UNION = 3
65  };
66 
67  // Facets
68  enum FACET {
72  FACET_NONE = 0,
76  FACET_LENGTH = 1,
80  FACET_MINLENGTH = 2,
84  FACET_MAXLENGTH = 4,
88  FACET_PATTERN = 8,
92  FACET_WHITESPACE = 16,
96  FACET_MAXINCLUSIVE = 32,
100  FACET_MAXEXCLUSIVE = 64,
104  FACET_MINEXCLUSIVE = 128,
108  FACET_MININCLUSIVE = 256,
112  FACET_TOTALDIGITS = 512,
116  FACET_FRACTIONDIGITS = 1024,
120  FACET_ENUMERATION = 2048
121  };
122 
123  // possible order relations
124  enum ORDERING {
128  ORDERED_FALSE = 0,
133  ORDERED_PARTIAL = 1,
137  ORDERED_TOTAL = 2
138  };
139 
140  // Constructors and Destructor
141  // -----------------------------------------------------------------------
144 
158  (
159  DatatypeValidator* const datatypeValidator
160  , VARIETY stVariety
161  , XSTypeDefinition* const xsBaseType
162  , XSSimpleTypeDefinition* const primitiveOrItemType
163  , XSSimpleTypeDefinitionList* const memberTypes
164  , XSAnnotation* headAnnot
165  , XSModel* const xsModel
167  );
168 
170 
175 
176  //---------------------
180 
184  VARIETY getVariety() const;
185 
191  XSSimpleTypeDefinition *getPrimitiveType();
192 
198  XSSimpleTypeDefinition *getItemType();
199 
205  XSSimpleTypeDefinitionList *getMemberTypes() const;
206 
211  int getDefinedFacets() const;
212 
219  bool isDefinedFacet(FACET facetName);
220 
224  int getFixedFacets() const;
225 
232  bool isFixedFacet(FACET facetName);
233 
245  const XMLCh *getLexicalFacetValue(FACET facetName);
246 
250  StringList *getLexicalEnumeration();
251 
255  StringList *getLexicalPattern();
256 
260  ORDERING getOrdered() const;
261 
265  bool getFinite() const;
266 
270  bool getBounded() const;
271 
275  bool getNumeric() const;
276 
280  XSAnnotationList *getAnnotations();
286  XSFacetList *getFacets();
287 
291  XSMultiValueFacetList *getMultiValueFacets();
292 
297  const XMLCh* getName() const;
298 
303  const XMLCh* getNamespace();
304 
311 
316  bool getAnonymous() const;
317 
323 
331  bool derivedFromType(const XSTypeDefinition* const ancestorType);
332 
336  inline DatatypeValidator* getDatatypeValidator() const;
337 
339 
340  //----------------------------------
344 
345 
347 
348 private:
349 
350  // -----------------------------------------------------------------------
351  // Unimplemented constructors and operators
352  // -----------------------------------------------------------------------
354  XSSimpleTypeDefinition & operator=(const XSSimpleTypeDefinition &);
355 
359  void setFacetInfo
360  (
361  int definedFacets
362  , int fixedFacets
363  , XSFacetList* const xsFacetList
364  , XSMultiValueFacetList* const xsMultiValueFacetList
365  , StringList* const patternList
366  );
367  void setPrimitiveType(XSSimpleTypeDefinition* const toSet);
368 
369  friend class XSObjectFactory;
370 
371 protected:
372 
373  // -----------------------------------------------------------------------
374  // data members
375  // -----------------------------------------------------------------------
379  DatatypeValidator* fDatatypeValidator;
386 };
387 
389 {
390  return fVariety;
391 }
392 
394 {
395  if (fVariety == VARIETY_ATOMIC)
396  return fPrimitiveOrItemType;
397 
398  return 0;
399 }
400 
402 {
403  if (fVariety == VARIETY_LIST)
404  return fPrimitiveOrItemType;
405 
406  return 0;
407 }
408 
410 {
411  return fMemberTypes;
412 }
413 
415 {
416  return fDefinedFacets;
417 }
418 
420 {
421  return fFixedFacets;
422 }
423 
425 {
426  return fPatternList;
427 }
428 
430 {
431  return fXSFacetList;
432 }
433 
435 {
436  return fXSMultiValueFacetList;
437 }
438 
440 {
441  return fXSAnnotationList;
442 }
443 
444 inline void
445 XSSimpleTypeDefinition::setPrimitiveType(XSSimpleTypeDefinition* const toSet)
446 {
447  fPrimitiveOrItemType = toSet;
448 }
449 
450 inline DatatypeValidator*
452 {
453  return fDatatypeValidator;
454 }
455 
457 
458 #endif