Sen API
Sen Libraries
Loading...
Searching...
No Matches
json.h
Go to the documentation of this file.
1// === json.h ==========================================================================================================
2// Sen Infrastructure
3// Released under the Apache License v2.0 (SPDX-License-Identifier Apache-2.0).
4// See the LICENSE.txt file for more information.
5// © Airbus SAS, Airbus Helicopters, and Airbus Defence and Space SAU/GmbH/SAS.
6// =====================================================================================================================
7
8#ifndef SEN_LIBS_GEN_INCLUDE_SEN_GEN_JSON_H
9#define SEN_LIBS_GEN_INCLUDE_SEN_GEN_JSON_H
10
13
14#include <memory>
15#include <string>
16#include <vector>
17
18namespace sen::gen
19{
20
23{
26 std::string schemaName;
27
30 std::vector<std::string> classes;
31};
32
35{
37 std::string schemaName;
38
40 std::string componentName;
41};
42
46{
47 SEN_NOCOPY_NOMOVE(JsonGenerator)
48
49public:
52
54 [[nodiscard]] std::string generatePackage(const sen::lang::TypeSetContext& typeSets, const PackageOptions& opts = {});
55
58 [[nodiscard]] std::string generateComponent(const sen::lang::TypeSetContext& typeSets,
59 const ComponentOptions& opts = {});
60
64 [[nodiscard]] std::string combineSchemas(const std::vector<std::string>& schemaContents,
65 const std::string& schemaName);
66
70 [[nodiscard]] std::string renderTypeSchema(const sen::CustomType& type);
71
72private:
73 class Impl;
74 std::unique_ptr<Impl> pimpl_;
75};
76
77} // namespace sen::gen
78
79#endif // SEN_LIBS_GEN_INCLUDE_SEN_GEN_JSON_H
Represents a user-defined type.
Definition custom_type.h:23
std::string generateComponent(const sen::lang::TypeSetContext &typeSets, const ComponentOptions &opts={})
Renders a component schema (i.e. one that exposes a Configuration class) for the supplied type set.
std::string combineSchemas(const std::vector< std::string > &schemaContents, const std::string &schemaName)
Renders a kernel configuration file that combines an arbitrary number of previously rendered schemas ...
std::string renderTypeSchema(const sen::CustomType &type)
Renders one type's JSON-Schema fragment in the same shape the file-level renderers use ("<qualifiedNa...
std::string generatePackage(const sen::lang::TypeSetContext &typeSets, const PackageOptions &opts={})
Renders a package schema for the supplied type set.
The set of types used during resolution.
Definition stl_resolver.h:51
std::string schemaName
Becomes the schemaName field in the rendered JSON. Caller is expected to derive it from the desired o...
Definition json.h:26
std::vector< std::string > classes
Qualified names of classes implemented by the user. Each is materialised as a concrete class deriving...
Definition json.h:30
std::string componentName
Becomes the component field in the rendered JSON.
Definition json.h:40
std::string schemaName
Becomes the schemaName field in the rendered JSON.
Definition json.h:37
Options for JsonGenerator::generateComponent.
Definition json.h:35
Options for JsonGenerator::generatePackage.
Definition json.h:23
Definition cpp.h:21