diff options
Diffstat (limited to 'src/3rdparty/assimp/code/FBXProperties.h')
-rw-r--r-- | src/3rdparty/assimp/code/FBXProperties.h | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/src/3rdparty/assimp/code/FBXProperties.h b/src/3rdparty/assimp/code/FBXProperties.h index 60cdfe2c6..09b8aa94c 100644 --- a/src/3rdparty/assimp/code/FBXProperties.h +++ b/src/3rdparty/assimp/code/FBXProperties.h @@ -2,7 +2,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -44,15 +45,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef INCLUDED_AI_FBX_PROPERTIES_H #define INCLUDED_AI_FBX_PROPERTIES_H -#include <map> #include "FBXCompileConfig.h" #include <memory> +#include <string> namespace Assimp { namespace FBX { - class Element; - +// Forward declarations +class Element; /** Represents a dynamic property. Type info added by deriving classes, * see #TypedProperty. @@ -60,10 +61,8 @@ namespace FBX { @verbatim P: "ShininessExponent", "double", "Number", "",0.5 @endvebatim - */ -class Property -{ +class Property { protected: Property(); @@ -77,17 +76,14 @@ public: } }; - template<typename T> -class TypedProperty : public Property -{ +class TypedProperty : public Property { public: explicit TypedProperty(const T& value) - : value(value) - { + : value(value) { + // empty } -public: const T& Value() const { return value; } @@ -98,21 +94,19 @@ private: typedef std::fbx_unordered_map<std::string,std::shared_ptr<Property> > DirectPropertyMap; -typedef std::fbx_unordered_map<std::string,const Property*> PropertyMap; -typedef std::fbx_unordered_map<std::string,const Element*> LazyPropertyMap; +typedef std::fbx_unordered_map<std::string,const Property*> PropertyMap; +typedef std::fbx_unordered_map<std::string,const Element*> LazyPropertyMap; /** * Represents a property table as can be found in the newer FBX files (Properties60, Properties70) */ -class PropertyTable -{ +class PropertyTable { public: // in-memory property table with no source element PropertyTable(); PropertyTable(const Element& element, std::shared_ptr<const PropertyTable> templateProps); ~PropertyTable(); -public: const Property* Get(const std::string& name) const; // PropertyTable's need not be coupled with FBX elements so this can be NULL @@ -133,41 +127,37 @@ private: const Element* const element; }; - // ------------------------------------------------------------------------------------------------ template <typename T> -inline T PropertyGet(const PropertyTable& in, const std::string& name, - const T& defaultValue) -{ +inline +T PropertyGet(const PropertyTable& in, const std::string& name, const T& defaultValue) { const Property* const prop = in.Get(name); - if(!prop) { + if( nullptr == prop) { return defaultValue; } // strong typing, no need to be lenient const TypedProperty<T>* const tprop = prop->As< TypedProperty<T> >(); - if(!tprop) { + if( nullptr == tprop) { return defaultValue; } return tprop->Value(); } - // ------------------------------------------------------------------------------------------------ template <typename T> -inline T PropertyGet(const PropertyTable& in, const std::string& name, - bool& result) -{ +inline +T PropertyGet(const PropertyTable& in, const std::string& name, bool& result) { const Property* const prop = in.Get(name); - if(!prop) { + if( nullptr == prop) { result = false; return T(); } // strong typing, no need to be lenient const TypedProperty<T>* const tprop = prop->As< TypedProperty<T> >(); - if(!tprop) { + if( nullptr == tprop) { result = false; return T(); } @@ -176,7 +166,6 @@ inline T PropertyGet(const PropertyTable& in, const std::string& name, return tprop->Value(); } - } //! FBX } //! Assimp |