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


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

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


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

示例1: SaveConfig

//---------------------------------------------------------------------------
void TRsyncConfigAdapter::SaveConfig(){



    TStringList* lines = new TStringList();



    TModuleHolder* currentModule = GetModuleHolder(GLOBAL_MODULE);


    for(int i = 0; i < currentModule->nvp->Count; i++){
        lines->Add(currentModule->nvp->Strings[i]);
    }

    //Now get remaining modules
    for(int j = 0; j < modules->Count; j++){
        currentModule = (TModuleHolder*)modules->Items[j];
        if(currentModule->moduleName == GLOBAL_MODULE){
            continue;
        }

        lines->Add("[" + currentModule->moduleName + "]");
        for(int i = 0; i < currentModule->nvp->Count; i++){
            lines->Add(currentModule->nvp->Strings[i]);
        }
    }

    lines->SaveToFile(CONFIG_FILE);


    delete lines;
}
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:34,代码来源:RSyncConfigAdapter.cpp

示例2: if

//---------------------------------------------------------------------------
TStringList* StringToTok2( AnsiString Words,
  AnsiString Dlmtr1, AnsiString Dlmtr2 )
{
  AnsiString Work = Words.Trim();
  int spos;
  TStringList *Making = new TStringList;

  int spos1 = Work.AnsiPos(Dlmtr1);
  int spos2 = Work.AnsiPos(Dlmtr2);
  while (spos1 || spos2) {
 //   int spos = 0;
    if (!spos1 && spos2) spos = spos2;
    else if (!spos2 && spos1) spos = spos1;
    else spos = (spos1 < spos2) ? spos1 : spos2;
    Making->Add(Work.SubString( 1, spos-1));
    Work = Work.SubString( spos+1, Work.Length() - spos);
    Work = Work.Trim();
    spos1 = Work.AnsiPos(Dlmtr1);
    spos2 = Work.AnsiPos(Dlmtr2);
  } // while
  if (Work != "")
    Making->Add(Work);

  return Making;
}
开发者ID:GraffLittle,项目名称:first,代码行数:26,代码来源:Commons.cpp

示例3: GetFileList

TStringList GetFileList(wxString folder, const wxString& mask, bool includeFullFolderPath)
{
	TStringList result;
	wxString FName;
	if (wxDir::Exists(folder) == false)
	{
		return result;
	}
	wxDir dir(folder);
	if (dir.GetFirst(&FName,mask,wxDIR_FILES))
	{
		do
		{
			if (includeFullFolderPath)
			{
				wxString FullFileName = IncludeTrailingPathDelimiter(folder) + FName;
				result.Add(FullFileName);
			}
			else
			{
				result.Add(FName);
			}
		} while(dir.GetNext(&FName));
	}
	return result;
}
开发者ID:gkathire,项目名称:wxVCL,代码行数:26,代码来源:fileutil.cpp

示例4: ZaladujDaneProduktu

