コード例 #1
0
 /**
    \brief Display enode definitions #n := (f #i_1 ... #i_n), where #i_k is the root
    of the k-th argument of the enode #n.
  */
 void context::display_normalized_enodes(std::ostream & out) const {
     out << "normalized enodes:\n";
     ptr_vector<enode>::const_iterator it  = m_enodes.begin();
     ptr_vector<enode>::const_iterator end = m_enodes.end();
     for (; it != end; ++it) {
         enode * n = *it;
         out << "#";
         out.width(5);
         out << std::left << n->get_owner_id() << " #";
         out.width(5);
         out << n->get_root()->get_owner_id() << " := " << std::right;
         unsigned num = n->get_owner()->get_num_args();
         if (num > 0)
             out << "(";
         out << n->get_decl()->get_name();
         if (!n->get_decl()->private_parameters())
             display_parameters(out, n->get_decl()->get_num_parameters(), n->get_decl()->get_parameters());
         for (unsigned i = 0; i < num; i++) {
             expr * arg = n->get_owner()->get_arg(i);
             if (e_internalized(arg)) {
                 enode * n = get_enode(arg)->get_root();
                 out << " #" << n->get_owner_id();
             }
             else {
                 out << " #" << arg->get_id();
             }
         }
         if (num > 0)
             out << ")";
         if (is_relevant(n))
             out << "\t*";
         out << "\n";
     }
 }
コード例 #2
0
ファイル: Memory.cpp プロジェクト: Jach/luciddb
void hexDump(std::ostream &o,void const *v,uint cb,uint cbDone)
{
    boost::io::ios_all_saver streamStateSaver(o);

    PConstBuffer b = (PConstBuffer) v;
    uint cbLine = 16, cbThis;
    o.fill('0');
    for (; cb; cb -= cbThis, cbDone += cbThis) {
        cbThis = std::min(cbLine, cb);
        o << std::hex;
        o.width(4);
        o << cbDone << ": ";
        uint i;
        for (i = 0; i < cbThis; i++, b++) {
            o.width(2);
            o << (uint) *b << " ";
        }
        for (i = cbThis; i < cbLine; i++) {
            o << "   ";
        }
        o << "| ";
        for (i = 0, b -= cbThis; i < cbThis; i++, b++) {
            if (isprint(*b)) {
                o << *b;
            } else {
                o << " ";
            }
        }
        o << std::endl;
    }
}
コード例 #3
0
void DataDisplay::output( std::ostream& os)
{

 int rows = DataTable->numRows(); 
 int cols = DataTable->numCols(); 

 os << "! LEGEND:"<< std::endl;
 os << "! "       << std::endl;
 
 int k = 0;
 for (int i=0; i<cols; i++)
 {
   if  ( ! DataTable->isColumnHidden(i) ) {
     os << "! Column " << ++k << " : " 
        << DataTable->horizontalHeader( )->label(i).replace('\n', ',') << std::endl;
   }
 }

 os << "!" << std::endl;

 k = 0 ;
 QString tmp_heading;
 
 for ( int i=0; i <cols; i++)
 {
   if  ( ! DataTable->isColumnHidden(i) ) {
     tmp_heading = "Column " + QString::number(++k); 

     if ( k == 1){
       os.width(1); os <<"!"; os.width(17);
       os << tmp_heading;            
     }
     else {
       os.width(18);
       os.setf(std::ios_base::right | std::ios_base::scientific);
       os << tmp_heading;       
     }
   }
 }

 os << std::endl;
 os << "!" << std::endl;

 

 for (int i=0; i< rows; i++)
 {
   for (int j=0; j< cols; j++)
   {
     if  ( !DataTable->isColumnHidden(j) ) {

     os.width(18);
     os.setf(std::ios_base::right | std::ios_base::scientific);
     os << DataTable->text(i,j);
     } 
   }
   os << std::endl; 

 }
}
コード例 #4
0
void Order::display(std::ostream & os) const {
    eanOrd.display(os);
    os.width(9);
    os << ordered;
    os.width(11);
    os << delivered;
}
コード例 #5
0
inline
void
arma_ostream::print(std::ostream& o, const subview_field<oT>& x)
  {
  arma_extra_debug_sigprint();
  
  const arma_ostream_state stream_state(o);
  
  const std::streamsize cell_width = o.width();
  
  const uword x_n_rows = x.n_rows;
  const uword x_n_cols = x.n_cols;
  
  for(uword col=0; col<x_n_cols; ++col)
    {
    o << "[field column " << col << ']' << '\n'; 
    for(uword row=0; row<x_n_rows; ++row)
      {
      o.width(cell_width);
      o << x.at(row,col) << '\n';
      }
    
    o << '\n';
    }
  
  o.flush();
  stream_state.restore(o);
  }
コード例 #6
0
  /** Ouptut a bonmin.opt file with options default values and short descritpions.*/
  void
  RegisteredOptions::writeBonminOpt(std::ostream &os, ExtraCategoriesInfo which){
      std::list< Ipopt::RegisteredOption * > options;
      chooseOptions(which, options);

      //Create journalist to write to os
      Ipopt::Journalist jnlst;
      Ipopt::SmartPtr<Ipopt::StreamJournal> J = new Ipopt::StreamJournal("options_journal", Ipopt::J_ALL);
      J->SetOutputStream(&os);
      J->SetPrintLevel(Ipopt::J_DOCUMENTATION, Ipopt::J_SUMMARY);
      jnlst.AddJournal(GetRawPtr(J));

      std::string registeringCategory = "";
      for(std::list< Ipopt::RegisteredOption * >::iterator i = options.begin();
           i != options.end() ; i++)
       {
          if((*i)->RegisteringCategory() != registeringCategory){
           registeringCategory = (*i)->RegisteringCategory();
             os<<std::endl<<"# registering category: "<<registeringCategory<<std::endl<<std::endl;
           }
           os<<"bonmin.";
           os.setf(std::ios::left);
           os.width(37);
           os<<(*i)->Name()<<" ";
           os.width(10);
           os<<makeNumber(defaultAsString(*i))<<"\t#";
           os<<(*i)->ShortDescription();
           os<<std::endl;            
       }
    }
コード例 #7
0
ファイル: Timer.cpp プロジェクト: AliAlawieh/kalibr
  void Timing::print(std::ostream & out) {
    map_t & tagMap = instance().m_tagMap;
    //list_t & timers = instance().m_timers;
    
    out << "SM Timing\n";
    out << "-----------\n";
    map_t::iterator t = tagMap.begin();
    for( ; t != tagMap.end(); t++) {
      size_t i = t->second;
      out.width((std::streamsize)instance().m_maxTagLength);
      out.setf(std::ios::left,std::ios::adjustfield);
      out << t->first << "\t";
      out.width(7);
      
      out.setf(std::ios::right,std::ios::adjustfield);
      out << getNumSamples(i) << "\t";
      if(getNumSamples(i) > 0) 
	{
	  out << secondsToTimeString(getTotalSeconds(i)) << "\t";
	  double meansec = getMeanSeconds(i);
	  double stddev = sqrt(getVarianceSeconds(i));
	  out << "(" << secondsToTimeString(meansec) << " +- ";
	  out << secondsToTimeString(stddev) << ")\t";
	  
	  double minsec = getMinSeconds(i);
	  double maxsec = getMaxSeconds(i);
	  
	  // The min or max are out of bounds.
	  out << "[" << secondsToTimeString(minsec) << "," << secondsToTimeString(maxsec) << "]";
	  
	}
      out << std::endl;
    }
  }
コード例 #8
0
 void context::display_subexprs_info(std::ostream & out, expr * n) const {
     ptr_buffer<expr> todo;
     todo.push_back(n);
     while (!todo.empty()) {
         expr * n = todo.back();
         todo.pop_back();
         out << "#";
         out.width(6);
         out << std::left << n->get_id();
         out << ", relevant: " << is_relevant(n);
         if (m_manager.is_bool(n)) {
             out << ", val: ";
             out.width(7);
             out << std::right;
             if (lit_internalized(n))
                 out << get_assignment(n);
             else
                 out << "l_undef";
         }
         if (e_internalized(n)) {
             enode * e = get_enode(n);
             out << ", root: #" << e->get_root()->get_owner_id();
         }
         out << "\n";
         if (is_app(n)) {
             for (unsigned i = 0; i < to_app(n)->get_num_args(); i++)
                 todo.push_back(to_app(n)->get_arg(i));
         }
     }
 }
コード例 #9
0
ファイル: stacktrace.hpp プロジェクト: bluescarni/piranha
// Custom streaming for stacktraces.
inline void stream_stacktrace(std::ostream &os, const stacktrace &st)
{
    os << '\n';
    const auto w = os.width();
    const auto max_idx_width = std::to_string(st.size()).size();
    // NOTE: the overflow check is because we will have to cast to std::streamsize
    // later, due to the iostreams API.
    // LCOV_EXCL_START
    if (unlikely(max_idx_width > static_cast<std::make_unsigned<std::streamsize>::type>(
                                     std::numeric_limits<std::streamsize>::max()))) {
        // Not much left to do here really.
        std::cerr << "Overflow in the size of a stacktrace, aborting now.\n";
        std::abort();
    }
    // LCOV_EXCL_STOP
    // We customize a bit the printing of the stacktrace, and we traverse
    // it backwards.
    auto i = st.size();
    for (auto it = st.rbegin(); it != st.rend(); --i, ++it) {
        os << "#";
        os.width(static_cast<std::streamsize>(max_idx_width));
        os << i;
        os.width(w);
        os << "| " << *it << '\n';
    }
}
コード例 #10
0
ファイル: Node1D.cpp プロジェクト: sbolding/holo_imc
void Node1D::print(std::ostream &out)
{
	out << " ID = ";
	out.width(4);
	out << _id;
	out << ", X = ";
	out.width(4);
	out.left;
	out << _x;
	out << std::endl;
}
コード例 #11
0
 void printSyntaxTree (std::ostream & os, Nonterm const & nonterm)
 {
   LRRule const & rule = nonterm.getRule ();
   os << rule.str;
   // info->name is node name
   NontermInfo const * info = rule.nonterm_info;
   os << " [" << info->name << "]";
   os << '\n';
   typedef std::pair <Nonterm const *, int> ChildIter;
   std::deque <ChildIter> stack;
   stack.push_back (ChildIter (& nonterm, 1));
   int indent = 1;
   for (;;)
   {
     ChildIter & iter = stack.back ();
     Nonterm const & nonterm = * iter.first;
     if (iter.second > nonterm.getNumChild ())
     {
       stack.pop_back ();
       if (stack.empty ())
       {
         break;
       }
       -- indent;
     }
     else
     {
       Node & node = nonterm.getChild (iter.second ++);
       Token const & token = node.getToken ();
       if (token.isSet ())
       {
         os.width (indent * 2);
         os << "";
         os << identToString (token.getLexeme ()) << '\n';
       }
       Nonterm const & nonterm = node.getNonterm ();
       if (nonterm.isSet ())
       {
         LRRule const & rule = nonterm.getRule ();
         os.width (indent * 2);
         os << "";
         os << rule.str;
         // info->name is node name
         NontermInfo const * info = rule.nonterm_info;
         os << " [" << info->name << "]";
         os << '\n';
         stack.push_back (ChildIter (& nonterm, 1));
         ++ indent;
       }
     }
   }
 }
コード例 #12
0
ファイル: ILogger.cpp プロジェクト: Moltov/Time-Voyager
  void ILogger::WriteTag(std::ostream& theOstream, SeverityType theSeverity,
      const char* theSourceFile, int theSourceLine)
  {
    const struct std::tm* anTm; // Pointer to Time structure
    std::time_t anNow;

    // Get current time in seconds since Jan 1, 1970
    anNow = std::time(NULL);

    // Convert current time value into local time (with help from OS)
    anTm = std::localtime(&anNow);

    // Output time in timestamp format
    theOstream << anTm->tm_year + 1900 << "-";
    theOstream.fill('0');
    theOstream.width(2);
    theOstream << anTm->tm_mon + 1 << "-";
    theOstream.fill('0');
    theOstream.width(2);
    theOstream << anTm->tm_mday << " ";
    theOstream.fill('0');
    theOstream.width(2);
    theOstream << anTm->tm_hour + 1 << ":";
    theOstream.fill('0');
    theOstream.width(2);
    theOstream << anTm->tm_min << ":";
    theOstream.fill('0');
    theOstream.width(2);
    theOstream << anTm->tm_sec << " ";

    // Now print the log level as a single character
    switch(theSeverity)
    {
      case SeverityInfo:
        theOstream << "I";
        break;
      case SeverityWarning:
        theOstream << "W";
        break;
      case SeverityError:
        theOstream << "E";
        break;
      case SeverityFatal:
        theOstream << "F";
        break;
      default:
        theOstream << "U";
        break;
    }
    theOstream << " " << theSourceFile << ":" << theSourceLine << " ";
  }
