00001 /**************************************************************************************** 00002 00003 Copyright (C) 2012 Autodesk, Inc. 00004 All rights reserved. 00005 00006 Use of this software is subject to the terms of the Autodesk license agreement 00007 provided at the time of installation or download, or which otherwise accompanies 00008 this software in either electronic or hard copy form. 00009 00010 ****************************************************************************************/ 00011 00013 #ifndef _FBXSDK_UTILS_EMBEDDED_FILES_ACCUMULATOR_H_ 00014 #define _FBXSDK_UTILS_EMBEDDED_FILES_ACCUMULATOR_H_ 00015 00016 #include <fbxsdk/fbxsdk_def.h> 00017 00018 #include <fbxsdk/utils/fbxprocessor.h> 00019 #include <fbxsdk/core/base/fbxmap.h> 00020 00021 #include <fbxsdk/fbxsdk_nsbegin.h> 00022 00028 class FBXSDK_DLL FbxEmbeddedFilesAccumulator : public FbxProcessor 00029 { 00030 public: 00031 00040 struct PropertyUrlIndex 00041 { 00042 FbxString mPropName; 00043 int mIndex; 00044 00045 PropertyUrlIndex() : mIndex(0) 00046 { 00047 } 00048 00049 PropertyUrlIndex(const FbxString& pUrl, int pIndex) 00050 : mPropName(pUrl) 00051 , mIndex(pIndex) 00052 { 00053 } 00054 }; 00055 00057 struct PropertyUrlIndexCompare 00058 { 00059 inline int operator()(const PropertyUrlIndex& pUrl1, const PropertyUrlIndex& pUrl2) const 00060 { 00061 if( pUrl1.mPropName < pUrl2.mPropName ) 00062 { 00063 return -1; 00064 } 00065 if( pUrl2.mPropName < pUrl1.mPropName ) 00066 { 00067 return 1; 00068 } 00069 00070 if(pUrl1.mIndex < pUrl2.mIndex) 00071 { 00072 return -1; 00073 } 00074 if(pUrl2.mIndex < pUrl1.mIndex) 00075 { 00076 return 1; 00077 } 00078 00079 return 0; 00080 } 00081 }; 00082 00083 typedef FbxSet2<PropertyUrlIndex, PropertyUrlIndexCompare> PropertyUrlIndexSet; 00084 00085 typedef FbxMap<FbxObject*, PropertyUrlIndexSet> ObjectPropertyMap; 00086 00087 struct EmbeddedFileInfo 00088 { 00089 FbxString mOriginalPropertyUrl; 00090 ObjectPropertyMap mConsumers; 00091 }; 00093 00100 typedef FbxMap<FbxString, EmbeddedFileInfo> EmbeddedFilesMap; 00101 00102 EmbeddedFilesMap mEmbeddedFiles; 00104 00105 public: 00106 00116 FbxEmbeddedFilesAccumulator(FbxManager& pManager, const char* pName, FbxSet2<FbxString>& pPropertyFilter); 00117 virtual ~FbxEmbeddedFilesAccumulator(); 00118 00120 // 00121 // WARNING! 00122 // 00123 // Anything beyond these lines may not be documented accurately and is 00124 // subject to change without notice. 00125 // 00127 00128 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00129 00130 private: 00131 virtual bool internal_ProcessObject(FbxObject* pObject); 00132 FbxSet2<FbxString> mPropertyFilter; 00133 00134 #endif 00135 00136 }; 00137 00138 #include <fbxsdk/fbxsdk_nsend.h> 00139 00140 #endif /* _FBXSDK_UTILS_EMBEDDED_FILES_ACCUMULATOR_H_ */