paramxx  1.0.7
NameAttributeValue.h
1 #ifndef NameAttributeValue_H
2 #define NameAttributeValue_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 <iostream>
29 #include <string>
30 
31 using namespace std;
32 
41 
45  friend ostream& operator << ( ostream& os, NameAttributeValue& a ) {
46  a.print( os );
47  return os;
48  }
49 
53  friend ostream& operator << ( ostream& os, NameAttributeValue* a ) {
54  a->print( os );
55  return os;
56  }
57 
58 public:
59 
61  virtual ~NameAttributeValue( ) { }
62 
64  NameAttributeValue( ) : name( "" ), attribute( "" ), value( "" ) { }
65 
70  NameAttributeValue( const char* str ) { init_NameAttributeValue( str ); }
71 
73  string get_attribute( void ) { return attribute; }
74 
76  string get_name( void ) const { return name; }
77 
79  string get_value( void ) const { return value; }
80 
82  void init_NameAttributeValue( const char* str );
83 
85  virtual void print( ostream& os=cerr );
86 
88  void set_attribute( const char* a ) { attribute = a; }
89 
91  void set_name( const char* n ) { name = n; }
92 
94  void set_value( const char* v ) { value = v; }
95 
96 protected:
97 
98  string name;
99 
100  string attribute;
101 
102  string value;
103 
104 private:
105 
106  bool check_boolean( char* str );
107 
108  void seperate_keyword_attribute( char* );
109 
110  void seperate_keyword_value( char* );
111 
113  NameAttributeValue& operator = ( const NameAttributeValue& rhs );
114 
115 };
116 
117 #endif
void set_name(const char *n)
set the name of the object.
Definition: NameAttributeValue.h:91
void set_value(const char *v)
set the value of the object.
Definition: NameAttributeValue.h:94
STL namespace.
Definition: NameAttributeValue.h:40
virtual void print(ostream &os=cerr)
Print the content of the object to a stream.
Definition: NameAttributeValue.cc:103
NameAttributeValue()
Default constructor, all members are initialize to an empty string.
Definition: NameAttributeValue.h:64
void set_attribute(const char *a)
set the attribute of the object.
Definition: NameAttributeValue.h:88
virtual ~NameAttributeValue()
Destructor.
Definition: NameAttributeValue.h:61
string get_name(void) const
return the name of the object
Definition: NameAttributeValue.h:76
NameAttributeValue(const char *str)
Definition: NameAttributeValue.h:70
string get_attribute(void)
return the attribute of the object
Definition: NameAttributeValue.h:73
string get_value(void) const
return the pointer to the value of the object
Definition: NameAttributeValue.h:79