paramxx  1.0.7
ParTxt.h
1 #ifndef PARTXT_H
2 #define PARTXT_H
3 
4 // --8<--8<--8<--8<--
5 //
6 // Copyright (C) 2006 Smithsonian Astrophysical Observatory
7 //
8 // This file is part of paramxx
9 //
10 // paramxx is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU General Public License
12 // as published by the Free Software Foundation; either version 2
13 // of the License, or (at your option) any later version.
14 //
15 // paramxx is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program; if not, write to the
22 // Free Software Foundation, Inc.
23 // 51 Franklin Street, Fifth Floor
24 // Boston, MA 02110-1301, USA
25 //
26 // -->8-->8-->8-->8--
27 
28 #include "ParFileException.h"
29 
31 class ParTxt {
32 
34  friend ostream& operator << ( ostream& os, ParTxt& par ) {
35  par.print( os );
36  return os;
37  }
38 
40  friend ostream& operator << ( ostream& os, ParTxt* par ) {
41  par->print( os );
42  return os;
43  }
44 
45 public:
46 
47  ~ParTxt( );
48 
49  ParTxt( char* str=NULL ) throw( ParFileException );
50 
51  void init_ParTxt( char* str=NULL ) throw( ParFileException );
52 
53  static int restore;
54 
55  operator char* ( ) const { return buffer; }
56 
57  operator char** ( ) const { return buffer_argv; }
58 
59  char* get_token( size_t n ) throw( ParFileException );
60 
61  void print( ostream& os );
62 
63  static void verify_mode( const string& str ) throw( ParFileException );
64 
65 protected:
66 
67  char* buffer;
68 
69  char** buffer_argv;
70 
71  size_t num_tokens;
72 
73 private:
74 
75  ParTxt( const ParTxt& partxt );
76 
77  ParTxt& operator = ( const ParTxt& rhs );
78 
79 };
80 
81 #endif
Definition: ParFileException.h:33
static void verify_mode(const string &str)
Definition: ParTxt.cc:127
friend ostream & operator<<(ostream &os, ParTxt &par)
This operator outputs the contents of the object.
Definition: ParTxt.h:34
A class to handle the Param library specific string manipulation.
Definition: ParTxt.h:31