[breaking] Rename synopsis_options —> generation_options
More consistent.
This commit is contained in:
parent
c86e950847
commit
27fd67bad1
3 changed files with 19 additions and 19 deletions
|
|
@ -130,8 +130,8 @@ namespace cppast
|
||||||
code_generator& operator=(const code_generator&) = delete;
|
code_generator& operator=(const code_generator&) = delete;
|
||||||
virtual ~code_generator() noexcept = default;
|
virtual ~code_generator() noexcept = default;
|
||||||
|
|
||||||
/// Flags that control the synopsis.
|
/// Flags that control the generation.
|
||||||
enum synopsis_flags
|
enum generation_flags
|
||||||
{
|
{
|
||||||
exclude, //< Exclude the entire entity.
|
exclude, //< Exclude the entire entity.
|
||||||
exclude_return, //< Exclude the return type of a function entity.
|
exclude_return, //< Exclude the return type of a function entity.
|
||||||
|
|
@ -140,8 +140,8 @@ namespace cppast
|
||||||
_flag_set_size, //< \exclude
|
_flag_set_size, //< \exclude
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Options that control the synopsis.
|
/// Options that control the generation.
|
||||||
using synopsis_options = type_safe::flag_set<synopsis_flags>;
|
using generation_options = type_safe::flag_set<generation_flags>;
|
||||||
|
|
||||||
/// Sentinel type used to output a given entity.
|
/// Sentinel type used to output a given entity.
|
||||||
class output
|
class output
|
||||||
|
|
@ -184,7 +184,7 @@ namespace cppast
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \returns The synopsis options.
|
/// \returns The synopsis options.
|
||||||
synopsis_options options() const noexcept
|
generation_options options() const noexcept
|
||||||
{
|
{
|
||||||
return options_;
|
return options_;
|
||||||
}
|
}
|
||||||
|
|
@ -319,7 +319,7 @@ namespace cppast
|
||||||
private:
|
private:
|
||||||
type_safe::object_ref<code_generator> gen_;
|
type_safe::object_ref<code_generator> gen_;
|
||||||
type_safe::optional_ref<const cpp_entity> e_;
|
type_safe::optional_ref<const cpp_entity> e_;
|
||||||
synopsis_options options_;
|
generation_options options_;
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -330,7 +330,7 @@ namespace cppast
|
||||||
/// The base class version has no effect.
|
/// The base class version has no effect.
|
||||||
/// \returns The synopsis options for that entity,
|
/// \returns The synopsis options for that entity,
|
||||||
/// the base class version always returns no special options.
|
/// the base class version always returns no special options.
|
||||||
virtual synopsis_options on_container_begin(const cpp_entity& e)
|
virtual generation_options on_container_begin(const cpp_entity& e)
|
||||||
{
|
{
|
||||||
(void)e;
|
(void)e;
|
||||||
return {};
|
return {};
|
||||||
|
|
@ -347,7 +347,7 @@ namespace cppast
|
||||||
/// The base class version has no effect.
|
/// The base class version has no effect.
|
||||||
/// \returns The synopsis options for that entity,
|
/// \returns The synopsis options for that entity,
|
||||||
/// the base class version always returns no special options.
|
/// the base class version always returns no special options.
|
||||||
virtual synopsis_options on_leaf(const cpp_entity& e)
|
virtual generation_options on_leaf(const cpp_entity& e)
|
||||||
{
|
{
|
||||||
(void)e;
|
(void)e;
|
||||||
return {};
|
return {};
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ inline std::unique_ptr<cppast::cpp_file> parse(const cppast::cpp_entity_index& i
|
||||||
class test_generator : public cppast::code_generator
|
class test_generator : public cppast::code_generator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
test_generator(synopsis_options options) : options_(std::move(options))
|
test_generator(generation_options options) : options_(std::move(options))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,12 +55,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
synopsis_options on_container_begin(const cppast::cpp_entity&) override
|
generation_options on_container_begin(const cppast::cpp_entity&) override
|
||||||
{
|
{
|
||||||
return options_;
|
return options_;
|
||||||
}
|
}
|
||||||
|
|
||||||
synopsis_options on_leaf(const cppast::cpp_entity&) override
|
generation_options on_leaf(const cppast::cpp_entity&) override
|
||||||
{
|
{
|
||||||
return options_;
|
return options_;
|
||||||
}
|
}
|
||||||
|
|
@ -92,14 +92,14 @@ private:
|
||||||
was_newline_ = true;
|
was_newline_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string str_;
|
std::string str_;
|
||||||
synopsis_options options_;
|
generation_options options_;
|
||||||
unsigned indent_ = 0;
|
unsigned indent_ = 0;
|
||||||
bool was_newline_ = false;
|
bool was_newline_ = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::string get_code(const cppast::cpp_entity& e,
|
inline std::string get_code(const cppast::cpp_entity& e,
|
||||||
cppast::code_generator::synopsis_options options = {})
|
cppast::code_generator::generation_options options = {})
|
||||||
{
|
{
|
||||||
test_generator generator(options);
|
test_generator generator(options);
|
||||||
cppast::generate_code(generator, e);
|
cppast::generate_code(generator, e);
|
||||||
|
|
|
||||||
|
|
@ -79,14 +79,14 @@ void print_entity(std::ostream& out, const cppast::cpp_entity& e)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// called at the beginning of the code generation of a container entity (i.e. one with child)
|
// called at the beginning of the code generation of a container entity (i.e. one with child)
|
||||||
synopsis_options on_container_begin(const cppast::cpp_entity&) override
|
generation_options on_container_begin(const cppast::cpp_entity&) override
|
||||||
{
|
{
|
||||||
// generate declaration only
|
// generate declaration only
|
||||||
return code_generator::declaration;
|
return code_generator::declaration;
|
||||||
}
|
}
|
||||||
|
|
||||||
// called before code generation of a leaf entity
|
// called before code generation of a leaf entity
|
||||||
synopsis_options on_leaf(const cppast::cpp_entity&) override
|
generation_options on_leaf(const cppast::cpp_entity&) override
|
||||||
{
|
{
|
||||||
// generate declaration only
|
// generate declaration only
|
||||||
return code_generator::declaration;
|
return code_generator::declaration;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue