00001 
00004 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXIOPLUGINREGISTRY_H
00005 #define FBXFILESDK_KFBXPLUGINS_KFBXIOPLUGINREGISTRY_H
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 #include <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00043 #include <fbxfilesdk/components/kbaselib/kaydara.h>
00044 
00045 #include <fbxfilesdk/kfbxio/kfbxreader.h>
00046 #include <fbxfilesdk/kfbxio/kfbxwriter.h>
00047 
00048 #include <fbxfilesdk/components/kbaselib/kbaselib_forward.h>
00049 
00050 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00051 
00052 class KFbxSdkManager;
00053 class KFbxIOPluginRegistry;
00054 class KFbxExporter;
00055 class KFbxImporter;
00056 class KFbxIOSettings;
00057 
00063 class KFBX_DLL KFbxIOPluginRegistry
00064 {
00065 public:
00066 
00069     KFbxIOPluginRegistry();
00070 
00073     virtual ~KFbxIOPluginRegistry();
00074 
00080     void RegisterReader(char const* pPluginPath,
00081                         int& pFirstPluginID,
00082                         int& pRegisteredCount);
00083 
00091     void RegisterReader(KFbxReader::CreateFuncType pCreateF, 
00092                         KFbxReader::GetInfoFuncType pInfoF,
00093                         int& pFirstPluginID,
00094                         int& pRegisteredCount,
00095                         KFbxReader::IOSettingsFillerFuncType pIOSettingsFillerF = NULL
00096                        );
00097 
00098 
00104     void RegisterWriter(char const* pPluginPath,
00105                         int& pFirstPluginID,
00106                         int& pRegisteredCount);
00107 
00115     void RegisterWriter(KFbxWriter::CreateFuncType pCreateF, 
00116                         KFbxWriter::GetInfoFuncType pInfoF,
00117                         int& pFirstPluginID,
00118                         int& pRegisteredCount,
00119                         KFbxWriter::IOSettingsFillerFuncType pIOSettingsFillerF = NULL);
00120 
00126     KFbxReader* CreateReader(KFbxSdkManager& pManager, 
00127                              KFbxImporter& pImporter, 
00128                              int pPluginID) const;
00129 
00135     KFbxWriter* CreateWriter(KFbxSdkManager& pManager, 
00136                              KFbxExporter& pExporter,
00137                              int pPluginID) const;
00138 
00143     int FindReaderIDByExtension(char const* pExt) const;
00144 
00149     int FindWriterIDByExtension(char const* pExt) const;
00150     
00155     int FindReaderIDByDescription(char const* pDesc) const;
00156 
00161     int FindWriterIDByDescription(char const* pDesc) const;
00162     
00167     bool ReaderIsFBX(int pFileFormat) const;
00168 
00173     bool WriterIsFBX(int pFileFormat) const;
00174 
00179     bool ReaderIsGenuine(int pFileFormat) const;
00180 
00185     bool WriterIsGenuine(int pFileFormat) const;
00186 
00190     int GetReaderFormatCount() const;
00191 
00198     int GetWriterFormatCount() const;
00199 
00204     char const* GetReaderFormatDescription(int pFileFormat) const;
00205 
00210     char const* GetWriterFormatDescription(int pFileFormat) const;
00211 
00216     char const* GetReaderFormatExtension(int pFileFormat) const;
00217     
00222     char const* GetWriterFormatExtension(int pFileFormat) const;
00223 
00228     char const* const* GetWritableVersions(int pFileFormat) const;
00229 
00240     bool DetectFileFormat(const char* pFileName, int& pFileFormat) const;
00241     
00245     int GetNativeReaderFormat();
00246 
00250     int GetNativeWriterFormat();
00251 
00255     void FillIOSettingsForReadersRegistered(KFbxIOSettings & pIOS);
00256 
00260     void FillIOSettingsForWritersRegistered(KFbxIOSettings & pIOS);
00261 
00262 
00264 
00265 
00266 
00267 
00268 
00269 
00271 
00272 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00273 
00274 private:
00275     void RegisterInternalIOPlugins();
00276 
00277     struct ReaderPluginEntry
00278     {
00279         ReaderPluginEntry(char const* pExtension, char const* pDescription, KFbxReader::CreateFuncType pCreatorFunction, int pBaseID,
00280             KFbxReader::IOSettingsFillerFuncType pIOSettingsFillerFunction=NULL);
00281         
00282         char const*                             mExtension;
00283         char const*                             mDescription;
00284         KFbxReader::CreateFuncType              mCreatorFunction;
00285         KFbxReader::IOSettingsFillerFuncType    mIOSettingsFillerFunction;
00286         int                                     mBaseID;
00287         bool                                    mIsFBX;
00288         bool                                    mIsInternalPlugin;
00289     };
00290     
00291     struct WriterPluginEntry
00292     {
00293         WriterPluginEntry(char const* pExtension, char const* pDescription, char const* const* pVersions, KFbxWriter::CreateFuncType pCreatorFunction, int pBaseID,
00294             KFbxWriter::IOSettingsFillerFuncType pIOSettingsFillerFunction=NULL);
00295         
00296         char const*                             mExtension;
00297         char const*                             mDescription;
00298         char const* const*                      mVersions;
00299         KFbxWriter::CreateFuncType              mCreatorFunction;
00300         KFbxWriter::IOSettingsFillerFuncType    mIOSettingsFillerFunction;
00301         int                                     mBaseID;
00302         bool                                    mIsFBX;
00303         bool                                    mIsInternalPlugin;
00304     };
00305 
00306     KArrayTemplate<ReaderPluginEntry*>  mReaders;
00307     KArrayTemplate<WriterPluginEntry*>  mWriters;
00308     int                                 mNativeReaderFormat;
00309     int                                 mNativeWriterFormat;
00310     bool                                mInternalPluginMode;
00311 
00312 #endif //DOXYGEN
00313 };
00314 
00315 
00316 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00317 
00318 #endif // FBXFILESDK_KFBXPLUGINS_KFBXIOPLUGINREGISTRY_H
00319