Update README.linux
[deliverable/titan.core.git] / xsdconvert / FieldType.hh
CommitLineData
970ed795
EL
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///////////////////////////////////////////////////////////////////////////////
8#ifndef FIELDTYPE_HH_
9#define FIELDTYPE_HH_
10
11#include "SimpleType.hh"
12#include "GeneralTypes.hh"
13
14class ComplexType;
15class FieldType;
16
17struct ImportedField {
18 /// The imported field
19 FieldType *field;
20
21 /** The original field (probably called "base") which caused the import,
22 * or any other previous field. The point is that the imported field
23 * follows the "original" field. */
24 FieldType *orig;
25};
26
27/**
28 * Type that contains information of a field of a TTCN-3 record or union
29 *
30 */
31class FieldType : public SimpleType
32{
33 ComplexType * parent;
34
35 List<FieldType*> attributes;
36
37 int level;
38
39 bool isAnyAttr;
40
41 /// Attribute qualifier
42 Mstring path;
43 Mstring variantID;
44
45 static int variantIdCounter;
46
47public:
48 explicit FieldType (ComplexType * a_complextype);
49 FieldType (const FieldType & other);
50 FieldType & operator = (const FieldType & rhs);
51 virtual ~FieldType ();
52
53 void setTypeOfField (const Mstring& in);
54 void setNameOfField (const Mstring& in, bool add_to_path_for_later_use, bool from_ref_attribute = false);
55 void setToAnyAttribute();
56 void applyRefAttribute (const Mstring& ref_value);
57 void applyUseAttribute (UseValue use_value, unsigned long long & minOcc, unsigned long long & maxOcc);
58 void applyNillableAttribute (const Mstring& nil_value);
59 void applyNamespaceAttribute (VariantMode varLabel, const Mstring& ns_list);
60
61 void applyMinMaxOccursAttribute (unsigned long long minOccurs_value, unsigned long long maxOccurs_value,
62 bool generate_list_postfix = false);
63
64 void setLevel (int l);
65 void incrLevel () {level++;}
66
67 int getLevel () const {return level;}
68 const Mstring& getPath () const {return path;}
69 const Mstring& getVariantId () const {return variantID;}
70
71 bool isOptional () const {return minOccurs == 0 && maxOccurs == 1 && !name.list_extension;}
72 bool isAnyAttribute() const {return isAnyAttr;}
73
74 Mstring generateVariantId ();
75 void variantIdReplaceInPath (const Mstring& varid, const Mstring& text);
76
77 void applyReference (const FieldType & other, bool on_attributes = false);
78
79 void referenceForST (SimpleType const * const found_ST,
80 List<FieldType*> & temp_container);
81
82 /** Resolves the reference to the given ComplexType. The fields of the referenced type
83 * will be copied into one of the containers.
84 * @return 0 if the current field has been added to the container (the field can not be deleted)
85 * "this" if a copy of the field has been added (the field can be deleted)
86 */
87 FieldType* referenceForCT (ComplexType & found_CT,
88 List<FieldType*> & temp_container, List<ImportedField> & temp_container_imported);
89
90 List<FieldType*> & getAttributes () {return attributes;}
91 void addAttribute (FieldType * attr);
92 void sortAttributes ();
93 void checkSortAndAddAttributes (const List<FieldType*> & referencedAttributes);
94
95 void dump (unsigned int depth) const;
96};
97
98#endif /* FIELDTYPE_HH_ */
This page took 0.034495 seconds and 5 git commands to generate.