diff --git a/Builds/VisualStudio2012/beast.vcxproj b/Builds/VisualStudio2012/beast.vcxproj
index 707588afe..ee11c79c2 100644
--- a/Builds/VisualStudio2012/beast.vcxproj
+++ b/Builds/VisualStudio2012/beast.vcxproj
@@ -114,6 +114,7 @@
+
diff --git a/Builds/VisualStudio2012/beast.vcxproj.filters b/Builds/VisualStudio2012/beast.vcxproj.filters
index cc49cebe6..aa2c10605 100644
--- a/Builds/VisualStudio2012/beast.vcxproj.filters
+++ b/Builds/VisualStudio2012/beast.vcxproj.filters
@@ -68,10 +68,10 @@
beast_core
- beast\crypto\impl\sha2
+ beast\http\crypto\impl\sha2
- beast\crypto\impl\sha2
+ beast\http\crypto\impl\sha2
scripts
@@ -255,15 +255,6 @@
{1fff3bd8-44ae-41df-8dd4-8bb6f07b2908}
-
- {9c1ef4c4-5623-4500-859f-12d6ce5ae362}
-
-
- {fc3d3f14-9ba1-43e4-b086-cbbd2f63b944}
-
-
- {44489531-f44a-439a-a6ea-d32c252b1e8b}
-
{57dc7059-cbb2-437c-9c52-79825d9a4cf5}
@@ -1107,10 +1098,10 @@
beast
- beast\crypto\impl\sha2
+ beast\http\crypto\impl\sha2
- beast\crypto
+ beast\http\crypto
beast_asio\async
@@ -1282,7 +1273,7 @@
beast\asio
- beast\crypto
+ beast\http\crypto
beast\smart_ptr
@@ -1344,6 +1335,9 @@
beast\insight
+
+ beast
+
@@ -1812,19 +1806,19 @@
beast\http\impl
- beast\crypto\impl\sha2
+ beast\http\crypto\impl\sha2
- beast\crypto\impl\sha2
+ beast\http\crypto\impl\sha2
- beast\crypto\impl\sha2
+ beast\http\crypto\impl\sha2
- beast\crypto
+ beast\http\crypto
- beast\crypto\impl
+ beast\http\crypto\impl
beast\chrono\impl
@@ -1896,7 +1890,7 @@
beast\asio\impl
- beast\crypto\impl
+ beast\http\crypto\impl
beast\smart_ptr\impl
diff --git a/beast/Boost.h b/beast/Boost.h
index 295eca5a5..708b63ab3 100644
--- a/beast/Boost.h
+++ b/beast/Boost.h
@@ -3,10 +3,6 @@
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco
- Portions of this file are from JUCE.
- Copyright (c) 2013 - Raw Material Software Ltd.
- Please visit http://www.juce.com
-
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
diff --git a/beast/cyclic_iterator.h b/beast/cyclic_iterator.h
new file mode 100644
index 000000000..27e441723
--- /dev/null
+++ b/beast/cyclic_iterator.h
@@ -0,0 +1,513 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Based on work with these copyrights:
+ Copyright Carl Philipp Reh 2009 - 2013.
+ Copyright Philipp Middendorf 2009 - 2013.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+
+ Original code taken from
+ https://github.com/freundlich/fcppt
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_CYCLIC_ITERATOR_H_INCLUDED
+#define BEAST_CYCLIC_ITERATOR_H_INCLUDED
+
+#include
+#include
+
+namespace beast {
+
+//
+// cyclic_iterator_fwd.hpp
+//
+
+template<
+ typename ContainerIterator
+>
+class cyclic_iterator;
+
+//
+// cyclic_iterator_category.hpp
+//
+
+namespace detail
+{
+
+template<
+ typename SourceCategory
+>
+struct cyclic_iterator_category;
+
+template<>
+struct cyclic_iterator_category<
+ std::forward_iterator_tag
+>
+{
+ typedef std::forward_iterator_tag type;
+};
+
+template<>
+struct cyclic_iterator_category<
+ std::bidirectional_iterator_tag
+>
+{
+ typedef std::bidirectional_iterator_tag type;
+};
+
+template<>
+struct cyclic_iterator_category<
+ std::random_access_iterator_tag
+>
+{
+ typedef std::bidirectional_iterator_tag type;
+};
+
+}
+
+//
+// cyclic_iterator_base.hpp
+//
+
+namespace detail
+{
+
+template<
+ typename ContainerIterator
+>
+struct cyclic_iterator_base
+{
+ typedef boost::iterator_facade<
+ cyclic_iterator<
+ ContainerIterator
+ >,
+ typename std::iterator_traits<
+ ContainerIterator
+ >::value_type,
+ typename detail::cyclic_iterator_category<
+ typename std::iterator_traits<
+ ContainerIterator
+ >::iterator_category
+ >::type,
+ typename std::iterator_traits<
+ ContainerIterator
+ >::reference
+ > type;
+};
+
+}
+
+//
+// cyclic_iterator_decl.hpp
+//
+
+/**
+\brief An iterator adaptor that cycles through a range
+
+\ingroup fcpptmain
+
+\tparam ContainerIterator The underlying iterator which must be at least a
+forward iterator
+
+A cyclic iterator can be useful in cases where you want end() to
+become begin() again. For example, imagine a cycling through a
+list of items which means if you skip over the last, you will return to the
+first one.
+
+This class can only increment or decrement its underlying iterator, random
+access is not supported. The iterator category will be at most bidirectional.
+It inherits all capabilities from boost::iterator_facade which
+means that it will have the usual iterator operations with their semantics.
+
+Here is a short example demonstrating its use.
+
+\snippet cyclic_iterator.cpp cyclic_iterator
+*/
+template<
+ typename ContainerIterator
+>
+class cyclic_iterator
+:
+ public detail::cyclic_iterator_base<
+ ContainerIterator
+ >::type
+{
+public:
+ /**
+ \brief The base type which is a boost::iterator_facade
+ */
+ typedef typename detail::cyclic_iterator_base<
+ ContainerIterator
+ >::type base_type;
+
+ /**
+ \brief The underlying iterator type
+ */
+ typedef ContainerIterator container_iterator_type;
+
+ /**
+ \brief The value type adapted from \a ContainerIterator
+ */
+ typedef typename base_type::value_type value_type;
+
+ /**
+ \brief The reference type adapted from \a ContainerIterator
+ */
+ typedef typename base_type::reference reference;
+
+ /**
+ \brief The pointer type adapted from \a ContainerIterator
+ */
+ typedef typename base_type::pointer pointer;
+
+ /**
+ \brief The difference type adapted from \a ContainerIterator
+ */
+ typedef typename base_type::difference_type difference_type;
+
+ /**
+ \brief The iterator category, either Forward or Bidirectional
+ */
+ typedef typename base_type::iterator_category iterator_category;
+
+ /**
+ \brief Creates a singular iterator
+ */
+ cyclic_iterator();
+
+ /**
+ \brief Copy constructs from another cyclic iterator
+
+ Copy constructs from another cyclic iterator \a other. This only works
+ if the underlying iterators are convertible.
+
+ \param other The iterator to copy construct from
+ */
+ template<
+ typename OtherIterator
+ >
+ explicit
+ cyclic_iterator(
+ cyclic_iterator const &other
+ );
+
+ /**
+ \brief Constructs a new cyclic iterator
+
+ Constructs a new cyclic iterator, starting at \a it, inside
+ a range from \a begin to \a end.
+
+ \param pos The start of the iterator
+ \param begin The beginning of the range
+ \param end The end of the range
+
+ \warning The behaviour is undefined if \a pos isn't between \a begin
+ and \a end. Also, the behaviour is undefined, if \a begin and \a end
+ don't form a valid range.
+ */
+ cyclic_iterator(
+ container_iterator_type const &pos,
+ container_iterator_type const &begin,
+ container_iterator_type const &end
+ );
+
+ /**
+ \brief Assigns from another cyclic iterator
+
+ Assigns from another cyclic iterator \a other. This only works if the
+ underlying iterators are convertible.
+
+ \param other The iterator to assign from
+
+ \return *this
+ */
+ template<
+ typename OtherIterator
+ >
+ cyclic_iterator &
+ operator=(
+ cyclic_iterator const &other
+ );
+
+ /**
+ \brief Returns the beginning of the range
+ */
+ container_iterator_type
+ begin() const;
+
+ /**
+ \brief Returns the end of the range
+ */
+ container_iterator_type
+ end() const;
+
+ /**
+ \brief Returns the underlying iterator
+ */
+ container_iterator_type
+ get() const;
+private:
+ friend class boost::iterator_core_access;
+
+ void
+ increment();
+
+ void
+ decrement();
+
+ bool
+ equal(
+ cyclic_iterator const &
+ ) const;
+
+ reference
+ dereference() const;
+
+ difference_type
+ distance_to(
+ cyclic_iterator const &
+ ) const;
+private:
+ container_iterator_type
+ it_,
+ begin_,
+ end_;
+};
+
+//
+// cyclic_iterator_impl.hpp
+//
+
+template<
+ typename ContainerIterator
+>
+cyclic_iterator<
+ ContainerIterator
+>::cyclic_iterator()
+:
+ it_(),
+ begin_(),
+ end_()
+{
+}
+
+template<
+ typename ContainerIterator
+>
+template<
+ typename OtherIterator
+>
+cyclic_iterator<
+ ContainerIterator
+>::cyclic_iterator(
+ cyclic_iterator<
+ OtherIterator
+ > const &_other
+)
+:
+ it_(
+ _other.it_
+ ),
+ begin_(
+ _other.begin_
+ ),
+ end_(
+ _other.end_
+ )
+{
+}
+
+template<
+ typename ContainerIterator
+>
+cyclic_iterator<
+ ContainerIterator
+>::cyclic_iterator(
+ container_iterator_type const &_it,
+ container_iterator_type const &_begin,
+ container_iterator_type const &_end
+)
+:
+ it_(
+ _it
+ ),
+ begin_(
+ _begin
+ ),
+ end_(
+ _end
+ )
+{
+}
+
+template<
+ typename ContainerIterator
+>
+template<
+ typename OtherIterator
+>
+cyclic_iterator<
+ ContainerIterator
+> &
+cyclic_iterator<
+ ContainerIterator
+>::operator=(
+ cyclic_iterator<
+ OtherIterator
+ > const &_other
+)
+{
+ it_ = _other.it_;
+
+ begin_ = _other.begin_;
+
+ end_ = _other.end_;
+
+ return *this;
+}
+
+template<
+ typename ContainerIterator
+>
+typename cyclic_iterator<
+ ContainerIterator
+>::container_iterator_type
+cyclic_iterator<
+ ContainerIterator
+>::begin() const
+{
+ return begin_;
+}
+
+template<
+ typename ContainerIterator
+>
+typename cyclic_iterator<
+ ContainerIterator
+>::container_iterator_type
+cyclic_iterator<
+ ContainerIterator
+>::end() const
+{
+ return end_;
+}
+
+template<
+ typename ContainerIterator
+>
+typename cyclic_iterator<
+ ContainerIterator
+>::container_iterator_type
+cyclic_iterator<
+ ContainerIterator
+>::get() const
+{
+ return it_;
+}
+
+template<
+ typename ContainerIterator
+>
+void
+cyclic_iterator<
+ ContainerIterator
+>::increment()
+{
+ if(
+ begin_ != end_
+ && ++it_ == end_
+ )
+ it_ = begin_;
+}
+
+template<
+ typename ContainerIterator
+>
+void
+cyclic_iterator<
+ ContainerIterator
+>::decrement()
+{
+ if(
+ begin_ == end_
+ )
+ return;
+
+ if(
+ it_ == begin_
+ )
+ it_ =
+ std::prev(
+ end_
+ );
+ else
+ --it_;
+}
+
+template<
+ typename ContainerIterator
+>
+bool
+cyclic_iterator<
+ ContainerIterator
+>::equal(
+ cyclic_iterator const &_other
+) const
+{
+ return it_ == _other.it;
+}
+
+template<
+ typename ContainerIterator
+>
+typename cyclic_iterator<
+ ContainerIterator
+>::reference
+cyclic_iterator<
+ ContainerIterator
+>::dereference() const
+{
+ return *it_;
+}
+
+template<
+ typename ContainerIterator
+>
+typename cyclic_iterator<
+ ContainerIterator
+>::difference_type
+cyclic_iterator<
+ ContainerIterator
+>::distance_to(
+ cyclic_iterator const &_other
+) const
+{
+ return _other.it_ - it_;
+}
+
+// Convenience function for template argument deduction
+template
+cyclic_iterator make_cyclic (
+ ContainerIterator const& pos,
+ ContainerIterator const& begin,
+ ContainerIterator const& end);
+}
+
+#endif
diff --git a/beast/smart_ptr/AbstractObject.h b/beast/smart_ptr/AbstractObject.h
index 36c617847..c7155a50e 100644
--- a/beast/smart_ptr/AbstractObject.h
+++ b/beast/smart_ptr/AbstractObject.h
@@ -25,13 +25,13 @@
#define BEAST_SMARTPTR_ABSTRACTOBJECT_H_INCLUDED
#include
+#include
#include
#include
#include "../Atomic.h"
#include "../Config.h"
#include "../Uncopyable.h"
#include "../intrusive/LockFreeStack.h"
-#include "../smart_ptr/ScopedPointer.h"
namespace beast {
namespace abstract {
@@ -235,15 +235,17 @@ public:
Derived must be a subclass of Interface
*/
template
- void add_interface (ScopedPointer && derived)
+ void add_interface (Derived* derived)
{
+ std::unique_ptr base_interface (
+ derived);
if (has_interface ())
throw std::invalid_argument ("non-unique");
- m_set.emplace_back (derived);
+ m_set.emplace_back (base_interface.release ());
}
private:
- typedef std::list > Set;
+ typedef std::list > Set;
Set m_set;
};
diff --git a/beast/smart_ptr/impl/AbstractObject.cpp b/beast/smart_ptr/impl/AbstractObject.cpp
index 743082490..d597c6fca 100644
--- a/beast/smart_ptr/impl/AbstractObject.cpp
+++ b/beast/smart_ptr/impl/AbstractObject.cpp
@@ -66,8 +66,7 @@ public:
void create_interfaces (Object& object)
{
- object.add_interface (ScopedPointer (
- new Interface1));
+ object.add_interface (new Interface1);
}
};
@@ -91,8 +90,7 @@ public:
void create_interfaces (Object& object)
{
- object.add_interface (ScopedPointer (
- new Interface2));
+ object.add_interface (new Interface2);
}
};
@@ -112,12 +110,11 @@ public:
// find existing interfaces
expect (object.find_interface () != nullptr);
expect (object.find_interface () != nullptr);
-
+
// add duplicate interface
try
{
- object.add_interface (ScopedPointer (
- new Interface1));
+ object.add_interface (new Interface1);
fail ("uncaught exeption");
}
catch (std::invalid_argument const&)
diff --git a/beast/utility/Journal.h b/beast/utility/Journal.h
index 3d74a7b7b..d052a59ab 100644
--- a/beast/utility/Journal.h
+++ b/beast/utility/Journal.h
@@ -29,27 +29,32 @@ namespace beast {
/** A generic endpoint for log messages. */
class Journal
{
-public:
- class Sink;
-
-private:
- Sink* m_sink;
-
public:
/** Severity level of the message. */
enum Severity
{
- kLowestSeverity = 0,
- kTrace = kLowestSeverity,
+ kAll = 0,
+
+ kTrace = kAll,
kDebug,
kInfo,
kWarning,
kError,
kFatal,
- kDisabled
+ kDisabled,
+ kNone = kDisabled
};
+ class Sink;
+
+private:
+ Journal& operator= (Journal const& other); // disallowed
+
+ Sink* m_sink;
+ Severity m_level;
+
+public:
//--------------------------------------------------------------------------
/** Abstraction for the underlying message destination. */
@@ -82,7 +87,7 @@ public:
virtual void write (Severity level, std::string const& text) = 0;
private:
- Severity m_severity;
+ Severity m_level;
bool m_console;
};
@@ -103,23 +108,32 @@ public:
template
ScopedStream (Stream const& stream, T const& t)
: m_sink (stream.sink())
- , m_severity (stream.severity())
+ , m_level (stream.severity())
+ , m_active (stream.active ())
{
- m_ostream << t;
+ if (active ())
+ m_ostream << t;
}
- ScopedStream (Stream const& stream, std::ostream& manip (std::ostream&));
+ ScopedStream (Stream const& stream,
+ std::ostream& manip (std::ostream&));
~ScopedStream ();
+ bool active () const
+ { return m_active; }
+
std::ostringstream& ostream () const;
- std::ostream& operator<< (std::ostream& manip (std::ostream&)) const;
+ std::ostream& operator<< (
+ std::ostream& manip (std::ostream&)) const;
template
std::ostream& operator<< (T const& t) const
{
- return m_ostream << t;
+ if (active ())
+ m_ostream << t;
+ return m_ostream;
}
private:
@@ -128,7 +142,8 @@ public:
ScopedStream& operator= (ScopedStream const&); // disallowed
Sink& m_sink;
- Severity const m_severity;
+ Severity const m_level;
+ bool const m_active;
std::ostringstream mutable m_ostream;
bool m_toOutputWindow;
};
@@ -138,11 +153,14 @@ public:
class Stream : public SafeBool
{
public:
- /** Construct a stream which produces no logging output. */
+ /** Create a stream which produces no output. */
Stream ();
- /** Construct a stream that writes to the Sink at the given Severity. */
- Stream (Sink& sink, Severity severity);
+ /** Create stream that writes at the given level. */
+ /** @{ */
+ Stream (Sink& sink, Severity level, bool active = true);
+ Stream (Stream const& stream, bool active);
+ /** @} */
/** Construct or copy another Stream. */
/** @{ */
@@ -175,24 +193,48 @@ public:
private:
Sink* m_sink;
- Severity m_severity;
+ Severity m_level;
+ bool m_disabled;
};
//--------------------------------------------------------------------------
+ /** Create a journal that writes to the null sink. */
Journal ();
- explicit Journal (Sink& sink);
+
+ /** Create a journal that writes to the specified sink. */
+ /** @{ */
+ explicit Journal (Sink& sink, Severity level = kAll);
+
+ /** Create a journal from another journal.
+ When specifying a new minimum severity level, the effective minimum
+ level will be the higher of the other journal and the specified value.
+ */
+ /** @{ */
Journal (Journal const& other);
+ Journal (Journal const& other, Severity level);
+ /** @} */
+
+ /** Destroy the journal. */
~Journal ();
/** Returns the Sink associated with this Journal. */
Sink& sink() const;
/** Returns a stream for this sink, with the specified severity. */
- Stream stream (Severity severity) const;
+ Stream stream (Severity level) const;
- /** Returns `true` if any message would be logged at this severity level. */
- bool active (Severity severity) const;
+ /** Returns `true` if any message would be logged at this severity level.
+ For a message to be logged, the severity must be at or above both
+ the journal's severity level and the sink's severity level.
+ */
+ bool active (Severity level) const;
+
+ /** Returns this Journal's minimum severity level.
+ If the underlying sink has a higher threshold, there will still
+ be no output at that level.
+ */
+ Severity severity () const;
/** Convenience sink streams for each severity level. */
Stream const trace;
@@ -201,9 +243,6 @@ public:
Stream const warning;
Stream const error;
Stream const fatal;
-
-private:
- Journal& operator= (Journal const& other); // disallowed
};
}
diff --git a/beast/utility/impl/Journal.cpp b/beast/utility/impl/Journal.cpp
index 09036b017..ed115b07c 100644
--- a/beast/utility/impl/Journal.cpp
+++ b/beast/utility/impl/Journal.cpp
@@ -66,7 +66,7 @@ Journal::Sink& Journal::getNullSink ()
//------------------------------------------------------------------------------
Journal::Sink::Sink ()
- : m_severity (kLowestSeverity)
+ : m_level (kAll)
, m_console (false)
{
}
@@ -77,7 +77,7 @@ Journal::Sink::~Sink ()
bool Journal::Sink::active (Severity level) const
{
- return level >= m_severity;
+ return level >= m_level;
}
bool Journal::Sink::console () const
@@ -92,42 +92,56 @@ void Journal::Sink::console (bool output)
Journal::Severity Journal::Sink::severity () const
{
- return m_severity;
+ return m_level;
}
void Journal::Sink::severity (Severity level)
{
- m_severity = level;
+ m_level = level;
}
//------------------------------------------------------------------------------
Journal::ScopedStream::ScopedStream (Stream const& stream)
- : m_sink (stream.sink())
- , m_severity (stream.severity())
+ : m_sink (stream.sink ())
+ , m_level (stream.severity ())
+ , m_active (stream.active ())
{
init ();
}
Journal::ScopedStream::ScopedStream (ScopedStream const& other)
: m_sink (other.m_sink)
- , m_severity (other.m_severity)
+ , m_level (other.m_level)
+ , m_active (other.m_active)
{
init ();
}
-Journal::ScopedStream::ScopedStream (Stream const& stream, std::ostream& manip (std::ostream&))
- : m_sink (stream.sink())
- , m_severity (stream.severity())
+Journal::ScopedStream::ScopedStream (
+ Stream const& stream, std::ostream& manip (std::ostream&))
+ : m_sink (stream.sink ())
+ , m_level (stream.severity ())
+ , m_active (stream.active ())
{
init ();
- m_ostream << manip;
+ if (active ())
+ m_ostream << manip;
}
Journal::ScopedStream::~ScopedStream ()
{
- if (! m_ostream.str().empty() && m_sink.active (m_severity))
- m_sink.write (m_severity, m_ostream.str());
+ if (active ())
+ {
+ std::string const& s (m_ostream.str());
+ if (! s.empty ())
+ {
+ if (s == "\n")
+ m_sink.write (m_level, "");
+ else
+ m_sink.write (m_level, s);
+ }
+ }
}
void Journal::ScopedStream::init ()
@@ -155,20 +169,30 @@ std::ostringstream& Journal::ScopedStream::ostream () const
Journal::Stream::Stream ()
: m_sink (&getNullSink ())
- , m_severity (kDisabled)
+ , m_level (kDisabled)
+ , m_disabled (true)
{
}
-Journal::Stream::Stream (Sink& sink, Severity severity)
+Journal::Stream::Stream (Sink& sink, Severity level, bool active)
: m_sink (&sink)
- , m_severity (severity)
+ , m_level (level)
+ , m_disabled (! active)
+{
+ bassert (level != kDisabled);
+}
+
+Journal::Stream::Stream (Stream const& stream, bool active)
+ : m_sink (&stream.sink ())
+ , m_level (stream.severity ())
+ , m_disabled (! active)
{
- bassert (severity != kDisabled);
}
Journal::Stream::Stream (Stream const& other)
: m_sink (other.m_sink)
- , m_severity (other.m_severity)
+ , m_level (other.m_level)
+ , m_disabled (other.m_disabled)
{
}
@@ -179,12 +203,12 @@ Journal::Sink& Journal::Stream::sink () const
Journal::Severity Journal::Stream::severity () const
{
- return m_severity;
+ return m_level;
}
bool Journal::Stream::active () const
{
- return m_sink->active (m_severity);
+ return ! m_disabled && m_sink->active (m_level);
}
bool Journal::Stream::asBoolean () const
@@ -195,11 +219,12 @@ bool Journal::Stream::asBoolean () const
Journal::Stream& Journal::Stream::operator= (Stream const& other)
{
m_sink = other.m_sink;
- m_severity = other.m_severity;
+ m_level = other.m_level;
return *this;
}
-Journal::ScopedStream Journal::Stream::operator<< (std::ostream& manip (std::ostream&)) const
+Journal::ScopedStream Journal::Stream::operator<< (
+ std::ostream& manip (std::ostream&)) const
{
return ScopedStream (*this, manip);
}
@@ -208,6 +233,7 @@ Journal::ScopedStream Journal::Stream::operator<< (std::ostream& manip (std::ost
Journal::Journal ()
: m_sink (&getNullSink())
+ , m_level (kDisabled)
, trace (stream (kTrace))
, debug (stream (kDebug))
, info (stream (kInfo))
@@ -217,8 +243,9 @@ Journal::Journal ()
{
}
-Journal::Journal (Sink& sink)
+Journal::Journal (Sink& sink, Severity level)
: m_sink (&sink)
+ , m_level (level)
, trace (stream (kTrace))
, debug (stream (kDebug))
, info (stream (kInfo))
@@ -230,6 +257,19 @@ Journal::Journal (Sink& sink)
Journal::Journal (Journal const& other)
: m_sink (other.m_sink)
+ , m_level (other.m_level)
+ , trace (stream (kTrace))
+ , debug (stream (kDebug))
+ , info (stream (kInfo))
+ , warning (stream (kWarning))
+ , error (stream (kError))
+ , fatal (stream (kFatal))
+{
+}
+
+Journal::Journal (Journal const& other, Severity level)
+ : m_sink (other.m_sink)
+ , m_level (std::max (other.m_level, level))
, trace (stream (kTrace))
, debug (stream (kDebug))
, info (stream (kInfo))
@@ -248,15 +288,23 @@ Journal::Sink& Journal::sink() const
return *m_sink;
}
-Journal::Stream Journal::stream (Severity severity) const
+Journal::Stream Journal::stream (Severity level) const
{
- return Stream (*m_sink, severity);
+ return Stream (*m_sink, level, level >= m_level);
}
-bool Journal::active (Severity severity) const
+bool Journal::active (Severity level) const
{
- bassert (severity != kDisabled);
- return m_sink->active (severity);
+ if (level == kDisabled)
+ return false;
+ if (level < m_level)
+ return false;
+ return m_sink->active (level);
+}
+
+Journal::Severity Journal::severity () const
+{
+ return m_level;
}
}
diff --git a/modules/beast_core/system/BoostPlaceholdersFix.h b/modules/beast_core/system/BoostPlaceholdersFix.h
index 36cabfd03..5fbd1b613 100644
--- a/modules/beast_core/system/BoostPlaceholdersFix.h
+++ b/modules/beast_core/system/BoostPlaceholdersFix.h
@@ -30,11 +30,6 @@
#endif
#include
-
-#if BOOST_VERSION > 105499
-# error "This hasnt been tested with boost versions above 1.54"
-#endif
-
#include
#include