sbuild  1.7.1
keyfile-reader.h
1 /* Copyright © 2005-2013 Roger Leigh <rleigh@debian.org>
2  *
3  * schroot is free software: you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * schroot is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see
15  * <http://www.gnu.org/licenses/>.
16  *
17  *********************************************************************/
18 
19 #ifndef SBUILD_KEYFILE_READER_H
20 #define SBUILD_KEYFILE_READER_H
21 
22 #include <istream>
23 
24 #include <sbuild/keyfile.h>
25 
26 namespace sbuild
27 {
28 
33  {
34  public:
37 
44 
52  const std::string& file);
53 
61  std::istream& stream);
62 
64  virtual ~keyfile_reader();
65 
72  virtual void
73  read_stream(std::istream& stream);
74 
75  protected:
80  virtual void
81  begin();
82 
93  virtual void
94  parse_line (const std::string& line);
95 
100  virtual void
101  end();
102 
105 
108 
110  bool group_set;
111 
114 
116  bool key_set;
117 
120 
122  bool value_set;
123 
126 
129 
132 
140  friend
141  std::istream&
142  operator >> (std::istream& stream,
143  keyfile_reader& kp)
144  {
145  kp.read_stream(stream);
146  return stream;
147  }
148  };
149 
150 
151 }
152 
153 #endif /* SBUILD_KEYFILE_READER_H */
154 
155 /*
156  * Local Variables:
157  * mode:C++
158  * End:
159  */