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


C++ t_Str类代码示例

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


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

示例1: CompareNoCase

// CompareNoCase
// it's amazing what features std::string lacks.  This function simply
// does a lowercase compare against the two strings, returning 0 if they
// match.
int CompareNoCase(t_Str str1, t_Str str2)
{
#ifdef WIN32
   return stricmp(str1.c_str(), str2.c_str());
#else
   return strcasecmp(str1.c_str(), str2.c_str());
#endif
}
开发者ID:BackupTheBerlios,项目名称:btg-svn,代码行数:12,代码来源:cdatafile.cpp

示例2:

bool t_Str::operator!=(const t_Str &s1) const
{
        if(compare(s1.getText()) != 0)
                return true;

        return false;
}
开发者ID:embeddedspecialist,项目名称:RaspyMonitor,代码行数:7,代码来源:string++.cpp

示例3: t_Str

t_Str CDataFile::CommentStr(t_Str szComment)
{
   t_Str szNewStr = t_Str("");

   Trim(szComment);

   if ( szComment.size() == 0 )
      return szComment;

   if ( szComment.find_first_of(CommentIndicators) != 0 )
      {
         szNewStr = CommentIndicators[0];
         szNewStr += " ";
      }

   szNewStr += szComment;

   return szNewStr;
}
开发者ID:BackupTheBerlios,项目名称:btg-svn,代码行数:19,代码来源:cdatafile.cpp

示例4: t_Str

t_Str CDataFile::CommentStr(t_Str szComment)
{
	t_Str szNewStr = t_Str("");

	Trim(szComment);

        if ( szComment.size() == 0 )
          return szComment;
	
	if ( szComment.find(CommentIndicators[0]) == gedString::npos && szComment.find(CommentIndicators[1]) == gedString::npos)
	{
		szNewStr = (char)CommentIndicators[0];
		szNewStr += " ";
	}

	szNewStr += szComment;

	return szNewStr;
}
开发者ID:cubemoon,项目名称:game-editor,代码行数:19,代码来源:CDataFile.cpp

示例5: GetNextWord

// GetNextWord
// Given a key +delimiter+ value string, pulls the key name from the string,
// deletes the delimiter and alters the original string to contain the
// remainder.  Returns the key
t_Str GetNextWord(t_Str& CommandLine)
{
   int nPos = CommandLine.find_first_of(EqualIndicators);
   t_Str sWord = t_Str("");

   if ( nPos > -1 )
      {
         sWord = CommandLine.substr(0, nPos);
         CommandLine.erase(0, nPos+1);
      }
   else
      {
         sWord = CommandLine;
         CommandLine = t_Str("");
      }

   Trim(sWord);
   return sWord;
}
开发者ID:BackupTheBerlios,项目名称:btg-svn,代码行数:23,代码来源:cdatafile.cpp

示例6: SetFileName

// SetFileName
// Set's the m_szFileName member variable. For use when creating the CDataFile
// object by hand (-vs- loading it from a file
void CDataFile::SetFileName(t_Str szFileName)
{
   if (m_szFileName.size() != 0 && CompareNoCase(szFileName, m_szFileName) != 0)
      {
         m_bDirty = true;

         Report(E_WARN, "[CDataFile::SetFileName] The filename has changed from <%s> to <%s>.",
                m_szFileName.c_str(), szFileName.c_str());
      }

   m_szFileName = szFileName;
}
开发者ID:BackupTheBerlios,项目名称:btg-svn,代码行数:15,代码来源:cdatafile.cpp

示例7: GetNextWord

// GetNextWord
// Given a key +delimiter+ value string, pulls the key name from the string,
// deletes the delimiter and alters the original string to contain the
// remainder.  Returns the key
t_Str GetNextWord(t_Str& CommandLine)
{
	int nPos = CommandLine.find(EqualIndicators[0]);

	if(nPos == gedString::npos)
		nPos = CommandLine.find(EqualIndicators[1]);

	t_Str sWord = t_Str("");

	if ( nPos > -1 )
	{
		sWord = CommandLine.substr(0, nPos);
		CommandLine.erase(0, nPos+1);
	}
	else
	{
		sWord = CommandLine;
		CommandLine = t_Str("");
	}

	Trim(sWord);
	return sWord;
}
开发者ID:cubemoon,项目名称:game-editor,代码行数:27,代码来源:CDataFile.cpp

示例8: GetKey

// SetValue
// Given a key, a value and a section, this function will attempt to locate the
// Key within the given section, and if it finds it, change the keys value to
// the new value. If it does not locate the key, it will create a new key with
// the proper value and place it in the section requested.
bool CDataFile::SetValue(t_Str szKey, t_Str szValue, t_Str szComment, t_Str szSection)
{
	t_Key* pKey = GetKey(szKey, szSection);
	t_Section* pSection = GetSection(szSection);

	if (pSection == NULL)
	{
		if ( !(m_Flags & AUTOCREATE_SECTIONS) || !CreateSection(szSection,""))
			return false;

		pSection = GetSection(szSection);
	}

	// Sanity check...
	if ( pSection == NULL )
		return false;

	// if the key does not exist in that section, and the value passed 
	// is not t_Str("") then add the new key.
	if ( pKey == NULL && szValue.size() > 0 && (m_Flags & AUTOCREATE_KEYS))
	{
		t_Key Key;

		Key.szKey = szKey;
		Key.szValue = szValue;
		Key.szComment = szComment;
		
		m_bDirty = true;
		
		pSection->Keys.PushBack(Key);
		pKey = GetKey(szKey, szSection);

		return true;
	}

	if ( pKey != NULL )
	{
		pKey->szValue = szValue;
		pKey->szComment = szComment;

		m_bDirty = true;
		
		return true;
	}

	return false;
}
开发者ID:cubemoon,项目名称:game-editor,代码行数:52,代码来源:CDataFile.cpp

示例9: copy

void t_Str::copy(const t_Str &original)
{
	clear();

	if(original.getLength() < minsize)
	{
		content.ministring.length = (unsigned)original.getLength();
		memmove(content.ministring.text, original.getText(), original.getLength() + 1);
		content.ministring.big = false;
		return;
	}

//	ptr = original.getText();
	content.bigstring.length = original.getLength();
	content.bigstring.size = setSize(original.getLength() + 1);
	content.bigstring.text = getSpace(content.bigstring.size);
	content.ministring.big = true;
	memmove(content.bigstring.text, original.getText(), original.getLength() + 1);
}
开发者ID:embeddedspecialist,项目名称:RaspyMonitor,代码行数:19,代码来源:string++.cpp

示例10: strprintf

int strprintf(t_Str &str, size_t size, const char *format, ...)
{
	va_list args;
	va_start(args, format);
	int rtn;

	if(!size)
		size = str.getSize();

	if(size > str.getSize())
		str.resize(size);

	char *ptr = str.getText();
	str.setLength(0);
	ptr[0] = 0;
	rtn = vsnprintf(ptr, size, format, args);
	str.setLength(strlen(ptr));
	va_end(args);
	return rtn;
}
开发者ID:embeddedspecialist,项目名称:RaspyMonitor,代码行数:20,代码来源:string++.cpp

示例11: Trim

// Trim
// Trims whitespace from both sides of a string.
void Trim(t_Str& szStr)
{
   t_Str szTrimChars = WhiteSpace;

   szTrimChars += EqualIndicators;
   int nPos, rPos;

   // trim left
   nPos = szStr.find_first_not_of(szTrimChars);

   if ( nPos > 0 )
      szStr.erase(0, nPos);

   // trim right and return
   nPos = szStr.find_last_not_of(szTrimChars);
   rPos = szStr.find_last_of(szTrimChars);

   if ( rPos > nPos && rPos > -1)
      szStr.erase(rPos, szStr.size()-rPos);
}
开发者ID:BackupTheBerlios,项目名称:btg-svn,代码行数:22,代码来源:cdatafile.cpp

示例12: search

bool t_Str::operator*=(const t_Str &s1) const
{
	return search(s1.getText(), s1.getLength()) != npos;
}
开发者ID:embeddedspecialist,项目名称:RaspyMonitor,代码行数:4,代码来源:string++.cpp

示例13: Trim

// Trim
// Trims whitespace from both sides of a string.
void Trim(t_Str& szStr)
{
	szStr.trimLeft();
	szStr.trimRight();
}
开发者ID:cubemoon,项目名称:game-editor,代码行数:7,代码来源:CDataFile.cpp

示例14: rfind

size_t t_Str::rfind(const t_Str &str, size_t ind) const
{
	return rfind(str.getText(), ind, str.getLength());
}
开发者ID:embeddedspecialist,项目名称:RaspyMonitor,代码行数:4,代码来源:string++.cpp

示例15: find

size_t t_Str::find(const t_Str &str, size_t ind, unsigned instance) const
{
	return find(str.getText(), ind, str.getLength(), instance);
}
开发者ID:embeddedspecialist,项目名称:RaspyMonitor,代码行数:4,代码来源:string++.cpp


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