1#ifndef Rosebud_SawyerGenerator_H
2#define Rosebud_SawyerGenerator_H
3#include <Rosebud/CxxGenerator.h>
12 using Ptr = std::shared_ptr<SawyerGenerator>;
15 boost::filesystem::path generatedDir;
16 boost::filesystem::path headerPrefix;
22 static Ptr instance();
25 std::string
name()
const override;
47 void genPropertyAccessor(std::ostream&, std::ostream&,
const Ast::PropertyPtr&,
Access,
const std::string &returnType,
48 const std::string &accessorName,
const std::string &thisTypeQualifiers);
49 void genPropertyAccessors(std::ostream&, std::ostream&,
const Ast::PropertyPtr&);
51 void genPropertyMutator(std::ostream&, std::ostream&,
const Ast::PropertyPtr&,
Access,
const std::string &mutatorName,
52 const std::string &argumentType);
53 void genPropertyMutators(std::ostream&, std::ostream&,
const Ast::PropertyPtr&);
54 void genTupFile(
const std::vector<std::string> &implNames,
const std::vector<std::string> &hdrNames);
55 void genMakeFile(
const std::vector<std::string> &implNames,
const std::vector<std::string> &hdrNames);
56 void genCmakeFile(
const std::vector<std::string> &implNames,
const std::vector<std::string> &hdrNames);
57 void genNamespaceDeclarationOpen(std::ostream&,
const std::string&);
58 void genNamespaceDeclarationClose(std::ostream&,
const std::string&);
61 static std::string title(
const std::string&);
72 std::vector<std::string> implementationFileNames(
const Classes&);
73 std::vector<std::string> headerFileNames(
const Classes&);
Base class for generators that produce C++ code.
Generator that produces Sawyer::Tree class hierarchies.
std::string purpose() const override
Property: Single-line description for documentation.
std::string valueType(const Ast::PropertyPtr &) override
Type of value for initializing a property.
void genConstructorBody(std::ostream &, const Ast::ClassPtr &) override
Emit code for the constructor body.
void generate(const Ast::ProjectPtr &) override
Generate code.
std::string propertyDataMemberName(const Ast::PropertyPtr &) const override
Data member name for a property.
std::string propertyDataMemberType(const Ast::PropertyPtr &) override
Type for the data member for a property.
std::string ctorInitializerExpression(const Ast::PropertyPtr &, const std::string &) override
Expression for initializing a property in a constructor, or empty.
std::string propertyMutatorArgumentType(const Ast::PropertyPtr &) override
Type for the argument for a property mutator.
bool genArgsConstructor(std::ostream &, std::ostream &, const Ast::ClassPtr &, const Hierarchy &, Access) override
Emit code for the constructor with ctor_args property arguments.
std::string name() const override
Property: Every generator should have a unique name.
void adjustParser(Sawyer::CommandLine::Parser &) override
Add command-line switches and documentation to a parser.
void genDefaultConstructor(std::ostream &, std::ostream &, const Ast::ClassPtr &, Access) override
Emit code for the class default constructor.
The parser for a program command line.
Graph containing user-defined vertices and edges.
Holds a value or nothing.
std::shared_ptr< Class > ClassPtr
Shared-ownership pointer to a Class.
std::shared_ptr< Property > PropertyPtr
Shared-ownership pointer to a Property.
std::shared_ptr< Project > ProjectPtr
Shared-ownership pointer to a Project.
Rosebud is a tool to generate abstract syntax trees.
std::vector< Ast::ClassPtr > Classes
Ordered sequence of classes.