Skip to content
Snippets Groups Projects
Commit c8833c85 authored by Shon Ferguson's avatar Shon Ferguson
Browse files

Updating NiObject to new Python update method. Will probably break compilation for a while.

parent c4b19a25
No related branches found
No related tags found
No related merge requests found
/* Copyright (c) 2006, NIF File Format Library and Tools
All rights reserved. Please see niflib.h for license. */
//-----------------------------------NOTICE----------------------------------//
// Some of this file is automatically filled in by a Python script. Only //
// add custom code in the designated areas or it will be overwritten during //
// the next update. //
//-----------------------------------NOTICE----------------------------------//
#ifndef _NIOBJECT_H_
#define _NIOBJECT_H_
//--BEGIN FILE HEAD CUSTOM CODE--//
//--END CUSTOM CODE--//
#include "../Type.h"
#include "../Ref.h"
#include "../nif_basic_types.h"
#include <iostream>
#include <fstream>
#include <iomanip>
......@@ -12,27 +25,41 @@ All rights reserved. Please see niflib.h for license. */
#include <list>
#include <map>
#include <vector>
#include "../NIF_IO.h"
#include "../Ref.h"
#include "../Type.h"
#include "../gen/obj_defines.h"
namespace Niflib {
using namespace std;
class NiObject;
typedef Ref<NiObject> NiObjectRef;
/**
* NiObject - Base NIF object from which all other NIF objects derive
/*!
* NiObject - Abstract object type.
*/
class NiObject {
public:
/*! Constructor */
NIFLIB_API NiObject();
/*! Destructor */
NIFLIB_API virtual ~NiObject();
NIFLIB_API ~NiObject();
/*!
* A constant value which uniquly identifies objects of this type.
*/
NIFLIB_API static const Type TYPE;
/*!
* A factory function used during file reading to create an instance of this type of object.
* \return A pointer to a newly allocated instance of this type of object.
*/
NIFLIB_API static NiObject * Create();
/*!
* Summarizes the information contained in this object in English.
* \param[in] verbose Determines whether or not detailed information about large areas of data will be printed out.
* \return A string containing a summary of the information within the object in English. This is the function that Niflyze calls to generate its analysis, so the output is the same.
*/
NIFLIB_API virtual string asString( bool verbose = false ) const;
/*!
* Used to determine the type of a particular instance of this object.
......@@ -40,6 +67,8 @@ public:
*/
NIFLIB_API virtual const Type & GetType() const;
//--BEGIN MISC CUSTOM CODE--//
/*!
* Used to determine whether this object is exactly the same type as the given type constant.
* \return True if this object is exactly the same type as that represented by the given type constant. False otherwise.
......@@ -75,20 +104,12 @@ public:
*/
NIFLIB_API NiObjectRef Clone( unsigned int version = 0xFFFFFFFF, unsigned int user_version = 0 );
/*!
* Summarizes the information contained in this object in English.
* \param[in] verbose Determines whether or not detailed information about large areas of data will be printed out.
* \return A string containing a summary of the information within the object in English. This is the function that Niflyze calls to generate its analysis, so the output is the same.
*/
NIFLIB_API virtual string asString( bool verbose = false ) const;
/*!
* Formats a human readable string that includes the type of the object, and its name, if any
* \return A string in the form: address(type), or adress(type) {name}
*/
NIFLIB_API virtual string GetIDString() const;
/*!
* Returns the total number of NIF objects of any kind that have been allocated by Niflib for any reason. This is for debugging or informational purpouses. Mostly usful for tracking down memory leaks.
* \return The total number of NIF objects that have been allocated.
......@@ -112,37 +133,24 @@ public:
* \return The number of references to this object that are in use.
*/
NIFLIB_API unsigned int GetNumRefs();
private:
mutable unsigned int _ref_count;
list<NiObject*> _cross_refs;
static unsigned int objectsInMemory;
//--NIFLIB_HIDDEN functions. For internal use only--//
//--END CUSTOM CODE--//
public:
/*! NIFLIB_HIDDEN function. For internal use only. */
NIFLIB_HIDDEN virtual list<NiObjectRef> GetRefs() const;
//Streaming Functions
NIFLIB_HIDDEN virtual void Read( istream& in, list<unsigned int> & link_stack, const NifInfo & info );
/*! NIFLIB_HIDDEN function. For internal use only. */
NIFLIB_HIDDEN virtual void Read( istream& in, list<unsigned int> & link_stack, const NifInfo & info ) {}
NIFLIB_HIDDEN virtual void Write( ostream& out, const map<NiObjectRef,unsigned int> & link_map, const NifInfo & info ) const;
/*! NIFLIB_HIDDEN function. For internal use only. */
NIFLIB_HIDDEN virtual void Write( ostream& out, const map<NiObjectRef,unsigned int> & link_map, const NifInfo & info ) const {}
NIFLIB_HIDDEN virtual void FixLinks( const map<unsigned int,NiObjectRef> & objects, list<unsigned int> & link_stack, const NifInfo & info );
/*! NIFLIB_HIDDEN function. For internal use only. */
NIFLIB_HIDDEN virtual void FixLinks( const map<unsigned int,NiObjectRef> & objects, list<unsigned int> & link_stack, const NifInfo & info ) {}
NIFLIB_API static const Type TYPE;
NIFLIB_API static NiObject * Create();
private:
mutable unsigned int _ref_count;
list<NiObject*> _cross_refs;
static unsigned int objectsInMemory;
void InternalRead( istream& in, list<unsigned int> & link_stack, const NifInfo & info );
void InternalWrite( ostream& out, const map<NiObjectRef,unsigned int> & link_map, const NifInfo & info ) const;
string InternalAsString( bool verbose ) const;
void InternalFixLinks( const map<unsigned int,NiObjectRef> & objects, list<unsigned int> & link_stack, const NifInfo & info );
list<NiObjectRef> InternalGetRefs() const;
NIFLIB_HIDDEN virtual list<NiObjectRef> GetRefs() const;
};
//--BEGIN FILE FOOT CUSTOM CODE--//
/*
* Casting Templates
......@@ -219,5 +227,8 @@ inline list<Ref<U> > DynamicCast( list<Ref<T> > const & objs ) {
return retval;
}
#endif
}
//--END CUSTOM CODE--//
} //End Niflib namespace
#endif
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