Changed: #1440 Parse function instead of serialized handler

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent 8cacf5f386
commit dc0e9a513e

@ -65,6 +65,16 @@ void CClassData::toString(std::ostream &ostream, const std::string &pad)
CStorageContainer::toString(ostream, pad);
}
void CClassData::parse(uint16 version, TParseLevel level)
{
CStorageContainer::parse(version, level);
}
void CClassData::build(uint16 version)
{
CStorageContainer::build(version);
}
IStorageObject *CClassData::createChunkById(uint16 id, bool container)
{
if (container)
@ -78,11 +88,6 @@ IStorageObject *CClassData::createChunkById(uint16 id, bool container)
return CStorageContainer::createChunkById(id, container);
}
void CClassData::serialized(TStorageObjectContainer::iterator soit, bool container)
{
CStorageContainer::serialized(soit, container);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
@ -107,6 +112,16 @@ void CClassDataEntry::toString(std::ostream &ostream, const std::string &pad)
CStorageContainer::toString(ostream, pad);
}
void CClassDataEntry::parse(uint16 version, TParseLevel level)
{
CStorageContainer::parse(version, level);
}
void CClassDataEntry::build(uint16 version)
{
CStorageContainer::build(version);
}
IStorageObject *CClassDataEntry::createChunkById(uint16 id, bool container)
{
if (!container)
@ -125,11 +140,6 @@ IStorageObject *CClassDataEntry::createChunkById(uint16 id, bool container)
return CStorageContainer::createChunkById(id, container);
}
void CClassDataEntry::serialized(TStorageObjectContainer::iterator soit, bool container)
{
CStorageContainer::serialized(soit, container);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

@ -56,10 +56,11 @@ public:
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void parse(uint16 version, TParseLevel level);
virtual void build(uint16 version);
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
virtual void serialized(TStorageObjectContainer::iterator soit, bool container);
}; /* class CClassData */
@ -78,10 +79,11 @@ public:
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void parse(uint16 version, TParseLevel level);
virtual void build(uint16 version);
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
virtual void serialized(TStorageObjectContainer::iterator soit, bool container);
}; /* class CClassDataEntry */

@ -65,6 +65,16 @@ void CClassDirectory3::toString(std::ostream &ostream, const std::string &pad)
CStorageContainer::toString(ostream, pad);
}
void CClassDirectory3::parse(uint16 version, TParseLevel level)
{
CStorageContainer::parse(version, level);
}
void CClassDirectory3::build(uint16 version)
{
CStorageContainer::build(version);
}
IStorageObject *CClassDirectory3::createChunkById(uint16 id, bool container)
{
if (container)
@ -78,11 +88,6 @@ IStorageObject *CClassDirectory3::createChunkById(uint16 id, bool container)
return CStorageContainer::createChunkById(id, container);
}
void CClassDirectory3::serialized(TStorageObjectContainer::iterator soit, bool container)
{
CStorageContainer::serialized(soit, container);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
@ -107,6 +112,16 @@ void CClassEntry::toString(std::ostream &ostream, const std::string &pad)
CStorageContainer::toString(ostream, pad);
}
void CClassEntry::parse(uint16 version, TParseLevel level)
{
CStorageContainer::parse(version, level);
}
void CClassEntry::build(uint16 version)
{
CStorageContainer::build(version);
}
IStorageObject *CClassEntry::createChunkById(uint16 id, bool container)
{
if (!container)
@ -122,11 +137,6 @@ IStorageObject *CClassEntry::createChunkById(uint16 id, bool container)
return CStorageContainer::createChunkById(id, container);
}
void CClassEntry::serialized(TStorageObjectContainer::iterator soit, bool container)
{
CStorageContainer::serialized(soit, container);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

@ -56,10 +56,11 @@ public:
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void parse(uint16 version, TParseLevel level);
virtual void build(uint16 version);
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
virtual void serialized(TStorageObjectContainer::iterator soit, bool container);
}; /* class CClassDirectory3 */
@ -78,10 +79,11 @@ public:
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void parse(uint16 version, TParseLevel level);
virtual void build(uint16 version);
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
virtual void serialized(TStorageObjectContainer::iterator soit, bool container);
}; /* class CClassEntry */

@ -66,6 +66,16 @@ void CConfig::toString(std::ostream &ostream, const std::string &pad)
CStorageContainer::toString(ostream, pad);
}
void CConfig::parse(uint16 version, TParseLevel level)
{
CStorageContainer::parse(version, level);
}
void CConfig::build(uint16 version)
{
CStorageContainer::build(version);
}
IStorageObject *CConfig::createChunkById(uint16 id, bool container)
{
if (container)
@ -89,11 +99,6 @@ IStorageObject *CConfig::createChunkById(uint16 id, bool container)
return CStorageContainer::createChunkById(id, container);
}
void CConfig::serialized(TStorageObjectContainer::iterator soit, bool container)
{
CStorageContainer::serialized(soit, container);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
@ -118,6 +123,16 @@ void CConfig20a0::toString(std::ostream &ostream, const std::string &pad)
CStorageContainer::toString(ostream, pad);
}
void CConfig20a0::parse(uint16 version, TParseLevel level)
{
CStorageContainer::parse(version, level);
}
void CConfig20a0::build(uint16 version)
{
CStorageContainer::build(version);
}
IStorageObject *CConfig20a0::createChunkById(uint16 id, bool container)
{
if (container)
@ -139,11 +154,6 @@ IStorageObject *CConfig20a0::createChunkById(uint16 id, bool container)
return CStorageContainer::createChunkById(id, container);
}
void CConfig20a0::serialized(TStorageObjectContainer::iterator soit, bool container)
{
CStorageContainer::serialized(soit, container);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
@ -168,6 +178,16 @@ void CConfig20a0Entry::toString(std::ostream &ostream, const std::string &pad)
CStorageContainer::toString(ostream, pad);
}
void CConfig20a0Entry::parse(uint16 version, TParseLevel level)
{
CStorageContainer::parse(version, level);
}
void CConfig20a0Entry::build(uint16 version)
{
CStorageContainer::build(version);
}
IStorageObject *CConfig20a0Entry::createChunkById(uint16 id, bool container)
{
if (container)
@ -216,11 +236,6 @@ IStorageObject *CConfig20a0Entry::createChunkById(uint16 id, bool container)
return CStorageContainer::createChunkById(id, container);
}
void CConfig20a0Entry::serialized(TStorageObjectContainer::iterator soit, bool container)
{
CStorageContainer::serialized(soit, container);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
@ -245,6 +260,16 @@ void CConfigScript::toString(std::ostream &ostream, const std::string &pad)
CStorageContainer::toString(ostream, pad);
}
void CConfigScript::parse(uint16 version, TParseLevel level)
{
CStorageContainer::parse(version, level);
}
void CConfigScript::build(uint16 version)
{
CStorageContainer::build(version);
}
IStorageObject *CConfigScript::createChunkById(uint16 id, bool container)
{
if (container)
@ -258,11 +283,6 @@ IStorageObject *CConfigScript::createChunkById(uint16 id, bool container)
return CStorageContainer::createChunkById(id, container);
}
void CConfigScript::serialized(TStorageObjectContainer::iterator soit, bool container)
{
CStorageContainer::serialized(soit, container);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
@ -287,6 +307,16 @@ void CConfigScriptEntry::toString(std::ostream &ostream, const std::string &pad)
CStorageContainer::toString(ostream, pad);
}
void CConfigScriptEntry::parse(uint16 version, TParseLevel level)
{
CStorageContainer::parse(version, level);
}
void CConfigScriptEntry::build(uint16 version)
{
CStorageContainer::build(version);
}
IStorageObject *CConfigScriptEntry::createChunkById(uint16 id, bool container)
{
if (container)
@ -308,11 +338,6 @@ IStorageObject *CConfigScriptEntry::createChunkById(uint16 id, bool container)
return CStorageContainer::createChunkById(id, container);
}
void CConfigScriptEntry::serialized(TStorageObjectContainer::iterator soit, bool container)
{
CStorageContainer::serialized(soit, container);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
@ -370,6 +395,16 @@ void CConfigScriptMetaContainer::toString(std::ostream &ostream, const std::stri
CStorageContainer::toString(ostream, pad);
}
void CConfigScriptMetaContainer::parse(uint16 version, TParseLevel level)
{
CStorageContainer::parse(version, level);
}
void CConfigScriptMetaContainer::build(uint16 version)
{
CStorageContainer::build(version);
}
IStorageObject *CConfigScriptMetaContainer::createChunkById(uint16 id, bool container)
{
if (container)
@ -405,11 +440,6 @@ IStorageObject *CConfigScriptMetaContainer::createChunkById(uint16 id, bool cont
return CStorageContainer::createChunkById(id, container);
}
void CConfigScriptMetaContainer::serialized(TStorageObjectContainer::iterator soit, bool container)
{
CStorageContainer::serialized(soit, container);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

@ -56,10 +56,11 @@ public:
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void parse(uint16 version, TParseLevel level);
virtual void build(uint16 version);
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
virtual void serialized(TStorageObjectContainer::iterator soit, bool container);
}; /* class CConfig */
@ -78,10 +79,11 @@ public:
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void parse(uint16 version, TParseLevel level);
virtual void build(uint16 version);
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
virtual void serialized(TStorageObjectContainer::iterator soit, bool container);
}; /* class CConfig20a0 */
@ -100,10 +102,11 @@ public:
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void parse(uint16 version, TParseLevel level);
virtual void build(uint16 version);
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
virtual void serialized(TStorageObjectContainer::iterator soit, bool container);
}; /* class CConfig20a0Entry */
@ -122,10 +125,11 @@ public:
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void parse(uint16 version, TParseLevel level);
virtual void build(uint16 version);
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
virtual void serialized(TStorageObjectContainer::iterator soit, bool container);
}; /* class CConfigScript */
@ -144,10 +148,11 @@ public:
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void parse(uint16 version, TParseLevel level);
virtual void build(uint16 version);
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
virtual void serialized(TStorageObjectContainer::iterator soit, bool container);
}; /* class CConfigScriptEntry */
@ -190,10 +195,11 @@ public:
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void parse(uint16 version, TParseLevel level);
virtual void build(uint16 version);
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
virtual void serialized(TStorageObjectContainer::iterator soit, bool container);
}; /* class CConfigScriptMetaContainer */

