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
14 ******************************************************************************/
15 #ifndef GENERALFUNCTIONS_HH_
16 #define GENERALFUNCTIONS_HH_
20 #include "GeneralTypes.hh"
22 typedef List<QualifiedName> QualifiedNames;
25 type_reference_name, type_name, field_name, enum_id_name
28 void XSDName2TTCN3Name(const Mstring& in, QualifiedNames & used_names, modeType type_of_the_name,
29 Mstring & res, Mstring & variant, bool no_replace = false);
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);
44 bool matchDates(const char * string, const char * type);
45 bool matchRegexp(const char * string, const char * pattern);
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);
53 long double stringToLongDouble(const char * input);
59 const Mstring& getNameSpaceByPrefix(const RootType * root, const Mstring& prefix);
60 const Mstring& getPrefixByNameSpace(const RootType * root, const Mstring& namespace_);
62 const Mstring findBuiltInType(const RootType * ref, Mstring type);
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);
74 int multi(const TTCN3Module *module, ReferenceData const& outside_reference,
77 void generate_TTCN3_header(FILE * file, const char* modulename, const bool timestamp = true);
79 inline unsigned long long llmin(unsigned long long l, unsigned long long r) {
83 inline unsigned long long llmax(unsigned long long l, unsigned long long r) {
87 #endif /* GENERALFUNCTIONS_HH_ */