//---------------------------------------------------------------------------
/// Metoda odpowiada za wyci¹gniêcie oraz sparsowanie poszczególnych danych produktu
/// po czym przypisuje te dane do przekazanego obiektu.
void __fastcall ParsujDane::ZaladujDaneProduktu()
{

	AnsiString znacznikDaneProduktu, znacznikMarka, nazwaMarki, znacznikModel, nazwaModel, znacznikKod, kodProduktu,
				znacznikRodzUrz, rodzajUrzadzenia, znacznikKategoria, kategoria, dodUwagi, str;
	int index;
	TStringList *listaKat = new TStringList;
	try
	{
		listaKat->Add("Komputery");
		listaKat->Add("Fotografia");
		listaKat->Add("Telefony_i_akcesoria");
		listaKat->Sort();
		//----
		znacznikDaneProduktu = "keys : [";
		DaneProduktuText = ZnajdzDane(Text, znacznikDaneProduktu, ']');
		UsunZnacznik(DaneProduktuText, "'");
		//----                                                                    `
		znacznikKategoria = "Cat1:  \'";
		kategoria = ZnajdzDane(Text, znacznikKategoria, '\'');
        bool x = listaKat->Find(kategoria, index);

		if (!listaKat->Find(kategoria, index))
		{
			BladKategorii = true;
			ShowMessage("Proces parsowania tekstu nie powiód³ siê - brak parsera dla wybranej kategorii!");
			return;
		}
		//----
		znacznikMarka = "\"Producent: ";
		nazwaMarki = ZnajdzDane(DaneProduktuText, znacznikMarka, '\"');
		//----
		znacznikModel = "\"" + nazwaMarki;
		znacznikModel = znacznikModel.LowerCase();
		DaneProduktuText = DaneProduktuText.LowerCase();
		nazwaModel = ZnajdzDane(DaneProduktuText, znacznikModel, '\"');
		//----
		while (true)
		{
			DaneProduktuText.Delete(DaneProduktuText.Pos(","), 1);
			if (DaneProduktuText.IsEmpty()) break;
			str = ZnajdzDane(DaneProduktuText, '\"', '\"');
			if (str.Pos(":") == 0) continue;
			dodUwagi += str + ";";
		}
		//----
		znacznikKod = "productID: \'";
		kodProduktu = ZnajdzDane(Text, znacznikKod, '\'');
		//----
		znacznikRodzUrz = "catmin: \'";
		rodzajUrzadzenia = ZnajdzDane(Text, znacznikRodzUrz, '\'');
		// ----
		FProdukt->DodajDaneProduktu(nazwaMarki, nazwaModel, kodProduktu.ToInt(), rodzajUrzadzenia, dodUwagi);
	}
	catch(...) { if (listaKat != NULL) delete listaKat; listaKat = NULL; throw; }
	if (listaKat != NULL) delete listaKat;
	listaKat = NULL;
}
开发者ID:godzillaq,项目名称:Proces_ETL,代码行数:61,代码来源:UParsuj.cpp

示例5: ConsumeProducts

//---------------------------------------------------------------------------
void __fastcall TMainForm::ConsumeProducts()
{
	TStringList * products = new TStringList();
	if (FInAppPurchase->IsProductPurchased(EuropeID)) {
		products->Add(EuropeID);
	}
	if (FInAppPurchase->IsProductPurchased(NoAdsID)) {
		products->Add(NoAdsID);
	}
	FInAppPurchase->ConsumeProducts(products);
	products->DisposeOf();
}
开发者ID:FMXExpress,项目名称:Firemonkey,代码行数:13,代码来源:Main.cpp

示例6: ReadSectionNames

void TIniFile::ReadSectionNames(const wxString &Section, TStringList &Strings)
{
	wxString N;
	wxString V;
	int I;

	// Assert( !! Strings , SStringsUnassignedError );
	Strings.BeginUpdate();
	try
	{
		Strings.Clear();
		if (FFileBuffer->Count() > 0)
		{
			I = GetSectionIndex(Section);
			if (I != -1)
			{
				++I;
				while ((I < FFileBuffer->Count()) && !IsSection
				  (FFileBuffer->Item(I)))
				{
					N = GetName(FFileBuffer->Item(I));
					if (N != EmptyStr)
					{
						Strings.Add(N);
					}
					++I;
				}
			}
		}
	} /* ? *//* FINALLY */
	catch (...)
	{
		Strings.EndUpdate();
	}
}
开发者ID:gkathire,项目名称:wxVCL,代码行数:35,代码来源:inifiles.cpp

示例7: ReadSections

void TIniFile::ReadSections(TStringList &Strings)
{
	long I;
	wxString Section;

	// Assert( !! Strings , SStringsUnassignedError );
	Strings.BeginUpdate();
	try
	{
		Strings.Clear();
		if (FFileBuffer->Count() > 0)
		{
			I = 0;
			while ((I < FFileBuffer->Count()))
			{
				if (IsSection(FFileBuffer->Item(I)))
				{
					Section = Trim(FFileBuffer->Item(I));
					Delete(Section, 0, 1);
					Delete(Section, Length(Section) - 1, 1);
					Strings.Add(Trim(Section));
				}
				++I;
			}
		}
	} /* ? *//* FINALLY */
	catch (...)
	{
		Strings.EndUpdate();
	}
}
开发者ID:gkathire,项目名称:wxVCL,代码行数:31,代码来源:inifiles.cpp

示例8: StringToTokiens