@ -61,6 +61,16 @@ void CDllDirectory::toString(std::ostream &ostream, const std::string &pad)
CStorageContainer::toString(ostream, pad);
}
void CDllDirectory::parse(uint16 version, TParseLevel level)
{
CStorageContainer::parse(version, level);
}
void CDllDirectory::build(uint16 version)
{
CStorageContainer::build(version);
}
IStorageObject *CDllDirectory::createChunkById(uint16 id, bool container)
{
if (container)
@ -75,18 +85,13 @@ IStorageObject *CDllDirectory::createChunkById(uint16 id, bool container)
{
switch (id)
{
case 0x21C0: // FileVersion
case 0x21C0: // DllDirectoryHeader
return new CStorageValue<uint32>();
}
}
return CStorageContainer::createChunkById(id, container);
}
void CDllDirectory::serialized(TStorageObjectContainer::iterator soit, bool container)
{
CStorageContainer::serialized(soit, container);
}
CDllEntry::CDllEntry()
{
@ -107,6 +112,16 @@ void CDllEntry::toString(std::ostream &ostream, const std::string &pad)
CStorageContainer::toString(ostream, pad);
}
void CDllEntry::parse(uint16 version, TParseLevel level)
{
CStorageContainer::parse(version, level);
}
void CDllEntry::build(uint16 version)
{
CStorageContainer::build(version);
}
IStorageObject *CDllEntry::createChunkById(uint16 id, bool container)
{
if (!container)
@ -121,11 +136,6 @@ IStorageObject *CDllEntry::createChunkById(uint16 id, bool container)
return CStorageContainer::createChunkById(id, container);
}
void CDllEntry::serialized(TStorageObjectContainer::iterator soit, bool container)
{
CStorageContainer::serialized(soit, container);
}
} /* namespace MAX */
} /* namespace PIPELINE */

