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


C++ TStringList::IndexOf方法代码示例

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


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

示例1:

BOOST_FIXTURE_TEST_CASE(test7, base_fixture_t)
{
  TStringList Lines;
  Lines.SetSorted(true);
  if (1)
  {
    Lines.SetDuplicates(dupAccept);
    Lines.Add(L"aaa");
    Lines.Add(L"aaa");
    Lines.Add(L"bbb");
    BOOST_CHECK(3 == Lines.GetCount());
    BOOST_CHECK(0 == Lines.IndexOf(L"aaa"));
    BOOST_CHECK(2 == Lines.IndexOf(L"bbb"));
  }
  Lines.Clear();
  if (1)
  {
    Lines.SetDuplicates(dupIgnore);
    Lines.Add(L"aaa");
    Lines.Add(L"aaa");
    Lines.Add(L"bbb");
    BOOST_CHECK(2 == Lines.GetCount());
    BOOST_CHECK(1 == Lines.IndexOf(L"bbb"));
  }
  Lines.Clear();
  if (1)
  {
    Lines.SetDuplicates(dupError);
    Lines.Add(L"aaa");
    Lines.Add(L"bbb");
    BOOST_CHECK_THROW(Lines.Add(L"aaa"), std::exception);
  }
}
开发者ID:elfmz,项目名称:far2l,代码行数:33,代码来源:testnetbox_02.cpp

示例2: GetProjectPath

//---------------------------------------------------------------------------
String __fastcall TTarget::GetProjectPath(bool FallBack)
{
  TStringList *ProjectPathes = FormMain->FrameProject->GetProjects();
  int Index = ProjectPathes->IndexOf(ProjectPath);
  if (ProjectPath.IsEmpty() || (Index < 0)) {
    return FallBack && ProjectPathes->Count ? ProjectPathes->Strings[0] : EmptyStr;
  }
  return ProjectPath;
}
开发者ID:NogsIoT,项目名称:Nogs-IDE,代码行数:10,代码来源:Target.cpp

示例3: RemoveFromList

void Defines::RemoveFromList(String keyList, String data)
{
        TStringList *s = GetList(keyList);
        if (s==0)
                return;
        int i=s->IndexOf(data);
        if (i>=0)
                s->Delete(i);
        SetList(keyList,s);
        delete s;
}
开发者ID:SpaceWind,项目名称:elo2kbuilder,代码行数:11,代码来源:defines.cpp

示例4: TSrvMediaSettings

__fastcall TSrvAudioSettings::TSrvAudioSettings(TSrvResponse* Response)
	: TSrvMediaSettings(Response, MEDIA_NAME, MEDIA_DEFAULT,
		CFG_DEFAULT_AUDIO_ALLOWEXTENSIONS)
{
	this->FRequirePicture = Response->ReadBool(
		TSrvResponseValID(L"RequirePic", MEDIA_NAME, MEDIA_DEFAULT),
		CFG_DEFAULT_AUDIO_REQUIREPICTURE);

	//Format
	TStringList* SL = Response->ReadList(
		TSrvResponseValID("Formats", MEDIA_NAME, MEDIA_DEFAULT),
		CFG_DEFAULT_AUDIO_FORMATS);
	if (SL->IndexOf(L"mp3")>=0) {
		TSrvMediaFormat* obj = new TSrvMediaFormat;
		obj->Label = L"MPEG 3";
		obj->FileExt = L"mp3";
		obj->InternetMediaType = L"audio/mp3";
		obj->FFmpegOptions =
			Response->ReadString(TSrvResponseValID("MP3Options", MEDIA_NAME, MEDIA_DEFAULT),
			CFG_DEFAULT_MP3_OPTIONS, false);
		this->Formats->AddObject(L"mp3", obj);

		this->NativeExts->Add(L"mp3=mp3");
	}
	delete SL;
	if (this->Formats->Count == 0) throw ESrvResponseError(L"No valid audio formats found.");

	if (Response->ReadBool(
			TSrvResponseValID(L"NoTranscode"), CFG_DEFAULT_NO_TRANSCODE)
		|| Response->ReadBool(
			TSrvResponseValID(L"NoTranscode", MEDIA_NAME),
				CFG_DEFAULT_AUDIO_NO_TRANSCODE))
	{
			this->FAllNative = true;
	}
}
开发者ID:DesktopUpload,项目名称:DesktopUploader,代码行数:36,代码来源:SrvInfo.cpp

示例5: UpdateTable

