当前位置: 首页>>代码示例>>C++>>正文


C++ ostream::unsetf方法代码示例

本文整理汇总了C++中std::ostream::unsetf方法的典型用法代码示例。如果您正苦于以下问题:C++ ostream::unsetf方法的具体用法?C++ ostream::unsetf怎么用?C++ ostream::unsetf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在std::ostream的用法示例。


在下文中一共展示了ostream::unsetf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: hexDump

void AsnBuf::hexDump(std::ostream &os) const
{
   bool done = false;
   int ch;
   
   ResetMode();

   std::hex(os);

   while (! done)
   {
	 
     try
      {
		 ch = GetUByte();
		 os << "0x";
		 os << ch;
		 os << "   ";
	  }
      catch (...)
      {

		 os.unsetf(std::ios_base::hex);
         os.unsetf(std::ios_base::hex);
         done = true;
      }
 
   }

  
}
开发者ID:azsnaccbuilds,项目名称:esnacc-ng,代码行数:31,代码来源:asn-buf.cpp

示例2: writeSpeciesData

    void writeSpeciesData(std::ostream& log, const Species& spec) {
        
        if (!spec.id.empty()) 
            log << endl << "   id/date: " << spec.id << endl;
        else 
            log << " ... " << endl;
        
        log << "   phase: " 
            << spec.phase << endl 
            << "   composition: (";
        
        for (size_t ie = 0; ie < spec.elements.size(); ie++) {
	  if (!spec.elements[ie].name.empty()) {
	    log.flags(ios::fixed);
	    log.precision(0);
	    if (ie > 0) log << ", ";
	    log << spec.elements[ie].number << " " 
		<< spec.elements[ie].name;
	  }
        } 
        log << ")";
	
	if (spec.thermoFormatType == 0) {
	  log.flags(ios::showpoint | ios::fixed);
	  log.precision(2);
	  log << endl << "   Tlow, Tmid, Thigh: (" << spec.tlow << ", " << 
            spec.tmid << ", " << spec.thigh << ")" << endl << endl;
	  log << "   coefficients (low, high):" << endl;
	  log.flags(ios::scientific | ios::uppercase | ios::internal );
	 log.precision(8);
	 for (int j = 0; j < 7; j++) { 
	   log << "   a" << j + 1;
	   log.setf(ios::showpos);
	   log << "  \t" << spec.lowCoeffs[j] 
	       << "  \t" << spec.highCoeffs[j] << endl;
	   log.unsetf(ios::showpos);
	 }
	 log << endl;
	} else if (spec.thermoFormatType == 1) {
	  log.flags(ios::showpoint | ios::fixed);
	  log.precision(2);
	  log << endl;
	  log << "Number of temp regions = " << spec.nTempRegions << endl;
	  for (int i = 0; i < spec.nTempRegions; i++) {
	    log << "   Tlow, Thigh: (" << spec.minTemps[i] << ", " 
		<< spec.maxTemps[i] << ")" << endl << endl;
	    log << "   coefficients :" << endl;
	    log.flags( ios::scientific | ios::uppercase | ios::internal);
            log.precision(8);
	    vector_fp &cc = *spec.region_coeffs[i];
	    for (int j = 0; j < 9; j++) { 
	      log << "   a" << j + 1;
	      log.setf(ios::showpos);
	      log << "  \t" << cc[j]  << endl;
	      log.unsetf(ios::showpos);
	    }
	    log << endl;
	  }
        }
     }
开发者ID:hkmoffat,项目名称:cantera,代码行数:60,代码来源:writelog.cpp

