Commit | Line | Data |
---|---|---|
d44e3c4f | 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 | ******************************************************************************/ | |
970ed795 EL |
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 | ||
3abe9331 | 24 | enum modeType { |
25 | type_reference_name, type_name, field_name, enum_id_name | |
26 | }; | |
970ed795 | 27 | |
3abe9331 | 28 | void XSDName2TTCN3Name(const Mstring& in, QualifiedNames & used_names, modeType type_of_the_name, |
29 | Mstring & res, Mstring & variant, bool no_replace = false); | |
970ed795 EL |
30 | |
31 | class ReferenceData; | |
32 | ||
33 | ||
3abe9331 | 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); | |
970ed795 | 43 | |
3abe9331 | 44 | bool matchDates(const char * string, const char * type); |
45 | bool matchRegexp(const char * string, const char * pattern); | |
970ed795 | 46 | |
3abe9331 | 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); | |
970ed795 | 52 | |
3abe9331 | 53 | long double stringToLongDouble(const char * input); |
970ed795 EL |
54 | |
55 | class RootType; | |
56 | class SimpleType; | |
57 | class TTCN3Module; | |
58 | ||
3abe9331 | 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 | ||
970ed795 | 64 | /// Lookup in a list of modules |
3abe9331 | 65 | RootType * lookup(const List<TTCN3Module*> mods, |
66 | const SimpleType * reference, wanted w); | |
970ed795 | 67 | /// Lookup in a list of modules |
3abe9331 | 68 | RootType * lookup(const List<TTCN3Module*> mods, |
69 | const Mstring& name, const Mstring& nsuri, const RootType *reference, wanted w); | |
970ed795 EL |
70 | /// Lookup inside one module |
71 | RootType *lookup1(const TTCN3Module *module, | |
3abe9331 | 72 | const Mstring& name, const Mstring& nsuri, const RootType *reference, wanted w); |
970ed795 EL |
73 | |
74 | int multi(const TTCN3Module *module, ReferenceData const& outside_reference, | |
3abe9331 | 75 | const RootType *obj); |
970ed795 | 76 | |
feade998 | 77 | void generate_TTCN3_header(FILE * file, const char* modulename, const bool timestamp = true); |
78 | ||
970ed795 | 79 | inline unsigned long long llmin(unsigned long long l, unsigned long long r) { |
3abe9331 | 80 | return l < r ? l : r; |
970ed795 EL |
81 | } |
82 | ||
83 | inline unsigned long long llmax(unsigned long long l, unsigned long long r) { | |
3abe9331 | 84 | return l > r ? l : r; |
970ed795 EL |
85 | } |
86 | ||
87 | #endif /* GENERALFUNCTIONS_HH_ */ |