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


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

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


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

示例1: write_resource_table

ResourceTableHeader write_resource_table(ostream &out, const ResourceSet &rs)
{
	ResourceIndex index;
	uint32_t pre_data(out.tellp());
	write_resource_data(out, index, rs);
	uint32_t post_data(out.tellp());
	write_resource_index(out, index);

	ResourceTableHeader tbl_header;
	tbl_header.data_size = post_data - pre_data;
	tbl_header.resource_count = rs.size();
	return tbl_header;
}
开发者ID:zhaobr,项目名称:qbrt,代码行数:13,代码来源:qbc.cpp

示例2:

JSize
JTellp
	(
	ostream& stream
	)
{
	return stream.tellp();
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:8,代码来源:jStreamUtil_UNIX.cpp

示例3: DWrite

int IOBuffer::DWrite(ostream & stream, int recref) const
// write specified record
		{
	stream.seekp(recref, ios::beg);
	if(stream.tellp() != recref)
		return -1;
	return Write(stream);
}
开发者ID:grachegrache,项目名称:multitab_server,代码行数:8,代码来源:iobuffer.cpp

示例4: WriteHeader

int VariableLengthBuffer::WriteHeader(ostream & stream)const{
    int result;
    result = IOBuffer::WriteHeader(stream);
    if(!result) return 0;
    stream.write(headerStr, headerSize);
    if(! stream.good()) return 0;
    return stream.tellp();
}
开发者ID:atawre,项目名称:fstructure,代码行数:8,代码来源:varlen.cpp

示例5: Write

int VariableLengthBuffer::Write(ostream & stream) const{
    int recaddr = stream.tellp();
    unsigned short bufferSize;
    bufferSize = BufferSize;
    stream.write((char *)&bufferSize, sizeof(bufferSize));
    if(!stream) return -1;
    stream.write(Buffer, BufferSize);
    if(! stream.good()) return -1;
    return recaddr;
}
开发者ID:atawre,项目名称:fstructure,代码行数:10,代码来源:varlen.cpp

示例6: WriteSize

void WriteSize(ostream& out)
{
  unsigned filesize = out.tellp();
  unsigned size = filesize - 8;
  out.seekp(4, ios_base::beg);
  out.write((char*)&size, 4);
  unsigned data_size = filesize - 44;
  out.seekp(40, ios_base::beg);
  out.write((char*)&data_size, 4);
}
开发者ID:chinjao,项目名称:ros_src,代码行数:10,代码来源:rasp24record.cpp

示例7: WriteHeader

int FixedFieldBuffer::WriteHeader(ostream & stream) const{
    if(!Initialized) return -1;
    int result = FixedLengthBuffer::WriteHeader(stream);
    if(!result) return -1;
    stream.write((char*)&NumFields, sizeof(NumFields));
    for(int i=0; i<NumFields; i++)
        stream.write((char*)&FieldSize[i], sizeof(FieldSize[i]));
    if(!stream) return -1;
    return stream.tellp();
}
开发者ID:atawre,项目名称:fstructure,代码行数:10,代码来源:fixfld.cpp

示例8: encode

//-------------------------------------------------------------------------------------------------
size_t MessageBase::encode(ostream& to) const
{
	const std::ios::pos_type where(to.tellp());
	for (Positions::const_iterator itr(_pos.begin()); itr != _pos.end(); ++itr)
	{
#if defined POPULATE_METADATA
		check_set_rlm(itr->second);
#endif
		Presence::const_iterator fpitr(_fp.get_presence().end());
		if (!_fp.get(itr->second->_fnum, fpitr, FieldTrait::suppress))	// some fields are not encoded until unsuppressed (eg. checksum)
		{
			itr->second->encode(to);
			if (fpitr->_field_traits.has(FieldTrait::group))
				encode_group(itr->second->_fnum, to);
		}
	}

	return to.tellp() - where;
}
开发者ID:6qat,项目名称:fix8,代码行数:20,代码来源:message.cpp

示例9: sizeOut

bool Nitf::SectgaParser::fromDynamicObject(const DynamicObject& input, ostream& output, size_t& numBytesWritten,
   string &errorMessage) const
{
   if (output.tellp() < 0 || static_cast<uint64_t>(output.tellp()) > std::numeric_limits<size_t>::max())
   {
      return false;
   }
   size_t sizeIn = max<size_t>(0, static_cast<size_t>(output.tellp()));
   size_t sizeOut(sizeIn);

   try
   {
      output << sizeString(dv_cast<string>(input.getAttribute(SECTGA::SEC_ID)), 12);
      output << sizeString(dv_cast<string>(input.getAttribute(SECTGA::SEC_BE)), 15);
      output << toString(dv_cast<unsigned int>(input.getAttribute(SECTGA::RESERVED001)), 1, -1);
   }
   catch (const bad_cast&)
   {
      return false;
   }

   if (output.tellp() < 0 || static_cast<uint64_t>(output.tellp()) > std::numeric_limits<size_t>::max())
   {
      return false;
   }
   sizeOut = static_cast<size_t>(output.tellp());
   numBytesWritten = sizeOut - sizeIn;
   return true;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:29,代码来源:NitfSectgaParser.cpp

示例10: encode

//-------------------------------------------------------------------------------------------------
size_t MessageBase::encode(ostream& to) const
{
	const std::ios::pos_type where(to.tellp());
	for (const auto& pp : _pos)
	{
#if defined FIX8_POPULATE_METADATA
		check_set_rlm(pp.second);
#endif
		Presence::const_iterator fpitr(_fp.get_presence().end());
		if (!_fp.get(pp.second->_fnum, fpitr, FieldTrait::suppress))	// some fields are not encoded until unsuppressed (eg. checksum)
		{
			pp.second->encode(to);
			if (fpitr->_field_traits.has(FieldTrait::group) && has_group_count(pp.second))
				encode_group(pp.second->_fnum, to);
		}
	}

	if (_unknown.size())
		to << _unknown;

	return to.tellp() - where;
}
开发者ID:fix8,项目名称:fix8,代码行数:23,代码来源:message.cpp

示例11: Write

int VariableLengthBuffer :: Write (ostream & stream) const
{
    int recaddr = stream.tellp();
    stream.write(Buffer, BufferSize);
    int t=sizeof(BufferSize);
	for(int i=0;i<150-t;i++)
	{
	stream.write(" ",1);
	}
    stream.write("#",1);

    if(!stream.good())
      return -1;
    return recaddr;
}
开发者ID:didiradi,项目名称:C-CPP-Projects,代码行数:15,代码来源:Varlen.cpp

示例12: writeCentralDirectory

void ZipOutputStreambuf::writeCentralDirectory( const vector< ZipCDirEntry > &entries, 
						EndOfCentralDirectory eocd, 
						ostream &os ) {
  int cdir_start = os.tellp() ;
  std::vector< ZipCDirEntry >::const_iterator it ;
  int cdir_size = 0 ;

  for ( it = entries.begin() ; it != entries.end() ; ++it ) {
    os << *it ;
    cdir_size += it->getCDirHeaderSize() ;
  }
  eocd.setOffset( cdir_start ) ;
  eocd.setCDirSize( cdir_size ) ;
  eocd.setTotalCount( entries.size() ) ;
  os << eocd ;
}
开发者ID:Caraul,项目名称:Enigma,代码行数:16,代码来源:zipoutputstreambuf.cpp

示例13: WriteHeader

int VariableLengthBuffer::WriteHeader(ostream & stream) const
// write a buffer header to the beginning of the stream
// A header consists of the 
//	IOBUFFER header	
//	header string
//	Variable sized record of length fields
//		that describes the file records
		{
	int result;
	// write the parent (IOBuffer) header
	result = IOBuffer::WriteHeader(stream);
	if(!result)
		return FALSE;
	// write the header string
	stream.write(headerStr, headerSize);
	if(!stream.good())
		return FALSE;
	// write the record description
	return stream.tellp();
}
开发者ID:grachegrache,项目名称:multitab_server,代码行数:20,代码来源:varlen.cpp

示例14: StreamSelectionWiresOut

void Fl_Canvas::StreamSelectionWiresOut(ostream &s)
{
	int total_wires = 0, curpos=0;

	curpos = s.tellp();

	s<<-1<<endl;

	if (m_WireVec.size()>0)
		for(vector<CanvasWire>::iterator i=m_WireVec.begin();
			i!=m_WireVec.end(); i++)
		{
			std::vector<int>::iterator output = std::find( m_Selection.m_DeviceIds.begin(), m_Selection.m_DeviceIds.end(), i->OutputID );
			std::vector<int>::iterator input = std::find( m_Selection.m_DeviceIds.begin(), m_Selection.m_DeviceIds.end(), i->InputID );

			if ((input != m_Selection.m_DeviceIds.end()) && (output != m_Selection.m_DeviceIds.end()))
			{
				s<<i->OutputID<<" ";
				s<<0<<" ";
				s<<i->OutputPort<<" ";
				s<<i->OutputTerminal<<" ";
				s<<i->InputID<<" ";
				s<<0<<" ";
				s<<i->InputPort<<" ";
					s<<i->InputTerminal<<endl;

				total_wires += 1;
			}
		}

	if (total_wires >= 1)
	{
		s.seekp(curpos, ios::beg);
		s<<total_wires<<endl;
		s.seekp(0, ios::end);
	}
}
开发者ID:original-male,项目名称:spiralsynthmodular,代码行数:37,代码来源:Fl_Canvas.C

示例15: sizeOut

bool Nitf::RpcParser::fromDynamicObject(const DynamicObject& input, ostream& output, size_t& numBytesWritten,
   string &errorMessage) const
{
   if (output.tellp() < 0 || static_cast<uint64_t>(output.tellp()) > std::numeric_limits<size_t>::max())
   {
      return false;
   }
   size_t sizeIn = max<size_t>(0, static_cast<size_t>(output.tellp()));
   size_t sizeOut(sizeIn);

   try
   {
      output << dv_cast<bool>(input.getAttribute(SUCCESS)) ? "1" : "0";
      output << toString(dv_cast<double>(input.getAttribute(ERR_BIAS)), 7, 2);
      output << toString(dv_cast<double>(input.getAttribute(ERR_RAND)), 7, 2);
      output << toString(dv_cast<unsigned int>(input.getAttribute(LINE_OFFSET)), 6);
      output << toString(dv_cast<unsigned int>(input.getAttribute(SAMP_OFFSET)), 5);
      output << toString(dv_cast<double>(input.getAttribute(LAT_OFFSET)), 8, 4, ZERO_FILL, POS_SIGN_TRUE);
      output << toString(dv_cast<double>(input.getAttribute(LONG_OFFSET)), 9, 4, ZERO_FILL, POS_SIGN_TRUE);
      output << toString(dv_cast<int>(input.getAttribute(HEIGHT_OFFSET)), 5, -1, ZERO_FILL, POS_SIGN_TRUE);
      output << toString(dv_cast<unsigned int>(input.getAttribute(LINE_SCALE)), 6);
      output << toString(dv_cast<unsigned int>(input.getAttribute(SAMP_SCALE)), 5);
      output << toString(dv_cast<double>(input.getAttribute(LAT_SCALE)), 8, 4, ZERO_FILL, POS_SIGN_TRUE);
      output << toString(dv_cast<double>(input.getAttribute(LONG_SCALE)), 9, 4, ZERO_FILL, POS_SIGN_TRUE);
      output << toString(dv_cast<int>(input.getAttribute(HEIGHT_SCALE)), 5, -1, ZERO_FILL, POS_SIGN_TRUE);

      unsigned int u;

      for (u = 1; u <= 20; ++u)
      {
         output << toString(dv_cast<double>(input.getAttribute(getRpcCoefficient(LINE_NUMERATOR_COEF_PREFIX, u))),
            12, 6, ZERO_FILL, POS_SIGN_TRUE, USE_SCIENTIFIC_NOTATION, ONE_EXP_DIGIT);
      }
      for (u = 1; u <= 20; ++u)
      {
         output << toString(dv_cast<double>(input.getAttribute(getRpcCoefficient(LINE_DENOMINATOR_COEF_PREFIX, u))),
            12, 6, ZERO_FILL, POS_SIGN_TRUE, USE_SCIENTIFIC_NOTATION, ONE_EXP_DIGIT);
      }
      for (u = 1; u <= 20; ++u)
      {
         output << toString(dv_cast<double>(input.getAttribute(getRpcCoefficient(SAMPLE_NUMERATOR_COEF_PREFIX, u))),
            12, 6, ZERO_FILL, POS_SIGN_TRUE, USE_SCIENTIFIC_NOTATION, ONE_EXP_DIGIT);
      }
      for (u = 1; u <= 20; ++u)
      {
         output << toString(dv_cast<double>(input.getAttribute(getRpcCoefficient(SAMPLE_DENOMINATOR_COEF_PREFIX, u))),
            12, 6, ZERO_FILL, POS_SIGN_TRUE, USE_SCIENTIFIC_NOTATION, ONE_EXP_DIGIT);
      }
   }
   catch (const bad_cast&)
   {
      return false;
   }

   if (output.tellp() < 0 || static_cast<uint64_t>(output.tellp()) > std::numeric_limits<size_t>::max())
   {
      return false;
   }
   sizeOut = static_cast<size_t>(output.tellp());
   numBytesWritten = sizeOut - sizeIn;
   return true;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:62,代码来源:NitfRpcParser.cpp


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