Base: apply clang format
This commit is contained in:
127
src/Base/Type.h
127
src/Base/Type.h
@@ -80,116 +80,107 @@ struct TypeData;
|
||||
class BaseExport Type
|
||||
{
|
||||
public:
|
||||
/// Construction
|
||||
Type(const Type& type) = default;
|
||||
Type(Type&& type) = default;
|
||||
Type() = default;
|
||||
/// Destruction
|
||||
~Type() = default;
|
||||
/// Construction
|
||||
Type(const Type& type) = default;
|
||||
Type(Type&& type) = default;
|
||||
Type() = default;
|
||||
/// Destruction
|
||||
~Type() = default;
|
||||
|
||||
/// creates a instance of this type
|
||||
void *createInstance();
|
||||
/// creates a instance of the named type
|
||||
static void *createInstanceByName(const char* TypeName, bool bLoadModule=false);
|
||||
static void importModule(const char* TypeName);
|
||||
/// creates a instance of this type
|
||||
void* createInstance();
|
||||
/// creates a instance of the named type
|
||||
static void* createInstanceByName(const char* TypeName, bool bLoadModule = false);
|
||||
static void importModule(const char* TypeName);
|
||||
|
||||
using instantiationMethod = void * (*)();
|
||||
using instantiationMethod = void* (*)();
|
||||
|
||||
static Type fromName(const char *name);
|
||||
static Type fromKey(unsigned int key);
|
||||
const char *getName() const;
|
||||
const Type getParent() const;
|
||||
bool isDerivedFrom(const Type type) const;
|
||||
static Type fromName(const char* name);
|
||||
static Type fromKey(unsigned int key);
|
||||
const char* getName() const;
|
||||
const Type getParent() const;
|
||||
bool isDerivedFrom(const Type type) const;
|
||||
|
||||
static int getAllDerivedFrom(const Type type, std::vector<Type>& List);
|
||||
/// Returns the given named type if is derived from parent type, otherwise return bad type
|
||||
static Type getTypeIfDerivedFrom(const char* name , const Type parent, bool bLoadModule=false);
|
||||
static int getAllDerivedFrom(const Type type, std::vector<Type>& List);
|
||||
/// Returns the given named type if is derived from parent type, otherwise return bad type
|
||||
static Type getTypeIfDerivedFrom(const char* name, const Type parent, bool bLoadModule = false);
|
||||
|
||||
static int getNumTypes();
|
||||
static int getNumTypes();
|
||||
|
||||
static const Type createType(const Type parent, const char *name,instantiationMethod method = nullptr);
|
||||
static const Type
|
||||
createType(const Type parent, const char* name, instantiationMethod method = nullptr);
|
||||
|
||||
unsigned int getKey() const;
|
||||
bool isBad() const;
|
||||
unsigned int getKey() const;
|
||||
bool isBad() const;
|
||||
|
||||
Type& operator = (const Type& type) = default;
|
||||
Type& operator = (Type&& type) = default;
|
||||
bool operator == (const Type type) const;
|
||||
bool operator != (const Type type) const;
|
||||
Type& operator=(const Type& type) = default;
|
||||
Type& operator=(Type&& type) = default;
|
||||
bool operator==(const Type type) const;
|
||||
bool operator!=(const Type type) const;
|
||||
|
||||
bool operator < (const Type type) const;
|
||||
bool operator <= (const Type type) const;
|
||||
bool operator >= (const Type type) const;
|
||||
bool operator > (const Type type) const;
|
||||
bool operator<(const Type type) const;
|
||||
bool operator<=(const Type type) const;
|
||||
bool operator>=(const Type type) const;
|
||||
bool operator>(const Type type) const;
|
||||
|
||||
static Type badType();
|
||||
static void init();
|
||||
static void destruct();
|
||||
static Type badType();
|
||||
static void init();
|
||||
static void destruct();
|
||||
|
||||
protected:
|
||||
static std::string getModuleName(const char* ClassName);
|
||||
static std::string getModuleName(const char* ClassName);
|
||||
|
||||
|
||||
private:
|
||||
unsigned int index{0};
|
||||
|
||||
static std::map<std::string,unsigned int> typemap;
|
||||
static std::vector<TypeData*> typedata;
|
||||
static std::set<std::string> loadModuleSet;
|
||||
unsigned int index {0};
|
||||
|
||||
static std::map<std::string, unsigned int> typemap;
|
||||
static std::vector<TypeData*> typedata;
|
||||
static std::set<std::string> loadModuleSet;
|
||||
};
|
||||
|
||||
|
||||
inline unsigned int
|
||||
Type::getKey() const
|
||||
inline unsigned int Type::getKey() const
|
||||
{
|
||||
return this->index;
|
||||
return this->index;
|
||||
}
|
||||
|
||||
inline bool
|
||||
Type::operator != (const Type type) const
|
||||
inline bool Type::operator!=(const Type type) const
|
||||
{
|
||||
return (this->getKey() != type.getKey());
|
||||
return (this->getKey() != type.getKey());
|
||||
}
|
||||
|
||||
inline bool
|
||||
Type::operator == (const Type type) const
|
||||
inline bool Type::operator==(const Type type) const
|
||||
{
|
||||
return (this->getKey() == type.getKey());
|
||||
return (this->getKey() == type.getKey());
|
||||
}
|
||||
|
||||
inline bool
|
||||
Type::operator < (const Type type) const
|
||||
inline bool Type::operator<(const Type type) const
|
||||
{
|
||||
return (this->getKey() < type.getKey());
|
||||
return (this->getKey() < type.getKey());
|
||||
}
|
||||
|
||||
inline bool
|
||||
Type::operator <= (const Type type) const
|
||||
inline bool Type::operator<=(const Type type) const
|
||||
{
|
||||
return (this->getKey() <= type.getKey());
|
||||
return (this->getKey() <= type.getKey());
|
||||
}
|
||||
|
||||
inline bool
|
||||
Type::operator >= (const Type type) const
|
||||
inline bool Type::operator>=(const Type type) const
|
||||
{
|
||||
return (this->getKey() >= type.getKey());
|
||||
return (this->getKey() >= type.getKey());
|
||||
}
|
||||
|
||||
inline bool
|
||||
Type::operator > (const Type type) const
|
||||
inline bool Type::operator>(const Type type) const
|
||||
{
|
||||
return (this->getKey() > type.getKey());
|
||||
return (this->getKey() > type.getKey());
|
||||
}
|
||||
|
||||
inline bool
|
||||
Type::isBad() const
|
||||
inline bool Type::isBad() const
|
||||
{
|
||||
return (this->index == 0);
|
||||
return (this->index == 0);
|
||||
}
|
||||
|
||||
} //namespace Base
|
||||
} // namespace Base
|
||||
|
||||
|
||||
#endif // BASE_TYPE_H
|
||||
|
||||
#endif // BASE_TYPE_H
|
||||
|
||||
Reference in New Issue
Block a user