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