示例3: print

	void entry::print(std::ostream& os, int indent) const
	{
		assert(indent >= 0);
		for (int i = 0; i < indent; ++i) os << " ";
		switch (m_type)
		{
		case int_t:
			os << integer() << "\n";
			break;
		case string_t:
			{
				bool binary_string = false;
				for (std::string::const_iterator i = string().begin(); i != string().end(); ++i)
				{
					if (!std::isprint(static_cast<unsigned char>(*i)))
					{
						binary_string = true;
						break;
					}
				}
				if (binary_string)
				{
					os.unsetf(std::ios_base::dec);
					os.setf(std::ios_base::hex);
					for (std::string::const_iterator i = string().begin(); i != string().end(); ++i)
						os << static_cast<unsigned int>((unsigned char)*i);
					os.unsetf(std::ios_base::hex);
					os.setf(std::ios_base::dec);
					os << "\n";
				}
				else
				{
					os << string() << "\n";
				}
			} break;
		case list_t:
			{
				os << "list\n";
				for (list_type::const_iterator i = list().begin(); i != list().end(); ++i)
				{
					i->print(os, indent+1);
				}
			} break;
		case dictionary_t:
			{
				os << "dictionary\n";
				for (dictionary_type::const_iterator i = dict().begin(); i != dict().end(); ++i)
				{
					for (int j = 0; j < indent+1; ++j) os << " ";
					os << "[" << i->first << "]";
					if (i->second.type() != entry::string_t && i->second.type() != entry::int_t) os << "\n";
					else os << " ";
					i->second.print(os, indent+2);
				}
			} break;
		default:
			os << "<uninitialized>\n";
		}
	}
开发者ID:340211173,项目名称:P2PCenter,代码行数:59,代码来源:entry.cpp

示例4: report_list

void report_list(
    std::ostream& o,
    const Vector& list,
    const char* prefix = "  "
) {
    if (!list.empty()) {
        typename Vector::value_type min_value, max_value;
        min_value = *std::min_element(list.begin(), list.end());
        max_value = *std::max_element(list.begin(), list.end());
        if (min_value == max_value) {
            o << prefix << "\t" << min_value << "\n";
        } else {
            o << std::endl;
            o << prefix << "min:\t" << min_value << "\n";
            o << prefix << "median:\t" << median_element(list) << "\n";
            std::streamsize precision = o.precision();
            o.setf(std::ios::fixed, std::ios_base::floatfield);
            o.precision(2);
            o << prefix << "avg:\t" << avg_element_double(list) << "\n";
            o.precision(precision);
            o.unsetf(std::ios_base::floatfield);
            o << prefix << "max:\t" << max_value << "\n";
        }
    }
    o << std::endl;
}
开发者ID:npge,项目名称:npge,代码行数:26,代码来源:report_list.hpp

示例5: WriteCHEMKINOnASCIIFile

	void ExtendedPressureLogarithmicRateExpression::WriteCHEMKINOnASCIIFile(std::ostream& fOutput) const
	{
		fOutput.unsetf(std::ios_base::floatfield);
		fOutput.precision(6);

		for (unsigned int k = 0; k < species_.size(); k++)
		{
			for (int j = 0; j < N_[k]; j++)
			{
				if (species_indices_[k] == -1)
				{
					fOutput << " PLOGMX / ";
				}
				else
				{
					fOutput << " PLOGSP / ";
					fOutput << species_[k] << "  ";
				}

				fOutput << std::showpoint << std::setw(12) << std::left << p_[k][j] / 101325.;
				fOutput << std::showpoint << std::setw(12) << std::left << std::exp(lnA_[k][j]) / conversion_A_;
				fOutput << std::showpoint << std::setw(12) << std::left << Beta_[k][j];
				fOutput << std::showpoint << std::setw(12) << std::left << E_over_R_[k][j] * PhysicalConstants::R_J_kmol / Conversions::J_from_kcal;;

				fOutput << "/" << std::endl;
			}
		}
	}
开发者ID:acuoci,项目名称:laminarSMOKE,代码行数:28,代码来源:ExtendedPressureLogarithmicRateExpression.hpp

示例6: Write

//-----------------------------------------------------------------------------
bool ConicModel::Write(std::ostream& out) const
{
    int prec = out.precision(3);						// Sauvegarde des parametres du flux
    std::ios::fmtflags flags = out.setf(std::ios::fixed);

    out << "  <intrinseque>" << std::endl;

    out << "   <sensor>" << std::endl;
    out << "    <image_size> " << std::endl;
    out << "     <width> " <<  m_width << " </width>" << std::endl;
    out << "     <height> " <<  m_height << " </height>" << std::endl;
    out << "    </image_size>" << std::endl;

    out.precision(3);

    out << "    <ppa>" << std::endl;
    out << "     <c> " <<  m_cPPA << " </c>" << std::endl;
    out << "     <l> " <<  m_lPPA  << " </l>" << std::endl;
    out << "     <focale> " <<  m_focal << " </focale>" << std::endl;
    out << "    </ppa>" << std::endl;

    if(m_distortion) m_distortion->Write(out);

    out << "   </sensor>" << std::endl;

    out << "  </intrinseque>" << std::endl;

    out.precision(prec);		// Restauration des parametres du flux
    out.unsetf(std::ios::fixed);
    out.setf(flags);

    return out.good();
}
开发者ID:IGNF,项目名称:libOri,代码行数:34,代码来源:ConicModel.cpp

