本文整理汇总了C++中String::Buffer方法的典型用法代码示例。如果您正苦于以下问题:C++ String::Buffer方法的具体用法?C++ String::Buffer怎么用?C++ String::Buffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::Buffer方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CopyChars
String String::operator + (const String& rhs) const
{
String ret;
ret.Resize(Length() + rhs.Length());
CopyChars(ret.Buffer(), Buffer(), Length());
CopyChars(ret.Buffer() + Length(), rhs.Buffer(), rhs.Length());
return ret;
}
示例2: WriteFormat
void WriteFormat(String const &str, T0 const &p0, T1 const &p1, T2 const &p2, T3 const &p3, T4 const &p4, T5 const &p5) {
var s = str.Buffer();
var len = str.Length();
#define CS_P5
#include "../INC/ConsoleWFW.inc"
#undef CS_P5
}
示例3: Find
size_t String::Find(const String& str, size_t startPos, bool caseSensitive) const
{
if (!str.Length() || str.Length() > Length())
return NPOS;
char first = str.Buffer()[0];
if (!caseSensitive)
first = Turso3D::ToLower(first);
for (size_t i = startPos; i <= Length() - str.Length(); ++i)
{
char c = Buffer()[i];
if (!caseSensitive)
c = Turso3D::ToLower(c);
if (c == first)
{
size_t skip = NPOS;
bool found = true;
for (size_t j = 1; j < str.Length(); ++j)
{
c = Buffer()[i + j];
char d = str.Buffer()[j];
if (!caseSensitive)
{
c = Turso3D::ToLower(c);
d = Turso3D::ToLower(d);
}
if (skip == NPOS && c == first)
skip = i + j - 1;
if (c != d)
{
found = false;
if (skip != NPOS)
i = skip;
break;
}
}
if (found)
return i;
}
}
return NPOS;
}
示例4: CreateDir
bool Path::CreateDir(const String & path)
{
#if defined(_WIN32)
return _wmkdir(path.ToWString()) == 0;
#else
return mkdir(path.Buffer(), 0777) == 0;
#endif
}
示例5: Replace
void String::Replace(size_t pos, size_t numChars, const String& replaceWith)
{
// If substring is illegal, do nothing
if (pos + numChars > Length())
return;
Replace(pos, numChars, replaceWith.Buffer(), replaceWith.Length());
}
示例6: CStringLength
String String::operator + (const char* rhs) const
{
size_t rhsLength = CStringLength(rhs);
String ret;
ret.Resize(Length() + rhsLength);
CopyChars(ret.Buffer(), Buffer(), Length());
CopyChars(ret.Buffer() + Length(), rhs, rhsLength);
return ret;
}
示例7: FindLast
size_t String::FindLast(const String& str, size_t startPos, bool caseSensitive) const
{
if (!str.Length() || str.Length() > Length())
return NPOS;
if (startPos > Length() - str.Length())
startPos = Length() - str.Length();
char first = str.Buffer()[0];
if (!caseSensitive)
first = Turso3D::ToLower(first);
for (size_t i = startPos; i < Length(); --i)
{
char c = Buffer()[i];
if (!caseSensitive)
c = Turso3D::ToLower(c);
if (c == first)
{
bool found = true;
for (size_t j = 1; j < str.Length(); ++j)
{
c = Buffer()[i + j];
char d = str.Buffer()[j];
if (!caseSensitive)
{
c = Turso3D::ToLower(c);
d = Turso3D::ToLower(d);
}
if (c != d)
{
found = false;
break;
}
}
if (found)
return i;
}
}
return NPOS;
}
示例8: Exists
bool File::Exists(const String & fileName)
{
#ifdef _WIN32
struct _stat32 statVar;
return ::_wstat32(((String)fileName).ToWString(), &statVar) != -1;
#else
struct stat statVar;
return ::stat(fileName.Buffer(), &statVar) == 0;
#endif
}
示例9: ReplaceExt
String Path::ReplaceExt(const String & path, const char * newExt)
{
StringBuilder sb(path.Length()+10);
int dotPos = path.LastIndexOf('.');
if (dotPos == -1)
dotPos = path.Length();
sb.Append(path.Buffer(), dotPos);
sb.Append('.');
sb.Append(newExt);
return sb.ProduceString();
}
示例10: Substring
String String::Substring(size_t pos) const
{
if (pos < Length())
{
String ret;
ret.Resize(Length() - pos);
CopyChars(ret.Buffer(), Buffer() + pos, ret.Length());
return ret;
}
else
return String();
}
示例11: SetText
void BaseForm::SetText(String text)
{
SetWindowTextW(handle, text.Buffer());
}
示例12: MessageBox
int BaseForm::MessageBox(const String & msg, const String & title, unsigned int style)
{
return ::MessageBoxW(handle, msg.Buffer(), title.Buffer(), style);
}
示例13: GetFont
HFONT FontsMgr::GetFont(String& _fontId)
{
CHECK_ERROR(_fontId.Length(), L"");
return (*fontsMap_)[_fontId.Buffer()]->GetFont();
}
示例14: Write
INLINE void Write(String const &s) {
Write(s.Buffer(), s.Length());
}