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


C++ UnicodeString::c_str方法代码示例

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


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

示例1: PatternLen

//---------------------------------------------------------------------------
intptr_t TInteractiveCustomCommand::PatternLen(const UnicodeString & Command, intptr_t Index)
{
  intptr_t Len = 0;
  switch (Command[Index + 1])
  {
    case L'?':
      {
        const wchar_t * Ptr = Command.c_str() + Index - 1;
        const wchar_t * PatternEnd = wcschr(Ptr + 1, L'!');
        if (PatternEnd == nullptr)
        {
          throw Exception(FMTLOAD(CUSTOM_COMMAND_UNTERMINATED, Command[Index + 1], Index));
        }
        Len = PatternEnd - Ptr + 1;
      }
      break;

    case L'`':
      {
        const wchar_t * Ptr = Command.c_str() + Index - 1;
        const wchar_t * PatternEnd = wcschr(Ptr + 2, L'`');
        if (PatternEnd == nullptr)
        {
          throw Exception(FMTLOAD(CUSTOM_COMMAND_UNTERMINATED, Command[Index + 1], Index));
        }
        Len = PatternEnd - Ptr + 1;
      }
      break;

    default:
      Len = FChildCustomCommand->PatternLen(Command, Index);
      break;
  }
  return Len;
}
开发者ID:nineclock,项目名称:Far-NetBox,代码行数:36,代码来源:FileMasks.cpp

示例2: TReplaceFlags

BOOST_FIXTURE_TEST_CASE(test14, base_fixture_t)
{
  {
    UnicodeString str = ::StringReplace(L"AA", L"A", L"B", TReplaceFlags() << rfReplaceAll);
    BOOST_CHECK_EQUAL(W2MB(str.c_str()).c_str(), "BB");
  }
  {
    UnicodeString str = ::AnsiReplaceStr(L"AA", L"A", L"B");
    BOOST_CHECK_EQUAL(W2MB(str.c_str()).c_str(), "BB");
  }
  {
    UnicodeString str = L"ABC";
    BOOST_CHECK_EQUAL(::Pos(str, L"DEF"), 0);
    BOOST_CHECK_EQUAL(::Pos(str, L"AB"), 1);
    BOOST_CHECK_EQUAL(::Pos(str, L"BC"), 2);
    BOOST_CHECK_EQUAL(::AnsiPos(str, 'D'), 0);
    BOOST_CHECK_EQUAL(::AnsiPos(str, 'A'), 1);
    BOOST_CHECK_EQUAL(::AnsiPos(str, 'B'), 2);
  }
  {
    UnicodeString str = ::LowerCase(L"AA");
    BOOST_CHECK_EQUAL(W2MB(str.c_str()).c_str(), "aa");
  }
  {
    UnicodeString str = ::UpperCase(L"aa");
    BOOST_CHECK_EQUAL(W2MB(str.c_str()).c_str(), "AA");
  }
  {
    UnicodeString str = ::Trim(L" aa ");
    BOOST_CHECK_EQUAL(W2MB(str.c_str()).c_str(), "aa");
  }
}
开发者ID:elfmz,项目名称:far2l,代码行数:32,代码来源:testnetbox_02.cpp

示例3: GetTextStr

UnicodeString TStrings::GetTextStr() const
{
  UnicodeString Result;
  intptr_t Count = GetCount();
  intptr_t Size = 0;
  UnicodeString LB = sLineBreak;
  for (intptr_t I = 0; I < Count; I++)
  {
    Size += GetString(I).Length() + LB.Length();
  }
  Result.SetLength(Size);
  wchar_t * P = const_cast<wchar_t *>(Result.c_str());
  for (intptr_t I = 0; I < Count; I++)
  {
    UnicodeString S = GetString(I);
    intptr_t L = S.Length() * sizeof(wchar_t);
    if (L != 0)
    {
      memmove(P, S.c_str(), L);
      P += S.Length();
    }
    L = LB.Length() * sizeof(wchar_t);
    if (L != 0)
    {
      memmove(P, LB.c_str(), L);
      P += LB.Length();
    }
  }
  return Result;
}
开发者ID:nineclock,项目名称:Far-NetBox,代码行数:30,代码来源:Classes.cpp

示例4: SetTextStr

