Sen API
Sen Libraries
Toggle main menu visibility
Loading...
Searching...
No Matches
cpp.h
Go to the documentation of this file.
1
// === cpp.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_CPP_H
9
#define SEN_LIBS_GEN_INCLUDE_SEN_GEN_CPP_H
10
11
#include "
sen/core/base/compiler_macros.h
"
12
#include "
sen/core/lang/stl_resolver.h
"
13
14
#include <filesystem>
15
#include <map>
16
#include <memory>
17
#include <string>
18
#include <vector>
19
20
namespace
sen::gen
21
{
22
24
struct
CppOptions
25
{
28
bool
recursive
=
false
;
29
32
bool
publicSymbols
=
false
;
33
36
std::string
basePath
;
37
};
38
40
struct
CppExportsOptions
41
{
43
std::string
packageName
;
44
46
std::vector<std::string>
stlFiles
;
47
50
std::vector<std::string>
packageDependencies
;
51
54
std::vector<std::string>
userImplementedClasses
;
55
};
56
59
class
CppGenerator
60
{
61
SEN_NOCOPY_NOMOVE(
CppGenerator
)
62
63
public
:
64
CppGenerator
();
65
~CppGenerator
();
66
70
using
FileContents
= std::map<std::filesystem::path, std::string>;
71
77
[[nodiscard]]
FileContents
generate
(
const
sen::lang::TypeSet
& typeSet,
const
CppOptions
& opts = {});
78
80
[[nodiscard]] std::string
generateExports
(
const
CppExportsOptions
& opts);
81
82
private
:
83
class
Impl;
84
std::unique_ptr<Impl> pimpl_;
85
};
86
87
}
// namespace sen::gen
88
89
#endif
// SEN_LIBS_GEN_INCLUDE_SEN_GEN_CPP_H
sen::gen::CppGenerator::generate
FileContents generate(const sen::lang::TypeSet &typeSet, const CppOptions &opts={})
Renders the types header + impl source for the supplied type set. When opts.recursive is true,...
sen::gen::CppGenerator::generateExports
std::string generateExports(const CppExportsOptions &opts)
Renders the package exports source file (sen_exported_types.cpp).
sen::gen::CppGenerator::FileContents
std::map< std::filesystem::path, std::string > FileContents
Map of relative output path -> rendered file contents. Keys are produced from the type set's parentDi...
Definition
cpp.h:70
sen::gen::CppGenerator::CppGenerator
CppGenerator()
sen::gen::CppGenerator::~CppGenerator
~CppGenerator()
compiler_macros.h
sen::gen::CppExportsOptions::packageName
std::string packageName
The Sen package name. Becomes the hashed package id embedded into the file.
Definition
cpp.h:43
sen::gen::CppOptions::publicSymbols
bool publicSymbols
When true, generated classes use public C++ symbols (rather than the default translation-unit-private...
Definition
cpp.h:32
sen::gen::CppExportsOptions::userImplementedClasses
std::vector< std::string > userImplementedClasses
Qualified names of types the user implements in this package. Each is materialised as a registration ...
Definition
cpp.h:54
sen::gen::CppExportsOptions::packageDependencies
std::vector< std::string > packageDependencies
Names of every package this one depends on. Each becomes a hashed package id in the rendered file's d...
Definition
cpp.h:50
sen::gen::CppOptions::recursive
bool recursive
When true, the generator also renders sources for every transitively imported type set found in TypeS...
Definition
cpp.h:28
sen::gen::CppExportsOptions::stlFiles
std::vector< std::string > stlFiles
Names of every STL file participating in the package.
Definition
cpp.h:46
sen::gen::CppOptions::basePath
std::string basePath
Optional base path embedded into the rendered #include lines so generated headers resolve correctly u...
Definition
cpp.h:36
sen::gen::CppExportsOptions
Options for CppGenerator::generateExports.
Definition
cpp.h:41
sen::gen::CppOptions
Options controlling how CppGenerator::generate renders one type set.
Definition
cpp.h:25
sen::lang::TypeSet
A set of types coming from a STL file.
Definition
stl_resolver.h:33
sen::gen
Definition
cpp.h:21
stl_resolver.h
libs
gen
include
sen
gen
cpp.h
Generated by
1.17.0