Reflection for RapidJSON
0.0.17
Reflection for serializing/deserializing with RapidJSON
Toggle main menu visibility
Loading...
Searching...
No Matches
codegenerator.h
Go to the documentation of this file.
1
#ifndef REFLECTIVE_RAPIDJSON_CODE_GENERATOR_H
2
#define REFLECTIVE_RAPIDJSON_CODE_GENERATOR_H
3
4
#include <iosfwd>
5
#include <string>
6
#include <vector>
7
8
namespace
clang
{
9
class
Decl;
10
class
CXXRecordDecl;
11
class
CXXBaseSpecifier;
12
class
SourceManager;
13
}
// namespace clang
14
15
namespace
ReflectiveRapidJSON
{
16
17
class
CodeFactory
;
18
22
class
CodeGenerator
{
23
public
:
24
CodeGenerator
(
CodeFactory
&
factory
);
25
virtual
~CodeGenerator
();
26
27
virtual
void
addDeclaration
(clang::Decl *decl);
28
30
virtual
void
generate
(std::ostream &os)
const
= 0;
31
32
protected
:
33
CodeFactory
&
factory
()
const
;
34
void
lazyInitializeSourceManager
()
const
;
35
bool
isOnlyIncluded
(
const
clang::Decl *declaration)
const
;
36
static
clang::CXXBaseSpecifier *
inheritsFromInstantiationOf
(clang::CXXRecordDecl *record,
const
char
*templateClass);
37
38
private
:
39
CodeFactory
&m_factory;
40
mutable
const
clang::SourceManager *m_sourceManager;
41
};
42
43
inline
CodeGenerator::CodeGenerator
(
CodeFactory
&
factory
)
44
: m_factory(
factory
)
45
, m_sourceManager(nullptr)
46
{
47
}
48
49
inline
CodeFactory
&
CodeGenerator::factory
()
const
50
{
51
return
m_factory;
52
}
53
54
}
// namespace ReflectiveRapidJSON
55
56
#endif
// REFLECTIVE_RAPIDJSON_CODE_GENERATOR_H
ReflectiveRapidJSON::CodeFactory
The CodeFactory class produces additional (reflection) code for a specified list of C++ source files.
Definition
codefactory.h:27
ReflectiveRapidJSON::CodeGenerator::inheritsFromInstantiationOf
static clang::CXXBaseSpecifier * inheritsFromInstantiationOf(clang::CXXRecordDecl *record, const char *templateClass)
Returns whether the specified record inherits from an instantiation of the specified templateClass.
Definition
codegenerator.cpp:50
ReflectiveRapidJSON::CodeGenerator::CodeGenerator
CodeGenerator(CodeFactory &factory)
Definition
codegenerator.h:43
ReflectiveRapidJSON::CodeGenerator::lazyInitializeSourceManager
void lazyInitializeSourceManager() const
Lazy initializes the source manager.
Definition
codegenerator.cpp:29
ReflectiveRapidJSON::CodeGenerator::addDeclaration
virtual void addDeclaration(clang::Decl *decl)
Adds the specified decl to the code generator.
Definition
codegenerator.cpp:20
ReflectiveRapidJSON::CodeGenerator::isOnlyIncluded
bool isOnlyIncluded(const clang::Decl *declaration) const
Returns whether the specified declaration is only included and not part of the actual file.
Definition
codegenerator.cpp:39
ReflectiveRapidJSON::CodeGenerator::factory
CodeFactory & factory() const
Definition
codegenerator.h:49
ReflectiveRapidJSON::CodeGenerator::generate
virtual void generate(std::ostream &os) const =0
Generates code based on the previously added declarations. The code is written to os.
ReflectiveRapidJSON
Definition
codegenerator.h:15
clang
Definition
codegenerator.h:8
Generated on
for Reflection for RapidJSON by
1.18.0