本文整理汇总了C++中AString::Length方法的典型用法代码示例。如果您正苦于以下问题:C++ AString::Length方法的具体用法?C++ AString::Length怎么用?C++ AString::Length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AString
的用法示例。
在下文中一共展示了AString::Length方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetNsisString
// Based on Dave Laundon's simplified process_string
AString GetNsisString(const AString &s)
{
AString res;
for (int i = 0; i < s.Length();)
{
unsigned char nVarIdx = s[i++];
if (nVarIdx > NS_CODES_START && i + 2 <= s.Length())
{
int nData = s[i++] & 0x7F;
unsigned char c1 = s[i++];
nData |= (((int)(c1 & 0x7F)) << 7);
if (nVarIdx == NS_SHELL_CODE)
res += GetShellString(c1);
else if (nVarIdx == NS_VAR_CODE)
res += GetVar(nData);
else if (nVarIdx == NS_LANG_CODE)
res += "NS_LANG_CODE";
}
else if (nVarIdx == NS_SKIP_CODE)
{
if (i < s.Length())
res += s[i++];
}
else // Normal char
res += (char)nVarIdx;
}
return res;
}
示例2: ClipboardSetText
bool ClipboardSetText(HWND owner, const UString &s)
{
CClipboard clipboard;
if (!clipboard.Open(owner))
return false;
#ifdef _WIN32
if (!::EmptyClipboard())
return false;
bool res;
res = ClipboardSetData(CF_UNICODETEXT, (const wchar_t *)s, (s.Length() + 1) * sizeof(wchar_t));
#ifndef _UNICODE
AString a;
a = UnicodeStringToMultiByte(s, CP_ACP);
res |= ClipboardSetData(CF_TEXT, (const char *)a, (a.Length() + 1) * sizeof(char));
a = UnicodeStringToMultiByte(s, CP_OEMCP);
res |= ClipboardSetData(CF_OEMTEXT, (const char *)a, (a.Length() + 1) * sizeof(char));
#endif
return res;
#else
wxTheClipboard->Clear();
// This data objects are held by the clipboard,
// so do not delete them in the app.
wxString ws(s);
wxTheClipboard->SetData( new wxTextDataObject(ws) );
return true;
#endif
}
示例3: CopyStrLimited
static void CopyStrLimited(char *dest, const AString &src, int len)
{
len--;
if (src.Length() < len)
len = src.Length();
memcpy(dest, src, sizeof(dest[0]) * len);
dest[len] = 0;
}
示例4: return
/** ********************************************************************************************
* Specialization of template method
* \ref aworx::lib::strings::ApplyTo "ApplyTo" for applicable type \b std::string.
* See \ref aworx::lib::strings::ApplyTo "ApplyTo" for more information.
* @param target The AString to append \p src to.
* @param logger The logger to apply.
* @return The length of the given string \p src which was appended to \p target.
**********************************************************************************************/
template<> inline int ApplyTo <const lox::core::Logger&>( AString& target, const lox::core::Logger& logger )
{
int origTargetLength= target.Length();
target << logger.GetName();
if ( !logger.GetName().Equals( logger.GetTypeName() ) )
target << " (" << logger.GetTypeName() << ")";
return (int) target.Length() - origTargetLength;
}
示例5: test_AString
static void test_AString()
{
AString a;
a = "abc";
assert(MyStringCompare(&a[0],"abc") == 0);
assert(a.Length() == 3);
a = GetAnsiString(L"abc");
assert(MyStringCompare(&a[0],"abc") == 0);
assert(a.Length() == 3);
}
示例6: HasTailSlash
bool HasTailSlash(const AString &name, UINT codePage)
{
if (name.IsEmpty())
return false;
LPCSTR prev =
#ifdef _WIN32
CharPrevExA((WORD)codePage, name, &name[name.Length()], 0);
#else
(LPCSTR)(name) + (name.Length() - 1);
#endif
return (*prev == '/');
}
示例7: MakeOctalString
static bool MakeOctalString12(char *s, UInt64 value)
{
AString tempString = MakeOctalString(value);
const int kMaxSize = 12;
if (tempString.Length() > kMaxSize)
return false;
int numSpaces = kMaxSize - tempString.Length();
for(int i = 0; i < numSpaces; i++)
s[i] = ' ';
memmove(s + numSpaces, (const char *)tempString, tempString.Length());
return true;
}
示例8: MultiByteToUnicodeString
UString MultiByteToUnicodeString(const AString &srcString, UINT codePage)
{
UString resultString;
if (!srcString.IsEmpty())
{
int numChars = MultiByteToWideChar(codePage, 0, srcString,
srcString.Length(), resultString.GetBuffer(srcString.Length()),
srcString.Length() + 1);
if (numChars == 0)
throw 282228;
resultString.ReleaseBuffer(numChars);
}
return resultString;
}
示例9: MultiByteToUnicodeString
UString MultiByteToUnicodeString(const AString &srcString, UINT codePage)
{
UString resultString;
for (int i = 0; i < srcString.Length(); i++)
resultString += wchar_t(srcString[i]);
return resultString;
}
示例10: GetNameOfProp
static AString GetNameOfProp2(PROPID propID, const wchar_t *name)
{
AString s = GetNameOfProp(propID, name);
if (s.Length() > (kInfoPanelLineSize - 1))
s = s.Left(kInfoPanelLineSize - 1);
return s;
}
示例11: atof_test
double atof_test(const AString& string, bool& success)
{
char* endptr = 0;
double result = strtod(string.Buffer(), &endptr);
success = endptr == string.Buffer() + string.Length();
return result;
}
示例12:
vuint64_t atou64_test(const AString& string, bool& success)
{
char* endptr = 0;
vuint64_t result = _strtoui64(string.Buffer(), &endptr, 10);
success = endptr == string.Buffer() + string.Length() && u64toa(result) == string;
return result;
}
示例13: atoi_test
vint atoi_test(const AString& string, bool& success)
{
char* endptr = 0;
vint result = strtol(string.Buffer(), &endptr, 10);
success = endptr == string.Buffer() + string.Length() && itoa(result) == string;
return result;
}
示例14: DrawText
void ACanvasSkia::DrawText(int x1,int y1,const AString& sText)
{
//_clip();
_SetPaint_Font();
int nFontSize = GetFont()->GetSize();
y1 += nFontSize;
//y1 -= 2;//微调 fix me later
//AString str;
//str = sText;
// AMemory ms;
// ms.SetSize( ::WideCharToMultiByte(CP_UTF8,0,sText.Text(),sText.Length(),NULL,0,NULL,NULL) +1 );
// char* buf = (char *)ms.GetData();
// ::WideCharToMultiByte(CP_UTF8,0,sText.Text(),sText.Length(),buf,ms.GetSize()-1,NULL,NULL);
// buf[ms.GetSize()-1] = 0;
const char* sz = (char *)sText.Text();// buf;//str.ConvertTo();
int iLen = sText.Length()*sizeof(ACHAR);// sz ? strlen(sz) : 0 );
m_Paint.setTextSize(SkIntToScalar(nFontSize));
//m_Paint.setSubpixelText(false);
//m_Paint.setLinearText(true);
//m_Paint.setHinting(SkPaint::kFull_Hinting);
m_pCanvas->drawText(sz,iLen,SkIntToScalar(x1),SkIntToScalar(y1),m_Paint);
// SkPoint pts[1000];
// SkScalar xpos = x1;
// //SkASSERT(length <= SK_ARRAY_COUNT(pts));
// for (size_t i = 0; i < iLen; i++) {
// pts[i].set(xpos, y1), xpos += nFontSize;
// }
// m_pCanvas->drawPosText(sz, iLen, pts, m_Paint);
Reset();
}
示例15: HasTailSlash
bool HasTailSlash(const AString &name, UINT codePage)
{
if (name.IsEmpty())
return false;
LPCSTR prev =
#if defined(_WIN32) && !defined(UNDER_CE)
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
(LPCSTR)(name) + (name.Length() - 1);
#else
CharPrevExA((WORD)codePage, name, &name[name.Length()], 0);
#endif
#else
(LPCSTR)(name) + (name.Length() - 1);
#endif
return (*prev == '/');
}