Changeset 3232


Ignore:
Timestamp:
May 21, 2014, 4:04:44 PM (7 years ago)
Author:
Peter
Message:

tidy up indentation, and minor code change

Location:
trunk/yat/utility
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/ColumnStream.cc

    r2919 r3232  
    2828#include <ostream>
    2929
    30 namespace theplu{
    31 namespace yat{
    32 namespace utility{
     30namespace theplu {
     31namespace yat {
     32namespace utility {
    3333
    3434  ColumnStream::ColumnStream(std::ostream& os, size_t columns)
     
    5656  void ColumnStream::fill(size_t column, size_t count)
    5757  {
    58     while(count<width_[column]){
    59       os_ << ' ';
    60       ++count;
    61     }
     58    if (count<width_[column])
     59      os_ << std::string(width_[column]-count, ' ');
    6260  }
    6361
     
    7977
    8078
    81   size_t& ColumnStream::margin(size_t c) 
    82   { 
    83     return margins_[c]; 
     79  size_t& ColumnStream::margin(size_t c)
     80  {
     81    return margins_[c];
    8482  }
    8583
     
    8886  {
    8987    ++activated_;
    90     if (activated_>=columns()) {
     88    if (activated_>=columns())
    9189      flush();
    92     }
    9390  }
     91
    9492
    9593  void ColumnStream::print(std::stringstream& ss)
     
    109107        activated_=0;
    110108      }
    111       else 
     109      else
    112110        *(buffer_[activated_]) << c;
    113     ss.get(c);
     111      ss.get(c);
    114112    }
    115113  }
    116114
    117115
    118   size_t& ColumnStream::width(size_t c) 
    119   { 
    120     return width_[c]; 
     116  size_t& ColumnStream::width(size_t c)
     117  {
     118    return width_[c];
    121119  }
    122120
     
    141139          count += word.size();
    142140          word = "";
    143         }       
     141        }
    144142        else {
    145143          if (!buffer_[column]->good())
    146144            buffer_[column]->clear(std::ios::goodbit);
    147          
     145
    148146          // if line is empty and word is longer than column width, we
    149147          // have to split the word
     
    163161        }
    164162      }
    165 
    166     }
     163    }
    167164    fill(column, count);
    168165    return false;
    169166  }
    170167
    171 
    172168}}} // end of namespace utility, yat, and theplu
  • trunk/yat/utility/ColumnStream.h

    r2526 r3232  
    3333
    3434  ///
    35   /// ostream for sending to multiple columns 
     35  /// ostream for sending to multiple columns
    3636  ///
    3737  class ColumnStream
     
    5050
    5151    ///
    52     /// flush to ostream, goes to newline andactivates first column
     52    /// flush to ostream, goes to newline and activates first column
    5353    ///
    5454    void flush(void);
     
    8888    bool writeline(size_t i);
    8989    size_t columns(void) const;
    90    
    9190
    9291    size_t activated_;
Note: See TracChangeset for help on using the changeset viewer.