コード例 #13
0
ファイル: DenseMatrix.hpp プロジェクト: bpass/cegis
void
DenseMatrix<T>::printOn(std::ostream& os) const
{
	std::streamsize width = os.width();
	os.width(0);
	for(size_t i = 0; i < numRows; ++i)
	{
		os << "[ ";
		for(size_t j = 0; j < numCols; ++j)
		{
			os << std::setw(width) << a(i, j) << ' ';
		}
		os << "]\n";
	}
}
コード例 #14
0
ファイル: Timer.cpp プロジェクト: Killfrra/llvm-kernel
// printAlignedFP - Simulate the printf "%A.Bf" format, where A is the
// TotalWidth size, and B is the AfterDec size.
//
static void printAlignedFP(double Val, unsigned AfterDec, unsigned TotalWidth,
                           std::ostream &OS) {
  assert(TotalWidth >= AfterDec+1 && "Bad FP Format!");
  OS.width(TotalWidth-AfterDec-1);
  char OldFill = OS.fill();
  OS.fill(' ');
  OS << (int)Val;  // Integer part;
  OS << ".";
  OS.width(AfterDec);
  OS.fill('0');
  unsigned ResultFieldSize = 1;
  while (AfterDec--) ResultFieldSize *= 10;
  OS << (int)(Val*ResultFieldSize) % ResultFieldSize;
  OS.fill(OldFill);
}
コード例 #15
0
ファイル: TridiagonalMatrix.hpp プロジェクト: bpass/cegis
void
TridiagonalMatrix<T>::printOn(std::ostream& os) const
{
	const std::streamsize width = os.width();
	os.width(0);

	for(size_t i = 0; i < size; ++i)
	{
		os << "[ ";
		for(size_t j = 0; j < size; ++j)
		{
			os << std::setw(width) << getElement(i, j) << ' ';
		}
		os << "]\n";
	}
}
コード例 #16
0
static inline void formatGdbmiChar(std::ostream &str, wchar_t c)
{
    switch (c) {
    case L'\n':
        str << "\\n";
        break;
    case L'\t':
        str << "\\t";
        break;
    case L'\r':
        str << "\\r";
        break;
    case L'\\':
    case L'"':
        str << '\\' << char(c);
        break;
    default:
        if (c < 128) {
            str << char(c);
        } else {
            // Always pad up to 3 digits in case a digit follows
            const char oldFill = str.fill('0');
            str << '\\' << std::oct;
            str.width(3);
            str << unsigned(c) << std::dec;
            str.fill(oldFill);
        }
        break;
    }
}
コード例 #17
0
ファイル: fde-print.cpp プロジェクト: stephenrkell/libdwarfpp
void print_in_readelf_style(std::ostream& s, const core::Cie& cie)
{
	// first line is section-offset, length-not-including-length-field, zeroes, "CIE"
	s.width(8);
	s.fill('0');
	s 	<< setw(8) << setfill('0') << std::hex << cie.get_offset()
		<< ' ' 
		<< setw(16) << setfill('0') << std::hex << cie.get_bytes_in_cie()
		<< ' ' 
		<< setw(8) << setfill('0') << 0 << std::dec
		<< " CIE"
		<< endl;
	// cie fields come next
	s 	<< "  Version:               " << (int) cie.get_version()                 << endl
		<< "  Augmentation:          \"" << cie.get_augmenter() << "\""  << endl
		<< "  Code alignment factor: " << cie.get_code_alignment_factor() << endl
		<< "  Data alignment factor: " << cie.get_data_alignment_factor() << endl
		<< "  Return address column: " << cie.get_return_address_register_rule() << endl
		<< "  Augmentation data:     ";
	auto augbytes = cie.get_augmentation_bytes();
	for (auto i_byte = augbytes.begin(); i_byte != augbytes.end(); ++i_byte)
	{
		if (i_byte != augbytes.begin()) s << ' ';
		s << std::hex << setw(2) << setfill('0') << (unsigned) *i_byte;
	}
	s << std::dec << endl;
	
	s << endl;
	
	/* Now we need to print the "initial instructions". */
	encap::frame_instrlist initial_instrs(cie, /* FIXME */ 8, cie.initial_instructions_seq());
	print_in_readelf_style(s, initial_instrs, -1);
}
コード例 #18
0
void print_in_readelf_style(std::ostream& s, const Fde& fde)
{
	// auto decoded = decode_fde(dbg, fde);
	// don't decode -- that's for -wF

	// first line is section-offset, length-not-including-length-field, id, "FDE"
	s.width(8);
	s.fill('0');
	s 	<< setw(8) << setfill('0') << std::hex << fde.get_fde_offset()
		<< ' ' 
		<< setw(16) << setfill('0') << std::hex << fde.get_fde_byte_length()
		<< ' ' 
		<< setw(8) << setfill('0') << fde.get_id() << std::dec
		<< " FDE cie="
		<< setw(8) << setfill('0') << std::hex << fde.find_cie()->get_cie_offset()
		<< " pc="
		<< setw(16) << setfill('0') << std::hex << fde.get_low_pc()
		<< ".." 
		<< setw(16) << setfill('0') << std::hex << (fde.get_low_pc() + fde.get_func_length())
		<< endl;
		
	/* Now we need to print the "initial instructions" in decoded form. */
	auto result = fde.decode();
	result.add_unfinished_row(fde.get_low_pc() + fde.get_func_length());

	print_in_readelf_style(s, result, *fde.find_cie());
}
コード例 #19
0
void print_in_readelf_style(std::ostream& s, const Cie& cie)
{
	// first line is section-offset, length-not-including-length-field, zeroes, "CIE"
	s.width(8);
	s.fill('0');
	s 	<< setw(8) << setfill('0') << std::hex << cie.get_offset()
		<< ' ' 
		<< setw(16) << setfill('0') << std::hex << cie.get_bytes_in_cie()
		<< ' ' 
		<< setw(8) << setfill('0') << 0 << std::dec
		<< " CIE "
		<< "\"" << cie.get_augmenter() << "\" cf=" << cie.get_code_alignment_factor()
		<< " df=" << cie.get_data_alignment_factor()
		<< " ra=" << cie.get_return_address_register_rule() << endl;
	
	/* Now we need to print the "initial instructions" in decoded form. */
	auto result = cie.get_owner().interpret_instructions(
		cie, 
		0, 
		cie.get_initial_instructions(),
		cie.get_initial_instructions_length()
	);
	// encap::frame_instrlist initial_instrs(cie, /* FIXME */ 8, cie.initial_instructions_seq());
	/* Add the unfinished row as if it were a real row. */
	result.add_unfinished_row(/* HACK */ result.unfinished_row_addr + 1);

	print_in_readelf_style(s, result, cie);
}
コード例 #20
0
inline
void
arma_ostream::print(std::ostream& o, const Cube<eT>& x, const bool modify)
  {
  arma_extra_debug_sigprint();
  
  const arma_ostream_state stream_state(o);
  
  const std::streamsize cell_width = modify ? arma_ostream::modify_stream(o, x.memptr(), x.n_elem) : o.width();
  
  if(x.is_empty() == false)
    {
    for(uword slice=0; slice < x.n_slices; ++slice)
      {
      o << "[cube slice " << slice << ']' << '\n';
      o.width(cell_width);
      arma_ostream::print(o, x.slice(slice), false);
      o << '\n';
      }
    }
  else
    {
    o << "[cube size: " << x.n_rows << 'x' << x.n_cols << 'x' << x.n_slices <<  "]\n";
    }

  stream_state.restore(o);
  }
