From cc12f4c5da1330591e16518157df1999e23cfb64 Mon Sep 17 00:00:00 2001
From: Shon Ferguson <shonferg@users.sourceforge.net>
Date: Sun, 28 May 2006 03:54:27 +0000
Subject: [PATCH] Gave Type it's own files and finished implementing member
 functions.

---
 niflib.vcproj    |  6 ++++++
 obj/NiObject.cpp | 24 ------------------------
 obj/NiObject.h   | 17 +----------------
 obj/Type.cpp     | 28 ++++++++++++++++++++++++++++
 obj/Type.h       | 29 +++++++++++++++++++++++++++++
 5 files changed, 64 insertions(+), 40 deletions(-)
 create mode 100644 obj/Type.cpp
 create mode 100644 obj/Type.h

diff --git a/niflib.vcproj b/niflib.vcproj
index 0baf57e3..2cebf664 100644
--- a/niflib.vcproj
+++ b/niflib.vcproj
@@ -794,6 +794,9 @@
 				<File
 					RelativePath=".\obj\TriBasedGeomData.cpp">
 				</File>
+				<File
+					RelativePath=".\obj\Type.cpp">
+				</File>
 			</Filter>
 		</Filter>
 		<Filter
@@ -1457,6 +1460,9 @@
 				<File
 					RelativePath=".\obj\TriBasedGeomData.h">
 				</File>
+				<File
+					RelativePath=".\obj\Type.h">
+				</File>
 			</Filter>
 		</Filter>
 		<Filter
diff --git a/obj/NiObject.cpp b/obj/NiObject.cpp
index be59a607..60f2c815 100644
--- a/obj/NiObject.cpp
+++ b/obj/NiObject.cpp
@@ -9,30 +9,6 @@ const Type NiObject::TYPE("NiObject", NULL );
 //Static to track total number of objects in memory.  Initialize to zero.
 unsigned int NiObject::objectsInMemory = 0;
 
-/*
- * Type Methods
- */
-
-bool Type::IsSameType( const Type & compare_to ) const {
-	return &compare_to == this;
-}
-
-bool Type::IsDerivedType( const Type & compare_to ) const {
-
-	const Type * search = this;
-	while ( search != NULL ) {
-		if ( search == &compare_to ) {
-			return true;
-		}
-		search = search->base_type;
-	}
-	return false;
-}
-
-/*
- * NiObject Methods
- */
-
 bool NiObject::IsSameType( const Type & compare_to) const {
 	return GetType().IsSameType( compare_to );
 }
diff --git a/obj/NiObject.h b/obj/NiObject.h
index f46dd623..57c6719d 100644
--- a/obj/NiObject.h
+++ b/obj/NiObject.h
@@ -14,27 +14,12 @@ All rights reserved.  Please see niflib.h for licence. */
 #include <vector>
 #include "NIF_IO.h"
 #include "Ref.h"
+#include "Type.h"
 #include "xml_extract.h"
 
 using namespace std;
 
-/**
- * Run Time Type Inforamtion Class
- */
-class Type {
-public:
-	Type (const string & type_name, const Type * base_type );
-	~Type();
 
-	string GetTypeName() const;
-
-	bool IsSameType ( const Type & compare_to ) const;
-	bool IsDerivedType ( const Type & compare_to ) const;
-	bool operator<( const Type & compare_to ) const { return (this < &compare_to); }
-private:
-	string name;
-	const Type * base_type;
-};
 
 /**
  * NiObject - Base Object class from which all other objects derive
diff --git a/obj/Type.cpp b/obj/Type.cpp
new file mode 100644
index 00000000..c39e0358
--- /dev/null
+++ b/obj/Type.cpp
@@ -0,0 +1,28 @@
+/* Copyright (c) 2006, NIF File Format Library and Tools
+All rights reserved.  Please see niflib.h for licence. */
+
+#include "Type.h"
+
+Type::Type (const string & type_name, const Type * par_type ) : name(type_name), base_type(par_type) {} 
+
+Type::~Type() {}
+
+bool Type::operator<( const Type & compare_to ) const {
+	return (this < &compare_to);
+}
+
+bool Type::IsSameType( const Type & compare_to ) const {
+	return &compare_to == this;
+}
+
+bool Type::IsDerivedType( const Type & compare_to ) const {
+
+	const Type * search = this;
+	while ( search != NULL ) {
+		if ( search == &compare_to ) {
+			return true;
+		}
+		search = search->base_type;
+	}
+	return false;
+}
\ No newline at end of file
diff --git a/obj/Type.h b/obj/Type.h
new file mode 100644
index 00000000..e87354a2
--- /dev/null
+++ b/obj/Type.h
@@ -0,0 +1,29 @@
+/* Copyright (c) 2006, NIF File Format Library and Tools
+All rights reserved.  Please see niflib.h for licence. */
+
+#ifndef _TYPE_H_
+#define _TYPE_H_
+
+#include <string>
+
+using namespace std;
+
+/**
+ * Run Time Type Inforamtion Class
+ */
+class Type {
+public:
+	Type (const string & type_name, const Type * par_type );
+	~Type();
+
+	string GetTypeName() const;
+
+	bool IsSameType ( const Type & compare_to ) const;
+	bool IsDerivedType ( const Type & compare_to ) const;
+	bool operator<( const Type & compare_to ) const;
+private:
+	string name;
+	const Type * base_type;
+};
+
+#endif
\ No newline at end of file
-- 
GitLab