implemented decmatch (artf724241)
[deliverable/titan.core.git] / xsdconvert / GeneralFunctions.hh
1 /******************************************************************************
2 * Copyright (c) 2000-2016 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 * Contributors:
9 * Balasko, Jeno
10 * Godar, Marton
11 * Raduly, Csaba
12 * Szabo, Bence Janos
13 *
14 ******************************************************************************/
15 #ifndef GENERALFUNCTIONS_HH_
16 #define GENERALFUNCTIONS_HH_
17
18 #include "Mstring.hh"
19 #include "List.hh"
20 #include "GeneralTypes.hh"
21
22 typedef List<QualifiedName> QualifiedNames;
23
24 enum modeType {
25 type_reference_name, type_name, field_name, enum_id_name
26 };
27
28 void XSDName2TTCN3Name(const Mstring& in, QualifiedNames & used_names, modeType type_of_the_name,
29 Mstring & res, Mstring & variant, bool no_replace = false);
30
31 class ReferenceData;
32
33
34 bool isBuiltInType(const Mstring& in);
35 bool isStringType(const Mstring& in);
36 bool isIntegerType(const Mstring& in);
37 bool isFloatType(const Mstring& in);
38 bool isTimeType(const Mstring& in);
39 bool isSequenceType(const Mstring& in);
40 bool isBooleanType(const Mstring& in);
41 bool isQNameType(const Mstring& in);
42 bool isAnyType(const Mstring& in);
43
44 bool matchDates(const char * string, const char * type);
45 bool matchRegexp(const char * string, const char * pattern);
46
47 void printWarning(const Mstring& filename, int lineNumber, const Mstring& text);
48 void printWarning(const Mstring& filename, const Mstring& typeName, const Mstring& text);
49 void printError(const Mstring& filename, int lineNumber, const Mstring& text);
50 void printError(const Mstring& filename, const Mstring& typeName, const Mstring& text);
51 void indent(FILE * file, const int x);
52
53 long double stringToLongDouble(const char * input);
54
55 class RootType;
56 class SimpleType;
57 class TTCN3Module;
58
59 const Mstring& getNameSpaceByPrefix(const RootType * root, const Mstring& prefix);
60 const Mstring& getPrefixByNameSpace(const RootType * root, const Mstring& namespace_);
61
62 const Mstring findBuiltInType(const RootType * ref, Mstring type);
63
64 /// Lookup in a list of modules
65 RootType * lookup(const List<TTCN3Module*> mods,
66 const SimpleType * reference, wanted w);
67 /// Lookup in a list of modules
68 RootType * lookup(const List<TTCN3Module*> mods,
69 const Mstring& name, const Mstring& nsuri, const RootType *reference, wanted w);
70 /// Lookup inside one module
71 RootType *lookup1(const TTCN3Module *module,
72 const Mstring& name, const Mstring& nsuri, const RootType *reference, wanted w);
73
74 int multi(const TTCN3Module *module, ReferenceData const& outside_reference,
75 const RootType *obj);
76
77 void generate_TTCN3_header(FILE * file, const char* modulename, const bool timestamp = true);
78
79 inline unsigned long long llmin(unsigned long long l, unsigned long long r) {
80 return l < r ? l : r;
81 }
82
83 inline unsigned long long llmax(unsigned long long l, unsigned long long r) {
84 return l > r ? l : r;
85 }
86
87 #endif /* GENERALFUNCTIONS_HH_ */
This page took 0.033172 seconds and 5 git commands to generate.