rdbxx  1.0.10
RDBComment.h
1 #ifndef RDBComment_h
2 #define RDBComment_h
3 
4 /* --8<--8<--8<--8<--
5  *
6  * Copyright (C) 2006 Smithsonian Astrophysical Observatory
7  *
8  * This file is part of RDB
9  *
10  * RDB 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  * RDB 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 #include <rdbxx/RDBErr.h>
31 
33 class RDBComment {
35 
36  friend std::istream& operator>>( std::istream& is, RDBComment& rdbcomment );
39  friend std::ostream& operator<<( std::ostream& os, const RDBComment& rdbcomment );
41 
42  public:
44 
45  RDBComment( const std::string& comment="" );
48  RDBComment( const RDBComment& rdbcomment );
50  ~RDBComment( void );
51 
53  const RDBComment& operator=( const RDBComment& rdbcomment );
55  const RDBComment& operator=( const std::string& rdbcomment );
57 
59 
60  void setComment( const std::string& comment );
63  void setCommentText( const std::string& comment );
65  void setKeyword( const std::string& keyword );
67  void setValue( const std::string& value );
69 
71 
72  std::string getComment( void ) const;
75  std::string getCommentText( void ) const;
77  std::string getKeyword( void ) const;
79  std::string getValue( void ) const;
81 
82 private:
84  std::string _comment;
86  std::string _keyword;
88  std::string _value;
89 
90 };
91 
92 #endif
RDBComment(const std::string &comment="")
Parses comment string for RDB comment structure.
Definition: RDBComment.cc:102
friend std::istream & operator>>(std::istream &is, RDBComment &rdbcomment)
Read comment from input stream.
Definition: RDBComment.cc:38
std::string getValue(void) const
Return the keyword's value, if any.
Definition: RDBComment.cc:375
std::string getKeyword(void) const
Return the keyword, if any.
Definition: RDBComment.cc:362
Provides interface for manipulating RDB comments.
Definition: RDBComment.h:33
void setCommentText(const std::string &comment)
Parses string for RDB comment elements.
Definition: RDBComment.cc:222
void setComment(const std::string &comment)
Parses comment string for RDB comment elements.
Definition: RDBComment.cc:190
const RDBComment & operator=(const RDBComment &rdbcomment)
Copy RDBComment object.
Definition: RDBComment.cc:150
std::string getCommentText(void) const
Return the full comment text.
Definition: RDBComment.cc:349
friend std::ostream & operator<<(std::ostream &os, const RDBComment &rdbcomment)
Write comment to output stream.
Definition: RDBComment.cc:73
void setValue(const std::string &value)
Set just the comment value.
Definition: RDBComment.cc:305
void setKeyword(const std::string &keyword)
Set just the comment keyword.
Definition: RDBComment.cc:281
~RDBComment(void)
Destructor has nothing to do.
Definition: RDBComment.cc:137
std::string getComment(void) const
Return the full comment.
Definition: RDBComment.cc:327