#include <typelib/registry.hh>
Public Types | |
enum | DumpMode { NameOnly = 0, AllType = 1, WithSourceId = 2, RecursiveTypeDump = 4 } |
typedef RegistryIterator | Iterator |
Public Member Functions | |
Registry () | |
~Registry () | |
void | importNamespace (const std::string &name, bool erase_existing=false) |
bool | setDefaultNamespace (const std::string &name) |
std::string | getDefaultNamespace () const |
bool | has (const std::string &name, bool build=true) const |
std::string | source (Type const *type) const |
Type const * | build (const std::string &name) |
Type const * | get (const std::string &name) const |
void | add (Type *type, std::string const &source_id="") |
void | alias (std::string const &base, std::string const &alias, std::string const &source_id="") |
size_t | size () const |
void | clear () |
std::string | getFullName (const std::string &name) const |
RegistryIterator | begin () const |
RegistryIterator | end () const |
void | merge (Registry const ®istry) |
Registry * | minimal (Registry const &auto_types) const |
bool | isSame (Registry const &other) const |
void | dump (std::ostream &stream, int dumpmode=AllType, const std::string &source_filter="*") const |
Static Public Member Functions | |
static Type const & | null () |
Friends | |
class | RegistryIterator |
Classes | |
struct | RegistryType |
Registry objects provide the following services:
using namespace
in C++)
Typelib::Registry::Registry | ( | ) |
References setDefaultNamespace().
Typelib::Registry::~Registry | ( | ) |
References clear().
void Typelib::Registry::importNamespace | ( | const std::string & | name, | |
bool | erase_existing = false | |||
) |
Import the name
namespace into the current namespace.
References Typelib::getNormalizedNamespace(), and Typelib::isInNamespace().
Referenced by setDefaultNamespace().
bool Typelib::Registry::setDefaultNamespace | ( | const std::string & | name | ) |
Sets the default namespace. This removes all namespace import and imports name
in the current namespace
References Typelib::getNormalizedNamespace(), importNamespace(), Typelib::isValidNamespace(), and Typelib::NamespaceMarkString.
Referenced by Registry().
std::string Typelib::Registry::getDefaultNamespace | ( | ) | const |
Get the default namespace (if any). Returns '/' (i.e. the root) if no default namespace have been set
bool Typelib::Registry::has | ( | const std::string & | name, | |
bool | build = true | |||
) | const |
Checks for the availability of a particular type
name
is a derived version (pointer or array) of a known typeReferences Typelib::TypeBuilder::getBaseType(), and getFullName().
Referenced by minimal().
std::string Typelib::Registry::source | ( | Type const * | type | ) | const |
Get the source ID of type
. Throws Undefined if type
is not a registered type
const Type * Typelib::Registry::build | ( | const std::string & | name | ) |
Build a derived type from its canonical name
References getFullName().
Referenced by Typelib::TypeBuilder::TypeBuilder().
const Type * Typelib::Registry::get | ( | const std::string & | name | ) | const |
Gets a Type object
Referenced by Typelib::TypeBuilder::addArrayMajor(), Typelib::TypeBuilder::addPointer(), and Typelib::Type::try_merge().
void Typelib::Registry::add | ( | Type * | type, | |
std::string const & | source_id = "" | |||
) |
Adds a new type
References Typelib::Type::getName().
void Typelib::Registry::alias | ( | std::string const & | base, | |
std::string const & | alias, | |||
std::string const & | source_id = "" | |||
) |
Creates an alias While base can be a derived type, all aliases are considered persistent since they can be referenced by their name in other types
References Typelib::isValidTypename().
Referenced by merge().
size_t Typelib::Registry::size | ( | ) | const |
Returns the count of types defined in this registry, including non-persistent and aliases
Referenced by Typelib::make_std_numeric(), and Typelib::Exporter::save().
void Typelib::Registry::clear | ( | ) |
Remove all types
Referenced by ~Registry().
std::string Typelib::Registry::getFullName | ( | const std::string & | name | ) | const |
Get the absolute type name of name
, taking the default namespace into account
References Typelib::isAbsoluteName().
RegistryIterator Typelib::Registry::begin | ( | ) | const |
Iterator pointing on the first type of the registry
References RegistryIterator.
Referenced by merge(), minimal(), and Typelib::Exporter::save().
RegistryIterator Typelib::Registry::end | ( | ) | const |
Past-the-end iterator on the registry
References RegistryIterator.
Referenced by merge(), minimal(), and Typelib::Exporter::save().
Type const & Typelib::Registry::null | ( | ) | [static] |
Returns a null type
void Typelib::Registry::merge | ( | Registry const & | registry | ) |
Merges the content of registry
into this object
References alias(), begin(), end(), and Typelib::Type::isSame().
Returns a registry containing the minimal set of types needed to define the types that are in this
and not in auto_types
References begin(), end(), has(), and Typelib::Type::isSame().
bool Typelib::Registry::isSame | ( | Registry const & | other | ) | const |
Compares the two registries. Returns true if they contain the same set of types, referenced under the same name
Note that for now, if this contains a type 'A' aliased to 'B' and other
contains the same type but named 'B' and aliased to 'A', the method will return false.
References m_global.
void Typelib::Registry::dump | ( | std::ostream & | stream, | |
int | dumpmode = AllType , |
|||
const std::string & | source_filter = "*" | |||
) | const |
References AllType, Typelib::TypeVisitor::apply(), Typelib::filter_source(), Typelib::Type::getName(), and WithSourceId.
friend class RegistryIterator [friend] |