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


C++ LString::length方法代码示例

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


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

示例1: LString

LString LString::operator +(const LString &o) const {
    if (this->isEmpty()) return o;
    if (o.isEmpty()) return *this;

    LStringData *newStr = LStringData::create(this->length() + o.length() + 1);
    std::copy(this->mData->begin(), this->mData->end(), newStr->begin());
    std::copy(o.mData->begin(), o.mData->end(), newStr->begin() + this->length());

    newStr->mSize = this->length() + o.length();
    return LString(newStr);
}
开发者ID:Latexi95,项目名称:CBCompiler,代码行数:11,代码来源:lstring.cpp

示例2: readStr

  LString readStr(int start, int end) {
    if (m_recbuf.isEmpty()) return LString();

    start --; end --;
    if (end >= m_recbuf.length())
      end = m_recbuf.length()-1;
    if (start<0)
      start = 0;
    if (start>end)
      start = end;

    return m_recbuf.substr(start, end-start+1);
  }
开发者ID:CueMol,项目名称:cuemol2,代码行数:13,代码来源:MSMSFileReader.hpp

示例3: print

void PrintStream::print(const LString &n)
{
  int len = n.length();
  int res = write(n.c_str(), 0, len);
  if (res!=len)
    MB_THROW(IOException, LString::format("OutStream.write() failed. (%d:%d)", res, len));
}
开发者ID:CueMol,项目名称:cuemol2,代码行数:7,代码来源:PrintStream.cpp

示例4: readOneImpl

  int readOneImpl() {
    int i;
    std::deque<unsigned char> cmp;
    for (i=0; i<m_nextMark.length(); ++i) {
      int c = qread();
      if (c>=0) {
        cmp.push_front(c);
        if (c==m_nextMark[i]) {
	  // MB_DPRINTLN("MM> %s", m_nextMark.substr(0, i).c_str());
          continue;
	}
      }
      else {

        // EOF
        if (cmp.size()<=0)
          break;
      }

      unsigned char ret = cmp.back();
      cmp.pop_back();
      std::deque<unsigned char>::const_iterator iter = cmp.begin();
      std::deque<unsigned char>::const_iterator iend = cmp.end();
      for (; iter!=iend; ++iter)
        unread(*iter);
      return ret;

    }

    m_bReady = false;
    return -1;
  }
开发者ID:biochem-fan,项目名称:cuemol2,代码行数:32,代码来源:ChunkDelimFilter.hpp

示例5: setMark

 void setMark(const LString &mark) {
   m_bReady = true;
   m_mark = mark;
   m_nCbufLen = m_mark.length();
   m_cbuf.set_capacity(m_nCbufLen);
   m_nMatch = 0;
 }
开发者ID:biochem-fan,项目名称:cuemol2,代码行数:7,代码来源:ChunkDelimFilter.hpp

示例6: GetAutocompleteCommand

LStr::clStringsVector clConsole::GetAutocompleteCommand( const LString& CMDName ) const
{
	LStr::clStringsVector Result;

	if ( CMDName.empty() ) { return Result; }

	LString CMD = LStr::GetUpper( CMDName );
	size_t Len = CMD.length();

	bool Lower = LStr::IsLower( CMDName[CMDName.size()-1] );

	for ( clCommandsList::const_iterator i = FCommandsList.begin(); i != FCommandsList.end(); ++i )
	{
		if ( LStr::StartsWith( i->first, CMD ) )
		{
			LString Tail = LStr::CopyFromPosToEnd( i->first, Len );
			Result.push_back( CMDName + ( Lower ? LStr::GetLower( Tail ) : Tail ) );
		}
	}

	for ( clAliasesList::const_iterator i = FAliasesList.begin(); i != FAliasesList.end(); ++i )
	{
		if ( LStr::StartsWith( i->first, CMD ) )
		{
			LString Tail = LStr::CopyFromPosToEnd( i->first, Len );
			Result.push_back( CMDName + ( Lower ? LStr::GetLower( Tail ) : Tail ) );
		}
	}

	return Result;
}
开发者ID:berezhkovskaya,项目名称:Carousel3D,代码行数:31,代码来源:Console.cpp

