ROSE  0.11.145.0
Public Types | Public Member Functions | Static Public 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. More...
 
virtual std::string name () const =0
 Every generator should have a unique name. More...
 
virtual std::string purpose () const =0
 Single-line description for documentation. More...
 
virtual void generate (const Ast::ProjectPtr &)=0
 Generate code. More...
 
virtual std::string propertyDataMemberName (const Ast::PropertyPtr &) const
 Data member name for a property. More...
 
virtual std::vector< std::string > propertyAccessorNames (const Ast::PropertyPtr &) const
 Accessor names for a property. More...
 
virtual std::vector< std::string > propertyMutatorNames (const Ast::PropertyPtr &) const
 Mutator names for a property. More...
 

Static Public Member Functions

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

Member Function Documentation

static void Rosebud::Generator::registerGenerator ( const Ptr &  )
static

Register a backend for use later.

static const std::vector<Ptr>& Rosebud::Generator::registeredGenerators ( )
static

Return all registered backends.

static Ptr Rosebud::Generator::lookup ( const std::string &  )
static

Return the registered generator with the specified name.

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::RoseGenerator, and Rosebud::YamlGenerator.

Definition at line 47 of file Generator.h.

static void Rosebud::Generator::addAllToParser ( Sawyer::CommandLine::Parser )
static

Add all known generator switches to parser.

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

Every generator should have a unique name.

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

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

Single-line description for documentation.

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

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

Generate code.

The specified project AST is used to generate code.

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

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::RosettaGenerator.

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.

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: