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


C++ std::istringstream类代码示例

本文整理汇总了C++中std::istringstream的典型用法代码示例。如果您正苦于以下问题:C++ istringstream类的具体用法?C++ istringstream怎么用?C++ istringstream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: CEvent

//unserialize l'objet
CHeroSyncEvent::CHeroSyncEvent(std::istringstream& data) 
: CEvent(EVENT_HEROSYNC), COORD_ERROR_MARGIN(50)
{
	data.read((char*)&m_dir,sizeof(UInt8));
	data.read((char*)&m_coord.x,sizeof(float));
	data.read((char*)&m_coord.y,sizeof(float));
}
开发者ID:isra17,项目名称:toursatan,代码行数:8,代码来源:HeroEvent.cpp

示例2: skipOverQuotes

/// directly sends the quoted text to oss
/// and returns if a quote was found
/// empties the given buffer in to oss if one is given
/// works only if a quote char is found where the iss cursor is.
bool JLDIO::skipOverQuotes(std::ostringstream& oss, std::istringstream& iss, std::list<char> *bufferToEmpty)
{
    char charBuffer = iss.peek();
    if(charBuffer == '\'' || charBuffer == '\"')
    {
        if(bufferToEmpty && !bufferToEmpty->empty())
        {
            oss << listToString(*bufferToEmpty);
            bufferToEmpty->clear();
        }
        // std::cout<<"Skipping: ";
        char matchedChar = charBuffer;
        iss.get(charBuffer);
        assert(matchedChar == charBuffer);
        do
        {
            oss << charBuffer;
            // std::cout<<charBuffer;
        } while(iss.get(charBuffer) && charBuffer != matchedChar);
        if(iss.good())
            oss << charBuffer;
        // std::cout<<charBuffer<<"\n";
        return true;
    }
    return false;
}
开发者ID:dare0021,项目名称:October3rd,代码行数:30,代码来源:JLDIO.cpp

示例3: factor

void factor( std::istringstream &ss, char &lookahead ) {
    if ( isDigit {}( lookahead ) ){
        int value = 0;
        do {
            value = value * 10 + ToDigit {}( lookahead );
            lookahead = ss.get();
        } while ( !ss.eof() && isDigit {} ( lookahead ) );
        print ( value );
    } else if ( lookahead == '(' ) {
        match ( ss, lookahead, '(' );
        expr( ss, lookahead );
        if( lookahead != ')' ){
            throw fail { "Expected a closing parenthesis before end of line." };
        }
        match ( ss, lookahead, ')' );
    } else if ( isWhiteSpace {} ( lookahead ) ) {
        for (;; lookahead = ss.get() ){
            if( isWhiteSpace {}( lookahead ) ) continue;
            else break;
        }
    } else {
        std::cerr << "Syntax Error: expecting a digit, got '" << lookahead << "' instead." << std::endl;
        abort();
    }
}
开发者ID:iamOgunyinka,项目名称:MyCC,代码行数:25,代码来源:inTopostfix.cpp

示例4:

 // This resets the flags of streamToReset and sets its string to be
 // newString.
 inline void
 ParsingUtilities::ResetStringstream( std::istringstream& streamToReset,
                                      std::string const& newString )
 {
   streamToReset.clear();
   streamToReset.str( newString );
 }
开发者ID:benoleary,项目名称:LesHouchesParserClasses_CPP,代码行数:9,代码来源:ParsingUtilities.hpp

示例5: parseObject

bool ossimWkt::parseObject( std::istringstream& is,
                            const std::string& prefix,
                            const std::string& object,
                            ossimKeywordlist& kwl )
{
    bool result = false;

    result = parseName( is, prefix, object, kwl );

    if ( result && is.good() )
    {
        char c;
        ossim_uint32 myObjectIndex = 0;
        ossim_uint32 paramIndex = 0;
        while ( is.good() )
        {
            is.get(c);
            if ( is.good() )
            {
                if ( c == ',' )
                {
                    parseParam( is, prefix, object, myObjectIndex, paramIndex, kwl );
                }
                else if ( (c == ']') || (c == ')') )
                {
                    break; // End of object.
                }
            }
        }

    }

    return result;
}
开发者ID:rkanavath,项目名称:ossim,代码行数:34,代码来源:ossimWkt.cpp

示例6: extractEnd

static bool extractEnd(std::istringstream &strm, std::string &end)
{
	std::stringbuf temp;
	strm.get(temp);
	end = temp.str();
	return !strm.fail();
}
开发者ID:Senzaki,项目名称:tipne_net,代码行数:7,代码来源:KeyMap.cpp

示例7:

int			PacketHelper::getUnreadSize(std::istringstream& st)
{
	std::streampos pos = st.tellg();
	st.seekg(0, st.end);
	int length = (int)(st.tellg() - pos);
	st.seekg(pos, st.beg);
	return length;
}
开发者ID:edd83,项目名称:Skype-like,代码行数:8,代码来源:PacketHelper.cpp

示例8: insert_spaces

/**
 * Read from input title and insert spaces into the title vector
 * @param iss       input stream
 * @param word      space word to insert
 * @param title     vector where to store the words
 */
void insert_spaces( std::istringstream& iss, std::string& word, std::vector<std::string>& title ){
  while( iss.peek() == ' ' ){
    iss.get();
    word += ' ';
  }
  if ( !word.empty() )
    title.push_back( std::move(word) );
}
开发者ID:Draxent,项目名称:CompetitiveProgramming,代码行数:14,代码来源:main.cpp