示例7: writeFacesToStream

 void MapWriter::writeFacesToStream(const Model::FaceList& faces, std::ostream& stream) {
     assert(stream.good());
     stream.unsetf(std::ios::floatfield);
     
     for (unsigned int i = 0; i < faces.size(); i++)
         writeFace(*faces[i], stream);
 }
开发者ID:ProPuke,项目名称:TrenchBroom,代码行数:7,代码来源:MapWriter.cpp

示例8: printIteration

 void Newton::printIteration(std::ostream &stream) {
   stream << setw(5) << "iter";
   stream << setw(10) << "res";
   stream << setw(10) << "step";
   stream << std::endl;
   stream.unsetf(std::ios::floatfield);
 }
开发者ID:cfpperche,项目名称:casadi,代码行数:7,代码来源:newton.cpp

示例9: binary_save

 bool binary_save(T const& t, std::ostream& os)
 {
     boost::io::ios_flags_saver saver(os);
     os.unsetf(std::ios_base::skipws);
     binary_oarchive<> bo(os);
     bo & t;
     return bo.good() ? true : (bo.clear(), false);
 }
开发者ID:roblade,项目名称:Bex,代码行数:8,代码来源:binary_oarchive.hpp

示例10: writeToStream

 void MapWriter::writeToStream(const Model::Map& map, std::ostream& stream) {
     assert(stream.good());
     stream.unsetf(std::ios::floatfield);
     
     const Model::EntityList& entities = map.entities();
     for (unsigned int i = 0; i < entities.size(); i++)
         writeEntity(*entities[i], stream);
 }
开发者ID:ProPuke,项目名称:TrenchBroom,代码行数:8,代码来源:MapWriter.cpp

示例11: OutputMaterials

void OutputMaterials(std::ostream &ofs, SModel* model)
{
	ofs << "METERIALS" << std::endl;
	ofs << "NumMaterials= " << model->numMaterials << std::endl;

	if ( model->numMaterials == 0 )
	{
		model->materials = NULL;
		return;
	}

	for ( uint i = 0; i < model->numMaterials; i++ )
	{
		SMaterial* mat = &model->materials[ i ];
		ofs << "\t" << "MaterialType= " << mat->type << std::endl;
		ofs << "\t" << SMatNames[mat->type] << " " << mat->name << "\n";
		ofs << "\t\t" << "materialID= " << mat->materialID << std::endl;

		// set float format
		std::streamsize oldPrec = ofs.precision(5);
		ofs.setf(std::ios::fixed,std::ios::floatfield);	// floatfield set to fixed

		OutputAttribute(ofs, "ambient       ", mat->ambient);
		OutputAttribute(ofs, "diffuse       ", mat->diffuse);
		OutputAttribute(ofs, "incandescence ", mat->incandescence);
		OutputAttribute(ofs, "transparency  ", mat->transparency);

		ofs << "\t\t" << "normalmap      tex= " << mat->normalmapTex << "\n";

		switch(mat->type) 
		{
			case MATERIAL_PHONG:
				{
					OutputAttribute(ofs, "specular      ", mat->specular);
					ofs	<< "\t\t" << "shininess      " << mat->shininess << std::endl; 
				}
				break;
			case MATERIAL_BLINN:
				{
					OutputAttribute(ofs, "specular      ", mat->specular);
					ofs	<< "\t\t" << "eccentricity   " << mat->eccentricity << std::endl; 
					ofs	<< "\t\t" << "specularRollOff " << mat->specularRollOff << std::endl; 
				}
				break;
			case MATERIAL_LAMBERT:
				{
					// nothing
				}
				break;
			default:
				assert(0); exit(1);
		}
	
		// unset float format
		ofs.precision(oldPrec);
		ofs.unsetf(std::ios::floatfield);
	}
}
开发者ID:shikui08,项目名称:character-system,代码行数:58,代码来源:Material.cpp

示例12: stream_state