void TStrings::SetTextStr(const UnicodeString & Text)
{
  BeginUpdate();
  SCOPE_EXIT
  {
    EndUpdate();
  };
  {
    Clear();
    const wchar_t * P = Text.c_str();
    if (P != nullptr)
    {
      while (*P != 0x00)
      {
        const wchar_t * Start = P;
        while (!((*P == 0x00) || (*P == 0x0A) || (*P == 0x0D)))
        {
          P++;
        }
        UnicodeString S;
        S.SetLength(P - Start);
        memmove(const_cast<wchar_t *>(S.c_str()), Start, (P - Start) * sizeof(wchar_t));
        Add(S);
        if (*P == 0x0D) { P++; }
        if (*P == 0x0A) { P++; }
      }
    }
  }
}
开发者ID:opengl-ms,项目名称:Far-NetBox,代码行数:29,代码来源:Classes.cpp

示例5: OpenKey

bool TRegistry::OpenKey(const UnicodeString & Key, bool CanCreate)
{
  bool Result = false;
  UnicodeString S = Key;
  bool Relative = Classes::IsRelative(S);

  // if (!Relative) S.erase(0, 1); // Delete(S, 1, 1);
  HKEY TempKey = 0;
  if (!CanCreate || S.IsEmpty())
  {
    Result = RegOpenKeyEx(GetBaseKey(Relative), S.c_str(), 0,
                          FAccess, &TempKey) == ERROR_SUCCESS;
  }
  else
  {
    Result = RegCreateKeyEx(GetBaseKey(Relative), S.c_str(), 0, nullptr,
                            REG_OPTION_NON_VOLATILE, FAccess, nullptr, &TempKey, nullptr) == ERROR_SUCCESS;
  }
  if (Result)
  {
    if ((GetCurrentKey() != 0) && Relative)
    {
      S = FCurrentPath + L'\\' + S;
    }
    ChangeKey(TempKey, S);
  }
  return Result;
}
开发者ID:nineclock,项目名称:Far-NetBox,代码行数:28,代码来源:Classes.cpp

示例6: Format

