Changed: #1440 Constness

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent 6ee389a1cf
commit e9fcadb737

@ -60,6 +60,10 @@ void CBuiltin::registerClasses(CSceneClassRegistry *registry)
{
registry->add(&AnimatableClassDesc);
registry->add(&AnimatableSuperClassDesc);
registry->add(&ReferenceMakerClassDesc);
registry->add(&ReferenceMakerSuperClassDesc);
registry->add(&ReferenceTargetClassDesc);
registry->add(&ReferenceTargetSuperClassDesc);
}
} /* namespace BUILTIN */

@ -52,6 +52,55 @@ CReferenceMaker::~CReferenceMaker()
}
const ucchar *CReferenceMaker::DisplayName = ucstring("ReferenceMaker").c_str();
const char *CReferenceMaker::InternalName = "ReferenceMaker";
const char *CReferenceMaker::InternalNameUnknown = "ReferenceMakerUnknown";
const NLMISC::CClassId CReferenceMaker::ClassId = NLMISC::CClassId(0x2ec43d15, 0x10a270ad); /* Not official, please correct */
const TSClassId CReferenceMaker::SuperClassId = 0x00000100;
const CReferenceMakerClassDesc ReferenceMakerClassDesc(&DllPluginDescBuiltin);
const CReferenceMakerSuperClassDesc ReferenceMakerSuperClassDesc(&ReferenceMakerClassDesc);
void CReferenceMaker::parse(uint16 version, TParseLevel level)
{
CAnimatable::parse(version, level);
}
void CReferenceMaker::clean()
{
CAnimatable::clean();
}
void CReferenceMaker::build(uint16 version)
{
CAnimatable:build(version);
}
void CReferenceMaker::disown()
{
CAnimatable::disown();
}
void CReferenceMaker::init()
{
CAnimatable::init();
}
bool CReferenceMaker::inherits(const NLMISC::CClassId classId) const
{
if (classId == classDesc()->classId()) return true;
return CAnimatable::inherits(classId);
}
const ISceneClassDesc *CReferenceMaker::classDesc() const
{
return &ReferenceMakerClassDesc;
}
void CReferenceMaker::toStringLocal(std::ostream &ostream, const std::string &pad) const
{
CAnimatable::toStringLocal(ostream, pad);
}
} /* namespace BUILTIN */
} /* namespace MAX */
} /* namespace PIPELINE */

@ -52,8 +52,30 @@ public:
CReferenceMaker();
virtual ~CReferenceMaker();
// class desc
static const ucchar *DisplayName;
static const char *InternalName;
static const char *InternalNameUnknown;
static const NLMISC::CClassId ClassId;
static const TSClassId SuperClassId;
// inherited
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);
virtual void disown();
virtual void init();
virtual bool inherits(const NLMISC::CClassId classId) const;
virtual const ISceneClassDesc *classDesc() const;
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "") const;
}; /* class CReferenceMaker */
typedef CSceneClassDesc<CReferenceMaker> CReferenceMakerClassDesc;
extern const CReferenceMakerClassDesc ReferenceMakerClassDesc;
typedef CSuperClassDesc<CReferenceMaker> CReferenceMakerSuperClassDesc;
extern const CReferenceMakerSuperClassDesc ReferenceMakerSuperClassDesc;
} /* namespace BUILTIN */
} /* namespace MAX */
} /* namespace PIPELINE */

@ -52,6 +52,55 @@ CReferenceTarget::~CReferenceTarget()
}
const ucchar *CReferenceTarget::DisplayName = ucstring("ReferenceTarget").c_str();
const char *CReferenceTarget::InternalName = "ReferenceTarget";
const char *CReferenceTarget::InternalNameUnknown = "ReferenceTargetUnknown";
const NLMISC::CClassId CReferenceTarget::ClassId = NLMISC::CClassId(0x5d545dd9, 0xa422e4); /* Not official, please correct */
const TSClassId CReferenceTarget::SuperClassId = 0x00000200;
const CReferenceTargetClassDesc ReferenceTargetClassDesc(&DllPluginDescBuiltin);
const CReferenceTargetSuperClassDesc ReferenceTargetSuperClassDesc(&ReferenceTargetClassDesc);
void CReferenceTarget::parse(uint16 version, TParseLevel level)
{
CReferenceMaker::parse(version, level);
}
void CReferenceTarget::clean()
{
CReferenceMaker::clean();
}
void CReferenceTarget::build(uint16 version)
{
CReferenceMaker:build(version);
}
void CReferenceTarget::disown()
{
CReferenceMaker::disown();
}
void CReferenceTarget::init()
{
CReferenceMaker::init();
}
bool CReferenceTarget::inherits(const NLMISC::CClassId classId) const
{
if (classId == classDesc()->classId()) return true;
return CReferenceMaker::inherits(classId);
}
const ISceneClassDesc *CReferenceTarget::classDesc() const
{
return &ReferenceTargetClassDesc;
}
void CReferenceTarget::toStringLocal(std::ostream &ostream, const std::string &pad) const
{
CReferenceMaker::toStringLocal(ostream, pad);
}
} /* namespace BUILTIN */
} /* namespace MAX */
} /* namespace PIPELINE */

@ -52,8 +52,30 @@ public:
CReferenceTarget();
virtual ~CReferenceTarget();
// class desc
static const ucchar *DisplayName;
static const char *InternalName;
static const char *InternalNameUnknown;
static const NLMISC::CClassId ClassId;
static const TSClassId SuperClassId;
// inherited
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);
virtual void disown();
virtual void init();
virtual bool inherits(const NLMISC::CClassId classId) const;
virtual const ISceneClassDesc *classDesc() const;
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "") const;
}; /* class CReferenceTarget */
typedef CSceneClassDesc<CReferenceTarget> CReferenceTargetClassDesc;
extern const CReferenceTargetClassDesc ReferenceTargetClassDesc;
typedef CSuperClassDesc<CReferenceTarget> CReferenceTargetSuperClassDesc;
extern const CReferenceTargetSuperClassDesc ReferenceTargetSuperClassDesc;
} /* namespace BUILTIN */
} /* namespace MAX */
} /* namespace PIPELINE */

@ -123,12 +123,12 @@ CAppData::~CAppData()
}
std::string CAppData::getClassName()
std::string CAppData::className() const
{
return "AppData";
}
void CAppData::toString(std::ostream &ostream, const std::string &pad)
void CAppData::toString(std::ostream &ostream, const std::string &pad) const
{
if (m_ChunksOwnsPointers)
{
@ -136,10 +136,10 @@ void CAppData::toString(std::ostream &ostream, const std::string &pad)
}
else
{
ostream << "(" << getClassName() << ") [" << m_Entries.size() << "] PARSED { ";
ostream << "(" << className() << ") [" << m_Entries.size() << "] PARSED { ";
std::string padpad = pad + "\t";
uint subi = 0;
for (TMap::iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
for (TMap::const_iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
{
ostream << "\n" << pad << "Entries[" << subi << "]: ";
subit->second->toString(ostream, padpad);
@ -330,7 +330,7 @@ CAppDataEntryKey::~CAppDataEntryKey()
}
std::string CAppDataEntryKey::getClassName()
std::string CAppDataEntryKey::className() const
{
return "AppDataEntryKey";
}
@ -343,9 +343,9 @@ void CAppDataEntryKey::serial(NLMISC::IStream &stream)
stream.serial(Size);
}
void CAppDataEntryKey::toString(std::ostream &ostream, const std::string &pad)
void CAppDataEntryKey::toString(std::ostream &ostream, const std::string &pad) const
{
ostream << "(" << getClassName() << ") { ";
ostream << "(" << className() << ") { ";
ostream << "\n" << pad << "ClassId: " << NLMISC::toString(ClassId);
ostream << "\n" << pad << "SuperClassId: " << SuperClassId;
ostream << "\n" << pad << "SubId: " << SubId;
@ -367,16 +367,16 @@ CAppDataEntry::~CAppDataEntry()
}
std::string CAppDataEntry::getClassName()
std::string CAppDataEntry::className() const
{
return "AppDataEntry";
}
void CAppDataEntry::toString(std::ostream &ostream, const std::string &pad)
void CAppDataEntry::toString(std::ostream &ostream, const std::string &pad) const
{
if (m_Key && m_Value)
{
ostream << "(" << getClassName() << ") [" << m_Chunks.size() << "] PARSED { ";
ostream << "(" << className() << ") [" << m_Chunks.size() << "] PARSED { ";
std::string padpad = pad + "\t";
ostream << "\n" << pad << "Key: ";
m_Key->toString(ostream, padpad);

@ -74,8 +74,8 @@ public:
virtual ~CAppData();
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual std::string className() const;
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);
@ -128,9 +128,9 @@ public:
uint32 Size;
// inherited
virtual std::string getClassName();
virtual std::string className() const;
virtual void serial(NLMISC::IStream &stream);
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
}; /* class CAppDataEntryKey */
@ -147,8 +147,8 @@ public:
virtual ~CAppDataEntry();
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual std::string className() const;
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);

@ -55,12 +55,12 @@ CClassData::~CClassData()
}
std::string CClassData::getClassName()
std::string CClassData::className() const
{
return "ClassData";
}
void CClassData::toString(std::ostream &ostream, const std::string &pad)
void CClassData::toString(std::ostream &ostream, const std::string &pad) const
{
CStorageContainer::toString(ostream, pad);
}
@ -112,12 +112,12 @@ CClassDataEntry::~CClassDataEntry()
}
std::string CClassDataEntry::getClassName()
std::string CClassDataEntry::className() const
{
return "ClassDataEntry";
}
void CClassDataEntry::toString(std::ostream &ostream, const std::string &pad)
void CClassDataEntry::toString(std::ostream &ostream, const std::string &pad) const
{
CStorageContainer::toString(ostream, pad);
}
@ -174,7 +174,7 @@ CClassDataHeader::~CClassDataHeader()
}
std::string CClassDataHeader::getClassName()
std::string CClassDataHeader::className() const
{
return "ClassDataHeader";
}
@ -185,9 +185,9 @@ void CClassDataHeader::serial(NLMISC::IStream &stream)
stream.serial(SuperClassID);
}
void CClassDataHeader::toString(std::ostream &ostream, const std::string &pad)
void CClassDataHeader::toString(std::ostream &ostream, const std::string &pad) const
{
ostream << "(" << getClassName() << ") { ";
ostream << "(" << className() << ") { ";
ostream << "\n" << pad << "ClassID: " << NLMISC::toString(ClassID);
ostream << "\n" << pad << "SuperClassID: " << SuperClassID;
ostream << " } ";

@ -54,8 +54,8 @@ public:
virtual ~CClassData();
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual std::string className() const;
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);
@ -79,8 +79,8 @@ public:
virtual ~CClassDataEntry();
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual std::string className() const;
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);
@ -108,9 +108,9 @@ public:
uint32 SuperClassID;
// inherited
virtual std::string getClassName();
virtual std::string className() const;
virtual void serial(NLMISC::IStream &stream);
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
}; /* class CClassDataHeader */

