本文整理汇总了C++中TCString::valid方法的典型用法代码示例。如果您正苦于以下问题:C++ TCString::valid方法的具体用法?C++ TCString::valid怎么用?C++ TCString::valid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCString
的用法示例。
在下文中一共展示了TCString::valid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CHECK
TCDynStr::TCDynStr(const TCString& str,uint pos,uint count)
/****************************************************************************
*
* Function: TCDynStr::TCDynStr
* Parameters: str - TCString to copy from
* pos - Starting position in the string
* count - Number of characters to copy
*
* Description: Constructs a string from another string, starting at the
* position 'pos' and including 'count' characters.
*
****************************************************************************/
{
CHECK(str.valid());
if (pos > str.length())
pos = str.length();
if (count > str.length() - pos)
count = str.length() - pos;
len = count+1;
size = computeSize(len);
if ((text = new char[size]) != NULL) {
memcpy(text,(const char *)str+pos,len);
text[count] = '\0'; // Null terminate the string
}
}
示例2:
TCSubStr::TCSubStr(const TCString& str,uint pos,uint count)
/****************************************************************************
*
* Function: TCSubStr::TCSubStr
* Parameters: str - TCString to copy from
* pos - Starting position in the string
* count - Number of characters to copy
*
* Description: Constructs a TCSubStr from another string, starting at the
* position 'pos' and including 'count' characters.
*
****************************************************************************/
{
CHECK(str.valid());
if (pos > str.length())
pos = str.length();
if (count > str.length() - pos)
count = str.length() - pos;
len = count+1;
text = (char *)((const char *)str + pos);
}