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 TEXT_READER_H_ 00026 #define TEXT_READER_H_ 00027 00028 #include <Core/InputOutput/Reader.h> 00029 00030 namespace Lamp{ 00031 00032 //------------------------------------------------------------------------------ 00033 /** 00034 * テキストリーダ 00035 */ 00036 class TextReader : public Reader{ 00037 public: 00038 /** 00039 * デストラクタ 00040 */ 00041 virtual ~TextReader(); 00042 00043 /** 00044 * テキストリーダの複製 00045 * @return 複製されたテキストリーダ 00046 */ 00047 virtual TextReader* cloneTextReader() = 0; 00048 00049 /** 00050 * リーダの複製 00051 * @return 複製されたリーダ 00052 */ 00053 virtual Reader* cloneReader(){ return cloneTextReader(); } 00054 00055 /** 00056 * 文字列の一行読み込み 00057 * 00058 * このメソッドを使用すると、改行コードの変換が行われます。 00059 * @return 読み出した文字列 00060 */ 00061 virtual String readLine(); 00062 00063 protected: 00064 /** 00065 * コンストラクタ 00066 * @param bufferSize バッファサイズ 00067 */ 00068 TextReader(int bufferSize = 4096); 00069 00070 /** 00071 * バッファサイズの取得 00072 * @return バッファサイズ 00073 */ 00074 int getBufferSize() const{ return bufferSize_; } 00075 00076 /** 00077 * テキストリーダデータのコピー 00078 * @param destination コピー先テキストリーダ 00079 */ 00080 virtual void copyTextReaderData(TextReader* destination); 00081 00082 private: 00083 // バッファ 00084 char* buffer_; 00085 // 出力 00086 char* output_; 00087 // バッファサイズ 00088 int bufferSize_; 00089 // 読み込みサイズ 00090 int readSize_; 00091 // 位置 00092 int position_; 00093 // ファイル位置 00094 int filePosition_; 00095 00096 }; 00097 00098 //------------------------------------------------------------------------------ 00099 } // End of namespace Lamp 00100 #endif // End of TEXT_READER_H_ 00101 //------------------------------------------------------------------------------