//---------------------------------------------------------------------------
TStringList* StringToTokiens( AnsiString Words, AnsiString Dlmtr )
{
  AnsiString Work = Words.Trim();
  int spos;
  TStringList *Making = new TStringList;

  while ((spos = Work.AnsiPos(Dlmtr)) != 0) {
    Making->Add(Work.SubString( 1, spos-1));
    Work = Work.SubString( spos+1, Work.Length() - spos);
    Work = Work.Trim();
  } // while
  if (Work != "")
    Making->Add(Work);

  return Making;
}
开发者ID:GraffLittle,项目名称:first,代码行数:17,代码来源:Commons.cpp

示例9: switch

TStringList * Defines::GetList(String key)
{
        int indexS = -1, indexF = -1;
        for (int i=0; i<l->Count; i++)
        {
                switch(indexS)
                {
                case -1:
                        if (l->Strings[i]==String("@")+key)
                                indexS = i;
                        break;
                default:
                        if (l->Strings[i]==String("/")+key)
                        {
                                indexF = i;
                                i = l->Count;
                        }
                        break;
                }
        }
        if (indexS !=-1 && indexF!=-1)
        {
                TStringList * out = new TStringList();
                for (int i=0; i<(indexF-indexS-1); i++)
                        out->Add(l->Strings[indexS+1+i]);
                return out;
        }
        else
                return 0;
}
开发者ID:SpaceWind,项目名称:elo2kbuilder,代码行数:30,代码来源:defines.cpp

示例10: apply

//---------------------------------------------------------------------------
void TfrmMain::apply(::Move& move)
{
	TStringsEnumerator *e = move.getEffects()->GetEnumerator();
	while(e->MoveNext())
	{
		if(e->Current[1] == '!')
		{
			Memo5->Lines->Delete(Memo5->Lines->IndexOf(e->Current.SubString(2,e->Current.Length())) );
		}
		else //add something
		{
			Memo5->Lines->Add(e->Current);        	
		}
	}
	TStringList *tmpState = new TStringList(); 
	TStringsEnumerator *eM = Memo5->Lines->GetEnumerator();
	while(eM->MoveNext())
	{
     	tmpState->Add(eM->Current);
	}
	Memo5->Clear();
	tmpState->Sort();
	Memo5->Lines->AddStrings(tmpState);
	tmpState->Free();
	eM->Free();
}
开发者ID:icewall,项目名称:Hanoi,代码行数:27,代码来源:formMain.cpp

示例11: SetParamValue

//---------------------------------------------------------------------------
void TRsyncConfigAdapter::SetParamValue(AnsiString moduleName, AnsiString paramName, AnsiString paramValue){
    TModuleHolder* aHolder = GetModuleHolder(moduleName);

    if(aHolder == NULL){
        return; //"Invalid module name";
    }


    TStringList* params = aHolder->nvp;

	bool newModule = true;
    for(int i = 0; i < params->Count; i++){
        AnsiString oneLine = params->Strings[i];
        AnsiString sName, sValue;

        if(ParseNameValue(oneLine, sName, sValue)){
            if(sName == paramName){
				params->Strings[i] = "    " + paramName + " = " + paramValue;
				newModule = false;
                break;
            }
        }

	}

	if(newModule){
		params->Add("    " + paramName + " = " + paramValue);
	}

}
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:31,代码来源:RSyncConfigAdapter.cpp

示例12: WMDropFiles

