ROSE  0.11.145.0
CxxGenerator.h
1 #ifndef Rosebud_CxxGenerator_H
2 #define Rosebud_CxxGenerator_H
3 #include <Rosebud/Generator.h>
4 
5 namespace Rosebud {
6 
8 class CxxGenerator: public Generator {
9 protected:
10  size_t outputWidth = 130; // nominal width of the generated code
11 
12 protected:
14  virtual std::string machineGenerated(char commentType = '/');
15 
42  virtual std::string ctorInitializerExpression(const Ast::PropertyPtr&, const std::string &expr);
43 
50  virtual std::string resetStatement(const Ast::PropertyPtr&);
51 
55  virtual std::string dataMemberType(const Ast::PropertyPtr&);
56 
60  virtual std::string initialValue(const Ast::PropertyPtr&);
61 
79  virtual std::string valueType(const Ast::PropertyPtr&);
80 
82  virtual void genDestructor(std::ostream &header, std::ostream &impl, const Ast::ClassPtr&);
83 
85  virtual void genDefaultConstructor(std::ostream &header, std::ostream &impl, const Ast::ClassPtr&, Access);
86 
88  virtual void genArgsConstructor(std::ostream &header, std::ostream &impl, const Ast::ClassPtr&, const Hierarchy&, Access);
89 
91  virtual void genInitProperties(std::ostream &header, std::ostream &impl, const Ast::ClassPtr&);
92 };
93 
94 } // namespace
95 #endif
Base class for generators that produce C++ code.
Definition: CxxGenerator.h:8
Graph containing user-defined vertices and edges.
Definition: Graph.h:625
virtual std::string resetStatement(const Ast::PropertyPtr &)
Statement to initialize a property.
virtual std::string initialValue(const Ast::PropertyPtr &)
Initial value expression for the property.
Rosebud is a tool to generate code for ROSE.
Definition: Ast.h:14
virtual void genInitProperties(std::ostream &header, std::ostream &impl, const Ast::ClassPtr &)
Emit code that initializes all local properties.
virtual std::string machineGenerated(char commentType= '/')
Return a title comment that says the file is machine generated.
virtual void genArgsConstructor(std::ostream &header, std::ostream &impl, const Ast::ClassPtr &, const Hierarchy &, Access)
Emit code for the constructor with ctor_args property arguments.
Access
Kinds of access.
Definition: ud/Utility.h:20
Base class for backend code generators.
Definition: Generator.h:10
virtual void genDefaultConstructor(std::ostream &header, std::ostream &impl, const Ast::ClassPtr &, Access)
Emit code for the class default constructor.
virtual void genDestructor(std::ostream &header, std::ostream &impl, const Ast::ClassPtr &)
Emit code for the class destructor.
virtual std::string dataMemberType(const Ast::PropertyPtr &)
Type for the data member for a property.
virtual std::string valueType(const Ast::PropertyPtr &)
Type of value for initializing a property.
std::shared_ptr< Property > PropertyPtr
Shared-ownership pointer to a Property.
Definition: ud/BasicTypes.h:49
std::shared_ptr< Class > ClassPtr
Shared-ownership pointer to a Class.
Definition: ud/BasicTypes.h:51
virtual std::string ctorInitializerExpression(const Ast::PropertyPtr &, const std::string &expr)
Expression for initializing a property in a constructor, or empty.