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


C++ AString::Length方法代码示例

本文整理汇总了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;
}
开发者ID:Dabil,项目名称:puNES,代码行数:30,代码来源:NsisIn.cpp

示例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
}
开发者ID:borneq,项目名称:bind7z,代码行数:28,代码来源:Clipboard.cpp

示例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;
}
开发者ID:walrus8u,项目名称:extract,代码行数:8,代码来源:Plugin.cpp

示例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;
    }
开发者ID:,项目名称:,代码行数:17,代码来源:

示例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);
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例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 == '/');
}
开发者ID:4ft35t,项目名称:firmware-mod-kit,代码行数:12,代码来源:ItemNameUtils.cpp

示例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;
}
开发者ID:BIAINC,项目名称:7Zip,代码行数:12,代码来源:TarOut.cpp

示例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;
}
开发者ID:cugxiangzhenwei,项目名称:MySrcCode,代码行数:14,代码来源:StringConvert.cpp

示例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;
}
开发者ID:bigpussy,项目名称:harib_os_src,代码行数:7,代码来源:StringConvert.cpp

示例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;
}
开发者ID:BIAINC,项目名称:7Zip,代码行数:7,代码来源:Plugin.cpp

示例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;
	}
开发者ID:FlyingSwan999,项目名称:Vlpp,代码行数:7,代码来源:String.cpp

示例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;
	}
开发者ID:FlyingSwan999,项目名称:Vlpp,代码行数:7,代码来源:String.cpp

示例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;
	}
开发者ID:FlyingSwan999,项目名称:Vlpp,代码行数:7,代码来源:String.cpp

示例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();
}
开发者ID:emuikernel,项目名称:BaijieCppUILib,代码行数:34,代码来源:ACanvasSkia.cpp

示例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 == '/');
}
开发者ID:QiangJi,项目名称:Klay-GE,代码行数:16,代码来源:ItemNameUtils.cpp


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