inline
void
arma_ostream::print(std::ostream& o, const SizeCube& S)
  {
  arma_extra_debug_sigprint();
  
  const arma_ostream_state stream_state(o);
  
  o.unsetf(ios::showbase);
  o.unsetf(ios::uppercase);
  o.unsetf(ios::showpos);
  
  o.setf(ios::fixed);
    
  o << S.n_rows << 'x' << S.n_cols << 'x' << S.n_slices;
  
  stream_state.restore(o);
  }
开发者ID:KaimingOuyang,项目名称:HPC-K-Means,代码行数:18,代码来源:arma_ostream_meat.hpp

示例13: print

/*===========================================================================*/
void VolumeObjectBase::print( std::ostream& os, const kvs::Indent& indent ) const
{
    BaseClass::print( os, indent );
    const std::ios_base::fmtflags flags( os.flags() );
    os << indent << "Veclen : " << this->veclen() << std::endl;
    os.setf( std::ios::boolalpha );
    os << indent << "Set of min/max value : " << this->hasMinMaxValues() << std::endl;
    os.unsetf( std::ios::boolalpha );
    os << indent << "Min. value : " << this->minValue() << std::endl;
    os << indent << "Max. value : " << this->maxValue() << std::endl;
    os.flags( flags );
}
开发者ID:hofsta,项目名称:KVS,代码行数:13,代码来源:VolumeObjectBase.cpp

示例14: setprecision

void VectorFunction<value_type>::printDifferenceQuotientSequence(ublas::vector<double> x,
                                                                 std::ostream& os) const
{
	using namespace std;

    for (double delta=.1; delta>1e-9; delta/=10)
    {
        os << scientific << setprecision(1) << "[delta: " << delta << "] ";
        os.unsetf(std::ios::scientific);
        os << setprecision(8) << differenceQuotient(x, delta) << endl;
    }
}
开发者ID:pombredanne,项目名称:BICEPS,代码行数:12,代码来源:DerivativeTest.hpp

示例15: writeObjectsToStream

        void MapWriter::writeObjectsToStream(const Model::EntityList& pointEntities, const Model::BrushList& brushes, std::ostream& stream) {
            assert(stream.good());
            stream.unsetf(std::ios::floatfield);

            Model::Entity* worldspawn = NULL;
            
            // group the brushes by their containing entities
            typedef std::map<Model::Entity*, Model::BrushList> EntityBrushMap;
            EntityBrushMap entityToBrushes;
            
            Model::BrushList::const_iterator brushIt, brushEnd;
            for (brushIt = brushes.begin(), brushEnd = brushes.end(); brushIt != brushEnd; ++brushIt) {
                Model::Brush& brush = **brushIt;
                Model::Entity& entity = *brush.entity();
                entityToBrushes[&entity].push_back(&brush);
                if (entity.worldspawn())
                    worldspawn = &entity;
            }
            
            // write worldspawn first
            if (worldspawn != NULL) {
                Model::BrushList& brushList = entityToBrushes[worldspawn];
                writeEntityHeader(*worldspawn, stream);
                for (brushIt = brushList.begin(), brushEnd = brushList.end(); brushIt != brushEnd; ++brushIt) {
                    writeBrush(**brushIt, stream);
                }
                writeEntityFooter(stream);
            }
            
            // now write the point entities
            Model::EntityList::const_iterator entityIt, entityEnd;
            for (entityIt = pointEntities.begin(), entityEnd = pointEntities.end(); entityIt != entityEnd; ++entityIt) {
                Model::Entity& entity = **entityIt;
                writeEntity(entity, stream);
            }

            // finally write the brush entities
            EntityBrushMap::iterator it, end;
            for (it = entityToBrushes.begin(), end = entityToBrushes.end(); it != end; ++it) {
                Model::Entity* entity = it->first;
                if (entity != worldspawn) {
                    Model::BrushList& brushList = it->second;
                    writeEntityHeader(*entity, stream);
                    for (brushIt = brushList.begin(), brushEnd = brushList.end(); brushIt != brushEnd; ++brushIt) {
                        writeBrush(**brushIt, stream);
                    }
                    writeEntityFooter(stream);
                }
            }
        }
开发者ID:ProPuke,项目名称:TrenchBroom,代码行数:50,代码来源:MapWriter.cpp


注:本文中的std::ostream::unsetf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。