File: GeneralTypes.hh

package info (click to toggle)
eclipse-titan 7.2.0-1.1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 103,144 kB
  • sloc: cpp: 264,784; ansic: 33,124; yacc: 23,073; makefile: 14,730; lex: 9,190; java: 4,849; perl: 3,783; sh: 2,298; xml: 1,378; javascript: 85; awk: 48; php: 32; python: 13
file content (178 lines) | stat: -rw-r--r-- 3,450 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/******************************************************************************
 * Copyright (c) 2000-2020 Ericsson Telecom AB
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
 *
 * Contributors:
 *   Balasko, Jeno
 *   Godar, Marton
 *   Raduly, Csaba
 *   Szabados, Kristof
 *   Szabo, Bence Janos
 *
 ******************************************************************************/
#ifndef GENERAL_TYPES_H_
#define GENERAL_TYPES_H_

#include "Mstring.hh"

enum ConstructType {
  c_unknown,
  c_schema,
  c_simpleType,
  c_complexType,
  c_element,
  c_attribute,
  c_attributeGroup,
  c_group,
  c_annotation,
  c_include,
  c_import,
  c_idattrib,
  c_simpleOrComplexType
};

enum NameConversionMode {
  nameMode,
  typeMode,
  fieldMode
};

enum UseValue {
  optional,
  prohibited,
  required
};

enum FormValue {
  notset,
  qualified,
  unqualified
};

enum BlockValue {
  not_set,
  all,
  substitution,
  restriction,
  extension
};

enum TagName {
  // XSD Elements:
  n_all,
  n_annotation,
  n_any,
  n_anyAttribute,
  n_appinfo,
  n_attribute,
  n_attributeGroup,
  n_choice,
  n_complexContent,
  n_complexType,
  n_documentation,
  n_element,
  n_extension,
  n_field, // Not supported by now
  n_group,
  n_import,
  n_include,
  n_key, // Not supported by now
  n_keyref, // Not supported by now
  n_list,
  n_notation, // Not supported by now
  n_redefine,
  n_restriction,
  n_schema,
  n_selector, // Not supported by now
  n_sequence,
  n_simpleContent,
  n_simpleType,
  n_union,
  n_unique, // Not supported by now

  // XSD Restrictions / Facets for Datatypes:
  n_enumeration,
  n_fractionDigits, // Not supported by now
  n_length,
  n_maxExclusive,
  n_maxInclusive,
  n_maxLength,
  n_minExclusive,
  n_minInclusive,
  n_minLength,
  n_pattern,
  n_totalDigits,
  n_whiteSpace,

  // Others - non-standard, but used:
  n_label, // ???
  n_definition, // ???

  n_NOTSET
};

/** This type just stores the textual information about an XML namespace */
class NamespaceType {
public:
  Mstring prefix;
  Mstring uri;

  NamespaceType()
  : prefix(), uri() {
  }

  NamespaceType(const Mstring& p, const Mstring& u)
  : prefix(p), uri(u) {
  }

  bool operator<(const NamespaceType & rhs) const {
    return uri < rhs.uri;
  }

  bool operator==(const NamespaceType & rhs) const {
    return (uri == rhs.uri) && (prefix == rhs.prefix);
  }
};

class QualifiedName {
public:
  Mstring nsuri;
  Mstring name;
  Mstring orig_name;
  bool dup;

  QualifiedName()
  : nsuri(), name(), orig_name(), dup(false) {
  }

  QualifiedName(const Mstring& ns, const Mstring nm)
  : nsuri(ns), name(nm), orig_name(nm), dup(false) {
  }

  QualifiedName(const Mstring& ns, const Mstring nm, const Mstring orig)
  : nsuri(ns), name(nm), orig_name(orig), dup(false) {
  }

  bool operator<(const QualifiedName& rhs) const {
    return name < rhs.name;
  }

  bool operator==(const QualifiedName& rhs) const {
    return (nsuri == rhs.nsuri) && (name == rhs.name);
  }
  
  bool operator!=(const QualifiedName& rhs) const {
    return (nsuri != rhs.nsuri) || (name != rhs.name);
  }
};

enum wanted {
  want_CT, want_ST, want_BOTH
};

static const char XMLSchema[] = "http://www.w3.org/2001/XMLSchema";

#endif /*GENERAL_TYPES_H_*/