From a15cf65c44d5c224169c32ef5495b68c758134b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 18 May 2014 16:08:14 +0200 Subject: Imported Upstream version 3.3.0.2 --- .../backend-elements/indentation/buffer.hxx | 61 ++ .../backend-elements/indentation/buffer.txx | 12 + .../backend-elements/indentation/clip.hxx | 173 ++++ .../backend-elements/indentation/clip.txx | 12 + .../backend-elements/indentation/cxx.hxx | 1016 ++++++++++++++++++++ .../backend-elements/indentation/cxx.txx | 12 + .../backend-elements/indentation/idl.hxx | 290 ++++++ .../backend-elements/indentation/idl.txx | 11 + .../backend-elements/indentation/sloc.hxx | 277 ++++++ libbackend-elements/backend-elements/makefile | 63 ++ libbackend-elements/backend-elements/regex.hxx | 208 ++++ libbackend-elements/backend-elements/regex.txx | 52 + libbackend-elements/backend-elements/types.hxx | 16 + 13 files changed, 2203 insertions(+) create mode 100644 libbackend-elements/backend-elements/indentation/buffer.hxx create mode 100644 libbackend-elements/backend-elements/indentation/buffer.txx create mode 100644 libbackend-elements/backend-elements/indentation/clip.hxx create mode 100644 libbackend-elements/backend-elements/indentation/clip.txx create mode 100644 libbackend-elements/backend-elements/indentation/cxx.hxx create mode 100644 libbackend-elements/backend-elements/indentation/cxx.txx create mode 100644 libbackend-elements/backend-elements/indentation/idl.hxx create mode 100644 libbackend-elements/backend-elements/indentation/idl.txx create mode 100644 libbackend-elements/backend-elements/indentation/sloc.hxx create mode 100644 libbackend-elements/backend-elements/makefile create mode 100644 libbackend-elements/backend-elements/regex.hxx create mode 100644 libbackend-elements/backend-elements/regex.txx create mode 100644 libbackend-elements/backend-elements/types.hxx (limited to 'libbackend-elements/backend-elements') diff --git a/libbackend-elements/backend-elements/indentation/buffer.hxx b/libbackend-elements/backend-elements/indentation/buffer.hxx new file mode 100644 index 0000000..7058814 --- /dev/null +++ b/libbackend-elements/backend-elements/indentation/buffer.hxx @@ -0,0 +1,61 @@ +// file : backend-elements/indentation/buffer.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2010 Boris Kolpackov +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef BACKEND_ELEMENTS_INDENTATION_BUFFER_HXX +#define BACKEND_ELEMENTS_INDENTATION_BUFFER_HXX + +#include + +#include + +namespace BackendElements +{ + namespace Indentation + { + template + class Buffer: public NonCopyable + { + public: + struct Write {}; + + public: + virtual + ~Buffer () + { + } + + public: + typedef + std::char_traits + Traits; + + typedef + typename Traits::char_type + AsChar; + + typedef + typename Traits::int_type + AsInt; + + public: + virtual AsInt + put (AsChar c) = 0; + + // Unbuffer flushes internal formatting buffers (if any). + // Note that unbuffer is not exactly flushing since it can + // result in formatting errors and in general can not be + // called at arbitrary points. Natural use case would be + // to call unbuffer at the end of the stream when no more + // data is expected. + // + virtual Void + unbuffer () = 0; + }; + } +} + +#include + +#endif // BACKEND_ELEMENTS_INDENTATION_BUFFER_HXX diff --git a/libbackend-elements/backend-elements/indentation/buffer.txx b/libbackend-elements/backend-elements/indentation/buffer.txx new file mode 100644 index 0000000..57ba7ab --- /dev/null +++ b/libbackend-elements/backend-elements/indentation/buffer.txx @@ -0,0 +1,12 @@ +// file : backend-elements/indentation/buffer.txx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2010 Boris Kolpackov +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +namespace BackendElements +{ + namespace Indentation + { + } +} + diff --git a/libbackend-elements/backend-elements/indentation/clip.hxx b/libbackend-elements/backend-elements/indentation/clip.hxx new file mode 100644 index 0000000..068ed0d --- /dev/null +++ b/libbackend-elements/backend-elements/indentation/clip.hxx @@ -0,0 +1,173 @@ +// file : backend-elements/indentation/clip.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2010 Boris Kolpackov +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef BACKEND_ELEMENTS_INDENTATION_CLIP_HXX +#define BACKEND_ELEMENTS_INDENTATION_CLIP_HXX + +#include + +#include + +#include + +namespace BackendElements +{ + namespace Indentation + { + template + class ToStreambufAdapter: public std::basic_streambuf, + public NonCopyable + { + public: + typedef + typename std::basic_streambuf::traits_type + Traits; + + typedef + typename std::basic_streambuf::char_type + AsChar; + + typedef + typename std::basic_streambuf::int_type + AsInt; + + public: + ToStreambufAdapter (Buffer& buffer) + : buffer_ (buffer) + { + } + + virtual AsInt + overflow (AsInt ch) + { + return buffer_.put (Traits::to_char_type (ch)); + } + + virtual Int + sync () + { + return 0; + } + + private: + Buffer& buffer_; + }; + + + template + class FromStreambufAdapter: public Buffer + { + public: + typedef + typename Buffer::Traits + Traits; + + typedef + typename Buffer::AsChar + AsChar; + + typedef + typename Buffer::AsInt + AsInt; + + typedef + typename Buffer::Write + Write; + + public: + FromStreambufAdapter (std::basic_streambuf& b) + : buffer_ (b) + { + } + + virtual AsInt + put (AsChar ch) + { + return buffer_.sputc (ch); + } + + virtual Void + unbuffer () + { + try + { + if (buffer_.pubsync () == 0) return; + } + catch (std::ios_base::failure const&) + { + } + + throw Write (); + } + + private: + std::basic_streambuf& buffer_; + }; + + + template