本文整理汇总了C++中FStringData::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ FStringData::Release方法的具体用法?C++ FStringData::Release怎么用?C++ FStringData::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FStringData
的用法示例。
在下文中一共展示了FStringData::Release方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StripRight
void FString::StripRight (const char *charset)
{
size_t max = Len(), i;
for (i = max; i-- > 0; )
{
if (!strchr (charset, Chars[i]))
break;
}
if (Data()->RefCount <= 1)
{
Chars[i+1] = '\0';
ReallocBuffer (i+1);
}
else
{
FStringData *old = Data();
AllocBuffer (i+1);
StrCopy (Chars, old->Chars(), i+1);
old->Release();
}
}
示例2: StripRight
void FString::StripRight ()
{
size_t max = Len(), i;
for (i = max - 1; i-- > 0; )
{
if (!isspace(Chars[i]))
break;
}
if (Data()->RefCount <= 1)
{
Chars[i+1] = '\0';
ReallocBuffer (i+1);
}
else
{
FStringData *old = Data();
AllocBuffer (i+1);
StrCopy (Chars, old->Chars(), i+1);
old->Release();
}
}
示例3: Insert
void FString::Insert (size_t index, const char *instr, size_t instrlen)
{
size_t mylen = Len();
if (index > mylen)
{
index = mylen;
}
if (Data()->RefCount <= 1)
{
ReallocBuffer (mylen + instrlen);
memmove (Chars + index + instrlen, Chars + index, (mylen - index + 1)*sizeof(char));
memcpy (Chars + index, instr, instrlen*sizeof(char));
}
else
{
FStringData *old = Data();
AllocBuffer (mylen + instrlen);
StrCopy (Chars, old->Chars(), index);
StrCopy (Chars + index, instr, instrlen);
StrCopy (Chars + index + instrlen, old->Chars() + index, mylen - index);
old->Release();
}
}
示例4: StripLeft
void FString::StripLeft (const char *charset)
{
size_t max = Len(), i, j;
for (i = 0; i < max; ++i)
{
if (!strchr (charset, Chars[i]))
break;
}
if (Data()->RefCount <= 1)
{
for (j = 0; i <= max; ++j, ++i)
{
Chars[j] = Chars[i];
}
ReallocBuffer (j-1);
}
else
{
FStringData *old = Data();
AllocBuffer (max - i);
StrCopy (Chars, old->Chars() + i, max - i);
old->Release();
}
}