//---------------------------------------------------------------------------
void __fastcall TFormOptsOplata::UpdateTable(TStringGrid* pTab)
{
  ClearTable(pTab);

  int i,j;
  TStringList* listIDStud = new TStringList;
  TStringList* listIDOpts = new TStringList;
  listIDOpts->Clear();
  listIDStud->Clear();

  ZMySqlQuery->SQL->Clear();
  ZMySqlQuery->SQL->Add("SELECT id FROM "+opts.DBStudTable+" WHERE deleted=0 AND grpid="+ToStr(AnsiString(IDGroup)));
  ZMySqlQuery->Active=true;
  for (i=1;i<=ZMySqlQuery->RecordCount;i++)
  {
    ZMySqlQuery->RecNo=i;
    listIDStud->Add(AnsiString(ZMySqlQuery->Fields->FieldByNumber(1)->AsString.ToInt()));
  }

  AnsiString IDOptsStr;
  for (i=0; i<listIDStud->Count; i++)
  {
    ZMySqlQuery->SQL->Clear();
    ZMySqlQuery->SQL->Add("SELECT idopts FROM "+opts.DBPayFacts+" WHERE deleted=0 AND idstud="+ToStr(listIDStud->Strings[i]));
    ZMySqlQuery->Active=true;

    for (j=1; j<=ZMySqlQuery->RecordCount;j++)
    {
      ZMySqlQuery->RecNo=j;
      IDOptsStr = ZMySqlQuery->Fields->FieldByNumber(1)->AsString;
      if (listIDOpts->IndexOf(IDOptsStr)==-1)
        listIDOpts->Add(IDOptsStr);
    }
  }


  int numCurRow=0;
  listIDs->Clear();
  listIDs->Add("NULL");
  listRealIDs->Clear();
  listRealIDs->Add("NULL");

for (j=0; j<listIDOpts->Count; j++)
{
  ZMySqlQuery->SQL->Clear();
  ZMySqlQuery->SQL->Add("SELECT id,idgroup,datestart,dateend,commoncountmoney FROM "+opts.DBPayOpts+" WHERE deleted=0 AND id="+ToStr(listIDOpts->Strings[j])+" ORDER BY datestart");
  ZMySqlQuery->Active=true;

  for (i=1;i<=ZMySqlQuery->RecordCount;i++)
  {
    ZMySqlQuery->RecNo=i;
    numCurRow++;
    pTab->RowCount=numCurRow+1;

    listIDs->Add(AnsiString(ZMySqlQuery->Fields->FieldByNumber(1)->AsString.ToInt()));
    pTab->Cells[0][numCurRow]=numCurRow;
    pTab->Cells[1][numCurRow]=WCGetTitleForKeyNum(GROUPS,ZMySqlQuery->Fields->FieldByNumber(2)->AsString.ToInt());
    pTab->Cells[2][numCurRow]=GetPeriodStr(ZMySqlQuery->Fields->FieldByNumber(3)->AsString,ZMySqlQuery->Fields->FieldByNumber(4)->AsString);
    pTab->Cells[3][numCurRow]=ZMySqlQuery->Fields->FieldByNumber(5)->AsString;

    pTab->Refresh();
  }
}
  delete listIDOpts;
  delete listIDStud;

  StrGridOptsClick(StrGridOpts);
}
开发者ID:txe,项目名称:ieml,代码行数:69,代码来源:UnitOptsOplataForm.cpp

示例6: TStringList

//---------------------------------------------------------------------------
TStrings * __fastcall TGUIConfiguration::GetLocales()
{
  UnicodeString LocalesExts;
  TStringList * Exts = new TStringList();
  try
  {
    Exts->Sorted = true;
    Exts->CaseSensitive = false;

    int FindAttrs = faReadOnly | faArchive;
    TSearchRec SearchRec;
    bool Found;

    Found = (bool)(FindFirst(ChangeFileExt(ModuleFileName(), L".*"),
      FindAttrs, SearchRec) == 0);
    try
    {
      UnicodeString Ext;
      while (Found)
      {
        Ext = ExtractFileExt(SearchRec.Name).UpperCase();
        if ((Ext.Length() >= 3) && (Ext != L".EXE") && (Ext != L".COM") &&
            (Ext != L".DLL") && (Ext != L".INI"))
        {
          Ext = Ext.SubString(2, Ext.Length() - 1);
          LocalesExts += Ext;
          Exts->Add(Ext);
        }
        Found = (FindNextChecked(SearchRec) == 0);
      }
    }
    __finally
    {
      FindClose(SearchRec);
    }

    if (FLastLocalesExts != LocalesExts)
    {
      FLastLocalesExts = LocalesExts;
      FLocales->Clear();

      TLanguages * Langs = Languages();
      int Ext, Index, Count;
      wchar_t LocaleStr[255];
      LCID Locale;

      Count = Langs->Count;
      Index = -1;
      while (Index < Count)
      {
        if (Index >= 0)
        {
          Locale = Langs->LocaleID[Index];
          Ext = Exts->IndexOf(Langs->Ext[Index]);
          if (Ext < 0)
          {
            Ext = Exts->IndexOf(Langs->Ext[Index].SubString(1, 2));
            if (Ext >= 0)
            {
              Locale = MAKELANGID(PRIMARYLANGID(Locale), SUBLANG_DEFAULT);
            }
          }

          if (Ext >= 0)
          {
            Exts->Objects[Ext] = reinterpret_cast<TObject*>(Locale);
          }
          else
          {
            Locale = 0;
          }
        }
        else
        {
          Locale = InternalLocale();
        }

        if (Locale)
        {
          UnicodeString Name;
          GetLocaleInfo(Locale, LOCALE_SENGLANGUAGE,
            LocaleStr, LENOF(LocaleStr));
          Name = LocaleStr;
          Name += L" - ";
          // LOCALE_SNATIVELANGNAME
          GetLocaleInfo(Locale, LOCALE_SLANGUAGE,
            LocaleStr, LENOF(LocaleStr));
          Name += LocaleStr;
          FLocales->AddObject(Name, reinterpret_cast<TObject*>(Locale));
        }
        Index++;
      }

      for (int Index = 0; Index < Exts->Count; Index++)
      {
        if ((Exts->Objects[Index] == NULL) &&
            (Exts->Strings[Index].Length() == 3) &&
            SameText(Exts->Strings[Index].SubString(1, 2), AdditionaLanguagePrefix))
        {
//.........这里部分代码省略.........
开发者ID:seebigsea,项目名称:winscp,代码行数:101,代码来源:GUIConfiguration.cpp


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