@ -55,10 +55,11 @@ public:
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void parse(uint16 version, TParseLevel level);
virtual void build(uint16 version);
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
virtual void serialized(TStorageObjectContainer::iterator soit, bool container);
}; /* class CDllDirectory */
@ -77,10 +78,11 @@ public:
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void parse(uint16 version, TParseLevel level);
virtual void build(uint16 version);
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
virtual void serialized(TStorageObjectContainer::iterator soit, bool container);
}; /* class CDllDirectory */

@ -66,6 +66,16 @@ void CScene::toString(std::ostream &ostream, const std::string &pad)
CStorageContainer::toString(ostream, pad);
}
void CScene::parse(uint16 version, TParseLevel level)
{
CStorageContainer::parse(version, level);
}
void CScene::build(uint16 version)
{
CStorageContainer::build(version);
}
IStorageObject *CScene::createChunkById(uint16 id, bool container)
{
if (container)
@ -76,11 +86,6 @@ IStorageObject *CScene::createChunkById(uint16 id, bool container)
return CStorageContainer::createChunkById(id, container);
}
void CScene::serialized(TStorageObjectContainer::iterator soit, bool container)
{
CStorageContainer::serialized(soit, container);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
@ -105,6 +110,16 @@ void CSceneClassContainer::toString(std::ostream &ostream, const std::string &pa
CStorageContainer::toString(ostream, pad);
}
void CSceneClassContainer::parse(uint16 version, TParseLevel level)
{
CStorageContainer::parse(version, level);
}
void CSceneClassContainer::build(uint16 version)
{
CStorageContainer::build(version);
}
IStorageObject *CSceneClassContainer::createChunkById(uint16 id, bool container)
{
if (container)
@ -116,11 +131,6 @@ IStorageObject *CSceneClassContainer::createChunkById(uint16 id, bool container)
return CStorageContainer::createChunkById(id, container);
}
void CSceneClassContainer::serialized(TStorageObjectContainer::iterator soit, bool container)
{
CStorageContainer::serialized(soit, container);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
@ -145,14 +155,19 @@ void CSceneClass::toString(std::ostream &ostream, const std::string &pad)
CStorageContainer::toString(ostream, pad);
}
IStorageObject *CSceneClass::createChunkById(uint16 id, bool container)
void CSceneClass::parse(uint16 version, TParseLevel level)
{
return CStorageContainer::createChunkById(id, container);
CStorageContainer::parse(version, level);
}
void CSceneClass::build(uint16 version)
{
CStorageContainer::build(version);
}
void CSceneClass::serialized(TStorageObjectContainer::iterator soit, bool container)
IStorageObject *CSceneClass::createChunkById(uint16 id, bool container)
{
CStorageContainer::serialized(soit, container);
return CStorageContainer::createChunkById(id, container);
}
const ucchar *CSceneClass::DisplayName = ucstring("Unknown Scene Class").c_str();

@ -59,10 +59,11 @@ public:
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void parse(uint16 version, TParseLevel level);
virtual void build(uint16 version);
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
virtual void serialized(TStorageObjectContainer::iterator soit, bool container);
}; /* class CScene */
@ -81,10 +82,11 @@ public:
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void parse(uint16 version, TParseLevel level);
virtual void build(uint16 version);
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
virtual void serialized(TStorageObjectContainer::iterator soit, bool container);
}; /* class CSceneClassContainer */
@ -105,6 +107,8 @@ public:
// inherited
virtual std::string getClassName();
virtual void toString(std::ostream &ostream, const std::string &pad = "");
virtual void parse(uint16 version, TParseLevel level);
virtual void build(uint16 version);
// static const
static const ucchar *DisplayName;
@ -117,7 +121,6 @@ public:
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
virtual void serialized(TStorageObjectContainer::iterator soit, bool container);
}; /* class CSceneClass */

