diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/XML.cpp | 6 | ||||
-rw-r--r-- | src/core/XML.hpp | 8 | ||||
-rw-r--r-- | src/core/common/Argument.cpp | 20 | ||||
-rw-r--r-- | src/core/common/Argument.hpp | 30 | ||||
-rw-r--r-- | src/core/common/Property.hpp | 32 | ||||
-rw-r--r-- | src/core/common/Rtti.cpp | 58 | ||||
-rw-r--r-- | src/core/common/Rtti.hpp | 106 | ||||
-rw-r--r-- | src/core/common/RttiBuilder.hpp | 22 | ||||
-rw-r--r-- | src/core/common/Variant.cpp | 6 | ||||
-rw-r--r-- | src/core/common/Variant.hpp | 10 | ||||
-rw-r--r-- | src/core/common/VariantConverter.cpp | 14 | ||||
-rw-r--r-- | src/core/common/VariantConverter.hpp | 34 | ||||
-rw-r--r-- | src/core/managed/Managed.cpp | 6 | ||||
-rw-r--r-- | src/core/managed/Managed.hpp | 20 | ||||
-rw-r--r-- | src/core/managed/Manager.cpp | 4 | ||||
-rw-r--r-- | src/core/model/Document.cpp | 12 | ||||
-rw-r--r-- | src/core/model/Document.hpp | 16 | ||||
-rw-r--r-- | src/core/model/Domain.cpp | 10 | ||||
-rw-r--r-- | src/core/model/Domain.hpp | 12 | ||||
-rw-r--r-- | src/core/model/Node.cpp | 14 | ||||
-rw-r--r-- | src/core/model/Node.hpp | 8 | ||||
-rw-r--r-- | src/core/model/Typesystem.cpp | 26 | ||||
-rw-r--r-- | src/core/model/Typesystem.hpp | 28 | ||||
-rw-r--r-- | src/core/parser/Scope.cpp | 8 | ||||
-rw-r--r-- | src/core/parser/Scope.hpp | 12 |
25 files changed, 261 insertions, 261 deletions
diff --git a/src/core/XML.cpp b/src/core/XML.cpp index b8ee11d..9ca808d 100644 --- a/src/core/XML.cpp +++ b/src/core/XML.cpp @@ -118,8 +118,8 @@ void Text::doSerialize(std::ostream &out, unsigned int tabdepth, bool pretty) namespace RttiTypes { - const RttiType XMLNode = RttiBuilder<xml::Node>("XMLNode"); - const RttiType XMLElement = + const Rtti XMLNode = RttiBuilder<xml::Node>("XMLNode"); + const Rtti XMLElement = RttiBuilder<xml::Element>("XMLElement") .parent(&XMLNode) .composedOf(&XMLNode) @@ -127,6 +127,6 @@ namespace RttiTypes {[](const xml::Element *obj) { return Variant::fromString(obj->name); }}}); - const RttiType XMLText = RttiBuilder<xml::Text>("XMLText").parent(&XMLNode); + const Rtti XMLText = RttiBuilder<xml::Text>("XMLText").parent(&XMLNode); } } diff --git a/src/core/XML.hpp b/src/core/XML.hpp index db7a9e1..67489f1 100644 --- a/src/core/XML.hpp +++ b/src/core/XML.hpp @@ -51,7 +51,7 @@ namespace ousia { // Forward declarations -class RttiType; +class Rtti; namespace xml { @@ -171,9 +171,9 @@ public: } namespace RttiTypes { -extern const RttiType XMLNode; -extern const RttiType XMLElement; -extern const RttiType XMLText; +extern const Rtti XMLNode; +extern const Rtti XMLElement; +extern const Rtti XMLText; } } #endif diff --git a/src/core/common/Argument.cpp b/src/core/common/Argument.cpp index a4c153d..21d4f6c 100644 --- a/src/core/common/Argument.cpp +++ b/src/core/common/Argument.cpp @@ -27,8 +27,8 @@ namespace ousia { /* Class Argument */ -Argument::Argument(std::string name, const RttiType &type, - const RttiType &innerType, Variant defaultValue, +Argument::Argument(std::string name, const Rtti &type, + const Rtti &innerType, Variant defaultValue, bool hasDefault) : type(type), innerType(innerType), @@ -38,12 +38,12 @@ Argument::Argument(std::string name, const RttiType &type, { } -Argument::Argument(std::string name, const RttiType &type, Variant defaultValue) +Argument::Argument(std::string name, const Rtti &type, Variant defaultValue) : Argument(std::move(name), type, RttiTypes::None, defaultValue, true) { } -Argument::Argument(std::string name, const RttiType &type) +Argument::Argument(std::string name, const Rtti &type) : Argument(std::move(name), type, RttiTypes::None, nullptr, false) { } @@ -99,13 +99,13 @@ Argument Argument::String(std::string name, return Argument{name, RttiTypes::String, Variant::fromString(defaultValue)}; } -Argument Argument::Object(std::string name, const RttiType &type) +Argument Argument::Object(std::string name, const Rtti &type) { return Argument(std::move(name), type, RttiTypes::None, Variant::fromObject(nullptr), false); } -Argument Argument::Object(std::string name, const RttiType &type, +Argument Argument::Object(std::string name, const Rtti &type, std::nullptr_t) { return Argument(std::move(name), type, RttiTypes::None, @@ -135,13 +135,13 @@ Argument Argument::Array(std::string name, return Argument(std::move(name), RttiTypes::Array, defaultValue); } -Argument Argument::Array(std::string name, const RttiType &innerType) +Argument Argument::Array(std::string name, const Rtti &innerType) { return Argument(std::move(name), RttiTypes::Array, innerType, nullptr, false); } -Argument Argument::Array(std::string name, const RttiType &innerType, +Argument Argument::Array(std::string name, const Rtti &innerType, const Variant::arrayType &defaultValue) { return Argument(std::move(name), RttiTypes::Array, innerType, defaultValue, @@ -158,12 +158,12 @@ Argument Argument::Map(std::string name, const Variant::mapType &defaultValue) return Argument(std::move(name), RttiTypes::Map, defaultValue); } -Argument Argument::Map(std::string name, const RttiType &innerType) +Argument Argument::Map(std::string name, const Rtti &innerType) { return Argument(std::move(name), RttiTypes::Map, innerType, nullptr, false); } -Argument Argument::Map(std::string name, const RttiType &innerType, +Argument Argument::Map(std::string name, const Rtti &innerType, const Variant::mapType &defaultValue) { return Argument(std::move(name), RttiTypes::Map, innerType, defaultValue, diff --git a/src/core/common/Argument.hpp b/src/core/common/Argument.hpp index dd652de..8d01c2d 100644 --- a/src/core/common/Argument.hpp +++ b/src/core/common/Argument.hpp @@ -44,7 +44,7 @@ namespace ousia { // Forward declaration class Logger; -class RttiType; +class Rtti; /** * The Argument class represents a single argument that can be passed to a @@ -55,13 +55,13 @@ private: /** * Type that should be returned by the Variant rttiType function. */ - const RttiType &type; + const Rtti &type; /** * Describes the inner type of the variant -- e.g. the type of the elements - * inside an array. Normally set to RttiType::None. + * inside an array. Normally set to RttiTypes::None. */ - const RttiType &innerType; + const Rtti &innerType; /** * Private constructor used for manually setting all internal data fields. @@ -75,7 +75,7 @@ private: * @param hasDefault indicates whether the defaultValue actually should be * used. */ - Argument(std::string name, const RttiType &type, const RttiType &innerType, + Argument(std::string name, const Rtti &type, const Rtti &innerType, Variant defaultValue, bool hasDefault); /** @@ -87,7 +87,7 @@ private: * expected. * @param defaultValue is the default value to be used. */ - Argument(std::string name, const RttiType &type, Variant defaultValue); + Argument(std::string name, const Rtti &type, Variant defaultValue); /** * Private constructor used to build an argument describing a primitive type @@ -97,7 +97,7 @@ private: * @param variantType is the variant type of the argument that is to be * expected. */ - Argument(std::string name, const RttiType &type); + Argument(std::string name, const Rtti &type); public: /** @@ -226,11 +226,11 @@ public: * * @param name is the name of the argument as used for error messages and in * case the arguments are given as a map. - * @param type is the RttiType of acceptable objects. All objects where the + * @param type is the Rtti of acceptable objects. All objects where the * "isa" function returns true for the given type are be accepted. * @return a new Argument instance. */ - static Argument Object(std::string name, const RttiType &type); + static Argument Object(std::string name, const Rtti &type); /** * Named constructor for an object argument with default value. The default @@ -240,13 +240,13 @@ public: * * @param name is the name of the argument as used for error messages and in * case the arguments are given as a map. - * @param type is the RttiType of acceptable objects. All objects where the + * @param type is the Rtti of acceptable objects. All objects where the * "isa" function returns true for the given type are be accepted. * @param defaultValue must be set to nullptr. Default object instances * cannot be stored. * @return a new Argument instance. */ - static Argument Object(std::string name, const RttiType &type, + static Argument Object(std::string name, const Rtti &type, std::nullptr_t defaultValue); /** @@ -303,7 +303,7 @@ public: * forced to be of this type. * @return a new Argument instance. */ - static Argument Array(std::string name, const RttiType &innerType); + static Argument Array(std::string name, const Rtti &innerType); /** * Named constructor for an array argument of objects of the given RTTI @@ -317,7 +317,7 @@ public: * @param defaultValue is the default value to be used in case this argument * is not supplied. */ - static Argument Array(std::string name, const RttiType &innerType, + static Argument Array(std::string name, const Rtti &innerType, const Variant::arrayType &defaultValue); /** @@ -352,7 +352,7 @@ public: * to be of this type. * @return a new Argument instance. */ - static Argument Map(std::string name, const RttiType &innerType); + static Argument Map(std::string name, const Rtti &innerType); /** * Named constructor for a map argument with default value and a given inner @@ -366,7 +366,7 @@ public: * is not supplied. * @return a new Argument instance. */ - static Argument Map(std::string name, const RttiType &innerType, + static Argument Map(std::string name, const Rtti &innerType, const Variant::mapType &defaultValue); /** diff --git a/src/core/common/Property.hpp b/src/core/common/Property.hpp index 72dff71..10db869 100644 --- a/src/core/common/Property.hpp +++ b/src/core/common/Property.hpp @@ -47,15 +47,15 @@ public: }; // Forward declaration -class RttiType; +class Rtti; namespace RttiTypes { -extern const RttiType None; +extern const Rtti None; } /** * Structure describing the type of a property -- which consists of a "outer" * type (which may either be a primitive variant type such as e.g. - * RttiTypes::Int or any other RttiType instance) and an inner type, which + * RttiTypes::Int or any other Rtti instance) and an inner type, which * describes the type contained within a container type such as RttiTypes::Array * or RttiTypes::Map. */ @@ -64,17 +64,17 @@ struct PropertyType { static const PropertyType None; /** - * Outer type, may be any RttiType instance. If set to RttiType::None, any + * Outer type, may be any Rtti instance. If set to RttiTypes::None, any * outer type is acceptable. */ - const RttiType &type; + const Rtti &type; /** * Describes the inner type of the property used when the outer type is a - * container type such as RttiType::Array or RttiType::Map. If set to - * RttiType::None any inner type is acceptable. + * container type such as RttiTypes::Array or RttiTypes::Map. If set to + * RttiTypes::None any inner type is acceptable. */ - const RttiType &innerType; + const Rtti &innerType; /** * Creates a new instance of the PropertyType class with both inner and @@ -88,10 +88,10 @@ struct PropertyType { * type. * * @param type is the "outer" type of the PropertyType instance which may - * be any RttiType instances or RttiType::None, in which case all types are + * be any Rtti instances or RttiTypes::None, in which case all types are * allowed. */ - PropertyType(const RttiType &type) + PropertyType(const Rtti &type) : type(type), innerType(RttiTypes::None){}; /** @@ -99,13 +99,13 @@ struct PropertyType { * inner type. * * @param type is the "outer" type of the PropertyType instance which may - * be any RttiType instances or RttiType::None, in which case all types are + * be any Rtti instances or RttiTypes::None, in which case all types are * allowed. * @param innerType is the inner type of the PropertyType instance, which is * relevant if the outer type is set to a basic container type, namely * RttiTypes::Array or RttiTypes::Map. */ - PropertyType(const RttiType &type, const RttiType &innerType) + PropertyType(const Rtti &type, const Rtti &innerType) : type(type), innerType(innerType){}; }; @@ -448,13 +448,13 @@ public: * * @param type is the type of the field that can be accessed by the * property. This may either be a primitive variant type such as e.g. - * RttiTypes::Int or any other RttiType instance + * RttiTypes::Int or any other Rtti instance * @param getter is a Getter for accessing the described property for * objects of type T. * @param setter is a Setter for writing the described property for objects * of type T. */ - Property(const RttiType &type, const Getter<T> &getter, + Property(const Rtti &type, const Getter<T> &getter, const Setter<T> &setter = Setter<T>{}) : PropertyDescriptor( PropertyType{type}, @@ -468,7 +468,7 @@ public: * * @param type is the type of the field that can be accessed by the * property. This may either be a primitive variant type such as e.g. - * RttiTypes::Int or any other RttiType instance. + * RttiTypes::Int or any other Rtti instance. * @param innerType is only relevant if type is set to either * RttiTypes::Array or RttiTypes::Map. In this case the innerType describes * the type of the elements stored inside these containers. @@ -477,7 +477,7 @@ public: * @param setter is a Setter for writing the described property for objects * of type T. */ - Property(const RttiType &type, const RttiType &innerType, + Property(const Rtti &type, const Rtti &innerType, const Getter<T> &getter, const Setter<T> &setter = Setter<T>{}) : PropertyDescriptor( PropertyType{type, innerType}, diff --git a/src/core/common/Rtti.cpp b/src/core/common/Rtti.cpp index ad77973..1213669 100644 --- a/src/core/common/Rtti.cpp +++ b/src/core/common/Rtti.cpp @@ -23,18 +23,18 @@ namespace ousia { /* Class RttiStore */ -std::unordered_map<std::type_index, const RttiType *> &RttiStore::table() +std::unordered_map<std::type_index, const Rtti *> &RttiStore::table() { - static std::unordered_map<std::type_index, const RttiType *> table; + static std::unordered_map<std::type_index, const Rtti *> table; return table; } -void RttiStore::store(const std::type_info &native, const RttiType *rtti) +void RttiStore::store(const std::type_info &native, const Rtti *rtti) { table().emplace(std::type_index{native}, rtti); } -const RttiType &RttiStore::lookup(const std::type_info &native) +const Rtti &RttiStore::lookup(const std::type_info &native) { const auto &tbl = table(); auto it = tbl.find(std::type_index{native}); @@ -69,9 +69,9 @@ RttiBuilderBase &RttiBuilderBase::genericProperty( return *this; } -/* Class RttiType */ +/* Class Rtti */ -void RttiType::initialize() const +void Rtti::initialize() const { // Only run this function exactly once -- directly set the initialized flag // to prevent unwanted recursion @@ -80,7 +80,7 @@ void RttiType::initialize() const // Register the parent properties and methods { - for (const RttiType *parent: parents) { + for (const Rtti *parent: parents) { parent->initialize(); methods.insert(parent->methods.begin(), parent->methods.end()); properties.insert(parent->properties.begin(), parent->properties.end()); @@ -90,12 +90,12 @@ void RttiType::initialize() const // Insert the parent types of the parent types and the composite types // of the parents { - std::unordered_set<const RttiType *> origParents = parents; - for (const RttiType *parent : origParents) { + std::unordered_set<const Rtti *> origParents = parents; + for (const Rtti *parent : origParents) { parent->initialize(); parents.insert(parent->parents.begin(), parent->parents.end()); } - for (const RttiType *parent : parents) { + for (const Rtti *parent : parents) { parent->initialize(); compositeTypes.insert(parent->compositeTypes.begin(), parent->compositeTypes.end()); @@ -106,9 +106,9 @@ void RttiType::initialize() const // Insert the composite types of the composite types and the parents // of each composite type { - std::unordered_set<const RttiType *> origCompositeTypes = + std::unordered_set<const Rtti *> origCompositeTypes = compositeTypes; - for (const RttiType *compositeType : origCompositeTypes) { + for (const Rtti *compositeType : origCompositeTypes) { compositeType->initialize(); compositeTypes.insert(compositeType->compositeTypes.begin(), compositeType->compositeTypes.end()); @@ -119,29 +119,29 @@ void RttiType::initialize() const } } -bool RttiType::isa(const RttiType &other) const +bool Rtti::isa(const Rtti &other) const { initialize(); return parents.count(&other) > 0; } -bool RttiType::composedOf(const RttiType &other) const +bool Rtti::composedOf(const Rtti &other) const { initialize(); return compositeTypes.count(&other) > 0; } -const RttiMethodMap &RttiType::getMethods() const { +const RttiMethodMap &Rtti::getMethods() const { initialize(); return methods; } -const RttiPropertyMap &RttiType::getProperties() const { +const RttiPropertyMap &Rtti::getProperties() const { initialize(); return properties; } -std::shared_ptr<Function> RttiType::getMethod(const std::string &name) const +std::shared_ptr<Function> Rtti::getMethod(const std::string &name) const { initialize(); auto it = methods.find(name); @@ -151,7 +151,7 @@ std::shared_ptr<Function> RttiType::getMethod(const std::string &name) const return it->second; } -std::shared_ptr<PropertyDescriptor> RttiType::getProperty(const std::string &name) const +std::shared_ptr<PropertyDescriptor> Rtti::getProperty(const std::string &name) const { initialize(); auto it = properties.find(name); @@ -161,12 +161,12 @@ std::shared_ptr<PropertyDescriptor> RttiType::getProperty(const std::string &nam return it->second; } -bool RttiType::hasMethod(const std::string &name) const +bool Rtti::hasMethod(const std::string &name) const { return methods.count(name) > 0; } -bool RttiType::hasProperty(const std::string &name) const +bool Rtti::hasProperty(const std::string &name) const { return properties.count(name) > 0; } @@ -174,15 +174,15 @@ bool RttiType::hasProperty(const std::string &name) const /* Constant initialization */ namespace RttiTypes { -const RttiType None{"none"}; -const RttiType Nullptr{"nullptr"}; -const RttiType Bool{"bool"}; -const RttiType Int{"int"}; -const RttiType Double{"double"}; -const RttiType String{"string"}; -const RttiType Array{"array"}; -const RttiType Map{"map"}; -const RttiType Function{"function"}; +const Rtti None{"none"}; +const Rtti Nullptr{"nullptr"}; +const Rtti Bool{"bool"}; +const Rtti Int{"int"}; +const Rtti Double{"double"}; +const Rtti String{"string"}; +const Rtti Array{"array"}; +const Rtti Map{"map"}; +const Rtti Function{"function"}; } } diff --git a/src/core/common/Rtti.hpp b/src/core/common/Rtti.hpp index 6b6eff0..fa2692f 100644 --- a/src/core/common/Rtti.hpp +++ b/src/core/common/Rtti.hpp @@ -34,7 +34,7 @@ * this would create a significant overhead. * * <b>How to use:</b> The Rtti class allows to attach information to a certain - * C++ class. To do so, create a global constant of the type RttiType in the + * C++ class. To do so, create a global constant of the type Rtti in the * source file associated with the type declaration, where T is the type you * want to register. As the type must only be registered once, you must not * declare the variable as "static" in the header file (this would register it @@ -50,7 +50,7 @@ * // Only needed if the type needs to be accessed * // from other compilation units! * namespace RttiTypes { - * extern const RttiType MyT; + * extern const Rtti MyT; * } * \endcode * In the source file: @@ -60,7 +60,7 @@ * // [...] * * namespace RttiTypes { - * const RttiType MyT = RttiBuilder<ousia::MyT>("MyT"); + * const Rtti MyT = RttiBuilder<ousia::MyT>("MyT"); * } * \endcode * @@ -79,14 +79,14 @@ namespace ousia { -class RttiType; +class Rtti; class Function; class PropertyDescriptor; /** - * Type describing a set of RttiType pointers. + * Type describing a set of Rtti pointers. */ -using RttiTypeSet = std::unordered_set<const RttiType *>; +using RttiSet = std::unordered_set<const Rtti *>; /** * Type describing a map containing methods and their name. @@ -109,11 +109,11 @@ private: * Function used internally to access the static map storing all registered * native types and their corresponding type information. */ - static std::unordered_map<std::type_index, const RttiType *> &table(); + static std::unordered_map<std::type_index, const Rtti *> &table(); public: /** - * Registers the given pointer to the RttiType class in the RTTI table. Does + * Registers the given pointer to the Rtti class in the RTTI table. Does * not override information for already registered types. * * @param native is a reference at the native type information provided @@ -121,19 +121,19 @@ public: * @param rtti is a pointer pointing at the type information that should be * stored for this type. */ - static void store(const std::type_info &native, const RttiType *rtti); + static void store(const std::type_info &native, const Rtti *rtti); /** * Looks up the type information stored for the given native type * information. */ - static const RttiType &lookup(const std::type_info &native); + static const Rtti &lookup(const std::type_info &native); }; /** * The RttiBuilderBase class is used to build new instances of the Rtti or the - * RttiType class. It follows the "Builder" pattern and allows to create - * the properties of the RttiType class by chaining method calls. The RttiType + * Rtti class. It follows the "Builder" pattern and allows to create + * the properties of the Rtti class by chaining method calls. The RttiType * class can be constructed from the RttiBuilderBase instance. Use the * RttiBuilder class for a more convenient, templated version that does not * require the native C++ type in the constructor and allows for more convenient @@ -156,12 +156,12 @@ public: /** * Set containing references to all parent types. */ - RttiTypeSet parentTypes; + RttiSet parentTypes; /** * Set containing references to all composite types. */ - RttiTypeSet compositeTypes; + RttiSet compositeTypes; /** * Map containing all methods. @@ -175,7 +175,7 @@ public: /** * Default constructor, initializes the name of the type described by the - * RttiTypeSet with "unknown". + * RttiSet with "unknown". * * @param native is the native C++ type information for which the type * information is being built. @@ -185,7 +185,7 @@ public: /** * Default constructor, initializes the name of the type described by the - * RttiTypeSet with the given name. + * RttiSet with the given name. * * @param native is the native C++ type information for which the type * information is being built. @@ -217,7 +217,7 @@ public: * @return a reference to the current RttiBuilderBase instance to allow * method chaining. */ - RttiBuilderBase &parent(const RttiType *p) + RttiBuilderBase &parent(const Rtti *p) { parentTypes.insert(p); return *this; @@ -231,7 +231,7 @@ public: * @return a reference to the current RttiBuilderBase instance to allow * method chaining. */ - RttiBuilderBase &parent(const RttiTypeSet &p) + RttiBuilderBase &parent(const RttiSet &p) { parentTypes.insert(p.begin(), p.end()); return *this; @@ -246,7 +246,7 @@ public: * @return a reference to the current RttiBuilderBase instance to allow * method chaining. */ - RttiBuilderBase &composedOf(const RttiType *p) + RttiBuilderBase &composedOf(const Rtti *p) { compositeTypes.insert(p); return *this; @@ -261,7 +261,7 @@ public: * @return a reference to the current RttiBuilderBase instance to allow * method chaining. */ - RttiBuilderBase &composedOf(const RttiTypeSet &p) + RttiBuilderBase &composedOf(const RttiSet &p) { compositeTypes.insert(p.begin(), p.end()); return *this; @@ -272,7 +272,7 @@ public: * type descriptor. * * @param name is the name of the method. Names must be unique for one - * RttiType instance. If the name is not unique, an exception is thrown. + * Rtti instance. If the name is not unique, an exception is thrown. * @param function is the function that should be registered. * @return a reference to the current RttiBuilderBase instance to allow * method chaining. @@ -285,7 +285,7 @@ public: * for this RTTI type descriptor. * * @param name is the name of the property. Names must be unique for one - * RttiType instance. If the property is not unique, an exception is thrown. + * Rtti instance. If the property is not unique, an exception is thrown. * @param property is the property that should be registered. * @return a reference to the current RttiBuilderBase instance to allow * method chaining. @@ -295,13 +295,13 @@ public: }; /** - * The RttiType class allows for attaching data to native types that can be + * The Rtti class allows for attaching data to native types that can be * accessed at runtime. This type information can e.g. be retrieved using the * "type" method of the Managed class. This system is used for attaching human * readable names, parent types and script engine functionality. Use the - * RttiType class for convenient registration of type information. + * Rtti class for convenient registration of type information. */ -class RttiType { +class Rtti { private: /** * Set to true if once the parents and the composite types list have been @@ -313,13 +313,13 @@ private: /** * Set containing references to all parent types, including their parents. */ - mutable RttiTypeSet parents; + mutable RttiSet parents; /** * Set containing references to all types this type is a composition of, * including all composite types of the original composite types. */ - mutable RttiTypeSet compositeTypes; + mutable RttiSet compositeTypes; /** * Map used for storing all registered methods. @@ -344,13 +344,13 @@ public: const std::string name; /** - * Creates a new RttiType instance and registers it in the global type + * Creates a new Rtti instance and registers it in the global type * table. Use the Rtti class for more convenient registration of type * information. * * @param builder is the builder instance containing the Rtti data. */ - RttiType(const RttiBuilderBase &builder) + Rtti(const RttiBuilderBase &builder) : initialized(false), parents(std::move(builder.parentTypes)), compositeTypes(std::move(builder.compositeTypes)), @@ -365,12 +365,12 @@ public: * Default constructor. Creates a Rtti instance with name "unknown" * and no parents. */ - RttiType() : name("unknown") {} + Rtti() : name("unknown") {} /** - * Constructor for an empty RttiType with the given name. + * Constructor for an empty Rtti with the given name. */ - RttiType(std::string name) : name(std::move(name)) {} + Rtti(std::string name) : name(std::move(name)) {} /** * Returns true if this Rtti instance is the given type or has the @@ -379,7 +379,7 @@ public: * @param other is the other type for which the relation to this type * should be checked. */ - bool isa(const RttiType &other) const; + bool isa(const Rtti &other) const; /** * Returns true if an instance of this type may have references to the other @@ -389,7 +389,7 @@ public: * @param other is the other type for which should be checked whether this * type is directly or indirectly composed of it. */ - bool composedOf(const RttiType &other) const; + bool composedOf(const Rtti &other) const; /** * Returns all methods that are registered for this type (and the parent @@ -457,7 +457,7 @@ public: * @tparam T is the C++ type for which the type information should be returned. */ template <typename T> -inline const RttiType &typeOf() +inline const Rtti &typeOf() { return RttiStore::lookup(typeid(T)); } @@ -473,7 +473,7 @@ inline const RttiType &typeOf() * returned. */ template <typename T> -inline const RttiType &typeOf(const T &obj) +inline const Rtti &typeOf(const T &obj) { return RttiStore::lookup(typeid(obj)); } @@ -482,47 +482,47 @@ namespace RttiTypes { /** * Type of no particular type. */ -extern const RttiType None; +extern const Rtti None; /** - * Nullptr type for use by the Variant::getRttiType method. + * Nullptr type for use by the Variant::getRtti method. */ -extern const RttiType Nullptr; +extern const Rtti Nullptr; /** - * Bool type for use by the Variant::getRttiType method. + * Bool type for use by the Variant::getRtti method. */ -extern const RttiType Bool; +extern const Rtti Bool; /** - * Integer type for use by the Variant::getRttiType method. + * Integer type for use by the Variant::getRtti method. */ -extern const RttiType Int; +extern const Rtti Int; /** - * Double type for use by the Variant::getRttiType method. + * Double type for use by the Variant::getRtti method. */ -extern const RttiType Double; +extern const Rtti Double; /** - * String type for use by the Variant::getRttiType method. + * String type for use by the Variant::getRtti method. */ -extern const RttiType String; +extern const Rtti String; /** - * Array type for use by the Variant::getRttiType method. + * Array type for use by the Variant::getRtti method. */ -extern const RttiType Array; +extern const Rtti Array; /** - * Map type for use by the Variant::getRttiType method. + * Map type for use by the Variant::getRtti method. */ -extern const RttiType Map; +extern const Rtti Map; /** - * Function type for use by the Variant::getRttiType method. + * Function type for use by the Variant::getRtti method. */ -extern const RttiType Function; +extern const Rtti Function; } } diff --git a/src/core/common/RttiBuilder.hpp b/src/core/common/RttiBuilder.hpp index 4b27058..442f358 100644 --- a/src/core/common/RttiBuilder.hpp +++ b/src/core/common/RttiBuilder.hpp @@ -45,13 +45,13 @@ class RttiBuilder : public RttiBuilderBase { public: /** * Default constructor, initializes the name of the type described by the - * RttiTypeSet with "unknown". + * RttiSet with "unknown". */ RttiBuilder() : RttiBuilderBase(typeid(T)){}; /** * Default constructor, initializes the name of the type described by the - * RttiTypeSet with the given name. + * RttiSet with the given name. * * @param name is the initial name of the type described by the type * builder. @@ -78,7 +78,7 @@ public: * @param p is the pointer to the type descriptor that should be added. * @return a reference to the current RttiBuilder to allow method chaining. */ - RttiBuilder<T> &parent(const RttiType *p) + RttiBuilder<T> &parent(const Rtti *p) { RttiBuilderBase::parent(p); return *this; @@ -91,7 +91,7 @@ public: * @param p is the pointer to the type descriptor that should be added. * @return a reference to the current RttiBuilder to allow method chaining. */ - RttiBuilder<T> &parent(const RttiTypeSet &p) + RttiBuilder<T> &parent(const RttiSet &p) { RttiBuilderBase::parent(p); return *this; @@ -105,7 +105,7 @@ public: * composition type. * @return a reference to the current RttiBuilder to allow method chaining. */ - RttiBuilder<T> &composedOf(const RttiType *p) + RttiBuilder<T> &composedOf(const Rtti *p) { RttiBuilderBase::composedOf(p); return *this; @@ -119,7 +119,7 @@ public: * composition type. * @return a reference to the current RttiBuilder to allow method chaining. */ - RttiBuilder<T> &composedOf(const RttiTypeSet &p) + RttiBuilder<T> &composedOf(const RttiSet &p) { RttiBuilderBase::composedOf(p); return *this; @@ -130,7 +130,7 @@ public: * type descriptor. * * @param name is the name of the method. Names must be unique for one - * RttiType instance. If the name is not unique, an exception is thrown. + * Rtti instance. If the name is not unique, an exception is thrown. * @param function is the function that should be registered. * @return a reference to the current RttiBuilder to allow method chaining. */ @@ -146,7 +146,7 @@ public: * for this RTTI type descriptor. * * @param name is the name of the property. Names must be unique for one - * RttiType instance. If the property is not unique, an exception is thrown. + * Rtti instance. If the property is not unique, an exception is thrown. * @param property is the property that should be registered. * @return a reference to the current RttiBuilder to allow method chaining. */ @@ -161,7 +161,7 @@ public: * Registers a method for this RTTI type descriptor. * * @param name is the name of the method. Names must be unique for one - * RttiType instance. If the name is not unique, an exception is thrown. + * Rtti instance. If the name is not unique, an exception is thrown. * @param method is the function that should be registered. * @return a reference to the current RttiBuilder to allow method chaining. */ @@ -174,7 +174,7 @@ public: * Registers a method for this RTTI type descriptor. * * @param name is the name of the method. Names must be unique for one - * RttiType instance. If the name is not unique, an exception is thrown. + * Rtti instance. If the name is not unique, an exception is thrown. * @param method is the function that should be registered. * @return a reference to the current RttiBuilder to allow method chaining. */ @@ -188,7 +188,7 @@ public: * Registers a property for this RTTI type descriptor. * * @param name is the name of the property. Names must be unique for one - * RttiType instance. If the property is not unique, an exception is thrown. + * Rtti instance. If the property is not unique, an exception is thrown. * @param property is the property that should be registered. * @return a reference to the current RttiBuilder to allow method chaining. */ diff --git a/src/core/common/Variant.cpp b/src/core/common/Variant.cpp index 81e6339..c5db4e5 100644 --- a/src/core/common/Variant.cpp +++ b/src/core/common/Variant.cpp @@ -112,7 +112,7 @@ Variant::arrayType Variant::toArray() const return res.asArray(); } -Variant::arrayType Variant::toArray(const RttiType &innerType) const +Variant::arrayType Variant::toArray(const Rtti &innerType) const { ExceptionLogger logger; Variant res{*this}; @@ -128,7 +128,7 @@ Variant::mapType Variant::toMap() const return res.asMap(); } -Variant::mapType Variant::toMap(const RttiType &innerType) const +Variant::mapType Variant::toMap(const Rtti &innerType) const { ExceptionLogger logger; Variant res{*this}; @@ -138,7 +138,7 @@ Variant::mapType Variant::toMap(const RttiType &innerType) const /* Type management */ -const RttiType& Variant::getRttiType() const +const Rtti& Variant::getRtti() const { switch (type) { case VariantType::NULLPTR: diff --git a/src/core/common/Variant.hpp b/src/core/common/Variant.hpp index 7ec3481..381a13e 100644 --- a/src/core/common/Variant.hpp +++ b/src/core/common/Variant.hpp @@ -48,7 +48,7 @@ namespace ousia { // Forward declarations class Function; -class RttiType; +class Rtti; /** * Enum containing the possible types a variant may have. @@ -764,7 +764,7 @@ public: * to. * @return the value of the variant as array. */ - arrayType toArray(const RttiType &innerType) const; + arrayType toArray(const Rtti &innerType) const; /** * Returns the value of the Variant as map. @@ -781,7 +781,7 @@ public: * to. * @return the value of the variant as map. */ - mapType toMap(const RttiType &innerType) const; + mapType toMap(const Rtti &innerType) const; /** * Sets the variant to null. @@ -939,9 +939,9 @@ public: * @return the Rtti type descriptor. Either one of RttiTypes::Int, * RttiTypes::Bool, RttiTypes::Double, RttiTypes::String, RttiTypes::Array * or RttiTypes::Function or -- in case an object is stored inside the - * variant -- the RttiType of that object. + * variant -- the Rtti of that object. */ - const RttiType &getRttiType() const; + const Rtti &getRtti() const; /** * Returns the name of the given variant type as C-style string. diff --git a/src/core/common/VariantConverter.cpp b/src/core/common/VariantConverter.cpp index 0f293f5..a14c003 100644 --- a/src/core/common/VariantConverter.cpp +++ b/src/core/common/VariantConverter.cpp @@ -270,7 +270,7 @@ bool VariantConverter::toString(Variant &var, Logger &logger, Mode mode) return false; } -bool VariantConverter::toArray(Variant &var, const RttiType &innerType, +bool VariantConverter::toArray(Variant &var, const Rtti &innerType, Logger &logger, Mode mode) { // If unsafe conversions are allowed, encapsulate the given variant in an @@ -302,7 +302,7 @@ bool VariantConverter::toArray(Variant &var, const RttiType &innerType, return false; } -bool VariantConverter::toMap(Variant &var, const RttiType &innerType, +bool VariantConverter::toMap(Variant &var, const Rtti &innerType, Logger &logger, Mode mode) { // Make sure the variant is a map @@ -341,8 +341,8 @@ bool VariantConverter::toFunction(Variant &var, Logger &logger) return false; } -bool VariantConverter::convert(Variant &var, const RttiType &type, - const RttiType &innerType, Logger &logger, +bool VariantConverter::convert(Variant &var, const Rtti &type, + const Rtti &innerType, Logger &logger, Mode mode) { // Check for simple Variant types @@ -382,16 +382,16 @@ bool VariantConverter::convert(Variant &var, const RttiType &type, } // Make sure the object type is correct - if (!var.getRttiType().isa(type)) { + if (!var.getRtti().isa(type)) { logger.error(std::string("Expected object of type ") + type.name + - " but got object of type " + var.getRttiType().name); + " but got object of type " + var.getRtti().name); var.setObject(nullptr); return false; } return true; } -bool VariantConverter::convert(Variant &var, const RttiType &type, +bool VariantConverter::convert(Variant &var, const Rtti &type, Logger &logger, Mode mode) { return convert(var, type, RttiTypes::None, logger, mode); diff --git a/src/core/common/VariantConverter.hpp b/src/core/common/VariantConverter.hpp index 6becbc4..0e66e39 100644 --- a/src/core/common/VariantConverter.hpp +++ b/src/core/common/VariantConverter.hpp @@ -33,7 +33,7 @@ namespace ousia { // Forward declaration class Logger; -class RttiType; +class Rtti; class Variant; /** @@ -160,7 +160,7 @@ public: * @return true if the operation was successful, false otherwise. In any * case the input/output parameter "var" will have the requested type. */ - static bool toArray(Variant &var, const RttiType &innerType, Logger &logger, + static bool toArray(Variant &var, const Rtti &innerType, Logger &logger, Mode mode = Mode::SAFE); @@ -180,7 +180,7 @@ public: * @return true if the operation was successful, false otherwise. In any * case the input/output parameter "var" will have the requested type. */ - static bool toMap(Variant &var, const RttiType &innerType, Logger &logger, + static bool toMap(Variant &var, const Rtti &innerType, Logger &logger, Mode mode = Mode::SAFE); /** @@ -195,17 +195,17 @@ public: static bool toFunction(Variant &var, Logger &logger); /** - * Tries conversion to the given RttiType with the given optional inner + * Tries conversion to the given Rtti with the given optional inner * type. * * @param type describes the type to which the variant should be converted. - * This might either be a variant type such as RttiType::Bool, - * RttiType::Int, RttiType::Double, RttiType::String, RttiType::Array, - * RttiType::Map or RttiType::Function. All other types are regarded as - * managed object of this type. If RttiType::None is given, all types are + * This might either be a variant type such as RttiTypes::Bool, + * RttiTypes::Int, RttiTypes::Double, RttiTypes::String, RttiTypes::Array, + * RttiTypes::Map or RttiTypes::Function. All other types are regarded as + * managed object of this type. If RttiTypes::None is given, all types are * accepted. * @param innerType is used in case of maps or arrays to check the type of - * the elements of these containers. If RttiType::None is given, no special + * the elements of these containers. If RttiTypes::None is given, no special * type is required. * @param logger is a reference at the logger instance to which error * messages are forwarded. @@ -213,19 +213,19 @@ public: * @return true if the operation was successful, false otherwise. In any * case the input/output parameter "var" will have the requested type. */ - static bool convert(Variant &var, const RttiType &type, - const RttiType &innerType, Logger &logger, + static bool convert(Variant &var, const Rtti &type, + const Rtti &innerType, Logger &logger, Mode mode = Mode::SAFE); /** - * Tries conversion to the given RttiType without any enforcement regarding + * Tries conversion to the given Rtti without any enforcement regarding * the inner type of container types. * * @param type describes the type to which the variant should be converted. - * This might either be a variant type such as RttiType::Bool, - * RttiType::Int, RttiType::Double, RttiType::String, RttiType::Array, - * RttiType::Map or RttiType::Function. All other types are regarded as - * managed object of this type. If RttiType::None is given, all types are + * This might either be a variant type such as RttiTypes::Bool, + * RttiTypes::Int, RttiTypes::Double, RttiTypes::String, RttiTypes::Array, + * RttiTypes::Map or RttiTypes::Function. All other types are regarded as + * managed object of this type. If RttiTypes::None is given, all types are * accepted. * @param logger is a reference at the logger instance to which error * messages are forwarded. @@ -233,7 +233,7 @@ public: * @return true if the operation was successful, false otherwise. In any * case the input/output parameter "var" will have the requested type. */ - static bool convert(Variant &var, const RttiType &type, + static bool convert(Variant &var, const Rtti &type, Logger &logger, Mode mode = Mode::SAFE); }; } diff --git a/src/core/managed/Managed.cpp b/src/core/managed/Managed.cpp index d9f3a86..a3caa76 100644 --- a/src/core/managed/Managed.cpp +++ b/src/core/managed/Managed.cpp @@ -77,11 +77,11 @@ bool Managed::unregisterEvent(EventType type, EventHandler handler, bool Managed::triggerEvent(Event &ev) { return mgr.triggerEvent(this, ev); } -const RttiType &Managed::type() const { return typeOf(*this); } +const Rtti &Managed::type() const { return typeOf(*this); } -bool Managed::isa(const RttiType &t) const { return type().isa(t); } +bool Managed::isa(const Rtti &t) const { return type().isa(t); } -bool Managed::composedOf(const RttiType &t) const +bool Managed::composedOf(const Rtti &t) const { return type().composedOf(t); } diff --git a/src/core/managed/Managed.hpp b/src/core/managed/Managed.hpp index e98e95e..08158b2 100644 --- a/src/core/managed/Managed.hpp +++ b/src/core/managed/Managed.hpp @@ -41,7 +41,7 @@ class Rooted; template <class T> class Owned; -class RttiType; +class Rtti; // TODO: Implement clone, getReferenced and getReferencing @@ -207,32 +207,32 @@ public: /* RTTI methods */ /** - * Returns the RttiType instance registered for instances of the type of + * Returns the Rtti instance registered for instances of the type of * this Managed instance. * - * @return a reference to the registered RttiType for this particular + * @return a reference to the registered Rtti for this particular * Managed class. */ - const RttiType &type() const; + const Rtti &type() const; /** * Returns true if this Managed instance is of the type described by the - * given RttiType instance. + * given Rtti instance. * - * @param true if the RttiType registered for this particular Managed + * @param true if the Rtti registered for this particular Managed * class is of the given type or one of the registered parent types is of * the given type. */ - bool isa(const RttiType &t) const; + bool isa(const Rtti &t) const; /** * Returns true if this Managed instance may contain instances of the type - * described by the given RttiType instance. + * described by the given Rtti instance. * - * @param true if the RttiType registered for this particular Managed class + * @param true if the Rtti registered for this particular Managed class * may contain instance of the given type. */ - bool composedOf(const RttiType &t) const; + bool composedOf(const Rtti &t) const; }; /** diff --git a/src/core/managed/Manager.cpp b/src/core/managed/Manager.cpp index c6d7f93..212aa9d 100644 --- a/src/core/managed/Manager.cpp +++ b/src/core/managed/Manager.cpp @@ -592,7 +592,7 @@ void Manager::exportGraphviz(const char *filename) : std::vector<EventHandlerDescriptor>{}; // Read type information and Node name (if available) - const RttiType &type = objectPtr->type(); + const Rtti &type = objectPtr->type(); const std::string &typeName = type.name; // Fetch the name of the object if the object has a "name" property @@ -659,7 +659,7 @@ void Manager::exportGraphviz(const char *filename) while (edgeCount > 0) { // Get the type of the target element uintptr_t pTar = reinterpret_cast<uintptr_t>(e.first); - const RttiType &typeTar = e.first->type(); + const Rtti &typeTar = e.first->type(); // Get some information about the edge std::string port = ""; diff --git a/src/core/model/Document.cpp b/src/core/model/Document.cpp index 5ca257b..fc9ff8d 100644 --- a/src/core/model/Document.cpp +++ b/src/core/model/Document.cpp @@ -409,21 +409,21 @@ bool Document::hasChild(Handle<StructureNode> s) const /* Type registrations */ namespace RttiTypes { -const RttiType Document = +const Rtti Document = RttiBuilder<model::Document>("Document").parent(&Node).composedOf( {&AnnotationEntity, &StructuredEntity}); -const RttiType StructureNode = +const Rtti StructureNode = RttiBuilder<model::StructureNode>("StructureNode").parent(&Node); -const RttiType StructuredEntity = +const Rtti StructuredEntity = RttiBuilder<model::StructuredEntity>("StructuredEntity") .parent(&StructureNode) .composedOf({&StructuredEntity, &DocumentPrimitive, &Anchor}); -const RttiType DocumentPrimitive = +const Rtti DocumentPrimitive = RttiBuilder<model::DocumentPrimitive>("DocumentPrimitive") .parent(&StructureNode); -const RttiType Anchor = +const Rtti Anchor = RttiBuilder<model::Anchor>("Anchor").parent(&StructureNode); -const RttiType AnnotationEntity = +const Rtti AnnotationEntity = RttiBuilder<model::AnnotationEntity>("AnnotationEntity") .parent(&Node) .composedOf({&StructuredEntity, &DocumentPrimitive, &Anchor}); diff --git a/src/core/model/Document.hpp b/src/core/model/Document.hpp index 164d9ba..7c5ee3c 100644 --- a/src/core/model/Document.hpp +++ b/src/core/model/Document.hpp @@ -120,7 +120,7 @@ namespace ousia { // Forward declarations -class RttiType; +class Rtti; namespace model { @@ -642,13 +642,13 @@ public: } namespace RttiTypes { -extern const RttiType Document; -extern const RttiType DocumentEntity; -extern const RttiType AnnotationEntity; -extern const RttiType StructureNode; -extern const RttiType StructuredEntity; -extern const RttiType DocumentPrimitive; -extern const RttiType Anchor; +extern const Rtti Document; +extern const Rtti DocumentEntity; +extern const Rtti AnnotationEntity; +extern const Rtti StructureNode; +extern const Rtti StructuredEntity; +extern const Rtti DocumentPrimitive; +extern const Rtti Anchor; } } diff --git a/src/core/model/Domain.cpp b/src/core/model/Domain.cpp index 6f50b1c..e4f087c 100644 --- a/src/core/model/Domain.cpp +++ b/src/core/model/Domain.cpp @@ -279,16 +279,16 @@ void Domain::addAnnotationClass(Handle<AnnotationClass> a) /* Type registrations */ namespace RttiTypes { -const RttiType FieldDescriptor = +const Rtti FieldDescriptor = RttiBuilder<model::FieldDescriptor>("FieldDescriptor").parent(&Node); -const RttiType Descriptor = +const Rtti Descriptor = RttiBuilder<model::Descriptor>("Descriptor").parent(&Node); -const RttiType StructuredClass = +const Rtti StructuredClass = RttiBuilder<model::StructuredClass>("StructuredClass").parent(&Descriptor).composedOf( &FieldDescriptor); -const RttiType AnnotationClass = +const Rtti AnnotationClass = RttiBuilder<model::AnnotationClass>("AnnotationClass").parent(&Descriptor); -const RttiType Domain = +const Rtti Domain = RttiBuilder<model::Domain>("Domain").parent(&Node).composedOf( {&StructuredClass, &AnnotationClass}); } diff --git a/src/core/model/Domain.hpp b/src/core/model/Domain.hpp index 86e2992..579a65c 100644 --- a/src/core/model/Domain.hpp +++ b/src/core/model/Domain.hpp @@ -211,7 +211,7 @@ namespace ousia { // Forward declarations -class RttiType; +class Rtti; namespace model { @@ -771,11 +771,11 @@ public: namespace RttiTypes { -extern const RttiType FieldDescriptor; -extern const RttiType Descriptor; -extern const RttiType StructuredClass; -extern const RttiType AnnotationClass; -extern const RttiType Domain; +extern const Rtti FieldDescriptor; +extern const Rtti Descriptor; +extern const Rtti StructuredClass; +extern const Rtti AnnotationClass; +extern const Rtti Domain; } } diff --git a/src/core/model/Node.cpp b/src/core/model/Node.cpp index d069eee..c4892af 100644 --- a/src/core/model/Node.cpp +++ b/src/core/model/Node.cpp @@ -67,7 +67,7 @@ public: /** * Type of the node that was requested for resolution. */ - const RttiType &type; + const Rtti &type; /** * Tracks all nodes that have already been visited. @@ -90,7 +90,7 @@ public: * @param type is the type of the node that should be resolved. */ SharedResolutionState(const std::vector<std::string> &path, - const RttiType &type) + const Rtti &type) : path(path), type(type) { } @@ -187,9 +187,9 @@ public: * * @return true if the type matches, false otherwise. */ - bool typeMatches(const RttiType &type) { return type.isa(shared.type); } + bool typeMatches(const Rtti &type) { return type.isa(shared.type); } - bool canContainType(const RttiType &type) + bool canContainType(const Rtti &type) { return type.composedOf(shared.type); } @@ -331,7 +331,7 @@ bool Node::continueResolveReference(Handle<Node> h, ResolutionState &state) } std::vector<ResolutionResult> Node::resolve( - const std::vector<std::string> &path, const RttiType &type) + const std::vector<std::string> &path, const Rtti &type) { // Create the state variables SharedResolutionState sharedState(path, type); @@ -347,7 +347,7 @@ std::vector<ResolutionResult> Node::resolve( } std::vector<ResolutionResult> Node::resolve(const std::string &name, - const RttiType &type) + const Rtti &type) { // Place the name in a vector and call the corresponding resolve function return resolve(std::vector<std::string>{name}, type); @@ -437,7 +437,7 @@ bool Node::validate(Logger &logger) const /* RTTI type registrations */ namespace RttiTypes { -const RttiType Node = +const Rtti Node = RttiBuilder<ousia::Node>("Node") .property("name", {RttiTypes::String, {[](const ousia::Node *obj) { diff --git a/src/core/model/Node.hpp b/src/core/model/Node.hpp index 4db0cf7..190e8de 100644 --- a/src/core/model/Node.hpp +++ b/src/core/model/Node.hpp @@ -44,7 +44,7 @@ namespace ousia { // Forward declarations class Logger; -class RttiType; +class Rtti; /** * Describes the validity of a node structure. @@ -481,7 +481,7 @@ public: * the resolved elements. */ std::vector<ResolutionResult> resolve(const std::vector<std::string> &path, - const RttiType &type); + const Rtti &type); /** * Function which resolves a single name to a list of possible nodes @@ -493,7 +493,7 @@ public: * the resolved elements. */ std::vector<ResolutionResult> resolve(const std::string &name, - const RttiType &type); + const Rtti &type); /** * Checks whether this node is valid and returns true if it is and false @@ -573,7 +573,7 @@ namespace RttiTypes { /** * Typeinformation for the base "Node" class. */ -extern const RttiType Node; +extern const Rtti Node; } } diff --git a/src/core/model/Typesystem.cpp b/src/core/model/Typesystem.cpp index 6daa7fe..f26363c 100644 --- a/src/core/model/Typesystem.cpp +++ b/src/core/model/Typesystem.cpp @@ -566,26 +566,26 @@ SystemTypesystem::SystemTypesystem(Manager &mgr) /* RTTI type registrations */ namespace RttiTypes { -const RttiType Type = RttiBuilder<model::Type>("Type").parent(&Node); -const RttiType StringType = +const Rtti Type = RttiBuilder<model::Type>("Type").parent(&Node); +const Rtti StringType = RttiBuilder<model::StringType>("StringType").parent(&Type); -const RttiType IntType = RttiBuilder<model::IntType>("IntType").parent(&Type); -const RttiType DoubleType = +const Rtti IntType = RttiBuilder<model::IntType>("IntType").parent(&Type); +const Rtti DoubleType = RttiBuilder<model::DoubleType>("DoubleType").parent(&Type); -const RttiType BoolType = RttiBuilder<model::BoolType>("BoolType").parent(&Type); -const RttiType EnumType = RttiBuilder<model::EnumType>("EnumType").parent(&Type); -const RttiType StructType = +const Rtti BoolType = RttiBuilder<model::BoolType>("BoolType").parent(&Type); +const Rtti EnumType = RttiBuilder<model::EnumType>("EnumType").parent(&Type); +const Rtti StructType = RttiBuilder<model::StructType>("StructType").parent(&Type).composedOf(&Attribute); -const RttiType ArrayType = RttiBuilder<model::ArrayType>("ArrayType").parent(&Type); -const RttiType UnknownType = +const Rtti ArrayType = RttiBuilder<model::ArrayType>("ArrayType").parent(&Type); +const Rtti UnknownType = RttiBuilder<model::UnknownType>("UnknownType").parent(&Type); -const RttiType Constant = RttiBuilder<model::Constant>("Constant").parent(&Node); -const RttiType Attribute = RttiBuilder<model::Attribute>("Attribute").parent(&Node); -const RttiType Typesystem = +const Rtti Constant = RttiBuilder<model::Constant>("Constant").parent(&Node); +const Rtti Attribute = RttiBuilder<model::Attribute>("Attribute").parent(&Node); +const Rtti Typesystem = RttiBuilder<model::Typesystem>("Typesystem").parent(&Node).composedOf( {&StringType, &IntType, &DoubleType, &BoolType, &EnumType, &StructType, &Constant}); -const RttiType SystemTypesystem = +const Rtti SystemTypesystem = RttiBuilder<model::SystemTypesystem> ("SystemTypesystem").parent(&Typesystem); } } diff --git a/src/core/model/Typesystem.hpp b/src/core/model/Typesystem.hpp index a126813..dce8abc 100644 --- a/src/core/model/Typesystem.hpp +++ b/src/core/model/Typesystem.hpp @@ -41,7 +41,7 @@ namespace ousia { // Forward declarations -class RttiType; +class Rtti; namespace model { @@ -1111,67 +1111,67 @@ namespace RttiTypes { /** * Type information for the Type class. */ -extern const RttiType Type; +extern const Rtti Type; /** * Type information for the StringType class. */ -extern const RttiType StringType; +extern const Rtti StringType; /** * Type information for the IntType class. */ -extern const RttiType IntType; +extern const Rtti IntType; /** * Type information for the DoubleType class. */ -extern const RttiType DoubleType; +extern const Rtti DoubleType; /** * Type information for the BoolType class. */ -extern const RttiType BoolType; +extern const Rtti BoolType; /** * Type information for the EnumType class. */ -extern const RttiType EnumType; +extern const Rtti EnumType; /** * Type information for the StructType class. */ -extern const RttiType StructType; +extern const Rtti StructType; /** * Type information for the ArrayType class. */ -extern const RttiType ArrayType; +extern const Rtti ArrayType; /** * Type information for the UnknownType class. */ -extern const RttiType UnknownType; +extern const Rtti UnknownType; /** * Type information for the Constant class. */ -extern const RttiType Constant; +extern const Rtti Constant; /** * Type information for the Attribute class. */ -extern const RttiType Attribute; +extern const Rtti Attribute; /** * Type information for the Typesystem class. */ -extern const RttiType Typesystem; +extern const Rtti Typesystem; /** * Type information for the SystemTypesystem class. */ -extern const RttiType SystemTypesystem; +extern const Rtti SystemTypesystem; } } diff --git a/src/core/parser/Scope.cpp b/src/core/parser/Scope.cpp index 6e7dceb..6942b9a 100644 --- a/src/core/parser/Scope.cpp +++ b/src/core/parser/Scope.cpp @@ -46,7 +46,7 @@ GuardedScope::GuardedScope(GuardedScope &&s) /* Class ScopeBase */ Rooted<Node> ScopeBase::resolve(const std::vector<std::string> &path, - const RttiType &type, Logger &logger) + const Rtti &type, Logger &logger) { // Go up the stack and try to resolve the for (auto it = nodes.rbegin(); it != nodes.rend(); it++) { @@ -75,7 +75,7 @@ Rooted<Node> ScopeBase::resolve(const std::vector<std::string> &path, DeferredResolution::DeferredResolution(const NodeVector<Node> &nodes, const std::vector<std::string> &path, - const RttiType &type, + const Rtti &type, ResolutionResultCallback resultCallback, const SourceLocation &location) : scope(nodes), @@ -116,7 +116,7 @@ Rooted<Node> Scope::getRoot() const { return nodes.front(); } Rooted<Node> Scope::getLeaf() { return nodes.back(); } -bool Scope::resolve(const std::vector<std::string> &path, const RttiType &type, +bool Scope::resolve(const std::vector<std::string> &path, const Rtti &type, Logger &logger, ResolutionImposterCallback imposterCallback, ResolutionResultCallback resultCallback, const SourceLocation &location) @@ -128,7 +128,7 @@ bool Scope::resolve(const std::vector<std::string> &path, const RttiType &type, return true; } -bool Scope::resolve(const std::vector<std::string> &path, const RttiType &type, +bool Scope::resolve(const std::vector<std::string> &path, const Rtti &type, Logger &logger, ResolutionResultCallback resultCallback, const SourceLocation &location) { diff --git a/src/core/parser/Scope.hpp b/src/core/parser/Scope.hpp index 20a189a..1ceac2e 100644 --- a/src/core/parser/Scope.hpp +++ b/src/core/parser/Scope.hpp @@ -142,7 +142,7 @@ public: * found. */ Rooted<Node> resolve(const std::vector<std::string> &path, - const RttiType &type, Logger &logger); + const Rtti &type, Logger &logger); }; /** @@ -173,7 +173,7 @@ public: /** * Reference at the type of the object that should be resolved. */ - const RttiType &type; + const Rtti &type; /** * Position at which the resolution was triggered. @@ -188,14 +188,14 @@ public: * Scope class. * @param path is the path that was queried when the resolution failed the * first time. - * @param type is the RttiType of the element that should be queried. + * @param type is the Rtti of the element that should be queried. * @param resultCallback is the callback function that should be called if * the desired element has indeed been found. * @param location is the location at which the resolution was triggered. */ DeferredResolution(const NodeVector<Node> &nodes, const std::vector<std::string> &path, - const RttiType &type, + const Rtti &type, ResolutionResultCallback resultCallback, const SourceLocation &location = SourceLocation{}); @@ -294,7 +294,7 @@ public: * mean, that the resolved object does not exist, as it may be resolved * later. */ - bool resolve(const std::vector<std::string> &path, const RttiType &type, + bool resolve(const std::vector<std::string> &path, const Rtti &type, Logger &logger, ResolutionImposterCallback imposterCallback, ResolutionResultCallback resultCallback, const SourceLocation &location = SourceLocation{}); @@ -318,7 +318,7 @@ public: * mean, that the resolved object does not exist, as it may be resolved * later. */ - bool resolve(const std::vector<std::string> &path, const RttiType &type, + bool resolve(const std::vector<std::string> &path, const Rtti &type, Logger &logger, ResolutionResultCallback resultCallback, const SourceLocation &location = SourceLocation{}); |