/src/aspell/common/istream_enumeration.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | // This file is part of The New Aspell |
2 | | // Copyright (C) 2019 by Kevin Atkinson under the GNU LGPL license |
3 | | // version 2.1. You should have received a copy of the LGPL |
4 | | // license along with this library if you did not you can find |
5 | | // it at http://www.gnu.org/. |
6 | | |
7 | | #ifndef ASPELL_ISTREAM_ENUMERATION__HPP |
8 | | #define ASPELL_ISTREAM_ENUMERATION__HPP |
9 | | |
10 | | #include "fstream.hpp" |
11 | | #include "string_enumeration.hpp" |
12 | | |
13 | | namespace acommon { |
14 | | |
15 | | class IstreamEnumeration : public StringEnumeration { |
16 | | FStream * in; |
17 | | String data; |
18 | | public: |
19 | 7 | IstreamEnumeration(FStream & i) : in(&i) {} |
20 | 0 | IstreamEnumeration * clone() const { |
21 | 0 | return new IstreamEnumeration(*this); |
22 | 0 | } |
23 | 0 | void assign (const StringEnumeration * other) { |
24 | 0 | *this = *static_cast<const IstreamEnumeration *>(other); |
25 | 0 | } |
26 | 7 | Value next() { |
27 | 7 | if (!in->getline(data)) return 0; |
28 | 0 | else return data.c_str(); |
29 | 7 | } |
30 | 0 | bool at_end() const {return *in;} |
31 | | }; |
32 | | |
33 | | } |
34 | | |
35 | | #endif |