コード例 #21
0
void SparsitySuperset::print(std::ostream& os) const 
{
  Tabs tabs;

  /* find the maximum size of the std::string reps of the derivatives.
   * We'll use this to set the field width for printing derivatives. */
  int maxlen = 25;
  for (int i=0; i<derivs_.size(); i++)
    {
      int s = derivs_[i].toString().length();
      if (s > maxlen) maxlen = s;
    }


  os << tabs << "SparsitySuperset" << std::endl;
  for (int i=0; i<derivs_.size(); i++)
    {
      os << tabs << i << "\tderiv=\t";
      os.width(maxlen);
      os.setf(std::ios_base::left, std::ios_base::adjustfield);
      os << derivs_[i].toString() << "\tstate=\t" ;
      switch(states_[i])
        {
        case ZeroDeriv:
          os  << "Zero" << std::endl;
          break;
        case ConstantDeriv:
          os << "Constant" << std::endl;
          break;
        case VectorDeriv:
          os << "Vector" << std::endl;
          break;
        }
    }
}
コード例 #22
0
void dumpArray(std::ostream& file, const Array<T> table,
        const std::string& title = "", int indent = 0) {
    std::string indentString(indent, ' ');
    if (!title.empty()) {
        file << indentString << title << std::endl;
    }
    Array<std::string> txts(table.width(), table.height());
    size_t maxlen = 0;
    for (Point  p: arrayRange(table)) {
        txts[p] = boost::lexical_cast<std::string>(table[p]);
        maxlen = std::max(maxlen, txts[p].size());
    }
    // leave a space between characters
    ++maxlen;
    Point p;
    for (p.y = 0; p.y < static_cast<int>(table.height()); p.y++) {
        file << indentString;
        for (p.x = 0; p.x < static_cast<int>(table.width()); p.x++) {
            file.width(maxlen);
            file << txts[p];
        }
        file << std::endl;
    }
    file << std::endl;
}
コード例 #23
0
ファイル: fmt.cpp プロジェクト: zbigg/tinfra
size_t basic_fmt::check_command(std::ostream& formatter)
{
    fmt_command cmd;
    ostream_string_output output(formatter);
    
    size_t cmd_pos = process_fmt(this->fmt_, this->pos_, cmd, output);
    if( cmd_pos == (size_t)-1 ) 
        throw format_exception("basic_fmt: too many actual arguments");
    if( cmd.fill )
        formatter.fill(cmd.fill);
    if( cmd.width )
        formatter.width(cmd.width);
    if( cmd.precision )
        formatter.precision(cmd.precision);
    
    switch( cmd.command ) {
    case 's':
    case 'i':
    case 'd':
        std::dec(formatter);
        break;
    case 'x':
        std::hex(formatter);
        break;
    default:
        throw format_exception(fmt("basic_fmt: bad format command %s") % cmd.command);
    }
    return cmd_pos;
}
コード例 #24
0
ファイル: utils.cpp プロジェクト: Hadel/Orion
void Utils::DisplayTime( const timespec& disp, std::ostream& Cout)
{
	Cout << disp.tv_sec << ".";
	Cout.width(9);
	Cout.fill('0');
	Cout << disp.tv_nsec << " second(s)";
}
コード例 #25
0
ファイル: numMatrixBanded.cpp プロジェクト: sbolding/holo_imc
void numMatrixBanded::print(std::ostream & out){
	using std::ostream;
	using std::endl;
	using std::cout;
	using std::ios;

	for (int i = 0; i<_n_rows; i++){
		out << "Row " << i << endl;
		for (int j = 0; j<_n_cols; j++){
			out.setf(ios::scientific);
			out.precision(4);
			out.width(13);
			if (std::abs(j - i) > (_band_width / 2))
			{
				out << 0.0;
			}
			else
			{
				out << _coeff[i][getBandIdx(i, j)];
			}
			//if ((j + 1) % 6 == 0){
			//	out << endl;
			
		}
		out << endl;
		out << endl;
	}
}
コード例 #26
0
void printSym(std::ostream & s, unsigned sym) {
  if (sym > 256 ) {
    s << "INV";
  }
  else if (sym == 256) {
    s << "EOF";
  }
  else if (isprint(sym)) {
    char c = sym;
    s << "'" << c << "'";
  }
  else {
    std::streamsize w = s.width(3);
    s << std::hex << sym << std::dec;
    s.width(w);
  }
}
コード例 #27
0
inline
arma_ostream_state::arma_ostream_state(const std::ostream& o)
  : orig_flags    (o.flags())
  , orig_precision(o.precision())
  , orig_width    (o.width())
  , orig_fill     (o.fill())
  {
  }
