Reflection for RapidJSON 0.0.17
Reflection for serializing/deserializing with RapidJSON
Loading...
Searching...
No Matches
serializationcodegenerator.h
Go to the documentation of this file.
1#ifndef REFLECTIVE_RAPIDJSON_SERIALIZATION_CODE_GENERATOR_H
2#define REFLECTIVE_RAPIDJSON_SERIALIZATION_CODE_GENERATOR_H
3
4#include "./codegenerator.h"
5
6#include <llvm/ADT/StringRef.h>
7
8#include <optional>
9
10namespace ReflectiveRapidJSON {
11
12std::ostream &operator<<(std::ostream &os, llvm::StringRef str);
13
19public:
20 enum class IsRelevant { Yes, No, Maybe };
22 explicit RelevantClass(std::string &&qualifiedName, clang::CXXRecordDecl *record);
23
24 std::string qualifiedName;
25 std::string relevantBase;
26 clang::CXXRecordDecl *record = nullptr;
28 };
29
31
32 void addDeclaration(clang::Decl *decl) override;
33
34protected:
35 virtual void computeRelevantClass(RelevantClass &possiblyRelevantClass) const;
36 std::vector<RelevantClass> findRelevantClasses() const;
37 static std::vector<const RelevantClass *> findRelevantBaseClasses(
38 const RelevantClass &relevantClass, const std::vector<RelevantClass> &relevantBases);
39
40protected:
43
44private:
45 std::vector<clang::CXXRecordDecl *> m_records;
46 std::vector<RelevantClass> m_adaptionRecords;
47};
48
54
61
62} // namespace ReflectiveRapidJSON
63
64#endif // REFLECTIVE_RAPIDJSON_SERIALIZATION_CODE_GENERATOR_H
The CodeFactory class produces additional (reflection) code for a specified list of C++ source files.
Definition codefactory.h:27
CodeGenerator(CodeFactory &factory)
void addDeclaration(clang::Decl *decl) override
Adds all class declarations (to the internal member variable m_records).
static std::vector< const RelevantClass * > findRelevantBaseClasses(const RelevantClass &relevantClass, const std::vector< RelevantClass > &relevantBases)
virtual void computeRelevantClass(RelevantClass &possiblyRelevantClass) const
std::ostream & operator<<(std::ostream &os, llvm::StringRef str)
Prints an LLVM string reference without instantiating a std::string first.
RelevantClass(std::string &&qualifiedName, clang::CXXRecordDecl *record)