Changeset 606 for trunk/lib/HtmlStream.h


Ignore:
Timestamp:
Apr 20, 2008, 5:46:56 AM (13 years ago)
Author:
Peter Johansson
Message:

Fixes ticket:318. Changed HtmlStream? to be inherited from ostream and created a HtmlBuf? (inherited from streambuf) that does the real work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/HtmlStream.h

    r519 r606  
    2525*/
    2626
     27#include "HtmlBuf.h"
     28
    2729#include <map>
    2830#include <fstream>
     
    3133namespace theplu{
    3234namespace svndigest{
    33 
    3435  ///
    35   /// Filtering text to html code.
     36  /// \brief Convenient class for using HtmlBuf.
    3637  ///
    37   class HtmlStream
     38  /// Class is created from another ostream, whose buffer is used to
     39  /// create an internal HtmlBuf. In other words, when this class is
     40  /// used, typical with operator<<, data is sent to the HtmlBuffer,
     41  /// which transforms it as appropriate and sends it further to its
     42  /// target buffer. The target buffer is the buffer of the ostream
     43  /// this class is created of.
     44  ///
     45  class HtmlStream : public std::ostream
    3846  {
    3947  public:
    40 
    4148    ///
    42     /// @brief Constructor
     49    /// Creates a HtmlBuf from target.rdbuf().
    4350    ///
    44     HtmlStream(std::ostream&);
     51    HtmlStream(std::ostream& target);
    4552
    4653    ///
     
    4855    ///
    4956    ~HtmlStream(void);
    50 
    51     ///
    52     /// \brief filter and print stringstream
    53     ///
    54     void print(std::stringstream&);
    5557
    5658    ///
     
    6567    HtmlStream(const HtmlStream&);
    6668
    67     std::map<char, std::string> map_;
     69    HtmlBuf hbuf_;
    6870    std::ostream& os_;
    6971  };
    70 
    71 
    72   template <typename T>
    73   HtmlStream& operator<<(HtmlStream& html, const T& rhs)
    74   {
    75     std::stringstream ss;
    76     ss << rhs;
    77     html.print(ss);
    78     return html;
    79   }
    8072
    8173}} // end of namespace svndigest and namespace theplu
Note: See TracChangeset for help on using the changeset viewer.