コード例 #28
0
ファイル: field_meat.hpp プロジェクト: iirob/wire
inline
void
field<oT>::print(std::ostream& user_stream, const std::string extra_text) const
  {
  arma_extra_debug_sigprint();
  
  if(extra_text.length() != 0)
    {
    const std::streamsize orig_width = user_stream.width();
    
    user_stream << extra_text << '\n';
  
    user_stream.width(orig_width);
    }
  
  arma_ostream::print(user_stream, *this);
  }
コード例 #29
0
ファイル: streamtool.cpp プロジェクト: JonnyWideFoot/pd
void setFloatFmt( std::ostream &_file, int _width, int _precision )
{
	_file.setf(ios::showpoint); // ensure the decimal point is set
	_file.setf(ios::right,ios::adjustfield); // ensure all is right aligned to the available width
	_file.setf(ios::fixed,ios::floatfield); // ensure that the floating point representation
	_file.width(_width); // set the print width
	_file.precision(_precision); // set the number of decimal palaces
}
コード例 #30
0
void FileLogger::writeTag(std::ostream& outStream, SeverityType severity, const char* sourceFile, int sourceLine)
{
    const struct std::tm* timeStruct;
    std::time_t now;

    now = std::time(nullptr);

    timeStruct = std::localtime(&now);

    outStream << timeStruct->tm_year + 1900 << "-";
    outStream.fill('0');
    outStream.width(2);
    outStream << timeStruct->tm_mon + 1 << "-";
    outStream.fill('0');
    outStream.width(2);
    outStream << timeStruct->tm_mday << " ";
    outStream.fill('0');
    outStream.width(2);
    outStream << timeStruct->tm_hour + 1 << ":";
    outStream.fill('0');
    outStream.width(2);
    outStream << timeStruct->tm_min << ":";
    outStream.fill('0');
    outStream.width(2);
    outStream << timeStruct->tm_sec << " ";

    switch(severity)
    {
    case SeverityInfo:
        outStream << "Information :";
        break;
    case SeverityWarning:
        outStream << "Warning     :";
        break;
    case SeverityError:
        outStream << "Error       :";
        break;
    case SeverityFatal:
        outStream << "Fatal error :";
        break;
    default:
        outStream << "Unknown     :";
        break;
    }
    outStream << " " << sourceFile << " : line " << sourceLine << " ";
}