K3dTextReadFile.h

Go to the documentation of this file.
00001 
00014 /***************************************************************************
00015  *   Copyright (C) 2007 by Jan Koci   *
00016  *   honza.koci@email.cz   *
00017  *   http://kengine.sourceforge.net/tutorial/
00018  *                                                                         *
00019  *   This program is free software; you can redistribute it and/or modify  *
00020  *   it under the terms of the GNU General Public License as published by  *
00021  *   the Free Software Foundation; either version 2 of the License, or     *
00022  *   (at your option) any later version.                                   *
00023  *                                                                         *
00024  *   This program is distributed in the hope that it will be useful,       *
00025  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00026  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00027  *   GNU General Public License for more details.                          *
00028  *                                                                         *
00029  *   You should have received a copy of the GNU General Public License     *
00030  *   along with this program; if not, write to the                         *
00031  *   Free Software Foundation, Inc.,                                       *
00032  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00033  ***************************************************************************/
00034 
00035 #pragma once
00036 
00037 #include "K3dFile.h"
00038 
00039 class K3dTextReadFile
00040                         : public K3dFile
00041 {
00042         public:
00043                 K3dTextReadFile()       {}
00044                 K3dTextReadFile ( const std::string& _rFileName )
00045                 {
00046                         Open ( _rFileName );
00047                 }
00051                 bool Open ( const std::string& _rFileName )
00052                 {
00053                         return OpenForReadText ( _rFileName );
00054                 }
00060                 int Read ( char* _strBuffer, size_t _tLen )
00061                 {
00062                         return fread ( reinterpret_cast<void*> ( _strBuffer ), sizeof ( char ), _tLen, GetFile() );
00063                 }
00069                 int Read ( std::string& _rStr, size_t _tLen )
00070                 {
00071                         _rStr.resize ( _tLen );
00072                         return fread ( reinterpret_cast<void*> ( &_rStr[0] ), sizeof ( char ), _tLen, GetFile() );
00073                 }
00074 };
00075 

Generated on Thu Aug 16 23:53:28 2007 for K3dEngine by  doxygen 1.5.0