@ -72,13 +72,13 @@ CClassDirectory3::~CClassDirectory3()
m_ClassIdToIndex.clear();
}
std::string CClassDirectory3::getClassName()
std::string CClassDirectory3::className() const
{
return "ClassDirectory3";
}
// Parallel to CDllDirectory
void CClassDirectory3::toString(std::ostream &ostream, const std::string &pad)
void CClassDirectory3::toString(std::ostream &ostream, const std::string &pad) const
{
if (m_ChunksOwnsPointers)
{
@ -86,7 +86,7 @@ void CClassDirectory3::toString(std::ostream &ostream, const std::string &pad)
}
else
{
ostream << "(" << getClassName() << ") [" << m_Chunks.size() << "] PARSED { ";
ostream << "(" << className() << ") [" << m_Chunks.size() << "] PARSED { ";
std::string padpad = pad + "\t";
sint i = 0;
for (TStorageObjectContainer::const_iterator it = m_ChunkCache.begin(), end = m_ChunkCache.end(); it != end; ++it)
@ -97,7 +97,7 @@ void CClassDirectory3::toString(std::ostream &ostream, const std::string &pad)
case 0x2040: // ClassEntry
{
uint subi = 0;
for (std::vector<CClassEntry *>::iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
for (std::vector<CClassEntry *>::const_iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
{
ostream << "\n" << pad << "Entries[" << subi << "]: ";
(*subit)->toString(ostream, padpad);
@ -315,16 +315,16 @@ CClassEntry::~CClassEntry()
}
std::string CClassEntry::getClassName()
std::string CClassEntry::className() const
{
return "ClassEntry";
}
void CClassEntry::toString(std::ostream &ostream, const std::string &pad)
void CClassEntry::toString(std::ostream &ostream, const std::string &pad) const
{
if (m_Header && m_Name)
{
ostream << "(" << getClassName() << ") [" << m_Chunks.size() << "] PARSED { ";
ostream << "(" << className() << ") [" << m_Chunks.size() << "] PARSED { ";
std::string padpad = pad + "\t";
ostream << "\n" << pad << "Header: ";
m_Header->toString(ostream, padpad);
@ -400,7 +400,7 @@ CClassEntryHeader::~CClassEntryHeader()
}
std::string CClassEntryHeader::getClassName()
std::string CClassEntryHeader::className() const
{
return "ClassEntryHeader";
}
@ -412,9 +412,9 @@ void CClassEntryHeader::serial(NLMISC::IStream &stream)
stream.serial(SuperClassId);
}
void CClassEntryHeader::toString(std::ostream &ostream, const std::string &pad)
void CClassEntryHeader::toString(std::ostream &ostream, const std::string &pad) const
{
ostream << "(" << getClassName() << ") { ";
ostream << "(" << className() << ") { ";
ostream << "\n" << pad << "DllIndex: " << DllIndex;
ostream << "\n" << pad << "ClassId: " << NLMISC::toString(ClassId);
ostream << "\n" << pad << "SuperClassId: " << SuperClassId;

@ -64,8 +64,8 @@ public:
virtual ~CClassDirectory3();
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual std::string className() const;
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);
@ -109,9 +109,9 @@ public:
uint32 SuperClassId;
// inherited
virtual std::string getClassName();
virtual std::string className() const;
virtual void serial(NLMISC::IStream &stream);
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
}; /* class CClassEntryHeader */
@ -129,8 +129,8 @@ public:
virtual ~CClassEntry();
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual std::string className() const;
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);

@ -56,12 +56,12 @@ CConfig::~CConfig()
}
std::string CConfig::getClassName()
std::string CConfig::className() const
{
return "Config";
}
void CConfig::toString(std::ostream &ostream, const std::string &pad)
void CConfig::toString(std::ostream &ostream, const std::string &pad) const
{
CStorageContainer::toString(ostream, pad);
}
@ -123,12 +123,12 @@ CConfig20a0::~CConfig20a0()
}
std::string CConfig20a0::getClassName()
std::string CConfig20a0::className() const
{
return "Config20a0";
}
void CConfig20a0::toString(std::ostream &ostream, const std::string &pad)
void CConfig20a0::toString(std::ostream &ostream, const std::string &pad) const
{
CStorageContainer::toString(ostream, pad);
}
@ -188,12 +188,12 @@ CConfig20a0Entry::~CConfig20a0Entry()
}
std::string CConfig20a0Entry::getClassName()
std::string CConfig20a0Entry::className() const
{
return "Config20a0Entry";
}
void CConfig20a0Entry::toString(std::ostream &ostream, const std::string &pad)
void CConfig20a0Entry::toString(std::ostream &ostream, const std::string &pad) const
{
CStorageContainer::toString(ostream, pad);
}
@ -280,12 +280,12 @@ CConfigScript::~CConfigScript()
}
std::string CConfigScript::getClassName()
std::string CConfigScript::className() const
{
return "ConfigScript";
}
void CConfigScript::toString(std::ostream &ostream, const std::string &pad)
void CConfigScript::toString(std::ostream &ostream, const std::string &pad) const
{
CStorageContainer::toString(ostream, pad);
}
@ -337,12 +337,12 @@ CConfigScriptEntry::~CConfigScriptEntry()
}
std::string CConfigScriptEntry::getClassName()
std::string CConfigScriptEntry::className() const
{
return "ConfigScriptEntry";
}
void CConfigScriptEntry::toString(std::ostream &ostream, const std::string &pad)
void CConfigScriptEntry::toString(std::ostream &ostream, const std::string &pad) const
{
CStorageContainer::toString(ostream, pad);
}
@ -402,7 +402,7 @@ CConfigScriptHeader::~CConfigScriptHeader()
}
std::string CConfigScriptHeader::getClassName()
std::string CConfigScriptHeader::className() const
{
return "ConfigScriptHeader";
}
@ -413,9 +413,9 @@ void CConfigScriptHeader::serial(NLMISC::IStream &stream)
stream.serial(ClassID);
}
void CConfigScriptHeader::toString(std::ostream &ostream, const std::string &pad)
void CConfigScriptHeader::toString(std::ostream &ostream, const std::string &pad) const
{
ostream << "(" << getClassName() << ") { ";
ostream << "(" << className() << ") { ";
ostream << "\n" << pad << "SuperClassID: " << SuperClassID;
ostream << "\n" << pad << "ClassID: " << NLMISC::toString(ClassID);
ostream << " } ";
@ -435,12 +435,12 @@ CConfigScriptMetaContainer::~CConfigScriptMetaContainer()
}
std::string CConfigScriptMetaContainer::getClassName()
std::string CConfigScriptMetaContainer::className() const
{
return "ConfigScriptMetaContainer";
}
void CConfigScriptMetaContainer::toString(std::ostream &ostream, const std::string &pad)
void CConfigScriptMetaContainer::toString(std::ostream &ostream, const std::string &pad) const
{
CStorageContainer::toString(ostream, pad);
}
@ -514,7 +514,7 @@ CConfigScriptMetaString::~CConfigScriptMetaString()
}
std::string CConfigScriptMetaString::getClassName()
std::string CConfigScriptMetaString::className() const
{
return "ConfigScriptMetaString";
}
@ -538,9 +538,9 @@ void CConfigScriptMetaString::serial(NLMISC::IStream &stream)
nlassert(endByte == 0);
}
void CConfigScriptMetaString::toString(std::ostream &ostream, const std::string &pad)
void CConfigScriptMetaString::toString(std::ostream &ostream, const std::string &pad) const
{
ostream << "(" << getClassName() << ") { " << Value << " } ";
ostream << "(" << className() << ") { " << Value << " } ";
}
////////////////////////////////////////////////////////////////////////

