aboutsummaryrefslogtreecommitdiff
path: root/libbutl/char-scanner.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbutl/char-scanner.cxx')
-rw-r--r--libbutl/char-scanner.cxx20
1 files changed, 14 insertions, 6 deletions
diff --git a/libbutl/char-scanner.cxx b/libbutl/char-scanner.cxx
index 42a72cc..a2baaf3 100644
--- a/libbutl/char-scanner.cxx
+++ b/libbutl/char-scanner.cxx
@@ -4,12 +4,20 @@
#include <libbutl/char-scanner.hxx>
-#include <istream>
-
using namespace std;
namespace butl
{
+ char_scanner::
+ char_scanner (istream& is, bool crlf)
+ : is_ (is),
+ buf_ (dynamic_cast<fdbuf*> (is.rdbuf ())),
+ gptr_ (nullptr),
+ egptr_ (nullptr),
+ crlf_ (crlf)
+ {
+ }
+
auto char_scanner::
peek () -> xchar
{
@@ -22,14 +30,14 @@ namespace butl
if (eos_)
return xchar (xchar::traits_type::eof (), line, column);
- xchar::int_type v (is_.peek ());
+ int_type v (peek_ ());
if (v == xchar::traits_type::eof ())
eos_ = true;
else if (crlf_ && v == 0x0D)
{
- is_.get ();
- xchar::int_type v1 (is_.peek ());
+ get_ ();
+ int_type v1 (peek_ ());
if (v1 != '\n')
{
@@ -62,7 +70,7 @@ namespace butl
//
if (!eos (c))
{
- is_.get ();
+ get_ ();
if (c == '\n')
{