libjmmcg
release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
line_iterator_impl.hpp
Go to the documentation of this file.
1
/******************************************************************************
2
** Copyright © 2020 by J.M.McGuiness, coder@hussar.me.uk & M.Waplington
3
**
4
** This library is free software; you can redistribute it and/or
5
** modify it under the terms of the GNU Lesser General Public
6
** License as published by the Free Software Foundation; either
7
** version 2.1 of the License, or (at your option) any later version.
8
**
9
** This library is distributed in the hope that it will be useful,
10
** but WITHOUT ANY WARRANTY; without even the implied warranty of
11
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
** Lesser General Public License for more details.
13
**
14
** You should have received a copy of the GNU Lesser General Public
15
** License along with this library; if not, write to the Free Software
16
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*/
18
19
namespace
jmmcg
{
namespace
LIBJMMCG_VER_NAMESPACE
{
20
21
inline
22
line_iterator
::
line_iterator
(
std
::istream &s)
noexcept
(
false
)
23
: in_(&s) {
24
read();
25
}
26
27
inline
line_iterator
::reference
28
line_iterator
::
operator
*()
const
noexcept
(
true
) {
29
return
line_;
30
}
31
32
inline
line_iterator
::pointer
33
line_iterator
::
operator
->()
const
noexcept
(
true
) {
34
return
&line_;
35
}
36
37
inline
line_iterator
38
line_iterator
::
operator
++()
noexcept
(
false
) {
39
read();
40
return
*
this
;
41
}
42
43
inline
line_iterator
44
line_iterator
::
operator
++(
int
)
noexcept
(
false
) {
45
line_iterator
tmp=*
this
;
46
read();
47
return
tmp;
48
}
49
50
inline
bool
51
line_iterator
::
operator
==(
line_iterator
const
& i)
const
noexcept
(
true
) {
52
return
(in_==i.in_ && valid_==i.valid_)
53
|| (!valid_ && !i.valid_);
54
}
55
56
inline
bool
57
line_iterator
::
operator
!=(
line_iterator
const
& i)
const
noexcept
(
true
) {
58
return
!(*
this
==
i);
59
}
60
61
inline
void
62
line_iterator
::read()
noexcept
(
false
) {
63
if
(in_) {
64
std
::getline(*in_, line_);
65
}
66
valid_=
static_cast
<
bool
>(*in_);
67
}
68
69
} }
core
line_iterator_impl.hpp
Generated on Tue May 11 2021 17:19:22 for libjmmcg by
1.9.2