ROSE 0.11.145.147
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rosebud::Generator Class Referenceabstract

Description

Base class for backend code generators.

Definition at line 10 of file Generator.h.

#include <Rosebud/Generator.h>

Inheritance diagram for Rosebud::Generator:
Inheritance graph
[legend]

Public Types

using Ptr = GeneratorPtr
 

Public Member Functions

virtual void adjustParser (Sawyer::CommandLine::Parser &)
 Add command-line switches and documentation to a parser.
 
virtual std::string name () const =0
 Property: Every generator should have a unique name.
 
virtual std::string purpose () const =0
 Property: Single-line description for documentation.
 
virtual void generate (const Ast::ProjectPtr &)=0
 Generate code.
 
virtual std::string propertyDataMemberName (const Ast::PropertyPtr &) const
 Data member name for a property.
 
virtual std::vector< std::string > propertyAccessorNames (const Ast::PropertyPtr &) const
 Accessor names for a property.
 
virtual std::vector< std::string > propertyMutatorNames (const Ast::PropertyPtr &) const
 Mutator names for a property.
 
void commandLine (const std::vector< std::string > &)
 Property: Entire Rosebud command line.
 
const std::vector< std::string > & commandLine () const
 Property: Entire Rosebud command line.
 

Static Public Member Functions

static void registerGenerator (const Ptr &)
 Register a backend for use later.
 
static const std::vector< Ptr > & registeredGenerators ()
 Return all registered backends.
 
static Ptr lookup (const std::string &)
 Return the registered generator with the specified name.
 
static void addAllToParser (Sawyer::CommandLine::Parser &)
 Add all known generator switches to parser.
 

Protected Member Functions

std::string generatedByRosebud (const std::string &prefix)
 Return a multi-line comment that this file was generated by Rosebud.
 

Member Typedef Documentation

◆ Ptr

using Rosebud::Generator::Ptr = GeneratorPtr

Definition at line 15 of file Generator.h.

Constructor & Destructor Documentation

◆ ~Generator()

virtual Rosebud::Generator::~Generator ( )
inlinevirtual

Definition at line 28 of file Generator.h.

◆ Generator()

Rosebud::Generator::Generator ( )
inlineprotected

Definition at line 31 of file Generator.h.

Member Function Documentation

◆ adjustParser()

virtual void Rosebud::Generator::adjustParser ( Sawyer::CommandLine::Parser )
inlinevirtual

Add command-line switches and documentation to a parser.

Any command-line switches and documentation that is specific to the backend are added to the specified parser. In order to not conflict with other backends that might also be adding switch parsers, the backend should create a switch group and give it a unique prefix.

Reimplemented in Rosebud::RosettaGenerator, Rosebud::SawyerGenerator, and Rosebud::YamlGenerator.

Definition at line 48 of file Generator.h.

◆ name()

virtual std::string Rosebud::Generator::name ( ) const
pure virtual

Property: Every generator should have a unique name.

Implemented in Rosebud::NoneGenerator, Rosebud::RosettaGenerator, Rosebud::SawyerGenerator, and Rosebud::YamlGenerator.

◆ purpose()

virtual std::string Rosebud::Generator::purpose ( ) const
pure virtual

Property: Single-line description for documentation.

Implemented in Rosebud::NoneGenerator, Rosebud::RosettaGenerator, Rosebud::SawyerGenerator, and Rosebud::YamlGenerator.

◆ generate()

virtual void Rosebud::Generator::generate ( const Ast::ProjectPtr )
pure virtual

Generate code.

The specified project AST is used to generate code.

Implemented in Rosebud::NoneGenerator, Rosebud::RosettaGenerator, Rosebud::SawyerGenerator, and Rosebud::YamlGenerator.

◆ propertyDataMemberName()

virtual std::string Rosebud::Generator::propertyDataMemberName ( const Ast::PropertyPtr ) const
virtual

Data member name for a property.

Returns the name of the class data member that stores the value of the property. The returned value must be a valid C++ name for the property data member. Each property has exactly one data member.

Reimplemented in Rosebud::SawyerGenerator, and Rosebud::RosettaGenerator.

◆ propertyAccessorNames()

virtual std::vector< std::string > Rosebud::Generator::propertyAccessorNames ( const Ast::PropertyPtr ) const
virtual

Accessor names for a property.

Returns a list of zero or more C++ member function names to use as accessor names. If no names are returned, then no accessor functions are declared or defined.

Reimplemented in Rosebud::RosettaGenerator.

◆ propertyMutatorNames()

virtual std::vector< std::string > Rosebud::Generator::propertyMutatorNames ( const Ast::PropertyPtr ) const
virtual

Mutator names for a property.

Returns a list of zero or more C++ member function names to use as mutator names. If no names are returned, then no mutator functions are declared or defined.

Reimplemented in Rosebud::RosettaGenerator.


The documentation for this class was generated from the following file: