1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2015 Ericsson Telecom AB
3 // All rights reserved. This program and the accompanying materials
4 // are made available under the terms of the Eclipse Public License v1.0
5 // which accompanies this distribution, and is available at
6 // http://www.eclipse.org/legal/epl-v10.html
7 ///////////////////////////////////////////////////////////////////////////////
11 #include "RootType.hh"
16 LengthType & operator=(const LengthType &); // not implemented
17 // it's a bit strange that it has copy constructor but no assignment
19 SimpleType * parent; // no responsibility for this member
21 unsigned long long int facet_minLength;
22 unsigned long long int facet_maxLength;
23 unsigned long long int lower;
24 unsigned long long int upper;
26 LengthType(SimpleType * p_parent);
27 // Default copy constructor and destructor are used
29 void applyReference(const LengthType & other);
31 void printToFile(FILE * file) const;
35 PatternType & operator=(const PatternType &); // not implemented
36 // it's a bit strange that it has copy constructor but no assignment
38 SimpleType * parent; // no responsibility for this member
43 PatternType(SimpleType * p_parent);
44 // Default copy constructor and destructor are used
46 void applyReference(const PatternType & other);
48 void printToFile(FILE * file) const;
51 class EnumerationType {
52 EnumerationType & operator=(const EnumerationType &); // not implemented
53 // it's a bit strange that it has copy constructor but no assignment
55 SimpleType * parent; // no responsibility for this member
58 List<QualifiedName> items_string;
60 List<double> items_float;
61 List<QualifiedName> items_time;
62 List<Mstring> items_misc;
63 List<Mstring> variants;
65 EnumerationType(SimpleType * p_parent);
66 // Default copy constructor and destructor are used
68 void applyReference(const EnumerationType & other);
71 void printToFile(FILE * file, unsigned int indent_level = 0) const;
72 void insertVariants();
75 class WhitespaceType {
76 WhitespaceType & operator=(const WhitespaceType &); // not implemented
77 // it's a bit strange that it has copy constructor but no assignment
79 SimpleType * p_parent; // no responsibility for this member
84 WhitespaceType(SimpleType * p_parent);
85 // Default copy constructor and destructor are used
87 void applyReference(const WhitespaceType & other);
89 void printToFile(FILE * file) const;
93 ValueType & operator=(const ValueType &); // not implemented
94 // it's a bit strange that it has copy constructor but no assignment
96 SimpleType * parent; // no responsibility for this member
98 long double facet_minInclusive;
99 long double facet_maxInclusive;
100 long double facet_minExclusive;
101 long double facet_maxExclusive;
102 int facet_totalDigits;
109 Mstring default_value;
110 List<Mstring> items_with_value;
112 ValueType(SimpleType * p_parent);
113 // Default copy constructor and destructor are used
115 void applyReference(const ValueType & other);
117 void printToFile(FILE * file) const;
122 class ReferenceData {
133 void load(const Mstring& u, const Mstring& v, NamespaceType *n) {
139 const Mstring& get_uri() const {
143 const Mstring& get_val() const {
147 RootType *get_ref() const {
152 return uri.empty() && value.empty();
155 bool is_resolved() const {
159 void set_resolved(RootType *st /*= NULL*/) {
164 Mstring repr() const {
165 return uri + Mstring("|") + value;
167 private: // implementation
172 RootType *ref; // not owned
176 * Type that contains information coming from XSD simpleTypes, elements and attributes
180 * * <simpleType>, <element> and <attribute> element whose parent element is <schema>
187 class SimpleType : public RootType {
202 EnumerationType enumeration;
203 WhitespaceType whitespace;
206 FormValue element_form_as;
207 FormValue attribute_form_as;
211 ReferenceData outside_reference;
213 /// true if name_dependency would be set (not empty)
216 // True if element or attribute used with ref attribute
218 // XSD Type of the type
221 Mstring substitionGroup;
222 ComplexType * subsGroup;
226 void addToSubstitutions();
227 void nameConversion_names();
228 virtual void nameConversion_types(const List<NamespaceType> & ns);
230 SimpleType & operator=(const SimpleType &); // not implemented
231 // it's a bit strange that it has copy constructor but no assignment
233 SimpleType(XMLParser * a_parser, TTCN3Module * a_module, ConstructType a_construct);
234 SimpleType(const SimpleType& other);
235 // Default destructor is used
237 // Parent of the element (both complexType, and AttributeType) has this
238 // Not responsible for this member
239 ComplexType * parent;
242 * inherited from RootType
244 void loadWithValues();
245 void printToFile(FILE * file);
246 void referenceResolving();
247 void nameConversion(const NameConversionMode mode, const List<NamespaceType> & ns);
248 void finalModification();
249 virtual bool hasUnresolvedReference();
250 void dump(const unsigned int depth) const;
252 void applyDefaultAttribute(const Mstring& default_value);
253 void applyFixedAttribute(const Mstring& fixed_value);
254 void applyNillableAttribute(const bool nillable_value);
255 void applyAbstractAttribute(const bool abstract_value);
256 void applySubstitionGroupAttribute(const Mstring& substition_group);
257 void applyBlockAttribute(const BlockValue block_);
258 void applyRefAttribute(const Mstring& ref_value);
260 const Mstring & getBuiltInBase() const {
264 const LengthType & getLength() const {
268 const ValueType & getValue() const {
272 const PatternType & getPattern() const {
276 const WhitespaceType & getWhitespace() const {
280 const EnumerationType & getEnumeration() const {
284 FormValue getElementFormAs() const {
285 return element_form_as;
288 FormValue getAttributeFormAs() const {
289 return attribute_form_as;
292 Mode getMode() const {
296 bool isFromRef() const {
300 const ReferenceData& getReference() const {
301 return outside_reference;
304 EnumerationType & getEnumeration() {
308 void setBuiltInBase(const Mstring& base) {
312 void setMode(Mode m) {
316 void setElementFormAs(FormValue f) {
320 void setAttributeFormAs(FormValue f) {
321 attribute_form_as = f;
324 void setReference(const Mstring& ref, bool only_name_dependency = false);
326 void referenceForST(SimpleType * found_ST);
327 void referenceForCT(ComplexType * found_CT);
329 void setXsdtype(TagName xsdtype_) {
333 TagName getXsdtype() const {
337 ComplexType * getSubstitution() const {
341 BlockValue getBlock() const {
345 void addToNameDepList(SimpleType * t) {
346 if(subsGroup != NULL && this != (SimpleType*)subsGroup){
347 SimpleType * substitution = (SimpleType*)subsGroup;
348 substitution->addToNameDepList(t);
350 nameDepList.push_back(t);
356 #endif /* SIMPLETYPE_H_ */