ParTxt.h

00001 #ifndef PARTXT_H
00002 #define PARTXT_H
00003 
00004 // --8<--8<--8<--8<--
00005 //
00006 // Copyright (C) 2006 Smithsonian Astrophysical Observatory
00007 //
00008 // This file is part of paramxx
00009 //
00010 // paramxx is free software; you can redistribute it and/or
00011 // modify it under the terms of the GNU General Public License
00012 // as published by the Free Software Foundation; either version 2
00013 // of the License, or (at your option) any later version.
00014 //
00015 // paramxx is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 // GNU General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU General Public License
00021 // along with this program; if not, write to the 
00022 //       Free Software Foundation, Inc. 
00023 //       51 Franklin Street, Fifth Floor
00024 //       Boston, MA  02110-1301, USA
00025 //
00026 // -->8-->8-->8-->8--
00027 
00028 #include "ParFileException.h"
00029 
00031 class ParTxt {
00032 
00034   friend ostream& operator << ( ostream& os, ParTxt& par ) {
00035     par.print( os );
00036     return os;
00037   }
00038 
00040   friend ostream& operator << ( ostream& os, ParTxt* par ) {
00041     par->print( os );
00042     return os;
00043   }
00044  
00045 public:
00046 
00047   ~ParTxt( );
00048 
00049   ParTxt( char* str=NULL ) throw( ParFileException );
00050 
00051   void init_ParTxt( char* str=NULL ) throw( ParFileException );
00052 
00053   static int restore;
00054 
00055   operator char* ( ) const { return buffer; }
00056 
00057   operator char** ( ) const { return buffer_argv; }
00058 
00059   char* get_token( size_t n ) throw( ParFileException );
00060 
00061   void print( ostream& os );
00062 
00063   static void verify_mode( const string& str ) throw( ParFileException );
00064 
00065 protected:
00066 
00067   char*  buffer;
00068 
00069   char** buffer_argv;
00070 
00071   size_t num_tokens;
00072 
00073 private:
00074 
00075   ParTxt( const ParTxt& partxt );
00076 
00077   ParTxt& operator = ( const ParTxt& rhs );
00078 
00079 };
00080 
00081 #endif

Generated on Thu Oct 2 17:54:19 2008 for paramxx by  doxygen 1.5.6