- fbx: add DOM layer to represent the parsed FBX file in-memory, capturing the essential semantics we need for importing.

This commit is contained in:
Alexander Gessler
2012-06-26 18:31:19 +02:00
parent 05b98c279b
commit 25dfbdf58d
7 changed files with 1961 additions and 1398 deletions

View File

@@ -85,17 +85,26 @@ class Element
{
public:
Element(Parser& parser);
Element(TokenPtr key_token, Parser& parser);
~Element();
public:
const Scope* Compound() const {
return compound.get();
}
TokenPtr KeyToken() const {
return key_token;
}
const TokenList& Tokens() const {
return tokens;
}
private:
TokenPtr key_token;
TokenList tokens;
boost::scoped_ptr<Scope> compound;
};
@@ -123,6 +132,11 @@ public:
public:
const Element* operator[] (const std::string& index) const {
ElementMap::const_iterator it = elements.find(index);
return it == elements.end() ? NULL : (*it).second;
}
const ElementMap& Elements() const {
return elements;
}
@@ -139,6 +153,8 @@ class Parser
{
public:
/** Parse given a token list. Does not take ownership of the tokens -
* the objects must persist during the entire parser lifetime */
Parser (const TokenList& tokens);
~Parser();
@@ -168,6 +184,14 @@ private:
};
/* token parsing - this happens when building the DOM out of the parse-tree*/
uint64_t ParseTokenAsID(const Token& t, const char*& err_out);
uint64_t ParseTokenAsDim(const Token& t, const char*& err_out);
float ParseTokenAsFloat(const Token& t, const char*& err_out);
int ParseTokenAsInt(const Token& t, const char*& err_out);
std::string ParseTokenAsString(const Token& t, const char*& err_out);
} // ! FBX
} // ! Assimp