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

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

Generated on Wed Mar 16 10:29:30 2005 for Lamp by doxygen 1.3.2