void __fastcall TfrmMain::WMDropFiles(TWMDropFiles& Message)
{
  int Count = DragQueryFile(reinterpret_cast<void*>(Message.Drop), 0xFFFFFFFF, NULL, 0);
  try
  {
    char FileBuf[MAX_PATH+1];
    if (Count > 0)
    {
      TStringList* FileList = new TStringList();
      try
      {
        for (int i = 0; i < Count; i++)
        {
          DragQueryFile(reinterpret_cast<void*>(Message.Drop), i, FileBuf, sizeof(FileBuf));
          FileList->Add(FileBuf);
        }
        FileList->Sort();
        reSource->Lines->BeginUpdate();
        try
        {
          reSource->Lines->Clear();
          for (int i = 0; i < FileList->Count; i++)
            reSource->Lines->Add(StringFromFile(FileList->Strings[i]));
        }
        __finally
        {
          reSource->Lines->EndUpdate();
        }
      }
      __finally
      {
        delete FileList;
      }
    }
  } __finally {
开发者ID:chinnyannieb,项目名称:Meus-Projetos,代码行数:35,代码来源:MainForm.cpp

示例13: UnicodeString

TStringList* __fastcall TYoutubeGrabFormBase::PrepareLinks()
{
	TStringList* result = NULL;
	try {
		//Check categories
		try {
			this->UploadProperties->CheckCategories();
		} catch (UnicodeString msg) {
        	this->UploadProperties->GetCategoryControl()->SetFocus();
			throw msg;
		}

		//Remove empty lines and trim
		UnicodeString link;
		int pos = 0;
		for (int i = 0; i < this->memLinks->Lines->Count; i++) {
			link = this->memLinks->Lines->Strings[i].Trim();
			if (link.IsEmpty()) {
				this->memLinks->Lines->Delete(i);
				i--; continue;
			}
			this->memLinks->Lines->Strings[i] = link;
		}
		//Check if no links
		if (this->memLinks->Lines->Count == 0) {
			this->memLinks->SetFocus();
			throw UnicodeString(L"Please provide YouTube links.");
		}

		//Extract IDs
		UnicodeString id;
		result = new TStringList;
		for (int i = 0; i < this->memLinks->Lines->Count; i++) {
			link = this->memLinks->Lines->Strings[i];

			id = YT_ExpractID(link);
			if (id.IsEmpty()) {
				UnicodeString msg = L"Invalid YouTube link \"" \
				+ link + L"\".\r\n" \
				+ L"No YouTube video ID found.";

				this->memLinks->SetFocus();
				this->memLinks->SelStart = pos;
				this->memLinks->SelLength = memLinks->Lines->Strings[i].Length();
				throw msg;
			}
			result->Add(id);

			pos += link.Length()+2;
		}
	}
	catch (UnicodeString msg) {
		Framework->ShowErrorMessage(msg, this->Caption, true);
		delete result;
		return NULL;
	}

	return result;
}
开发者ID:DesktopUpload,项目名称:DesktopUploader,代码行数:59,代码来源:YoutubeGrabBase.cpp

示例14: FormClose

void __fastcall TfMain::FormClose(TObject *Sender, TCloseAction &Action)
{
	TFile f;
	TStringList* sl = new(TStringList);

	for(int i = 0; i < lvLib->Items->Count; i++)
		sl->Add(lvLib->Items->Item[i]->SubItems->Strings[0] + '=' +
			lvLib->Items->Item[i]->SubItems->Strings[1] + '/' +
			lvLib->Items->Item[i]->SubItems->Strings[2]);

	sl->SaveToFile(ExtractFileDir(Application->ExeName) + "\\Library.lb");
	sl->Clear();

	sl->Add("Login=" + leLogin->Text);
	if(cbRememberPass->Checked)
		sl->Add("Pass=" + lePass->Text);
	else
		sl->Add("Pass=");
	if(cbRememberPass->Checked)
		sl->Add("RememberPass=1");
	else
		sl->Add("RememberPass=0");
	sl->Add("Server=" + leServer->Text);

	sl->SaveToFile(ExtractFileDir(Application->ExeName) + "\\Settings.ini");

	sl->~TStringList();
}
开发者ID:szavalishin,项目名称:Libs,代码行数:28,代码来源:f_Main.cpp

示例15:

Debug::~Debug()
{
   if(ntimes==0) return;
   if(!debug_on_exit) return;

   TStringList *L = new TStringList;

   double elapsed = 1000.0*((double)accumulated_counter.LowPart)/((double)FrequencyCounter.LowPart);
   double average_elapsed = elapsed / (double) ntimes;

   L->Add("Number of times called:"+AnsiString(ntimes));
   L->Add("Elapsed time msec:"+AnsiString(elapsed));
   L->Add("Average elapsed time msec:"+AnsiString(average_elapsed));

   L->SaveToFile("c:\\debug.txt");

   delete L;
}
开发者ID:nippur72,项目名称:Chip64,代码行数:18,代码来源:Debug.cpp


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