yat  0.13.2pre
GetlineIterator.h
1 #ifndef _theplu_yat_utility_getline_iterator_
2 #define _theplu_yat_utility_getline_iterator_
3 
4 // $Id: GetlineIterator.h 3210 2014-05-05 06:10:02Z peter $
5 
6 /*
7  Copyright (C) 2009, 2013 Peter Johansson
8 
9  This file is part of the yat library, http://dev.thep.lu.se/yat
10 
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 3 of the
14  License, or (at your option) any later version.
15 
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with yat. If not, see <http://www.gnu.org/licenses/>.
23 */
24 
25 #include <boost/iterator/iterator_facade.hpp>
26 
27 #include <iterator>
28 #include <string>
29 
30 namespace theplu {
31 namespace yat {
32 namespace utility {
33 
59  : public boost::iterator_facade<
60  GetlineIterator, const std::string, std::input_iterator_tag
61  >
62  {
63  public:
67  GetlineIterator(void);
68 
75  explicit GetlineIterator(std::istream& is, char delimiter='\n');
76 
77  private:
78  friend class boost::iterator_core_access;
79 
80  char delimiter_;
81  std::istream* istream_;
82  std::string line_;
83 
84  GetlineIterator::reference dereference(void) const;
85  bool equal(const GetlineIterator& other) const;
86  void increment(void);
87  // Using compiler generated copy
88  //GetlineIterator(const GetlineIterator&);
89  //GetlineIterator& operator=(const GetlineIterator&);
90  };
91 
92 }}} // of namespace utility, yat, and theplu
93 
94 #endif
GetlineIterator(void)
Constructor of end of stream iterator.
bool is(const std::string &s)
check if string is convertible to (numerical) type T
Definition: utility.h:464
Read from std::istream with std::getline.
Definition: GetlineIterator.h:58

Generated on Wed Jan 4 2017 02:23:07 for yat by  doxygen 1.8.5