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

InputStream.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 INPUT_STREAM_H_
00026 #define INPUT_STREAM_H_
00027 
00028 namespace Lamp{
00029 
00030 //------------------------------------------------------------------------------
00031 /**
00032  * 入力ストリーム
00033  */
00034 class InputStream{
00035 friend class Reader;
00036 public:
00037     /**
00038      * コンストラクタ
00039      */
00040     InputStream(){}
00041 
00042     /**
00043      * デストラクタ
00044      */
00045     virtual ~InputStream(){}
00046 
00047     /**
00048      * 入力ストリームの複製
00049      * @return 複製された入力ストリーム
00050      */
00051     virtual InputStream* cloneInputStream() = 0;
00052 
00053 protected:
00054     /**
00055      * 終端かどうか
00056      * @return trueなら終端
00057      */
00058     virtual bool isEnd() = 0;
00059 
00060     /**
00061      * バイトデータの読み込み
00062      * @param data 読み出し先アドレス
00063      * @param size 読み出すサイズ
00064      */
00065     virtual void readBytes(void* data, int size) = 0;
00066 
00067     /**
00068      * サイズの取得
00069      * @return ストリーム全体のバイト数
00070      */
00071     virtual int getSize() = 0;
00072 
00073     /**
00074      * スキップ
00075      *
00076      * 指定されたバイト数、読み出しをスキップします。
00077      * @param size スキップするバイト数
00078      */
00079     virtual void skip(int size) = 0;
00080 
00081     /**
00082      * アライメントを取る
00083      *
00084      * 指定されたバイト数のアライメントまで読み飛ばします。
00085      * @param size アライメントをとるバイト数
00086      * @return スキップしたバイト数
00087      */
00088     virtual int align(int size) = 0;
00089 
00090     /**
00091      * 読み込み位置の取得
00092      * @return 読み込み位置
00093      */
00094     virtual int getPosition() = 0;
00095 
00096     /**
00097      * 読み込み位置の設定
00098      *
00099      * 指定された位置に読み込み位置を変更します。
00100      * @param position 読み込み位置
00101      */
00102     virtual void setPosition(int position) = 0;
00103 
00104 private:
00105     // コピーコンストラクタの隠蔽
00106     InputStream(const InputStream& copy);
00107 
00108     // 代入コピーの隠蔽
00109     void operator =(const InputStream& copy);
00110 
00111 };
00112 
00113 //------------------------------------------------------------------------------
00114 } // End of namespace Lamp
00115 #endif // End of INPUT_STREAM_H_
00116 //------------------------------------------------------------------------------

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