@ -54,8 +54,8 @@ public:
virtual ~CConfig();
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual std::string className() const;
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);
@ -79,8 +79,8 @@ public:
virtual ~CConfig20a0();
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual std::string className() const;
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);
@ -104,8 +104,8 @@ public:
virtual ~CConfig20a0Entry();
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual std::string className() const;
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);
@ -129,8 +129,8 @@ public:
virtual ~CConfigScript();
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual std::string className() const;
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);
@ -154,8 +154,8 @@ public:
virtual ~CConfigScriptEntry();
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual std::string className() const;
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);
@ -183,9 +183,9 @@ public:
NLMISC::CClassId ClassID;
// inherited
virtual std::string getClassName();
virtual std::string className() const;
virtual void serial(NLMISC::IStream &stream);
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
}; /* class CConfigScriptHeader */
@ -203,8 +203,8 @@ public:
virtual ~CConfigScriptMetaContainer();
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual std::string className() const;
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);
@ -231,9 +231,9 @@ public:
std::string Value;
// inherited
virtual std::string getClassName();
virtual std::string className() const;
virtual void serial(NLMISC::IStream &stream);
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
}; /* class CConfigScriptMetaString */

@ -70,13 +70,13 @@ CDllDirectory::~CDllDirectory()
m_Entries.clear();
}
std::string CDllDirectory::getClassName()
std::string CDllDirectory::className() const
{
return "DllDirectory";
}
// Parallel to CClassDirectory3
void CDllDirectory::toString(std::ostream &ostream, const std::string &pad)
void CDllDirectory::toString(std::ostream &ostream, const std::string &pad) const
{
if (m_ChunksOwnsPointers)
{
@ -84,7 +84,7 @@ void CDllDirectory::toString(std::ostream &ostream, const std::string &pad)
}
else
{
ostream << "(" << getClassName() << ") [" << m_Chunks.size() << "] PARSED { ";
ostream << "(" << className() << ") [" << m_Chunks.size() << "] PARSED { ";
std::string padpad = pad + "\t";
sint i = 0;
for (TStorageObjectContainer::const_iterator it = m_ChunkCache.begin(), end = m_ChunkCache.end(); it != end; ++it)
@ -95,7 +95,7 @@ void CDllDirectory::toString(std::ostream &ostream, const std::string &pad)
case 0x2038: // DllEntry
{
uint subi = 0;
for (std::vector<CDllEntry *>::iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
for (std::vector<CDllEntry *>::const_iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
{
ostream << "\n" << pad << "Entries[" << subi << "]: ";
(*subit)->toString(ostream, padpad);
@ -342,16 +342,16 @@ CDllEntry::~CDllEntry()
}
std::string CDllEntry::getClassName()
std::string CDllEntry::className() const
{
return "DllEntry";
}
void CDllEntry::toString(std::ostream &ostream, const std::string &pad)
void CDllEntry::toString(std::ostream &ostream, const std::string &pad) const
{
if (m_DllDescription && m_DllFilename)
{
ostream << "(" << getClassName() << ") [" << m_Chunks.size() << "] PARSED { ";
ostream << "(" << className() << ") [" << m_Chunks.size() << "] PARSED { ";
std::string padpad = pad + "\t";
ostream << "\n" << pad << "DllDescription: " << m_DllDescription->Value.toUtf8();
ostream << "\n" << pad << "DllFilename: " << m_DllFilename->Value.toUtf8();

@ -55,8 +55,8 @@ public:
virtual ~CDllEntry();
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual std::string className() const;
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);
@ -92,8 +92,8 @@ public:
virtual ~CDllDirectory();
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual std::string className() const;
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);

@ -29,6 +29,7 @@
#include "scene.h"
// STL includes
#include <iostream>
// NeL includes
// #include <nel/misc/debug.h>
@ -60,12 +61,12 @@ CScene::~CScene()
}
std::string CScene::getClassName()
std::string CScene::className() const
{
return "Scene";
}
void CScene::toString(std::ostream &ostream, const std::string &pad)
void CScene::toString(std::ostream &ostream, const std::string &pad) const
{
CStorageContainer::toString(ostream, pad);
}
@ -128,12 +129,12 @@ CSceneClassContainer::~CSceneClassContainer()
}
std::string CSceneClassContainer::getClassName()
std::string CSceneClassContainer::className() const
{
return "SceneClassContainer";
}
void CSceneClassContainer::toString(std::ostream &ostream, const std::string &pad)
void CSceneClassContainer::toString(std::ostream &ostream, const std::string &pad) const
{
CStorageContainer::toString(ostream, pad);
}
@ -177,12 +178,20 @@ IStorageObject *CSceneClassContainer::createChunkById(uint16 id, bool container)
}
else
{
// Create an unknown scene class; TODO: By TSClassId, maybe the registry should have a createUnknown(TSuperClassId)
// const NLMISC::CClassId classId, const TSClassId superClassId, const ucstring &displayName, const std::strin &internalName, const ucstring &dllFilename, const ucstring &dllDescription
const CDllEntry *dllEntry = m_DllDirectory->get(classEntry->dllIndex());
classEntry->toString(std::cout, "");
sceneClass = m_SceneClassRegistry->createUnknown(classEntry->classId(), classEntry->superClassId(), classEntry->displayName(), dllEntry->dllFilename(), dllEntry->dllDescription());
if (sceneClass)
{
return static_cast<IStorageObject *>(sceneClass);
}
else
{
// Create an invalid unknown scene class
return static_cast<IStorageObject *>(new CSceneClassUnknown<CSceneClass>(classEntry->classId(), classEntry->superClassId(), classEntry->displayName(), "SceneClassUnknown", dllEntry->dllFilename(), dllEntry->dllDescription()));
}
}
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

@ -63,8 +63,8 @@ public:
virtual ~CScene();
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual std::string className() const;
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);
@ -97,8 +97,8 @@ public:
virtual ~CSceneClassContainer();
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual std::string className() const;
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
virtual void parse(uint16 version, TParseLevel level);
virtual void clean();
virtual void build(uint16 version);

@ -74,12 +74,12 @@ CSceneClass::~CSceneClass()
}
std::string CSceneClass::getClassName()
std::string CSceneClass::className() const
{
return classDesc()->internalName();
}
void CSceneClass::toString(std::ostream &ostream, const std::string &pad)
void CSceneClass::toString(std::ostream &ostream, const std::string &pad) const
{
if (m_ChunksOwnsPointers)
{
@ -87,7 +87,7 @@ void CSceneClass::toString(std::ostream &ostream, const std::string &pad)
}
else
{
ostream << "(" << getClassName() << ": " << ucstring(classDesc()->displayName()).toUtf8() << ", " << classDesc()->classId().toString() << ", " << ucstring(classDesc()->dllPluginDesc()->internalName()).toUtf8() << ") [" << m_Chunks.size() << "] { ";
ostream << "(" << className() << ": " << ucstring(classDesc()->displayName()).toUtf8() << ", " << classDesc()->classId().toString() << ", " << ucstring(classDesc()->dllPluginDesc()->internalName()).toUtf8() << ") [" << m_Chunks.size() << "] { ";
toStringLocal(ostream, pad);
ostream << "} ";
}

@ -59,8 +59,8 @@ public:
//! \name Inherited functions that are implemented by wrapping around other virtual functions in this class
//@{
virtual std::string getClassName(); // do not override, implemented using classDesc
virtual void toString(std::ostream &ostream, const std::string &pad = ""); // do not override, implemented using toStringLocal
virtual std::string className() const; // do not override, implemented using classDesc
virtual void toString(std::ostream &ostream, const std::string &pad = "") const; // do not override, implemented using toStringLocal
//@}
//! \name Inherited functions called through the storage loading and saving system

@ -41,6 +41,22 @@ using namespace std;
namespace PIPELINE {
namespace MAX {
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// Elevate warnings to errors in this file for stricter reading
#undef nlwarning
#define nlwarning nlerror
// Elevate debug to error in this file for debugging
// #undef nldebug
// #define nldebug nlerror
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
CSceneClassRegistry::CSceneClassRegistry()
{
@ -66,7 +82,7 @@ void CSceneClassRegistry::remove(const NLMISC::CClassId classId)
/// Add a superclass to the registry
void CSceneClassRegistry::add(const ISuperClassDesc *desc)
{
if (m_SuperClassDescriptions.find(desc->classDesc()->superClassId()) == m_SuperClassDescriptions.end()) { nlerror("Already added this superclass to the registry"); return; }
if (m_SuperClassDescriptions.find(desc->classDesc()->superClassId()) != m_SuperClassDescriptions.end()) { nlerror("Already added this superclass to the registry"); return; }
m_SuperClassDescriptions[desc->classDesc()->superClassId()] = desc;
}
@ -80,14 +96,14 @@ void CSceneClassRegistry::remove(const TSClassId superClassId)
/// Create a class by class id
CSceneClass *CSceneClassRegistry::create(const NLMISC::CClassId classId) const
{
if (m_ClassDescriptions.find(classId) == m_ClassDescriptions.end()) { nldebug("Try to create class that does not exist"); return NULL; }
if (m_ClassDescriptions.find(classId) == m_ClassDescriptions.end()) { /* nldebug("Try to create class that does not exist"); */ return NULL; }
return m_ClassDescriptions.find(classId)->second->create();
}
/// Create an unknown class by superclass id
CSceneClass *CSceneClassRegistry::createUnknown(const TSClassId superClassId, const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const
{
if (m_ClassDescriptions.find(classId) == m_ClassDescriptions.end()) { nlwarning("Creating superclass that does not exist"); return NULL; }
if (m_ClassDescriptions.find(classId) == m_ClassDescriptions.end()) { nlwarning("Creating superclass 0x%x (%s) that does not exist", superClassId, displayName.toUtf8().c_str()); return NULL; }
return m_SuperClassDescriptions.find(classId)->second->createUnknown(classId, displayName, dllFilename, dllDescription);;
}
@ -104,6 +120,10 @@ const ISceneClassDesc *CSceneClassRegistry::describe(const NLMISC::CClassId clas
return m_ClassDescriptions.find(classId)->second;
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
} /* namespace MAX */
} /* namespace PIPELINE */

@ -103,7 +103,7 @@ CStorageContainer::~CStorageContainer()
m_Chunks.clear();
}
std::string CStorageContainer::getClassName() // why is this not const in IClassable?
std::string CStorageContainer::className() const // why is this not const in IClassable?
{
return "StorageContainer";
}
@ -171,7 +171,7 @@ void CStorageContainer::serial(NLMISC::IStream &stream)
}
}
void CStorageContainer::toString(std::ostream &ostream, const std::string &pad)
void CStorageContainer::toString(std::ostream &ostream, const std::string &pad) const
{
// note: only use pad when multi-lining
// like Blah: (Something) "SingleValue"
@ -179,7 +179,7 @@ void CStorageContainer::toString(std::ostream &ostream, const std::string &pad)
// Moo: (Foo) "What" }
// only increase pad when multi-lining sub-items
nlassert(m_ChunksOwnsPointers);
ostream << "(" << getClassName() << ") [" << m_Chunks.size() << "] { ";
ostream << "(" << className() << ") [" << m_Chunks.size() << "] { ";
std::string padpad = pad + "\t";
sint i = 0;
for (TStorageObjectContainer::const_iterator it = m_Chunks.begin(), end = m_Chunks.end(); it != end; ++it)
@ -313,7 +313,7 @@ CStorageRaw::~CStorageRaw()
}
std::string CStorageRaw::getClassName()
std::string CStorageRaw::className() const
{
return "StorageRaw";
}
@ -323,14 +323,14 @@ void CStorageRaw::serial(NLMISC::IStream &stream)
stream.serialBuffer(&Value[0], Value.size());
}
void CStorageRaw::toString(std::ostream &ostream, const std::string &pad)
void CStorageRaw::toString(std::ostream &ostream, const std::string &pad) const
{
// note: only use pad when multi-lining
// like Blah: (Something) "SingleValue"
// Blahblah: (Container) {
// Moo: (Foo) "What" }
// only increase pad when multi-lining sub-items
ostream << "(" << getClassName() << ") { ";
ostream << "(" << className() << ") { ";
ostream << "\n" << pad << "Size: " << Value.size();
bool isString = true;
ostream << "\n" << pad << "String: ";

@ -70,10 +70,11 @@ public:
IStorageObject();
virtual ~IStorageObject();
// virtual std::string getClassName() = 0; // inherited from NLMISC::IClassable through NLMISC::IStreamable
virtual std::string getClassName() { return className(); } // inherited from NLMISC::IClassable through NLMISC::IStreamable
virtual std::string className() const = 0; // renamed for constness
// virtual void serial(NLMISC::IStream &stream); // inherited from NLMISC::IStreamable
std::string toString();
virtual void toString(std::ostream &ostream, const std::string &pad = "") = 0;
virtual void toString(std::ostream &ostream, const std::string &pad = "") const = 0;
public: // should be protected but that doesn't compile, nice c++!
// Sets size when reading
@ -104,9 +105,9 @@ public:
virtual ~CStorageContainer();
// inherited
virtual std::string getClassName();
virtual std::string className() const;
virtual void serial(NLMISC::IStream &stream); // only used to wrap a container inside another stream
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
// virtual
// Parse this class with given version and parse level filter
@ -147,9 +148,9 @@ public:
virtual ~CStorageRaw();
// inherited
virtual std::string getClassName();
virtual std::string className() const;
virtual void serial(NLMISC::IStream &stream);
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
public: // should be protected but that doesn't compile, nice c++!
// Sets size when reading

@ -54,9 +54,9 @@ void CStorageValue<ucstring>::serial(NLMISC::IStream &stream)
}
template <>
void CStorageValue<ucstring>::toString(std::ostream &ostream, const std::string &pad)
void CStorageValue<ucstring>::toString(std::ostream &ostream, const std::string &pad) const
{
ostream << "(" << getClassName() << ") { " << Value.toUtf8() << " } ";
ostream << "(" << className() << ") { " << Value.toUtf8() << " } ";
}
template <>