@ -140,6 +140,28 @@ void CStorageContainer::toString(std::ostream &ostream, const std::string &pad)
ostream << "} ";
}
void CStorageContainer::parse(uint16 version, TParseLevel level)
{
for (TStorageObjectContainer::const_iterator it = Chunks.begin(), end = Chunks.end(); it != end; ++it)
{
if (it->second->isContainer())
{
static_cast<CStorageContainer *>(it->second)->parse(version, level);
}
}
}
void CStorageContainer::build(uint16 version)
{
for (TStorageObjectContainer::const_iterator it = Chunks.begin(), end = Chunks.end(); it != end; ++it)
{
if (it->second->isContainer())
{
static_cast<CStorageContainer *>(it->second)->build(version);
}
}
}
bool CStorageContainer::isContainer() const
{
return true;
@ -167,9 +189,9 @@ void CStorageContainer::serial(CStorageChunks &chunks)
Chunks.push_back(TStorageObjectWithId(id, storageObject));
if (chunks.leaveChunk()) // bytes were skipped while reading
throw EStorage();
TStorageObjectContainer::iterator soit = Chunks.end();
/*TStorageObjectContainer::iterator soit = Chunks.end();
--soit;
serialized(soit, cont);
serialized(soit, cont);*/
}
}
else
@ -195,11 +217,6 @@ IStorageObject *CStorageContainer::createChunkById(uint16 id, bool container)
}
}
void CStorageContainer::serialized(TStorageObjectContainer::iterator soit, bool container)
{
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

@ -49,12 +49,23 @@ struct EStorage : public NLMISC::Exception
enum TParseLevel
{
PARSE_SYSTEM = 0x00000001, // Parse system related classes
PARSE_INTERNAL = 0x00000001, // Directly parse basic class formats
// PARSE_BUILTIN = 0x00000002; // Parse all builtin classes - reserved
PARSE_NELDATA = 0x00000004, // Parse all structures related to nel specific data (nel material, node properties, etcetera)
PARSE_NEL3D = 0x00000008, // Parse classes to initialize their nel3d equivalent classes
// PARSE_NELDATA = 0x00000004, // Parse all structures related to nel specific data (nel material, node properties, etcetera)
// PARSE_NEL3D = 0x00000008, // Parse classes to initialize their nel3d equivalent classes
};
// NOTE: This is the wrong location. Make a definitions header.
const uint16 VersionUnknown = 0x0000;
const uint16 Version3 = 0x2004;
const uint16 Version4 = 0x2006;
const uint16 Version5 = 0x2008;
const uint16 Version6 = 0x2009;
const uint16 Version9 = 0x200E;
const uint16 Version2008 = 0x200F;
const uint16 Version2010 = 0x2012;
// END OF NOTE
// IStorageObject : exposes serial(CStorageStream &stream) and dump(const std::string &pad)
class IStorageObject : public NLMISC::IStreamable
{
@ -87,6 +98,12 @@ public:
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
// Parse this class with given version and parse level filter
virtual void parse(uint16 version, TParseLevel level);
// Build the storage structure needed to store the parsed data back
virtual void build(uint16 version);
public: // should be protected but that doesn't compile, nice c++!
// inherited
virtual bool isContainer() const;
@ -96,8 +113,6 @@ protected:
virtual void serial(CStorageChunks &chunks);
// Create a storage object by id, override to provide custom serialization
virtual IStorageObject *createChunkById(uint16 id, bool container);
// Callback when a storage object has been serialized and put in the chunks list, override to index them
virtual void serialized(TStorageObjectContainer::iterator soit, bool container);
};
// CStorageRaw : serializes raw data, use for unknown data

Loading…
Cancel
Save