UnicodeString Format(const wchar_t * Format, va_list Args)
{
  UnicodeString Result;
  if (Format && *Format)
  {
    intptr_t Len = _vscwprintf(Format, Args);
    Result.SetLength(Len + 1);
    // vswprintf(Buf, Len + 1, Format, args);
    vswprintf(const_cast<wchar_t *>(Result.c_str()), Len + 1, Format, Args);
  }
  return Result.c_str();
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:12,代码来源:Sysutils.cpp

示例7: rand

BOOST_FIXTURE_TEST_CASE(test21, base_fixture_t)
{
  BOOST_TEST_MESSAGE("RAND_MAX = " << RAND_MAX);
  for (int i = 0; i < 10; i++)
  {
    BOOST_TEST_MESSAGE("rand() = " << rand());
    BOOST_TEST_MESSAGE("random(256) = " << random(256));
  }
  UnicodeString enc = ::EncryptPassword(L"1234ABC", L"234556");
  BOOST_TEST_MESSAGE("enc = " << W2MB(enc.c_str()).c_str());
  UnicodeString dec = ::DecryptPassword(enc, L"234556");
  BOOST_TEST_MESSAGE("dec = " << W2MB(dec.c_str()).c_str());
  BOOST_CHECK(dec == L"1234ABC");
}
开发者ID:elfmz,项目名称:far2l,代码行数:14,代码来源:testnetbox_02.cpp

示例8: ItemsFormatString

UnicodeString ItemsFormatString(const UnicodeString & SingleItemFormat,
  const UnicodeString & MultiItemsFormat, intptr_t Count, const UnicodeString & FirstItem)
{
  UnicodeString Result;
  if (Count == 1)
  {
    Result = FORMAT(SingleItemFormat.c_str(), FirstItem.c_str());
  }
  else
  {
    Result = FORMAT(MultiItemsFormat.c_str(), Count);
  }
  return Result;
}
开发者ID:gumb0,项目名称:Far-NetBox,代码行数:14,代码来源:GUITools.cpp

示例9: ExpandFileName

UnicodeString ExpandFileName(const UnicodeString & FileName)
{
  UnicodeString Result;
  UnicodeString Buf(MAX_PATH, 0);
  intptr_t Size = GetFullPathNameW(FileName.c_str(), static_cast<DWORD>(Buf.Length() - 1),
    reinterpret_cast<LPWSTR>(const_cast<wchar_t *>(Buf.c_str())), nullptr);
  if (Size > Buf.Length())
  {
    Buf.SetLength(Size);
    Size = ::GetFullPathNameW(FileName.c_str(), static_cast<DWORD>(Buf.Length() - 1),
      reinterpret_cast<LPWSTR>(const_cast<wchar_t *>(Buf.c_str())), nullptr);
  }
  return UnicodeString(Buf.c_str(), Size);
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:14,代码来源:Sysutils.cpp

示例10: GridSetEditText

//---------------------------------------------------------------------------
void __fastcall TMediaDlgBox::GridSetEditText(TObject *Sender, int ACol,
	int ARow, const UnicodeString Value)
{
	double	d;

	if( Grid->EditorMode == TRUE ) return;
	if( ARow ){
		ARow--;
		switch(ACol){
			case 1:		// DIE(導)
				if( Calc(d, AnsiString(Value).c_str()) == TRUE){
					lenv.rel[ARow] = d;
					GridNewLine(ARow);
				}
				break;
			case 2:		// COND(誘電)
				if( Calc(d, AnsiString(Value).c_str()) == TRUE){
					lenv.cond[ARow] = d/1000.0;
					GridNewLine(ARow);
				}
				break;
			case 3:		// XorR(m)
				if( *Value.c_str() ){
					if( Calc(d, AnsiString(Value).c_str()) == TRUE){
						lenv.intval[ARow] = d;
						GridNewLine(ARow);
					}
				}
				else if( ARow >= (lenv.mmax - 1) ){
					lenv.intval[ARow] = NULLV;
					GridNewLine(ARow);
				}
				break;
			case 4:		// H(m)
				if( *Value.c_str() ){
					if( Calc(d, AnsiString(Value).c_str()) == TRUE){
						lenv.height[ARow] = d;
						GridNewLine(ARow);
					}
				}
				else if( ARow >= (lenv.mmax - 1) ){
					lenv.height[ARow] = NULLV;
					GridNewLine(ARow);
				}
				break;
		}
	}
}
开发者ID:ja7ude,项目名称:MMANA,代码行数:49,代码来源:MediaDlg.cpp

示例11: tokenize

static void tokenize(const UnicodeString & str, rde::vector<UnicodeString> & tokens,
  const UnicodeString & delimiters = L" ", const bool trimEmpty = false)
{
  intptr_t lastPos = 0;
  while (true)
  {
    intptr_t pos = str.FindFirstOf(delimiters.c_str(), lastPos);
    if (pos == NPOS)
    {
       pos = str.Length();

       if (pos != lastPos || !trimEmpty)
       {
         tokens.push_back(
           UnicodeString(str.data() + lastPos, pos - lastPos));
       }
       break;
    }
    else
    {
      if (pos != lastPos || !trimEmpty)
      {
        tokens.push_back(
          UnicodeString(str.data() + lastPos, pos - lastPos));
      }
    }

    lastPos = pos + 1;
  }
}
开发者ID:gvsurenderreddy,项目名称:Far-NetBox,代码行数:30,代码来源:Classes.cpp

示例12:

BOOST_FIXTURE_TEST_CASE(test19, base_fixture_t)
{
  UnicodeString ProgramsFolder;
  ::SpecialFolderLocation(CSIDL_PROGRAM_FILES, ProgramsFolder);
  BOOST_TEST_MESSAGE("ProgramsFolder = " << W2MB(ProgramsFolder.c_str()).c_str());
  BOOST_CHECK(ProgramsFolder.Length() > 0);
}
开发者ID:elfmz,项目名称:far2l,代码行数:7,代码来源:testnetbox_02.cpp

示例13: QueryValue

bool __fastcall TVersionInfo::QueryValue(const UnicodeString& SubBlock, LPVOID& Buffer,
  unsigned int& BufferLength) const
{
  assert(FFileVersionInfoData != NULL);

  return VerQueryValue(FFileVersionInfoData, SubBlock.c_str(), &Buffer, &BufferLength);
}
开发者ID:SkylineNando,项目名称:Delphi,代码行数:7,代码来源:VersionInfoComponent.cpp

示例14: ValidateName

//---------------------------------------------------------------------
void TCopyParamList::ValidateName(const UnicodeString & Name)
{
  if (Name.LastDelimiter(FInvalidChars) > 0)
  {
    throw Exception(FMTLOAD(ITEM_NAME_INVALID, Name.c_str(), FInvalidChars.c_str()));
  }
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:8,代码来源:GUIConfiguration.cpp

示例15: UpperCase

UnicodeString UpperCase(const UnicodeString & Str)
{
  std::wstring Result(Str.c_str(), Str.Length());
  // Result.SetLength(Str.Length());
  std::transform(Result.begin(), Result.end(), Result.begin(), ::toupper);
  return Result;
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:7,代码来源:Sysutils.cpp


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