@ -50,9 +50,9 @@ public:
TType Value;
// inherited
virtual std::string getClassName();
virtual std::string className() const;
virtual void serial(NLMISC::IStream &stream);
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
public: // should be protected but that doesn't compile, nice c++!
// Sets size when reading
@ -62,7 +62,7 @@ public: // should be protected but that doesn't compile, nice c++!
};
template <typename T>
std::string CStorageValue<T>::getClassName()
std::string CStorageValue<T>::className() const
{
return "CStorageValue";
}
@ -80,14 +80,14 @@ template <>
void CStorageValue<ucstring>::serial(NLMISC::IStream &stream);
template <typename T>
void CStorageValue<T>::toString(std::ostream &ostream, const std::string &pad)
void CStorageValue<T>::toString(std::ostream &ostream, const std::string &pad) const
{
std::string s = NLMISC::toString(Value);
ostream << "(" << getClassName() << ") { " << s << " } ";
ostream << "(" << className() << ") { " << s << " } ";
}
template <>
void CStorageValue<ucstring>::toString(std::ostream &ostream, const std::string &pad);
void CStorageValue<ucstring>::toString(std::ostream &ostream, const std::string &pad) const;
template <typename T>
void CStorageValue<T>::setSize(sint32 size)

@ -75,6 +75,24 @@ private:
const ISceneClassDesc *m_ClassDesc;
}; /* class ISceneClassDesc */
/**
* \brief CSuperClassDescUnknown
* \date 2012-08-22 09:42GMT
* \author Jan Boon (Kaetemi)
* Template for non-implemented superclass descriptions
*/
template <typename T, TSClassId superClassId>
class CSuperClassDescUnknown : public ISuperClassDesc
{
public:
CSuperClassDescUnknown(const ISceneClassDesc *classDesc) : m_ClassDesc(classDesc) { }
virtual CSceneClass *createUnknown(const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const { return static_cast<CSceneClass *>(new CSceneClassUnknown<T>(classId, superClassId, displayName,internalNameUnknown(), dllFilename, dllDescription)); }
virtual const char *internalNameUnknown() const { return T::InternalNameUnknown; }
virtual const ISceneClassDesc *classDesc() const { return m_ClassDesc; }
private:
const ISceneClassDesc *m_ClassDesc;
}; /* class ISceneClassDesc */
} /* namespace MAX */
} /* namespace PIPELINE */

@ -29,6 +29,7 @@
// Testing
#include "../max/builtin/storage/app_data.h"
#include "../max/builtin/builtin.h"
static const char *filename = "/srv/work/database/interfaces/anims_max/cp_fy_hof_species.max";
//static const char *filename = "/home/kaetemi/source/minimax/GE_Acc_MikotoBaniere.max";
@ -47,6 +48,7 @@ int main(int argc, char **argv)
PIPELINE::MAX::CSceneClassRegistry sceneClassRegistry;
PIPELINE::MAX::BUILTIN::CBuiltin::registerClasses(&sceneClassRegistry);
GsfInfile *infile;

Loading…
Cancel
Save