From f0510d2f90467de8e8f260b47d79a9baaf9bef17 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 17 Sep 2009 07:15:29 +0200 Subject: Start tracking XSD with git --- libxsd/xsd/cxx/zc-istream.txx | 94 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 libxsd/xsd/cxx/zc-istream.txx (limited to 'libxsd/xsd/cxx/zc-istream.txx') diff --git a/libxsd/xsd/cxx/zc-istream.txx b/libxsd/xsd/cxx/zc-istream.txx new file mode 100644 index 0000000..68d1933 --- /dev/null +++ b/libxsd/xsd/cxx/zc-istream.txx @@ -0,0 +1,94 @@ +// file : xsd/cxx/zc-istream.txx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +namespace xsd +{ + namespace cxx + { + // zc_streambuf + // + template + zc_streambuf:: + zc_streambuf (const ro_string& str) + : str_ (str.data (), str.size ()) + { + init (); + } + + template + zc_streambuf:: + zc_streambuf (const std::basic_string& str) + : str_ (str) + { + init (); + } + + template + void zc_streambuf:: + init () + { + C* b (const_cast (str_.data ())); + C* e (b + str_.size ()); + + setg (b, b, e); + } + + template + std::streamsize zc_streambuf:: + showmanyc () + { + return static_cast ( + this->egptr () - this->gptr ()); + } + + template + typename zc_streambuf::int_type zc_streambuf:: + underflow () + { + int_type r = traits_type::eof (); + + if (this->gptr () < this->egptr ()) + r = traits_type::to_int_type (*this->gptr ()); + + return r; + } + + + // zc_istream_base + // + template + zc_istream_base:: + zc_istream_base (const ro_string& str) + : buf_ (str) + { + } + + template + zc_istream_base:: + zc_istream_base (const std::basic_string& str) + : buf_ (str) + { + } + + + // zc_istream + // + template + zc_istream:: + zc_istream (const ro_string& str) + : zc_istream_base (str), + std::basic_istream (&this->buf_) + { + } + + template + zc_istream:: + zc_istream (const std::basic_string& str) + : zc_istream_base (str), + std::basic_istream (&this->buf_) + { + } + } +} -- cgit v1.1