Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

LampBinaryTranslator.h

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------
00002 // Lamp : Open source game middleware
00003 // Copyright (C) 2004  Junpei Ohtani ( Email : junpee@users.sourceforge.jp )
00004 //
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 //------------------------------------------------------------------------------
00019 
00020 /** @file
00021  * Lampバイナリトランスレータヘッダ
00022  * @author Junpee
00023  */
00024 
00025 #ifndef LAMP_BINARY_TRANSLATOR_H_
00026 #define LAMP_BINARY_TRANSLATOR_H_
00027 
00028 #include "Translator/Core/LampTranslator.h"
00029 
00030 namespace LampForMaya{
00031 
00032 //------------------------------------------------------------------------------
00033 /**
00034  * Lampバイナリトランスレータ
00035  */
00036 class LampBinaryTranslator : public MPxFileTranslator{
00037 public:
00038     /**
00039      * コンストラクタ
00040      */
00041     LampBinaryTranslator(){}
00042 
00043     /**
00044      * デストラクタ
00045      */
00046     virtual ~LampBinaryTranslator(){}
00047 
00048     /**
00049      * 生成
00050      *
00051      * unloadPluginを行わないとメモリリークとして検出されます。
00052      * @return プラグインインスタンス
00053      */
00054     static void* creator(){ return new LampBinaryTranslator(); }
00055 
00056     /**
00057      * 書き出し
00058      * @param file ファイル名
00059      * @param optionsString オプション
00060      * @param mode ファイルアクセスモード
00061      * @return 成功すれば MStatus::kSuccess
00062      */
00063     virtual MStatus writer(const MFileObject& file,
00064         const MString& optionsString, FileAccessMode mode){
00065         LampTranslator translator;
00066         return translator.write(file, optionsString, mode, false);
00067     }
00068 
00069     /**
00070      * 読み込み
00071      * @param file ファイル名
00072      * @param optionsString オプション
00073      * @param mode ファイルアクセスモード
00074      * @return 成功すれば MStatus::kSuccess
00075      */
00076     virtual MStatus reader (const MFileObject& file,
00077         const MString& optionsString, FileAccessMode mode){
00078         return MStatus(MStatus::kFailure);
00079     }
00080 
00081     /**
00082      * デフォルト拡張子
00083      * @return デフォルト拡張子
00084      */
00085     virtual MString defaultExtension() const{
00086         return LampTranslator::getBinarySceneExtension().getBytes();
00087     }
00088 
00089     /**
00090      * ファイルフィルタ
00091      * @return ファイルフィルタ
00092      */
00093     virtual MString filter() const{
00094         return MString("*.") + defaultExtension();
00095     }
00096 
00097     /**
00098      * 書き込みメソッドを持つか
00099      * @return 書き込みメソッドを持つならtrue
00100      */
00101     virtual bool haveWriteMethod() const{ return true; }
00102 
00103     /**
00104      * 読み込みメソッドを持つか
00105      * @return 読み込みメソッドを持つならtrue
00106      */
00107     virtual bool haveReadMethod() const{ return false; }
00108 
00109     /**
00110      * ネームスペースをサポートするかどうか
00111      * @return ネームスペースをサポートするならtrue
00112      */
00113     virtual bool haveNamespaceSupport() const{ return false; }
00114 
00115     /**
00116      * ファイルを開くことができるか
00117      * @return ファイルを開けるならtrue
00118      */
00119     virtual bool canBeOpened() const{ return false; }
00120 
00121     /**
00122      * ファイルの識別
00123      * @param file ファイルオブジェクト
00124      * @param buffer ファイルバッファ
00125      * @param size バッファサイズ
00126      * @return ファイルが自らのファイルフォーマットかどうか
00127      */
00128     virtual MPxFileTranslator::MFileKind identifyFile(
00129         const MFileObject& file, const char* buffer, short size) const{
00130         // 全て自分のフォーマットでない
00131         return kNotMyFileType;
00132     }
00133 
00134 
00135 private:
00136     // コピーコンストラクタの隠蔽
00137     LampBinaryTranslator(const LampBinaryTranslator& copy);
00138 
00139     // 代入コピーの隠蔽
00140     void operator =(const LampBinaryTranslator& copy);
00141 
00142 };
00143 
00144 //------------------------------------------------------------------------------
00145 } // End of namespace LampForMaya
00146 #endif // End of LAMP_BINARY_TRANSLATOR_H_
00147 //------------------------------------------------------------------------------

Generated on Wed Mar 16 10:29:55 2005 for LampForMaya by doxygen 1.3.2