Skip to content
Snippets Groups Projects
Commit 8eeca2c4 authored by Amorilia's avatar Amorilia
Browse files

Type::Create() method (requested by DragoonWraith).

parent 07b54ab9
No related branches found
No related tags found
No related merge requests found
...@@ -640,3 +640,4 @@ ...@@ -640,3 +640,4 @@
* Store block number in NiObject when reading a nif file (requested by DragoonWraith). * Store block number in NiObject when reading a nif file (requested by DragoonWraith).
* Added cmake build script. * Added cmake build script.
* GetTexture() now returns a TexDesc reference (requested by DragoonWraith). * GetTexture() now returns a TexDesc reference (requested by DragoonWraith).
* Type::Create() method (requested by DragoonWraith).
...@@ -10,6 +10,9 @@ All rights reserved. Please see niflib.h for license. */ ...@@ -10,6 +10,9 @@ All rights reserved. Please see niflib.h for license. */
using namespace std; using namespace std;
namespace Niflib { namespace Niflib {
// forward declaration
class NiObject;
/** /**
* Run Time Type Information Class * Run Time Type Information Class
*/ */
...@@ -23,6 +26,7 @@ public: ...@@ -23,6 +26,7 @@ public:
NIFLIB_API bool IsSameType ( const Type & compare_to ) const; NIFLIB_API bool IsSameType ( const Type & compare_to ) const;
NIFLIB_API bool IsDerivedType ( const Type & compare_to ) const; NIFLIB_API bool IsDerivedType ( const Type & compare_to ) const;
NIFLIB_API bool operator<( const Type & compare_to ) const; NIFLIB_API bool operator<( const Type & compare_to ) const;
NIFLIB_API NiObject * Create() const;
const Type * base_type; const Type * base_type;
private: private:
string name; string name;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
All rights reserved. Please see niflib.h for license. */ All rights reserved. Please see niflib.h for license. */
#include "../include/Type.h" #include "../include/Type.h"
#include "../include/ObjectRegistry.h"
using namespace Niflib; using namespace Niflib;
Type::Type (const string & type_name, const Type * par_type ) : name(type_name), base_type(par_type) {} Type::Type (const string & type_name, const Type * par_type ) : name(type_name), base_type(par_type) {}
...@@ -31,3 +32,7 @@ bool Type::IsDerivedType( const Type & compare_to ) const { ...@@ -31,3 +32,7 @@ bool Type::IsDerivedType( const Type & compare_to ) const {
string Type::GetTypeName() const { string Type::GetTypeName() const {
return name; return name;
} }
NiObject * Type::Create() const {
return ObjectRegistry::CreateObject(name);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment