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


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

本文整理汇总了C++中AString::Empty方法的典型用法代码示例。如果您正苦于以下问题:C++ AString::Empty方法的具体用法?C++ AString::Empty怎么用?C++ AString::Empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AString的用法示例。


在下文中一共展示了AString::Empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Clear

 void Clear()
 {
   CID.Empty();
   parentCID.Empty();
   createType.Empty();
   Extents.Clear();
 }
开发者ID:ming-hai,项目名称:soui,代码行数:7,代码来源:VmdkHandler.cpp

示例2: ReadDataString

static bool ReadDataString(LPCWSTR fileName, LPCSTR startID,
    LPCSTR endID, AString &stringResult)
{
  stringResult.Empty();
  NFile::NIO::CInFile inFile;
  if (!inFile.Open(fileName))
    return false;
  const int kBufferSize = (1 << 12);

  Byte buffer[kBufferSize];
  int signatureStartSize = lstrlenA(startID);
  int signatureEndSize = lstrlenA(endID);
  
  UInt32 numBytesPrev = 0;
  bool writeMode = false;
  UInt64 posTotal = 0;
  for (;;)
  {
    if (posTotal > (1 << 20))
      return (stringResult.IsEmpty());
    UInt32 numReadBytes = kBufferSize - numBytesPrev;
    UInt32 processedSize;
    if (!inFile.Read(buffer + numBytesPrev, numReadBytes, processedSize))
      return false;
    if (processedSize == 0)
      return true;
    UInt32 numBytesInBuffer = numBytesPrev + processedSize;
    UInt32 pos = 0;
    for (;;)
    {
      if (writeMode)
      {
        if (pos > numBytesInBuffer - signatureEndSize)
          break;
        if (memcmp(buffer + pos, endID, signatureEndSize) == 0)
          return true;
        char b = buffer[pos];
        if (b == 0)
          return false;
        stringResult += b;
        pos++;
      }
      else
      {
        if (pos > numBytesInBuffer - signatureStartSize)
          break;
        if (memcmp(buffer + pos, startID, signatureStartSize) == 0)
        {
          writeMode = true;
          pos += signatureStartSize;
        }
        else
          pos++;
      }
    }
    numBytesPrev = numBytesInBuffer - pos;
    posTotal += pos;
    memmove(buffer, buffer + pos, numBytesPrev);
  }
}
开发者ID:bks,项目名称:qz7,代码行数:60,代码来源:Main.cpp

示例3: wcstombs

static void UnicodeStringToMultiByte2(AString &dest, const UString &src, UINT /* codePage */, char defaultChar, bool &defaultCharWasUsed)
{
  dest.Empty();
  defaultCharWasUsed = false;
  if (src.IsEmpty())
    return;

  size_t limit = ((size_t)src.Len() + 1) * 6;
  char *d = dest.GetBuf((unsigned)limit);
  size_t len = wcstombs(d, src, limit);
  if (len != (size_t)-1)
  {
    dest.ReleaseBuf_SetEnd((unsigned)len);
    return;
  }

  {
    const wchar_t *s = (const wchar_t *)src;
    unsigned i;
    for (i = 0;;)
    {
      wchar_t c = s[i];
      if (c == 0)
        break;
      if (c >= 0x100)
      {
        c = defaultChar;
        defaultCharWasUsed = true;
      }
      d[i++] = (char)c;
    }
    d[i] = 0;
    dest.ReleaseBuf_SetLen(i);
  }
}
开发者ID:Alexander-r,项目名称:physfs,代码行数:35,代码来源:StringConvert.cpp

示例4: ReadToString

void CStdInStream::ReadToString(AString &resultString)
{
  resultString.Empty();
  int c;
  while((c = GetChar()) != EOF)
    resultString += char(c);
}
开发者ID:BGCX261,项目名称:zipeg-svn-to-git,代码行数:7,代码来源:StdInStream.cpp

示例5: GetCpuName

static void GetCpuName(AString &s)
{
  s.Empty();

  #ifdef MY_CPU_X86_OR_AMD64
  {
    #ifdef _7ZIP_ASM
    Cx86cpuid cpuid;
    if (x86cpuid_CheckAndRead(&cpuid))
    {
      x86cpuid_to_String(cpuid, s);
      return;
    }
    #endif
    #ifdef MY_CPU_AMD64
    s = "x64";
    #else
    s = "x86";
    #endif
  }
  #else

    #ifdef MY_CPU_LE
      s = "LE";
    #elif defined(MY_CPU_BE)
      s = "BE";
    #else
      #error ENDIANNESS
    #endif

  #endif
}
开发者ID:ArchangelSDY,项目名称:Qt7z,代码行数:32,代码来源:mySplitCommandLine.cpp

示例6: ReadString

void CInArchive::ReadString(unsigned size, AString &s)
{
  s.Empty();
  if (size != 0)
  {
    ReadBytes((Byte *)s.GetBuf(size), size);
    s.ReleaseBuf_CalcLen(size);
  }
}
开发者ID:mcmilk,项目名称:7-Zip-zstd,代码行数:9,代码来源:ChmIn.cpp

示例7: Parse

bool CExtentInfo::Parse(const char *s)
{
  NumSectors = 0;
  StartSector = 0;
  Access.Empty();
  Type.Empty();
  FileName.Empty();

  s = GetNextWord(s, Access);
  s = GetNextNumber(s, NumSectors);
  if (!s)
    return false;
  s = GetNextWord(s, Type);

  if (Type.IsEmpty())
    return false;

  SKIP_SPACES(s);

  if (IsType_ZERO())
    return (*s == 0);

  if (*s != '\"')
    return false;
  s++;
  {
    const char *s2 = strchr(s, '\"');
    if (!s2)
      return false;
    FileName.SetFrom(s, (unsigned)(s2 - s));
    s = s2 + 1;
  }
  SKIP_SPACES(s);
  if (*s == 0)
    return true;

  s = GetNextNumber(s, StartSector);
  if (!s)
    return false;
  return true;
  // SKIP_SPACES(s);
  // return (*s == 0);
}
开发者ID:ming-hai,项目名称:soui,代码行数:43,代码来源:VmdkHandler.cpp

示例8: ReadFileName

void CInArchive::ReadFileName(unsigned size, AString &s)
{
  if (size == 0)
  {
    s.Empty();
    return;
  }
  char *p = s.GetBuffer(size);
  SafeReadBytes(p, size);
  p[size] = 0;
  s.ReleaseBuffer();
}
开发者ID:borneq,项目名称:bind7z,代码行数:12,代码来源:ZipIn.cpp

示例9: UpdatePattern

bool ADVBPatterns::UpdatePattern(const AString& user, const AString& pattern, const AString& newpattern)
{
	const ADVBConfig& config = ADVBConfig::Get();
	ADVBLock lock("patterns");
	bool changed = false;

	if (user.Empty() || !(changed = UpdatePatternInFile(config.GetUserPatternsPattern().SearchAndReplace("{#?}", user), pattern, newpattern))) {
		changed = UpdatePatternInFile(config.GetPatternsFile(), pattern, newpattern);
	}

	return changed;
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例10: ExtractInfoZipUnicodePath

bool CExtraSubBlock::ExtractInfoZipUnicodePath(AString &name, AString &res) const
{
  res.Empty();

  if (ID != NFileHeader::NExtraID::kInfoZipUnicodePath ||
      (UInt32)Data.Size() < 5 ||
      *(const Byte *)Data < 1 ||
      GetUi32((const Byte *)Data + 1) != CrcCalc(name, name.Len()))
    return false;

  int size = (int)Data.Size() - sizeof(short) * 2 - sizeof(Byte);
  if (size > 0)
  {
    char *p = res.GetBuffer(size + 1);
    memcpy(p, (const Byte *)Data + sizeof(short) * 2 + sizeof(Byte), size);
    p[size] = '\0';
    res.ReleaseBuffer();
  }
  return true;
}
开发者ID:wyrover,项目名称:7-zip32_ungarbled,代码行数:20,代码来源:ZipItem.cpp

示例11: ParseDepedencyExpression

static bool ParseDepedencyExpression(const Byte *p, UInt32 size, AString &res)
{
  res.Empty();
  for (UInt32 i = 0; i < size;)
  {
    unsigned command = p[i++];
    if (command > ARRAY_SIZE(kExpressionCommands))
      return false;
    res += kExpressionCommands[command];
    if (command < 3)
    {
      if (i + kGuidSize > size)
        return false;
      res.Add_Space();
      AddGuid(res, p + i, false);
      i += kGuidSize;
    }
    res += "; ";
  }
  return true;
}
开发者ID:unknownbrackets,项目名称:maxcso,代码行数:21,代码来源:UefiHandler.cpp

示例12: MyCPUID

static void x86cpuid_to_String(const Cx86cpuid &c, AString &s)
{
  s.Empty();

  UInt32 maxFunc2 = 0;
  UInt32 t[3];

  MyCPUID(0x80000000, &maxFunc2, &t[0], &t[1], &t[2]);

  bool fullNameIsAvail = (maxFunc2 >= 0x80000004);

  if (!fullNameIsAvail)
  {
    for (int i = 0; i < 3; i++)
      PrintCpuChars(s, c.vendor[i]);
  }
  else
  {
    for (int i = 0; i < 3; i++)
    {
      UInt32 c[4] = { 0 };
      MyCPUID(0x80000002 + i, &c[0], &c[1], &c[2], &c[3]);
      for (int j = 0; j < 4; j++)
        PrintCpuChars(s, c[j]);
    }
  }

  s.Add_Space_if_NotEmpty();
  {
    char temp[32];
    ConvertUInt32ToHex(c.ver, temp);
    s += '(';
    s += temp;
    s += ')';
  }
}
开发者ID:ArchangelSDY,项目名称:Qt7z,代码行数:36,代码来源:mySplitCommandLine.cpp

示例13: SplitString

static void SplitString(const AString &srcString, AStringVector &destStrings)
{
  destStrings.Clear();
  AString string;
  int len = srcString.Length();
  if (len == 0)
    return;
  for (int i = 0; i < len; i++)
  {
    char c = srcString[i];
    if (c == '\n')
    {
      if (!string.IsEmpty())
      {
        destStrings.Add(string);
        string.Empty();
      }
    }
    else
      string += c;
  }
  if (!string.IsEmpty())
    destStrings.Add(string);
}
开发者ID:Esika,项目名称:sevenzipjbinding,代码行数:24,代码来源:FarUtils.cpp

示例14: Clear

 void Clear() { _fields.Clear(); LinesString.Empty(); }
开发者ID:Searcher23,项目名称:p7zip,代码行数:1,代码来源:List.cpp

示例15: WideCharToMultiByte

static void UnicodeStringToMultiByte2(AString &dest, const UString &src, UINT codePage, char defaultChar, bool &defaultCharWasUsed)
{
  dest.Empty();
  defaultCharWasUsed = false;
  if (src.IsEmpty())
    return;
  {
    /*
    unsigned numRequiredBytes = src.Len() * 2;
    char *d = dest.GetBuf(numRequiredBytes);
    const wchar_t *s = (const wchar_t *)src;
    unsigned i;
    
    for (i = 0;;)
    {
      wchar_t c = s[i];
      if (c >= 0x80 || c == 0)
        break;
      d[i++] = (char)c;
    }
    
    if (i != src.Len())
    {
      BOOL defUsed = FALSE;
      defaultChar = defaultChar;

      bool isUtf = (codePage == CP_UTF8 || codePage == CP_UTF7);
      unsigned len = WideCharToMultiByte(codePage, 0, s + i, src.Len() - i,
          d + i, numRequiredBytes + 1 - i,
          (isUtf ? NULL : &defaultChar),
          (isUtf ? NULL : &defUsed));
      defaultCharWasUsed = (defUsed != FALSE);
      if (len == 0)
        throw 282229;
      i += len;
    }

    d[i] = 0;
    dest.ReleaseBuf_SetLen(i);
    */

    /*
    if (codePage != CP_UTF7)
    {
      const wchar_t *s = (const wchar_t *)src;
      unsigned i;
      for (i = 0;; i++)
      {
        wchar_t c = s[i];
        if (c >= 0x80 || c == 0)
          break;
      }
      
      if (s[i] == 0)
      {
        char *d = dest.GetBuf(src.Len());
        for (i = 0;;)
        {
          wchar_t c = s[i];
          if (c == 0)
            break;
          d[i++] = (char)c;
        }
        d[i] = 0;
        dest.ReleaseBuf_SetLen(i);
        return;
      }
    }
    */

    unsigned len = WideCharToMultiByte(codePage, 0, src, src.Len(), NULL, 0, NULL, NULL);
    if (len == 0)
    {
      if (GetLastError() != 0)
        throw 282228;
    }
    else
    {
      BOOL defUsed = FALSE;
      bool isUtf = (codePage == CP_UTF8 || codePage == CP_UTF7);
      // defaultChar = defaultChar;
      len = WideCharToMultiByte(codePage, 0, src, src.Len(),
          dest.GetBuf(len), len,
          (isUtf ? NULL : &defaultChar),
          (isUtf ? NULL : &defUsed)
          );
      if (!isUtf)
        defaultCharWasUsed = (defUsed != FALSE);
      if (len == 0)
        throw 282228;
      dest.ReleaseBuf_SetEnd(len);
    }
  }
}
开发者ID:Alexander-r,项目名称:physfs,代码行数:94,代码来源:StringConvert.cpp


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