Add ability to generate code from code_generator
This commit is contained in:
parent
5a987db7a7
commit
2752d94e2a
2 changed files with 11 additions and 0 deletions
|
|
@ -358,6 +358,12 @@ namespace cppast
|
|||
return main_entity_.value();
|
||||
}
|
||||
|
||||
/// \effects Generates the code for the specified entity.
|
||||
/// It can be used to generate additional entities while generating another one.
|
||||
/// \returns Whether or not any code was generated.
|
||||
/// \notes This does not affect the main entity, but otherwise behaves just like [cppast::generate_code()]().
|
||||
bool generate_code(const cpp_entity& entity);
|
||||
|
||||
private:
|
||||
/// \returns The formatting options that should be used.
|
||||
/// The base class version has no flags set.
|
||||
|
|
|
|||
|
|
@ -1103,6 +1103,11 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
bool code_generator::generate_code(const cpp_entity& entity)
|
||||
{
|
||||
return generate_code_impl(*this, entity, cpp_public);
|
||||
}
|
||||
|
||||
bool cppast::generate_code(code_generator& generator, const cpp_entity& e)
|
||||
{
|
||||
generator.main_entity_ = type_safe::ref(e);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue