Sen API
Sen Libraries
Toggle main menu visibility
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
11
#include "
sen/core/base/compiler_macros.h
"
12
#include "
sen/core/lang/stl_resolver.h
"
13
14
#include <memory>
15
#include <string>
16
#include <vector>
17
18
namespace
sen::gen
19
{
20
22
struct
PackageOptions
23
{
26
std::string
schemaName
;
27
30
std::vector<std::string>
classes
;
31
};
32
34
struct
ComponentOptions
35
{
37
std::string
schemaName
;
38
40
std::string
componentName
;
41
};
42
45
class
JsonGenerator
46
{
47
SEN_NOCOPY_NOMOVE(
JsonGenerator
)
48
49
public
:
50
JsonGenerator
();
51
~JsonGenerator
();
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
72
private
:
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
sen::CustomType
Represents a user-defined type.
Definition
custom_type.h:23
sen::gen::JsonGenerator::generateComponent
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.
sen::gen::JsonGenerator::~JsonGenerator
~JsonGenerator()
sen::gen::JsonGenerator::combineSchemas
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 ...
sen::gen::JsonGenerator::JsonGenerator
JsonGenerator()
sen::gen::JsonGenerator::renderTypeSchema
std::string renderTypeSchema(const sen::CustomType &type)
Renders one type's JSON-Schema fragment in the same shape the file-level renderers use ("<qualifiedNa...
sen::gen::JsonGenerator::generatePackage
std::string generatePackage(const sen::lang::TypeSetContext &typeSets, const PackageOptions &opts={})
Renders a package schema for the supplied type set.
sen::lang::TypeSetContext
The set of types used during resolution.
Definition
stl_resolver.h:51
compiler_macros.h
sen::gen::PackageOptions::schemaName
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
sen::gen::PackageOptions::classes
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
sen::gen::ComponentOptions::componentName
std::string componentName
Becomes the component field in the rendered JSON.
Definition
json.h:40
sen::gen::ComponentOptions::schemaName
std::string schemaName
Becomes the schemaName field in the rendered JSON.
Definition
json.h:37
sen::gen::ComponentOptions
Options for JsonGenerator::generateComponent.
Definition
json.h:35
sen::gen::PackageOptions
Options for JsonGenerator::generatePackage.
Definition
json.h:23
sen::gen
Definition
cpp.h:21
stl_resolver.h
libs
gen
include
sen
gen
json.h
Generated by
1.17.0