示例9: convert

 void convert( unsigned int count, std::istringstream& inputStream, T * value )
 {
   DP_ASSERT( count );
   for ( unsigned int i=0 ; i<count ; i++ )
   {
     DP_ASSERT( !inputStream.eof() && !inputStream.bad() );
     value[i] = convert<T>( inputStream );
   }
 }
开发者ID:raedwulf,项目名称:pipeline,代码行数:9,代码来源:ParameterConversion.cpp

示例10: ignoreWhiteSpace

/// moves the iss's cursor to the next non-WS char
bool JLDIO::ignoreWhiteSpace(std::istringstream& iss)
{
    char charBuffer = iss.peek();
    bool output = false;
    while(std::isspace(charBuffer))
    {
        iss.get(charBuffer);
        charBuffer = iss.peek();
        output = true;
    }
    return output;
}
开发者ID:dare0021,项目名称:October3rd,代码行数:13,代码来源:JLDIO.cpp

示例11: match

void match ( std::istringstream &ss, char &lookahead, const char &currToken ) noexcept
{
    if ( lookahead == currToken ){
        lookahead = ss.get();
        if( isWhiteSpace {}( lookahead ) ){
            for(;; lookahead = ss.get() ){
                if(isWhiteSpace {}( lookahead ) ) continue;
                else break;
            }
        }
    }
    //otherwise we have an epsilon production
}
开发者ID:iamOgunyinka,项目名称:MyCC,代码行数:13,代码来源:inTopostfix.cpp

示例12: skipCharacter

void skipCharacter(std::istringstream& is, char char_to_skip)
{
    for (;;) {
        int c = is.get();
        if ( !is.good() ) {
            break;
        } else {
            if (c != char_to_skip) {
                is.unget();
                break;
            }
        }
    }
}
开发者ID:MastAvalons,项目名称:aimp-control-plugin,代码行数:14,代码来源:webctlrpc_request_parser.cpp

示例13: commandLine

void TaskConti::
commandLine( const std::string& cmdLine
	     ,std::istringstream& cmdArgs
	     ,std::ostream& os )
{
  if( cmdLine=="help" )
    {
      os << "TaskConti: "<<endl
	 << "  - touch <sot.control>"<<endl
	 << "  - timeRef" << endl
	 << "  - mu [<val>]" << endl;

      Task::commandLine( cmdLine,cmdArgs,os );
    }
  else if( cmdLine=="touch" )
    {
      Signal<ml::Vector,int> & sig
	= dynamic_cast< Signal<ml::Vector,int>& >
	(dg::PoolStorage::getInstance()->getSignal(cmdArgs));
      timeRef = TIME_REF_TO_BE_SET; //sig.getTime();
      q0 = sig.accessCopy();
    }
  else if( cmdLine=="timeRef" )
    {
      os << "timeRef = ";
      if( timeRef == TIME_REF_TO_BE_SET ) os << "to be set.";
      else if( timeRef == TIME_REF_UNSIGNIFICANT ) os << "no signaificant";
      else os << timeRef;
      os << std::endl;
    }
  else if( cmdLine=="mu" )
    {
      cmdArgs >> std::ws; if(! cmdArgs.good() ) os << "mu = " << mu << std::endl;
      else { cmdArgs >> mu; }
    }
开发者ID:andreadelprete,项目名称:sot-core,代码行数:35,代码来源:task-conti.cpp

示例14: readHex

// Parse input string stream. Read and convert a hexa-decimal number up 
// to a ``,'' or ``:'' or ``\0'' or end of stream.
uint_least32_t SidTuneTools::readHex( std::istringstream& hexin )
{
    uint_least32_t hexLong = 0;
    char c;
    do
    {
        hexin >> c;
        if ( !hexin )
            break;
        if (( c != ',') && ( c != ':' ) && ( c != 0 ))
        {
            // machine independed to_upper
            c &= 0xdf;
            ( c < 0x3a ) ? ( c &= 0x0f ) : ( c -= ( 0x41 - 0x0a ));
            hexLong <<= 4;
            hexLong |= (uint_least32_t)c;
        }
        else
        {
            if ( c == 0 )
                hexin.putback(c);
            break;
        }
    }  while ( hexin );
    return hexLong;
}
开发者ID:QaDeS,项目名称:droidsound,代码行数:28,代码来源:SidTuneTools.cpp

示例15: commandLine

void TimeStamp::
commandLine( const std::string& cmdLine,
	     std::istringstream& cmdArgs,
	     std::ostream& os )
{
  if( cmdLine=="help" )
    {
      os << "TimeStamp: "<<std::endl
	 << " - offset [{<value>|now}] : set/get the offset for double sig." << std::endl;      
      Entity::commandLine( cmdLine,cmdArgs,os );
    }
  else if( cmdLine=="offset" )
    {
      cmdArgs >> std::ws; 
      if( cmdArgs.good() )
	{ 
	  std::string offnow; 
	  cmdArgs >> offnow;  
	  if(offnow=="now") 
	    {
	      gettimeofday( &val,NULL );
	      offsetValue = val.tv_sec;
	    }
	  else { offsetValue = atoi(offnow.c_str()); }
	  offsetSet = ( offsetValue>0 );
	} else {
开发者ID:proyan,项目名称:sot-core,代码行数:26,代码来源:time-stamp.cpp


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