Candidate_v1.7.0
        stable
      
      
        
          | 
            Last change
 on this file since 1ca493a 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
           | 
        
      
      
| Line |   | 
|---|
| 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 | 
 | 
|---|
| 11 | // include config.h
 | 
|---|
| 12 | #ifdef HAVE_CONFIG_H
 | 
|---|
| 13 | #include <config.h>
 | 
|---|
| 14 | #endif
 | 
|---|
| 15 | 
 | 
|---|
| 16 | 
 | 
|---|
| 17 | #include <boost/function.hpp>
 | 
|---|
| 18 | #include <iosfwd>
 | 
|---|
| 19 | 
 | 
|---|
| 20 | #include "Views/StringView.hpp"
 | 
|---|
| 21 | 
 | 
|---|
| 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
 | 
|---|
| 28 |  * legacy reasons. These methods internally use the "LOG()" mechanism instead of the stream.
 | 
|---|
| 29 |  */
 | 
|---|
| 30 | class StreamStringView : public StringView
 | 
|---|
| 31 | {
 | 
|---|
| 32 | public:
 | 
|---|
| 33 |   StreamStringView(boost::function<void(std::ostream *)>);
 | 
|---|
| 34 |   virtual ~StreamStringView();
 | 
|---|
| 35 | 
 | 
|---|
| 36 |   virtual const std::string toString();
 | 
|---|
| 37 | 
 | 
|---|
| 38 | private:
 | 
|---|
| 39 |   boost::function<void(std::ostream *)> displayMethod;
 | 
|---|
| 40 | };
 | 
|---|
| 41 | 
 | 
|---|
| 42 | #endif /* STREAMSTRINGVIEW_HPP_ */
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.