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 * 出力ストリームヘッダ 00022 * @author Junpee 00023 */ 00024 00025 #ifndef OUTPUT_STREAM_H_ 00026 #define OUTPUT_STREAM_H_ 00027 00028 namespace Lamp{ 00029 00030 //------------------------------------------------------------------------------ 00031 /** 00032 * 出力ストリーム 00033 */ 00034 class OutputStream{ 00035 friend class Writer; 00036 public: 00037 /** 00038 * コンストラクタ 00039 */ 00040 OutputStream(){} 00041 00042 /** 00043 * デストラクタ 00044 */ 00045 virtual ~OutputStream(){} 00046 00047 protected: 00048 /** 00049 * バイトデータの書き出し 00050 * @param data 書き出すバイトデータ 00051 * @param size 書き出すサイズ 00052 */ 00053 virtual void writeBytes(const void* data, int size) = 0; 00054 00055 /** 00056 * サイズの取得 00057 * @return 書き込んだバイト数 00058 */ 00059 virtual int getSize() = 0; 00060 00061 /** 00062 * スキップ 00063 * 00064 * 指定されたバイト数、0を書き出します。 00065 * @param size 0を書き出すバイト数 00066 */ 00067 virtual void skip(int size) = 0; 00068 00069 /** 00070 * アライメントを取る 00071 * 00072 * 指定されたバイト数のアライメントまで0を書き出します。 00073 * @param size アライメントをとるバイト数 00074 * @return 0を書き出したバイト数 00075 */ 00076 virtual int align(int size) = 0; 00077 00078 /** 00079 * 書き込み位置の取得 00080 * @return 書き込み位置 00081 */ 00082 virtual int getPosition() = 0; 00083 00084 /** 00085 * 書き込み位置の設定 00086 * 00087 * 指定された位置に書き込み位置を変更します。 00088 * @param position 書き込み位置 00089 */ 00090 virtual void setPosition(int position) = 0; 00091 00092 /** 00093 * フラッシュ 00094 * 00095 * ストリームをフラッシュします。 00096 */ 00097 virtual void flush() = 0; 00098 00099 private: 00100 // コピーコンストラクタの隠蔽 00101 OutputStream(const OutputStream& copy); 00102 00103 // 代入コピーの隠蔽 00104 void operator =(const OutputStream& copy); 00105 00106 }; 00107 00108 //------------------------------------------------------------------------------ 00109 } // End of namespace Lamp 00110 #endif // End of OUTPUT_STREAM_H_ 00111 //------------------------------------------------------------------------------