From 279c71a5fdea5a8335b80f5a6b1b6468a74515ef Mon Sep 17 00:00:00 2001 From: g0dil <g0dil@wiback.org> Date: Wed, 10 Dec 2008 00:08:06 +0000 Subject: [PATCH] Minor fixes --- PPI/SocketSource.hh | 3 ++- Utils/Logger/AreaRegistry.cc | 2 +- Utils/Logger/AreaRegistry.ih | 2 +- Utils/Logger/Target.cc | 2 +- Utils/Logger/Target.cti | 2 +- Utils/Logger/Target.ih | 4 ++-- Utils/Range.cti | 11 +++++++++++ Utils/Range.hh | 6 ++++++ project.el | 4 +++- 9 files changed, 28 insertions(+), 8 deletions(-) diff --git a/PPI/SocketSource.hh b/PPI/SocketSource.hh index 49c863ff4..44368fb52 100644 --- a/PPI/SocketSource.hh +++ b/PPI/SocketSource.hh @@ -91,11 +91,12 @@ namespace module { { public: typedef unspecified_type Handle; // type of handle requested + typedef unspecified_type PacketType // type of packet returned SomeReader(); // EITHER default constructible SomeReader(SomeReader const & other); // OR copy constructible - Packet operator()(Handle handle); // extraction function + PacketType operator()(Handle handle); // extraction function }; \endcode Whenever the FileHandle object is ready for reading, the \a Reader's \c operator() is called diff --git a/Utils/Logger/AreaRegistry.cc b/Utils/Logger/AreaRegistry.cc index 5dc0d9d1e..7a6a98856 100644 --- a/Utils/Logger/AreaRegistry.cc +++ b/Utils/Logger/AreaRegistry.cc @@ -89,7 +89,7 @@ prefix_ void senf::log::detail::AreaBase::removeRoutingCache(Target & target, prefix_ void senf::log::detail::AreaBase::write(time_type timestamp, StreamBase const & stream, unsigned level, - std::string msg) + std::string const & msg) const { if (stream.index >= routingCache_.size()) diff --git a/Utils/Logger/AreaRegistry.ih b/Utils/Logger/AreaRegistry.ih index 58709bf45..53b3d1009 100644 --- a/Utils/Logger/AreaRegistry.ih +++ b/Utils/Logger/AreaRegistry.ih @@ -58,7 +58,7 @@ namespace detail { void updateRoutingCache(Target & target, StreamBase const & stream, unsigned limit) const; void removeRoutingCache(Target & target, StreamBase const & stream) const; void write(time_type timestamp, StreamBase const & stream, unsigned level, - std::string msg) const; + std::string const & msg) const; private: struct RouteEntry { diff --git a/Utils/Logger/Target.cc b/Utils/Logger/Target.cc index eafaabfe7..d63201f07 100644 --- a/Utils/Logger/Target.cc +++ b/Utils/Logger/Target.cc @@ -206,7 +206,7 @@ prefix_ void senf::log::Target::write(time_type timestamp, prefix_ void senf::log::detail::TargetRegistry::write(StreamBase const & stream, AreaBase const & area, unsigned level, - std::string msg) + std::string const & msg) { if (fallbackRouting_) { if (level >= stream.defaultRuntimeLimit()) diff --git a/Utils/Logger/Target.cti b/Utils/Logger/Target.cti index bad63ab45..5d906ee52 100644 --- a/Utils/Logger/Target.cti +++ b/Utils/Logger/Target.cti @@ -88,7 +88,7 @@ prefix_ void senf::log::Target::unroute(action_t action) // namespace senf::log::detail members template <class Stream, class Area, class Level> -prefix_ void senf::log::detail::write(std::string msg) +prefix_ void senf::log::detail::write(std::string const & msg) { TargetRegistry::instance().write(Stream::instance(), Area::instance(), Level::value, msg); } diff --git a/Utils/Logger/Target.ih b/Utils/Logger/Target.ih index c96eb3288..a0838719b 100644 --- a/Utils/Logger/Target.ih +++ b/Utils/Logger/Target.ih @@ -45,7 +45,7 @@ namespace detail { using senf::singleton<TargetRegistry>::instance; void write(StreamBase const & stream, AreaBase const & area, unsigned level, - std::string msg); + std::string const & msg); void routed(); bool fallbackRouting(); @@ -67,7 +67,7 @@ namespace detail { /** \brief Internal: Write log message */ template <class Stream, class Area, class Level> - void write(std::string msg); + void write(std::string const & msg); #ifndef DOXYGEN diff --git a/Utils/Range.cti b/Utils/Range.cti index 0444e4251..38744c353 100644 --- a/Utils/Range.cti +++ b/Utils/Range.cti @@ -41,6 +41,17 @@ senf::make_transform_range(Range const & range, Fn const & fn) boost::make_transform_iterator(boost::end(range), fn) ); } +template <class Range, class Fn> +prefix_ boost::iterator_range< + boost::transform_iterator< Fn, + typename boost::range_iterator<Range>::type > > +senf::make_transform_range(Range & range, Fn const & fn) +{ + return boost::make_iterator_range( + boost::make_transform_iterator(boost::begin(range), fn), + boost::make_transform_iterator(boost::end(range), fn) ); +} + ///////////////////////////////cti.e/////////////////////////////////////// #undef prefix_ diff --git a/Utils/Range.hh b/Utils/Range.hh index f9da32262..6f9ef840e 100644 --- a/Utils/Range.hh +++ b/Utils/Range.hh @@ -46,6 +46,12 @@ namespace senf { typename boost::range_const_iterator<Range>::type > > make_transform_range(Range const & range, Fn const & fn); + template <class Range, class Fn> + boost::iterator_range< + boost::transform_iterator< Fn, + typename boost::range_iterator<Range>::type > > + make_transform_range(Range & range, Fn const & fn); + } ///////////////////////////////hh.e//////////////////////////////////////// diff --git a/project.el b/project.el index 703309fc0..f34d53896 100644 --- a/project.el +++ b/project.el @@ -3,7 +3,9 @@ (defun check-namespace-indent (arg) (save-excursion (back-to-indentation) - (if (looking-at "namespace") [0] '+))) + (if (and (looking-at "namespace") + (not (looking-at ".*}"))) + [0] '+))) (defconst senf-c-style '((c-basic-offset . 4) -- GitLab