LCOV - code coverage report
Current view: top level - snaplogger - buffer_appender.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 1 100.0 %
Date: 2022-01-29 21:11:29 Functions: 1 2 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Copyright (c) 2013-2021  Made to Order Software Corp.  All Rights Reserved
       2             : //
       3             : // https://snapwebsites.org/project/snaplogger
       4             : // contact@m2osw.com
       5             : //
       6             : // This program is free software; you can redistribute it and/or modify
       7             : // it under the terms of the GNU General Public License as published by
       8             : // the Free Software Foundation; either version 2 of the License, or
       9             : // (at your option) any later version.
      10             : //
      11             : // This program is distributed in the hope that it will be useful,
      12             : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14             : // GNU General Public License for more details.
      15             : //
      16             : // You should have received a copy of the GNU General Public License along
      17             : // with this program; if not, write to the Free Software Foundation, Inc.,
      18             : // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      19             : #pragma once
      20             : 
      21             : /** \file
      22             :  * \brief The buffer appender sends its output to a memory buffer.
      23             :  *
      24             :  * This file declares the buffer appender class.
      25             :  */
      26             : 
      27             : // self
      28             : //
      29             : #include    "snaplogger/appender.h"
      30             : 
      31             : 
      32             : // C++ lib
      33             : //
      34             : #include    <sstream>
      35             : 
      36             : 
      37             : 
      38             : namespace snaplogger
      39             : {
      40             : 
      41             : 
      42          20 : class buffer_appender
      43             :     : public appender
      44             :     , public std::stringstream
      45             : {
      46             : public:
      47             :     typedef std::shared_ptr<buffer_appender>      pointer_t;
      48             : 
      49             :                             buffer_appender(std::string const name);
      50             : 
      51             :     bool                    empty() const;
      52             :     void                    clear(bool keep_buffer = false);
      53             :     std::string             str();
      54             :     void                    str(std::string const & buf);
      55             : 
      56             : protected:
      57             :     virtual void            process_message(message const & msg, std::string const & formatted_message) override;
      58             : };
      59             : 
      60             : 
      61             : } // snaplogger namespace
      62             : // vim: ts=4 sw=4 et

Generated by: LCOV version 1.13