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


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

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


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

示例1: MaskFileName

//---------------------------------------------------------------------------
UnicodeString MaskFileName(const UnicodeString & FileName, const UnicodeString & Mask)
{
  UnicodeString Result = FileName;
  if (IsEffectiveFileNameMask(Mask))
  {
    bool Masked;
    intptr_t P = Mask.LastDelimiter(L".");
    if (P > 0)
    {
      intptr_t P2 = Result.LastDelimiter(".");
      // only dot at beginning of file name is not considered as
      // name/ext separator
      UnicodeString FileExt = P2 > 1 ?
        Result.SubString(P2 + 1, Result.Length() - P2) : UnicodeString();
      FileExt = MaskFilePart(FileExt, Mask.SubString(P + 1, Mask.Length() - P), Masked);
      if (P2 > 1)
      {
        Result.SetLength(P2 - 1);
      }
      Result = MaskFilePart(Result, Mask.SubString(1, P - 1), Masked);
      if (!FileExt.IsEmpty())
      {
        Result += L"." + FileExt;
      }
    }
    else
    {
      Result = MaskFilePart(Result, Mask, Masked);
    }
  }
  return Result;
}
开发者ID:nineclock,项目名称:Far-NetBox,代码行数:33,代码来源:FileMasks.cpp

示例2: ValidateName

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

示例3: ValidateName

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

示例4: 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

示例5: TrimVersion

