FBX SDK Reference Guide: kfbxreader.h Source File
Go to the documentation of this file.
00001 
00004 #ifndef _FBXSDK_READER_H_
00005 #define _FBXSDK_READER_H_
00006 
00007 /**************************************************************************************
00008 
00009  Copyright © 2001 - 2008 Autodesk, Inc. and/or its licensors.
00010  All Rights Reserved.
00011 
00012  The coded instructions, statements, computer programs, and/or related material 
00013  (collectively the "Data") in these files contain unpublished information 
00014  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00015  Canada and United States of America federal copyright law and by international 
00016  treaties. 
00017  
00018  The Data may not be disclosed or distributed to third parties, in whole or in
00019  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00020 
00021  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00022  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00023  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00024  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00025  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00026  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00027  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00028  
00029  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00030  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00031  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00032  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00033  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00034  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00035  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00036  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00037  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00038  OR DAMAGE. 
00039 
00040 **************************************************************************************/
00041 
00042 #include <kaydaradef.h>
00043 
00044 #ifndef KFBX_DLL
00045     #define KFBX_DLL K_DLLIMPORT
00046 #endif
00047 
00048 #include <klib/kerror.h>
00049 
00050 
00051 #include <kbaselib_forward.h>
00052 #ifndef MB_FBXSDK
00053 #include <kbaselib_nsuse.h>
00054 #endif
00055 
00056 #include <kfcurve/kfcurve_forward.h>
00057 #ifndef MB_FBXSDK
00058 #include <kfcurve/kfcurve_nsuse.h>
00059 #endif
00060 
00061 #include <fbxfilesdk_nsbegin.h>
00062 
00063 class KFbxDocument;
00064 class KFbxNode;
00065 class KFbxSdkManager;
00066 class KFbxImporter;
00067 class KFbxStreamOptions;
00068 class KFbxIOSettings;
00069 class KFbxAxisSystem;
00070 class KFbxSystemUnit;
00071 class KFbxStatistics;
00072 class KFile;
00073 
00074 class KFBX_DLL KFbxReader
00075 {
00076 
00077 public:
00078 
00079     KFbxReader(KFbxSdkManager& pManager);
00080     virtual ~KFbxReader();
00081 
00082     virtual void GetVersion(int& pMajor, int& pMinor, int& pRevision) const;
00083 
00084     virtual bool FileOpen(char* pFileName) = 0;
00085     virtual bool FileOpen(KFile * pFile);
00086     virtual bool FileClose() = 0;
00087     virtual bool IsFileOpen() = 0;
00088 
00089     virtual KFbxStreamOptions* GetReadOptions(bool pParseFileAsNeeded = true) = 0;
00090     virtual bool Read(KFbxDocument* pDocument, KFbxStreamOptions* pStreamOptions) = 0;
00091 
00093     typedef enum
00094     {
00095         eFILE_CORRUPTED,
00096         eFILE_VERSION_NOT_SUPPORTED_YET,
00097         eFILE_VERSION_NOT_SUPPORTED_ANYMORE,
00098         eFILE_NOT_OPENED,
00099         eFILE_NOT_CREATED,
00100         eWRONG_PASSWORD,
00101         eSTREAM_OPTIONS_NOT_SET,
00102         eINVALID_DOCUMENT_HANDLE,
00103         eDOCUMENT_NOT_SUPPORTED,
00104         eUNRESOLVED_EXTERNAL_REFERENCES, // this is a warning
00105         eUNIDENTIFIED_ERROR,
00106         eERROR_COUNT
00107     } EError;
00108 
00109     KError&  GetError();
00110     EError   GetLastErrorID() const;
00111     const char* GetLastErrorString() const;
00112 
00113     void     GetMessage(KString &pMessage) const;
00114     void     ClearMessage();
00115 
00116     typedef KFbxReader* (*CreateFuncType)(KFbxSdkManager& pManager,
00117                                           KFbxImporter& pImporter,
00118                                           int pID);
00119 
00120     typedef void (*IOSettingsFillerFuncType)(KFbxIOSettings& pIOS);
00121 
00122     enum KInfoRequest {
00123         eInfoExtension, // return a null terminated char const* const*
00124         eInfoDescriptions, // return a null terminated char const* const*
00125         eReserved1 = 0xFBFB,
00126     };
00127 
00128     typedef void* (*GetInfoFuncType)(KInfoRequest pRequest, int pReaderTypeId);
00129 
00130 protected:
00131 
00132     KFbxReader& operator=(KFbxReader const&) { return *this; }
00133     virtual bool CheckDuplicateNodeNames(KFbxNode* pRootNode, KString& pDuplicateNodeNameList);
00134 
00135     KFbxSdkManager& mManager;
00136     KError          mError;
00137 
00138     KString         mMessage;
00139 
00140 public:
00141     enum EFileOpenSpecialFlags {
00142         ParseForGlobalSettings = 1,
00143         ParseForStatistics = 2
00144     };
00145 
00146     virtual bool FileOpen(char* pFileName, EFileOpenSpecialFlags pFlags) { return FileOpen(pFileName); };
00147     virtual bool GetAxisInfo(KFbxAxisSystem* pAxisSystem, KFbxSystemUnit* pSystemUnits) { return false; };
00148     virtual bool GetStatistics(KFbxStatistics* pStats) {return false; };
00149 };
00150 
00151 #include <fbxfilesdk_nsend.h>
00152 
00153 #endif // #ifndef _FBXSDK_READER_H_
00154 
00155