示例#1
0
string WordStringReader::getNextWord()
{
	if( isSingleWord() )
	{
		m_readPos = m_text.length();
		return m_text;
	}

	size_t uNextSpacePosition = m_text.find(' ', m_readPos+1);
	if( uNextSpacePosition == string::npos && m_readPos != m_text.length() )
	{
		size_t count = m_text.length() - m_readPos - 1;
		size_t start = m_readPos;
		m_readPos = m_text.length();
		return m_text.substr(start+1, count);
	}

	if( uNextSpacePosition != string::npos )
	{
		size_t start = isFirstRead() ? m_readPos : m_readPos + 1;
		size_t count = uNextSpacePosition - start;
		m_readPos = uNextSpacePosition;
		return m_text.substr(start, count);
	}

	return "";
}
示例#2
0
string WordStringReader::getRemainder()
{
	if( m_readPos >= m_text.length() )
		return "";

	size_t startPos = isFirstRead() ? m_readPos : m_readPos + 1;
	return m_text.substr(startPos);
}
示例#3
0
文件: types.hpp 项目: Brainiarc7/TS
 /// @deprecated - This is incorrect!
 ReadType getReadType(LibraryType lib) const
 {
     if (!shouldHaveMate() || isFirstRead())
         // This isn't valid! F3 isn't always first,
         // and an unpaired read isn't always F3
         return READ_TYPE_F3;
     switch (lib)
     {
         case LIBRARY_TYPE_RR:
             return READ_TYPE_F5_P2;
         case LIBRARY_TYPE_RRBC:
             return READ_TYPE_F5_BC;
         default:
             return READ_TYPE_R3; // LIBRARY_TYPE_MP
     }
 }