示例7: ConvertName

/**
   This will convert requested filename with full path into a single file name
    e.g.  c:\\data\\textures\\texture1.tga
          c~_data_textures_texture1.tga
**/
LString clResourcesManager::ConvertName( const LString& FileName )
{
	LString ConvName;

	for ( size_t i = 0; i < FileName.length(); ++i )
	{
		switch ( FileName[i] )
		{
			case '\\':
			case '/':
			{
				ConvName.push_back( '_' );
				continue;
			}
			case ':':
			{
				ConvName.push_back( '~' );
				continue;
			}
			case ' ':
			{
				ConvName.push_back( '#' );
				continue;
			}
		}

		ConvName.push_back( FileName[i] );
	}

	return ConvName;
}
开发者ID:berezhkovskaya,项目名称:Carousel3D,代码行数:36,代码来源:ResourcesManager.cpp

示例8: getRec

    void getRec(int pos, int unit, LString &ret)
    {
      int beg = pos*unit;

      if (beg>=m_line.length() ||
          beg<0) {
        MB_THROW(qlib::FileFormatException, "");
        return;
      }

      ret = m_line.substr(beg, unit);
    }
开发者ID:CueMol,项目名称:cuemol2,代码行数:12,代码来源:PsfReader.hpp

示例9: DisplayMessage

void clConsole::DisplayMessage( const LString& Message, const LConsoleMessageType MSGType ) const
{
	if ( Env )
	{
		Env->SendSync( L_EVENT_CONSOLELOG, LEventArgs( &Message ), false );
	}

	FTimeVisible = MESSAGE_VISIBILITY_TIME;

	LVector4 Color;

	switch ( MSGType )
	{
		case CMSG_ENGINEMESSAGE:
			Color = LC_LinderdaumConsoleEM;
			break;
		case CMSG_ERRORMESSAGE:
			Color = LC_LinderdaumConsoleERR;
			break;
		case CMSG_INFOTIP:
			Color = LC_LinderdaumConsoleIT;
			break;
		default:
			FATAL_MSG( "Unknown message type" );
	}

	LString Msg = Message;

	LMutex Lock( &FMessagesHistoryMutex );

	while ( true )
	{
		size_t Separation = Msg.find( "\n" );

		if ( Separation == LString::npos )
		{
			break;
		}

		LString NewMsg = Msg.substr( 0, Separation );

		FMessagesHistory.push_back( sConsoleMessage( NewMsg, Color ) );

		if ( FMessagesHistory.size() > MAX_HISTORY_SIZE )
		{
			FMessagesHistory.pop_front();
		}

		Msg = Msg.substr( Separation + 1, Message.length() - 1 );
	}

	FMessagesHistory.push_back( sConsoleMessage( Msg, Color ) );
}
开发者ID:berezhkovskaya,项目名称:Carousel3D,代码行数:53,代码来源:Console.cpp

示例10: formatAtomName

LString PDBFileWriter::formatAtomName(MolAtomPtr pAtom)
{
  LString atomnam = pAtom->getName();
  char cConfID = pAtom->getConfID();
  int elem = pAtom->getElement();
  
  if (cConfID=='\0')
    cConfID = ' ';

  // invalid name case
  if (atomnam.length()>=4||
      elem==ElemSym::XX) {
    return LString::format("%4s%c", atomnam.c_str(), cConfID);
  }

  LString elenam = ElemSym::symID2Str(elem);
  elenam = elenam.toUpperCase();
  int elepos = atomnam.indexOf(elenam);
  if (elepos<0) {
    return LString::format("%4s%c", atomnam.c_str(), cConfID);
  }
  
  LString atommod;
  // if (atomnam.equals(elenam)) {
  // // atom name==elem name
  // shead += LString::format(" %2s  ", elenam.c_str());
  // break;
  // }
  
  elepos += elenam.length();
  atommod = atomnam.substr(elepos);
  elenam = atomnam.substr(0, elepos);
  
  if (atommod.length()<=2) {
    return LString::format("%2s%-2s%c",
                           elenam.c_str(), atommod.c_str(), cConfID);
  }
  
  return LString::format("%4s%c", atomnam.c_str(), cConfID);
}
开发者ID:CueMol,项目名称:cuemol2,代码行数:40,代码来源:PDBFileWriter.cpp

示例11: getInt

    int getInt(int pos, int unit)
    {
      int ret;
      int beg = pos*unit;

      if (beg>=m_line.length() ||
          beg<0) {
        MB_THROW(qlib::FileFormatException, "");
        return -1;
      }

      LString s = m_line.substr(beg, unit);
      if (!s.toInt(&ret)) {
        MB_THROW(qlib::FileFormatException, "");
        return -1;
      }
      return ret;
    }
开发者ID:CueMol,项目名称:cuemol2,代码行数:18,代码来源:PsfReader.hpp

示例12: FindCommandsSeparator

size_t clConsole::FindCommandsSeparator( const LString& CMDString ) const
{
	bool InToken = false;

	for ( size_t i = 0; i != CMDString.length(); ++i )
	{
		if ( CMDString[i] == '"' )
		{
			InToken = !InToken;
		}

		if ( CMDString[i] == ';' && !InToken )
		{
			return i;
		}
	}

	return 0;
}
开发者ID:berezhkovskaya,项目名称:Carousel3D,代码行数:19,代码来源:Console.cpp

示例13: SetLocale

void clLocalizer::SetLocale( const LString& LocaleName )
{
	guard( "%s", LocaleName.c_str() );

	ClearLocalization();

	FLocaleName = LocaleName;

	const LString FileName( FLocalePath + "/Localizer-" + LocaleName + ".txt" );

	if ( Env->FileSystem->FileExists( FileName ) )
	{
		Env->Logger->LogP( L_NOTICE, "Reading locale from %s", FileName.c_str() );

		iIStream* Stream = Env->FileSystem->CreateFileReader( FileName );

		while ( !Stream->Eof() )
		{
			LString Line = Stream->ReadLine();

			size_t SepPos = Line.find( "~" );

			FATAL( SepPos == Line.npos, "Invalid locale translation file format: missing ~" );

			LString Text( Line.substr( 0, SepPos ) );
			LString Translation( Line.substr( SepPos + 1, Line.length() - SepPos - 1 ) );

			FTranslations[ Text ] = Translation;
		}

		delete( Stream );
	}
	else
	{
		Env->Logger->LogP( L_NOTICE, "Locale %s not found", FileName.c_str() );
	}

	this->SendAsync( L_EVENT_LOCALE_CHANGED, LEventArgs(), false );

	unguard();
}
开发者ID:berezhkovskaya,项目名称:Carousel3D,代码行数:41,代码来源:Localizer.cpp

示例14: indexOf

int LString::indexOf(const LString &str, int start) const {
    if (str.length() > this->length()) return -1;
    if (str.length() == 1) return indexOf(str[0], start);

    ConstIterator si = str.cbegin();
    int indexCounter = start;
    int index = 0;
    for (ConstIterator i = at(start); i != cend(); i++, indexCounter++) {
        if (*si == *i) {
            if (si == str.cbegin()) {
                index = indexCounter;
            }
            si++;
            if (si == str.cend()) {
                return index;
            }
            continue;
        }

        si = str.cbegin();
    }
    return -1;
}
开发者ID:Latexi95,项目名称:CBCompiler,代码行数:23,代码来源:lstring.cpp

示例15: DrawText

void clViewport::DrawText( int X, int Y, const LString& Text )
{
#ifdef OS_WINDOWS
    TextOut( FDeviceHandle, X, Y, Text.c_str(), static_cast<int>( Text.length() ) );
#endif
}
开发者ID:mildrock,项目名称:Carousel3D,代码行数:6,代码来源:Viewport.cpp


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