Candidate_v1.7.0
        stable
      
      
        
          | Last change
 on this file since 91c409 was             47d041, checked in by Frederik Heber <heber@…>, 14 years ago | 
        
          | 
HUGE: Removed all calls to Log(), eLog(), replaced by LOG() and ELOG().
 Replaced DoLog(.) && (Log() << Verbose(.) << ... << std::endl) by Log(., ...).
Replaced Log() << Verbose(.) << .. << by Log(., ...)
on multiline used stringstream to generate and message which was finally used
in LOG(., output.str())
there should be no more occurence of Log(). LOG() and ELOG() must be used
instead.
Eventually, this will allow for storing all errors and re-printing them on
program exit which would be very helpful to ascertain error-free runs for the
user.
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            995 bytes | 
      
      
| Rev | Line |  | 
|---|
| [9d8609] | 1 | /* | 
|---|
|  | 2 | * StreamStringView.hpp | 
|---|
|  | 3 | * | 
|---|
|  | 4 | *  Created on: Dec 14, 2009 | 
|---|
|  | 5 | *      Author: crueger | 
|---|
|  | 6 | */ | 
|---|
|  | 7 |  | 
|---|
|  | 8 | #ifndef STREAMSTRINGVIEW_HPP_ | 
|---|
|  | 9 | #define STREAMSTRINGVIEW_HPP_ | 
|---|
|  | 10 |  | 
|---|
| [56f73b] | 11 | // include config.h | 
|---|
|  | 12 | #ifdef HAVE_CONFIG_H | 
|---|
|  | 13 | #include <config.h> | 
|---|
|  | 14 | #endif | 
|---|
|  | 15 |  | 
|---|
|  | 16 |  | 
|---|
| [9d8609] | 17 | #include <boost/function.hpp> | 
|---|
| [986ed3] | 18 | #include <iosfwd> | 
|---|
| [9d8609] | 19 |  | 
|---|
|  | 20 | #include "Views/StringView.hpp" | 
|---|
|  | 21 |  | 
|---|
| [ef81b0] | 22 | /** | 
|---|
|  | 23 | * Wrapper to produce a StringView from any method that uses a stream to display something. | 
|---|
|  | 24 | * | 
|---|
|  | 25 | * The function is called with a stringstream which then is turned into a string later. | 
|---|
|  | 26 | * | 
|---|
|  | 27 | * Caveat: Make sure the stream passed to the method is actually used. Some methods seem to use a stream parameter for | 
|---|
| [47d041] | 28 | * legacy reasons. These methods internally use the "LOG()" mechanism instead of the stream. | 
|---|
| [ef81b0] | 29 | */ | 
|---|
| [9d8609] | 30 | class StreamStringView : public StringView | 
|---|
|  | 31 | { | 
|---|
|  | 32 | public: | 
|---|
| [24a5e0] | 33 | StreamStringView(boost::function<void(std::ostream *)>); | 
|---|
| [9d8609] | 34 | virtual ~StreamStringView(); | 
|---|
|  | 35 |  | 
|---|
| [24a5e0] | 36 | virtual const std::string toString(); | 
|---|
| [9d8609] | 37 |  | 
|---|
|  | 38 | private: | 
|---|
| [24a5e0] | 39 | boost::function<void(std::ostream *)> displayMethod; | 
|---|
| [9d8609] | 40 | }; | 
|---|
|  | 41 |  | 
|---|
|  | 42 | #endif /* STREAMSTRINGVIEW_HPP_ */ | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.