1#ifndef Rosebud_Generator_H
2#define Rosebud_Generator_H
3#include <Rosebud/Utility.h>
5#include <Sawyer/CommandLine.h>
21 static std::vector<Ptr> registry_;
22 std::vector<std::string> commandLine_;
41 static Ptr
lookup(
const std::string&);
58 virtual std::string
name()
const = 0;
102 static void initRegistry();
Base class for backend code generators.
virtual std::string propertyDataMemberName(const Ast::PropertyPtr &) const
Data member name for a property.
virtual std::string purpose() const =0
Property: Single-line description for documentation.
virtual std::string name() const =0
Property: Every generator should have a unique name.
virtual std::vector< std::string > propertyAccessorNames(const Ast::PropertyPtr &) const
Accessor names for a property.
static void addAllToParser(Sawyer::CommandLine::Parser &)
Add all known generator switches to parser.
const std::vector< std::string > & commandLine() const
Property: Entire Rosebud command line.
static Ptr lookup(const std::string &)
Return the registered generator with the specified name.
static void registerGenerator(const Ptr &)
Register a backend for use later.
virtual std::vector< std::string > propertyMutatorNames(const Ast::PropertyPtr &) const
Mutator names for a property.
std::string generatedByRosebud(const std::string &prefix)
Return a multi-line comment that this file was generated by Rosebud.
virtual void adjustParser(Sawyer::CommandLine::Parser &)
Add command-line switches and documentation to a parser.
virtual void generate(const Ast::ProjectPtr &)=0
Generate code.
void commandLine(const std::vector< std::string > &)
Property: Entire Rosebud command line.
static const std::vector< Ptr > & registeredGenerators()
Return all registered backends.
The parser for a program command line.
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::shared_ptr< Generator > GeneratorPtr
Shared-ownership pointer to a Generator.