Commit | Line | Data |
---|---|---|
3abe9331 | 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 | ||
970ed795 EL |
9 | #ifndef TTCN2JSON_HH |
10 | #define TTCN2JSON_HH | |
11 | ||
12 | // forward declarations | |
13 | namespace Common { | |
14 | class Modules; | |
15 | } | |
16 | ||
17 | class JSON_Tokenizer; | |
18 | ||
19 | namespace Ttcn { | |
20 | ||
21 | /** TTCN-3 to JSON schema converter | |
22 | * Generates a JSON schema from the type and coding function definitions in | |
23 | * TTCN-3 modules */ | |
24 | class Ttcn2Json { | |
25 | ||
26 | private: | |
27 | ||
28 | /** Input modules */ | |
29 | Common::Modules* modules; | |
30 | ||
31 | Ttcn2Json(const Ttcn2Json&); // no copying | |
32 | Ttcn2Json& operator=(const Ttcn2Json&); // no assignment | |
33 | ||
34 | /** Inserts the JSON schema skeleton into the parameter JSON tokenizer and | |
35 | * passes the tokenizer on to the TTCN-3 modules to insert the schemas for | |
36 | * their types and coding functions */ | |
37 | void create_schema(JSON_Tokenizer& json); | |
38 | ||
39 | /** Inserts a JSON schema to the end of another schema | |
40 | * @param to contains the destination schema | |
41 | * @param from contains the inserted (source) schema; its contents will be | |
42 | * altered (ruined), do not use after this call */ | |
43 | void insert_schema(JSON_Tokenizer& to, JSON_Tokenizer& from); | |
44 | ||
45 | public: | |
46 | ||
47 | /** Initializes this object with the input modules, calls create_schema() to | |
48 | * generate the JSON schema and writes the schema into the given file | |
49 | * @param p_modules input TTCN-3 modules | |
50 | * @param p_schema_name JSON schema file name */ | |
51 | Ttcn2Json(Common::Modules* p_modules, const char* p_schema_name); | |
52 | ||
53 | }; | |
54 | } | |
55 | ||
56 | #endif /* TTCN2JSON_HH */ | |
57 |