1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2014 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"
17 LengthType & operator = (const LengthType &); // not implemented
18 // it's a bit strange that it has copy constructor but no assignment
20 SimpleType * parent; // no responsibility for this member
22 unsigned long long int facet_minLength;
23 unsigned long long int facet_maxLength;
24 unsigned long long int lower;
25 unsigned long long int upper;
27 LengthType (SimpleType * p_parent);
28 // Default copy constructor and destructor are used
30 void applyReference (const LengthType & other);
32 void printToFile (FILE * file) const;
37 PatternType & operator = (const PatternType &); // not implemented
38 // it's a bit strange that it has copy constructor but no assignment
40 SimpleType * parent; // no responsibility for this member
45 PatternType (SimpleType * p_parent);
46 // Default copy constructor and destructor are used
48 void applyReference (const PatternType & other);
50 void printToFile (FILE * file) const;
55 EnumerationType & operator = (const EnumerationType &); // not implemented
56 // it's a bit strange that it has copy constructor but no assignment
58 SimpleType * parent; // no responsibility for this member
61 List<QualifiedName> items_string;
63 List<double> items_float;
64 List<QualifiedName> items_time;
65 List<Mstring> items_misc;
67 EnumerationType (SimpleType * p_parent);
68 // Default copy constructor and destructor are used
70 void applyReference (const EnumerationType & other);
73 void printToFile (FILE * file, unsigned int indent_level = 0) const;
78 WhitespaceType & operator = (const WhitespaceType &); // not implemented
79 // it's a bit strange that it has copy constructor but no assignment
81 SimpleType * p_parent; // no responsibility for this member
86 WhitespaceType (SimpleType * p_parent);
87 // Default copy constructor and destructor are used
89 void applyReference (const WhitespaceType & other);
91 void printToFile (FILE * file) const;
96 ValueType & operator = (const ValueType &); // not implemented
97 // it's a bit strange that it has copy constructor but no assignment
99 SimpleType * parent; // no responsibility for this member
101 long double facet_minInclusive;
102 long double facet_maxInclusive;
103 long double facet_minExclusive;
104 long double facet_maxExclusive;
105 int facet_totalDigits;
111 Mstring default_value;
112 List<Mstring> items_with_value;
114 ValueType (SimpleType * p_parent);
115 // Default copy constructor and destructor are used
117 void applyReference (const ValueType & other);
119 void printToFile (FILE * file) const;
124 class ReferenceData {
134 void load(const Mstring& u, const Mstring& v, NamespaceType *n)
141 const Mstring& get_uri() const { return uri; }
142 const Mstring& get_val() const { return value; }
143 const RootType *get_ref() const { return ref; }
146 return uri.empty() && value.empty();
149 bool is_resolved() const { return resolved; }
150 void set_resolved(RootType const *st /*= NULL*/) { resolved = true; ref = st; }
152 Mstring repr() const { return uri + Mstring("|") + value; }
153 private: // implementation
158 const RootType *ref; // not owned
162 * Type that contains information coming from XSD simpleTypes, elements and attributes
166 * * <simpleType>, <element> and <attribute> element whose parent element is <schema>
173 class SimpleType : public RootType
189 EnumerationType enumeration;
190 WhitespaceType whitespace;
193 FormValue element_form_as;
194 FormValue attribute_form_as;
198 ReferenceData outside_reference;
200 /// true if name_dependency would be set (not empty)
203 void referenceForST (SimpleType const * const found_ST);
204 void referenceForCT (ComplexType const * const found_CT);
206 void nameConversion_names ();
207 void nameConversion_types (const List<NamespaceType> & ns);
209 SimpleType & operator = (const SimpleType &); // not implemented
210 // it's a bit strange that it has copy constructor but no assignment
212 SimpleType (XMLParser * a_parser, TTCN3Module * a_module, ConstructType a_construct);
213 SimpleType(const SimpleType& other);
214 // Default destructor is used
217 * inherited from RootType
219 void loadWithValues ();
220 void printToFile (FILE * file);
221 void referenceResolving ();
222 void nameConversion (NameConversionMode mode, const List<NamespaceType> & ns);
223 void finalModification ();
224 bool hasUnresolvedReference ();
225 void dump (unsigned int depth) const;
227 void applyDefaultAttribute (const Mstring& default_value);
228 void applyFixedAttribute (const Mstring& fixed_value);
229 void applyNillableAttribute (bool nillable_value);
231 const Mstring & getBuiltInBase () const {return builtInBase;}
232 const LengthType & getLength () const {return length;}
233 const ValueType & getValue () const {return value;}
234 FormValue getElementFormAs () const {return element_form_as;}
235 FormValue getAttributeFormAs () const {return attribute_form_as;}
236 Mode getMode () const {return mode;}
237 const ReferenceData& getReference() const { return outside_reference; }
239 EnumerationType & getEnumeration () {return enumeration;}
241 void setBuiltInBase (const Mstring& base) {builtInBase = base;}
242 void setMode (Mode m) {mode = m;}
243 void setElementFormAs (FormValue f) {element_form_as = f;}
244 void setAttributeFormAs (FormValue f) {attribute_form_as = f;}
246 void setReference (const Mstring& ref, bool only_name_dependency = false);
249 #endif /* SIMPLETYPE_H_ */