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