diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2017-05-24 12:09:44 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-05-24 12:10:02 +0100 |
commit | 77d294db076dac19e8b549b445ffede9f7260c84 (patch) | |
tree | 828ee7a6862ec5c0bd24f97cb540625a2c647376 /src/3rdparty/assimp/code/FBXParser.h | |
parent | 59f8fec8a41606b3185fe3a4e276978e3e1ed5ef (diff) | |
parent | 939b9b4b7591e8a421cf048a0a84ed3e75d81d21 (diff) |
Merge branch 'dev' into wip/animationwip/animation
Change-Id: I6e770609c90a7745d08fa4e2f424e865678c5d6f
Diffstat (limited to 'src/3rdparty/assimp/code/FBXParser.h')
-rw-r--r-- | src/3rdparty/assimp/code/FBXParser.h | 153 |
1 files changed, 74 insertions, 79 deletions
diff --git a/src/3rdparty/assimp/code/FBXParser.h b/src/3rdparty/assimp/code/FBXParser.h index e6fa25d22..6bc34272a 100644 --- a/src/3rdparty/assimp/code/FBXParser.h +++ b/src/3rdparty/assimp/code/FBXParser.h @@ -2,11 +2,11 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2012, assimp team +Copyright (c) 2006-2016, assimp team All rights reserved. -Redistribution and use of this software in source and binary forms, -with or without modification, are permitted provided that the +Redistribution and use of this software in source and binary forms, +with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above @@ -23,16 +23,16 @@ following conditions are met: derived from this software without specific prior written permission of the assimp team. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------- @@ -44,13 +44,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef INCLUDED_AI_FBX_PARSER_H #define INCLUDED_AI_FBX_PARSER_H -#include <vector> +#include <stdint.h> #include <map> -#include <string> -#include <utility> - -#include <boost/shared_ptr.hpp> - +#include <memory> #include "LogAux.h" #include "FBXCompileConfig.h" @@ -59,18 +55,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace Assimp { namespace FBX { - class Scope; - class Parser; - class Element; +class Scope; +class Parser; +class Element; - // XXX should use C++11's unique_ptr - but assimp's need to keep working with 03 - typedef std::vector< Scope* > ScopeList; - typedef std::fbx_unordered_multimap< std::string, Element* > ElementMap; +// XXX should use C++11's unique_ptr - but assimp's need to keep working with 03 +typedef std::vector< Scope* > ScopeList; +typedef std::fbx_unordered_multimap< std::string, Element* > ElementMap; - typedef std::pair<ElementMap::const_iterator,ElementMap::const_iterator> ElementCollection; +typedef std::pair<ElementMap::const_iterator,ElementMap::const_iterator> ElementCollection; -# define new_Scope new Scope -# define new_Element new Element +# define new_Scope new Scope +# define new_Element new Element /** FBX data entity that consists of a key:value tuple. @@ -88,28 +84,28 @@ class Element { public: - Element(const Token& key_token, Parser& parser); - ~Element(); + Element(const Token& key_token, Parser& parser); + ~Element(); public: - const Scope* Compound() const { - return compound.get(); - } + const Scope* Compound() const { + return compound.get(); + } - const Token& KeyToken() const { - return key_token; - } + const Token& KeyToken() const { + return key_token; + } - const TokenList& Tokens() const { - return tokens; - } + const TokenList& Tokens() const { + return tokens; + } private: - const Token& key_token; - TokenList tokens; - boost::scoped_ptr<Scope> compound; + const Token& key_token; + TokenList tokens; + std::unique_ptr<Scope> compound; }; @@ -121,7 +117,7 @@ private: * @verbatim * GlobalSettings: { * Version: 1000 - * Properties70: + * Properties70: * [...] * } * @endverbatim */ @@ -130,73 +126,69 @@ class Scope public: - Scope(Parser& parser, bool topLevel = false); - ~Scope(); + Scope(Parser& parser, bool topLevel = false); + ~Scope(); public: - const Element* operator[] (const std::string& index) const { - ElementMap::const_iterator it = elements.find(index); - return it == elements.end() ? NULL : (*it).second; - } + const Element* operator[] (const std::string& index) const { + ElementMap::const_iterator it = elements.find(index); + return it == elements.end() ? NULL : (*it).second; + } - ElementCollection GetCollection(const std::string& index) const { - return elements.equal_range(index); - } + ElementCollection GetCollection(const std::string& index) const { + return elements.equal_range(index); + } - const ElementMap& Elements() const { - return elements; - } + const ElementMap& Elements() const { + return elements; + } private: - ElementMap elements; + ElementMap elements; }; /** FBX parsing class, takes a list of input tokens and generates a hierarchy * of nested #Scope instances, representing the fbx DOM.*/ -class Parser +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,bool is_binary); - ~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,bool is_binary); + ~Parser(); - const Scope& GetRootScope() const { - return *root.get(); - } +public: + const Scope& GetRootScope() const { + return *root.get(); + } - bool IsBinary() const { - return is_binary; - } + bool IsBinary() const { + return is_binary; + } private: + friend class Scope; + friend class Element; - friend class Scope; - friend class Element; - - TokenPtr AdvanceToNextToken(); + TokenPtr AdvanceToNextToken(); - TokenPtr LastToken() const; - TokenPtr CurrentToken() const; + TokenPtr LastToken() const; + TokenPtr CurrentToken() const; - private: + const TokenList& tokens; - const TokenList& tokens; - - TokenPtr last, current; - TokenList::const_iterator cursor; - boost::scoped_ptr<Scope> root; + TokenPtr last, current; + TokenList::const_iterator cursor; + std::unique_ptr<Scope> root; - const bool is_binary; + const bool is_binary; }; @@ -206,6 +198,7 @@ size_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); +int64_t ParseTokenAsInt64(const Token& t, const char*& err_out); std::string ParseTokenAsString(const Token& t, const char*& err_out); @@ -214,6 +207,7 @@ uint64_t ParseTokenAsID(const Token& t); size_t ParseTokenAsDim(const Token& t); float ParseTokenAsFloat(const Token& t); int ParseTokenAsInt(const Token& t); +int64_t ParseTokenAsInt64(const Token& t); std::string ParseTokenAsString(const Token& t); /* read data arrays */ @@ -224,6 +218,7 @@ void ParseVectorDataArray(std::vector<int>& out, const Element& el); void ParseVectorDataArray(std::vector<float>& out, const Element& el); void ParseVectorDataArray(std::vector<unsigned int>& out, const Element& el); void ParseVectorDataArray(std::vector<uint64_t>& out, const Element& e); +void ParseVectorDataArray(std::vector<int64_t>& out, const Element& el); |