//---------------------------------------------------------------------------
UnicodeString TConfiguration::TrimVersion(const UnicodeString & Version) const
{
  UnicodeString Result = Version;
  while ((Result.Pos(L".") != Result.LastDelimiter(L".")) &&
    (Result.SubString(Result.Length() - 1, 2) == L".0"))
  {
    Result.SetLength(Result.Length() - 2);
  }
  return Result;
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:11,代码来源:Configuration.cpp

示例6: MakeDirectoryMask

//---------------------------------------------------------------------------
UnicodeString TFileMasks::MakeDirectoryMask(const UnicodeString & Str)
{
  assert(!Str.IsEmpty());
  UnicodeString Result = Str;
  if (Result.IsEmpty() || !Result.IsDelimiter(DirectoryMaskDelimiters, Result.Length()))
  {
    intptr_t D = Result.LastDelimiter(DirectoryMaskDelimiters);
    // if there's any [back]slash anywhere in str,
    // add the same [back]slash at the end, otherwise add slash
    wchar_t Delimiter = (D > 0) ? Result[D] : DirectoryMaskDelimiters[1];
    Result += Delimiter;
  }
  return Result;
}
开发者ID:nineclock,项目名称:Far-NetBox,代码行数:15,代码来源:FileMasks.cpp

示例7: ExtractFileDir

UnicodeString ExtractFileDir(const UnicodeString & Str)
{
  UnicodeString Result;
  intptr_t Pos = Str.LastDelimiter(L"/\\");
  // it used to return Path when no slash was found
  if (Pos > 0)
  {
    Result = Str.SubString(1, Pos);
  }
  else
  {
    Result = (Pos == 1) ? UnicodeString(L"/") : UnicodeString();
  }
  return Result;
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:15,代码来源:Sysutils.cpp

示例8: CreateMask

//---------------------------------------------------------------------------
void TFileMasks::CreateMask(
  const UnicodeString & MaskStr, intptr_t MaskStart, intptr_t /*MaskEnd*/, bool Include)
{
  bool Directory = false; // shut up
  TMask Mask;

  Mask.MaskStr = MaskStr;
  Mask.UserStr = MaskStr;
  Mask.FileNameMask.Kind = TMaskMask::Any;
  Mask.FileNameMask.Mask = nullptr;
  Mask.DirectoryMask.Kind = TMaskMask::Any;
  Mask.DirectoryMask.Mask = nullptr;
  Mask.HighSizeMask = TMask::None;
  Mask.LowSizeMask = TMask::None;
  Mask.HighModificationMask = TMask::None;
  Mask.LowModificationMask = TMask::None;

  wchar_t NextPartDelimiter = L'\0';
  intptr_t NextPartFrom = 1;
  while (NextPartFrom <= MaskStr.Length())
  {
    wchar_t PartDelimiter = NextPartDelimiter;
    intptr_t PartFrom = NextPartFrom;
    UnicodeString PartStr = CopyToChars(MaskStr, NextPartFrom, L"<>", false, &NextPartDelimiter, true);

    intptr_t PartStart = MaskStart + PartFrom - 1;
    intptr_t PartEnd = MaskStart + NextPartFrom - 1 - 2;

    TrimEx(PartStr, PartStart, PartEnd);

    if (PartDelimiter != L'\0')
    {
      bool Low = (PartDelimiter == L'>');

      TMask::TMaskBoundary Boundary;
      if ((PartStr.Length() >= 1) && (PartStr[1] == L'='))
      {
        Boundary = TMask::Close;
        PartStr.Delete(1, 1);
      }
      else
      {
        Boundary = TMask::Open;
      }

      TFormatSettings FormatSettings = TFormatSettings::Create(GetDefaultLCID());
      FormatSettings.DateSeparator = L'-';
      FormatSettings.TimeSeparator = L':';
      FormatSettings.ShortDateFormat = L"yyyy/mm/dd";
      FormatSettings.ShortTimeFormat = L"hh:nn:ss";

      TDateTime Modification;
      if (TryStrToDateTime(PartStr, Modification, FormatSettings) ||
          TryRelativeStrToDateTime(PartStr, Modification))
      {
        TMask::TMaskBoundary & ModificationMask =
          (Low ? Mask.LowModificationMask : Mask.HighModificationMask);

        if ((ModificationMask != TMask::None) || Directory)
        {
          // include delimiter into size part
          ThrowError(PartStart - 1, PartEnd);
        }

        ModificationMask = Boundary;
        (Low ? Mask.LowModification : Mask.HighModification) = Modification;
      }
      else
      {
        TMask::TMaskBoundary & SizeMask = (Low ? Mask.LowSizeMask : Mask.HighSizeMask);
        __int64 & Size = (Low ? Mask.LowSize : Mask.HighSize);

        if ((SizeMask != TMask::None) || Directory)
        {
          // include delimiter into size part
          ThrowError(PartStart - 1, PartEnd);
        }

        SizeMask = Boundary;
        Size = ParseSize(PartStr);
      }
    }
    else if (!PartStr.IsEmpty())
    {
      intptr_t D = PartStr.LastDelimiter(DirectoryMaskDelimiters);

      Directory = (D > 0) && (D == PartStr.Length());

      if (Directory)
      {
        do
        {
          PartStr.SetLength(PartStr.Length() - 1);
          Mask.UserStr.Delete(PartStart - MaskStart + D, 1);
          D--;
        }
        while (PartStr.IsDelimiter(DirectoryMaskDelimiters, PartStr.Length()));

        D = PartStr.LastDelimiter(DirectoryMaskDelimiters);
//.........这里部分代码省略.........
开发者ID:nineclock,项目名称:Far-NetBox,代码行数:101,代码来源:FileMasks.cpp

示例9: IsMask

//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
bool TFileMasks::IsMask(const UnicodeString & Mask)
{
  return (Mask.LastDelimiter(L"?*[/") > 0);
}
开发者ID:nineclock,项目名称:Far-NetBox,代码行数:6,代码来源:FileMasks.cpp

示例10: PropertyToKey

UnicodeString TConfiguration::PropertyToKey(const UnicodeString & Property)
{
  // no longer useful
  intptr_t P = Property.LastDelimiter(L".>");
  return Property.SubString(P + 1, Property.Length() - P);
}
开发者ID:elfmz,项目名称:far2l,代码行数:6,代码来源:Configuration.cpp


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