Added basic class access and type specifiers generation

This commit is contained in:
Bartek Kryza
2021-02-23 23:31:35 +01:00
parent a3459035d7
commit 78d8655c6d
8 changed files with 145 additions and 11 deletions

View File

@@ -101,18 +101,39 @@ public:
ostr << c.name << " {" << std::endl;
//
// Process methods
//
for (const auto &m : c.methods) {
if (m.is_pure_virtual)
ostr << "{abstract} ";
ostr << to_string(m.scope) << m.type << " " << m.name + "()";
if (m.is_static)
ostr << "{static} ";
std::string type{};
if (m.type != "void")
type = m.type;
ostr << to_string(m.scope) << type << " " << m.name + "()";
if (m.is_const)
ostr << " const";
assert(!(m.is_pure_virtual && m.is_defaulted));
if (m.is_pure_virtual)
ostr << " = 0";
if (m.is_defaulted)
ostr << " = default";
ostr << std::endl;
}
//
// Process members
//
for (const auto &m : c.members) {
ostr << to_string(m.scope) << m.type << " " << m.name << std::endl;
}