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


C++ TStrings类代码示例

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


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

示例1: TStringList

void TGridModeDemoMainForm::SortPattern(TcxGridDBDataController *ADataController)
{
    TcxGridDBTableView *AView = (TcxGridDBTableView*)ADataController->GridView;
    TStrings *ASortList = new TStringList();
    try{
      AView->BeginUpdate();
      String AOrder, AFieldName;
      int AIndex;
      for (int I = 0; I < AView->SortedItemCount; I++){
        AIndex = ADataController->GetSortingItemIndex(I);
        AFieldName = AView->Columns[AIndex]->DataBinding->FieldName;
        if (AView->Columns[AIndex]->SortOrder == soAscending)
          AOrder = " ASC, ";
        else
          AOrder = " DESC, ";
        ASortList->Add(AFieldName + AOrder);
      }
      GridModeDemoDataDM->
        ApplySortToQuery((TQuery*)ADataController->DataSet, ASortList);
    }
    __finally{
      delete ASortList;
      AView->EndUpdate();
    }
}
开发者ID:chinnyannieb,项目名称:Meus-Projetos,代码行数:25,代码来源:GridModeDemoMain.cpp

示例2: SetupPageComboBox

void __fastcall TEditTiffForm::SetupPageComboBox(int count, int start) {
//-------------------------------------------------------------------------------
//                          Заполняет PageComboBox                              |
// Если start == -1, то не меняет ItemIndex                                     |
//-------------------------------------------------------------------------------
    TStrings *items = PageComboBox->Items;
    int i;
    char buf[50];

    items->Clear();
    for (i = 1; i <= count; i++) {
        sprintf(buf, "%d / %d", i, count);
        items->Add(buf);
    }

    InsideChange = true;
    ScrollBar1->Max = count;
    if (start >= 0) {
        PageComboBox->ItemIndex = start;
        ScrollBar1->Position = start;
    } else if (PageComboBox->ItemIndex == -1) {
        PageComboBox->ItemIndex = 0;
        ScrollBar1->Position = 0;
    }

    EnumTiffPages();
    InsideChange = false;
}
开发者ID:ands904,项目名称:SEnum,代码行数:28,代码来源:EditTiffUnit.cpp

示例3: ecmd_commands

void ecmd_commands(TStrings &rc) {
   MTLOCK_THIS_FUNC _lk;
   if (!ecmd) ecmd = new_ini(ecmd_name());
   ecmd->ReadSectionKeys("COMMANDS",rc);
   // trim spaces and empty lines
   rc.TrimEmptyLines();
   rc.TrimAllLines();
   for (int ii=0; ii<rc.Count(); ii++) rc[ii].upper();
}
开发者ID:OS2World,项目名称:SYSTEM-LOADER-QSINIT,代码行数:9,代码来源:ldrini.cpp

示例4: str_copylines

str_list* _std str_copylines(str_list*list, u32t first, u32t last) {
   TStrings lst;
   if (first<=last) {
      str_getstrs(list,lst);
      if (lst.Count())
         if (first>=lst.Count()) lst.Clear(); else {
            if (last>=lst.Count()) last=lst.Max();
            if (++last!=lst.Count()) lst.Delete(last,lst.Count()-last);
            if (first) lst.Delete(0,first);
         }
   }   
   return str_getlist_local(lst.Str);
}
开发者ID:OS2World,项目名称:SYSTEM-LOADER-QSINIT,代码行数:13,代码来源:ldrini.cpp

示例5: AssignTo

//---------------------------------------------------------------------------
void __fastcall TAddressBook::AssignTo(TPersistent* Dest)
{
	TStrings *DestStrings = dynamic_cast<TStrings *>(Dest);

	if (DestStrings) {
		DestStrings->BeginUpdate();
		try {
			DestStrings->Clear();
			DestStrings->AddStrings(FNames);
		}
		__finally {
			DestStrings->EndUpdate();
		}
	}
}
开发者ID:EBNull,项目名称:wphf-reloaded,代码行数:16,代码来源:AddressBook.cpp

示例6: splittext

void splittext(const char *text, u32t width, TStrings &lst, u32t flags) {
   lst.Clear();
   if (!text || width<8) return;
   const char *ps = text, *pps;
   char    softcr = flags&SplitText_HelpMode?'&':0;
   int         ln = 0;
   spstr linehead;
   lst.Add(spstr());
   do {
      while (*ps && (strchr(AllowSet,*ps) || *ps==softcr)) {
         register char cr=*ps++;
         if (cr!=' ') {
            if (cr==softcr) {
               pps = ps;
               if (*pps) pps++;
               while (*pps==' ' || *pps=='\t') pps++;
               /* get 1 char after eol and all spaces after it and use result
                  as a header for all next lines until real cr */
               linehead = spstr(ps, pps-ps).expandtabs(4);
               ps = pps;
            } else {
               lst.Add(spstr());
               if (cr=='\r' && *ps=='\n') ps++;
               linehead.clear();
               if (lst[ln].lastchar()==' ') lst[ln].dellast();
               ln++;
            }
         }
      }
      if (*ps==0) break;
      pps = strpbrk(ps, softcr ? CarrySet AllowSet "&" : CarrySet AllowSet);
      int carry = pps&&strchr(CarrySet,*pps)?1:0;
      spstr curr(ps,pps?pps-ps+carry:0), sum;
      sum = lst[ln]+curr;
      sum.expandtabs(4);

      if ((flags&SplitText_NoAnsi?strlen:str_length)(sum())<width-2)
         lst[ln]=sum;
      else {
         lst.Add(linehead+curr);
         if (lst[ln].lastchar()==' ') lst[ln].dellast();
         ln++;
      }
      if (!carry||pps&&pps[1]==' ') lst[ln]+=' ';
      ps=pps;
      if (carry) ps++;
   } while (pps);
}
开发者ID:OS2World,项目名称:SYSTEM-LOADER-QSINIT,代码行数:48,代码来源:ldrini.cpp

示例7: ExceptionToMoreMessages

TStrings * ExceptionToMoreMessages(Exception * E)
{
  TStrings * Result = nullptr;
  UnicodeString Message;
  if (ExceptionMessage(E, Message))
  {
    Result = new TStringList();
    Result->Add(Message);
    ExtException * ExtE = dyn_cast<ExtException>(E);
    if ((ExtE != nullptr) && (ExtE->GetMoreMessages() != nullptr))
    {
      Result->AddStrings(ExtE->GetMoreMessages());
    }
  }
  return Result;
}
开发者ID:skyformat99,项目名称:Far-NetBox,代码行数:16,代码来源:Exceptions.cpp

示例8: ExceptionToMoreMessages

TStrings * ExceptionToMoreMessages(Exception * E)
{
  TStrings * Result = nullptr;
  UnicodeString Message;
  if (ExceptionMessage(E, Message))
  {
    Result = new TStringList();
    Result->Add(Message);
    ExtException * ExtE = NB_STATIC_DOWNCAST(ExtException, E);
    if ((ExtE != nullptr) && (ExtE->GetMoreMessages() != nullptr))
    {
      Result->AddStrings(ExtE->GetMoreMessages());
    }
  }
  return Result;
}
开发者ID:gumb0,项目名称:Far-NetBox,代码行数:16,代码来源:Exceptions.cpp

示例9: get_userpass_input

//---------------------------------------------------------------------------
int get_userpass_input(prompts_t * p, unsigned char * /*in*/, int /*inlen*/)
{
  assert(p != NULL);
  TSecureShell * SecureShell = reinterpret_cast<TSecureShell *>(p->frontend);
  assert(SecureShell != NULL);

  int Result;
  TStrings * Prompts = new TStringList();
  TStrings * Results = new TStringList();
  try
  {
    for (int Index = 0; Index < int(p->n_prompts); Index++)
    {
      prompt_t * Prompt = p->prompts[Index];
      Prompts->AddObject(Prompt->prompt, (TObject *)(FLAGMASK(Prompt->echo, pupEcho)));
      // this fails, when new passwords do not match on change password prompt,
      // and putty retries the prompt
      assert(Prompt->resultsize == 0);
      Results->Add(L"");
    }

    if (SecureShell->PromptUser(p->to_server, p->name, p->name_reqd,
          p->instruction, p->instr_reqd, Prompts, Results))
    {
      for (int Index = 0; Index < int(p->n_prompts); Index++)
      {
        prompt_t * Prompt = p->prompts[Index];
        prompt_set_result(Prompt, AnsiString(Results->Strings[Index]).c_str());
      }
      Result = 1;
    }
    else
    {
      Result = 0;
    }
  }
  __finally
  {
    delete Prompts;
    delete Results;
  }

  return Result;
}
开发者ID:elazzi,项目名称:winscp,代码行数:45,代码来源:PuttyIntf.cpp

示例10: TForm

//---------------------------------------------------------------------------
__fastcall TLicenseDialog::TLicenseDialog(TComponent * Owner, TLicense License)
  : TForm(Owner)
{
  UseSystemSettings(this);

  TStrings * LicenseList = new TStringList();
  try
  {
    LicenseList->Text = ReadResource(LicenseStr[License]);
    assert(LicenseList->Count > 0);
    Caption = FMTLOAD(LICENSE_CAPTION, (LicenseList->Strings[0]));
    LicenseList->Delete(0);
    LicenseMemo->Lines->Text = LicenseList->Text;
  }
  __finally
  {
    delete LicenseList;
  }
}
开发者ID:elazzi,项目名称:winscp,代码行数:20,代码来源:License.cpp

示例11: init_msg_ini

static void init_msg_ini(void) {
   if (!msg) {
      TStrings     ht;
      spstr   secname("help");
      msg = new_ini(msg_name());

      msg->ReadSection(secname, ht);
      /* merge strings, ended by backslash. ugly, but allows more friendly
         editing of msg.ini */
      l ii=0, lp;
      while (ii<ht.Count()) {
         if (ht[ii].trim().lastchar()=='\\') {
            ht[ii].dellast()+=ht.MergeBackSlash(ii+1,&lp);
            ht.Delete(ii+1, lp-ii-1);
         }
         ii++;
      }
      msg->WriteSection(secname, ht, true);
   }
}
开发者ID:OS2World,项目名称:SYSTEM-LOADER-QSINIT,代码行数:20,代码来源:ldrini.cpp

示例12: LoadRemoteTokens

//---------------------------------------------------------------------------
void __fastcall TPropertiesDialog::LoadRemoteTokens(TComboBox * ComboBox,
  const TRemoteTokenList * List)
{
  TStrings * Items = ComboBox->Items;
  Items->BeginUpdate();
  try
  {
    Items->Clear();
    if (List != NULL)
    {
      int Count = List->Count();
      for (int Index = 0; Index < Count; Index++)
      {
        Items->Add(LoadRemoteToken(*List->Token(Index)));
      }
    }
  }
  __finally
  {
    Items->EndUpdate();
  }
}
开发者ID:seebigsea,项目名称:winscp,代码行数:23,代码来源:Properties.cpp

示例13: String

//---------------------------------------------------------------------------
int __fastcall TThdSend::GetScheme(TScheme *Scheme,String SchemeName)
{
  String      NodeName  = "自动派发";
  String      FileName  = String(TRjlSysVar()()->TradePath) + "\\TradeScheme.xml";
  TStringList *attr     = new TStringList();
  TStringList *cond     = new TStringList();

  if(SchemeName==""){
    TStrings *Header    = new TStringList();

    Header->Clear();
    TRjlXML::GetHead(FileName,Header);
    SchemeName = Header->Values["DftSend"];  //方案名为空的话取默认方案

    delete Header;
  }

  cond->Add("Name="+SchemeName);
  if(TRjlXML::GetNode(FileName,NodeName,cond,attr)<=0) {delete cond;delete attr;return -1;}
  if(attr->Count>0){
    Scheme->Name          = SchemeName;
    Scheme->ConsignPrice  = StrToInt(attr->Values["ConsignPrice"]);
    Scheme->FloatMny      = TRjlFunc::StrToDouble(attr->Values["FloatMny"]);
    Scheme->VolPercent    = TRjlFunc::StrToDouble(attr->Values["VolPercent"]);
    Scheme->VolScheme     = StrToInt(attr->Values["VolScheme"]);
    Scheme->Vol1          = StrToInt(attr->Values["Vol1"]);
    Scheme->Vol2          = StrToInt(attr->Values["Vol2"]);
    Scheme->TrdSec        = StrToInt(attr->Values["TrdSec"]);
    Scheme->Sec1          = StrToInt(attr->Values["Sec1"]);
    Scheme->Sec2          = StrToInt(attr->Values["Sec2"]);
    Scheme->TrdCancelTime = StrToInt(attr->Values["TrdCancelTime"]);
    Scheme->TrdCancelPrc  = TRjlFunc::StrToDouble(attr->Values["TrdCancelPrc"]);
  }

  delete cond;
  delete attr;
  return 0;
}
开发者ID:code4hunter,项目名称:oldpts,代码行数:39,代码来源:UThdSend.cpp

示例14: Download

//---------------------------------------------------------------------------
void __fastcall Download(TTerminal * Terminal, const UnicodeString FileName,
                         bool UseDefaults)
{
    UnicodeString TargetDirectory;
    TGUICopyParamType CopyParam = GUIConfiguration->DefaultCopyParam;
    TStrings * FileList = NULL;

    try
    {
        FileList = new TStringList();
        TRemoteFile * File = Terminal->Files->FindFile(FileName);
        if (File == NULL)
        {
            throw Exception(FMTLOAD(FILE_NOT_EXISTS, (FileName)));
        }
        FileList->AddObject(FileName, File);
        UnicodeString LocalDirectory = ExpandFileName(Terminal->SessionData->LocalDirectory);
        if (LocalDirectory.IsEmpty())
        {
            LocalDirectory = GetPersonalFolder();
        }
        TargetDirectory = IncludeTrailingBackslash(LocalDirectory);

        int Options = coDisableQueue;
        int CopyParamAttrs = Terminal->UsableCopyParamAttrs(0).Download;
        if (UseDefaults ||
                DoCopyDialog(false, false, FileList, TargetDirectory, &CopyParam,
                             Options, CopyParamAttrs, NULL))
        {
            Terminal->CopyToLocal(FileList, TargetDirectory, &CopyParam, 0);
        }
    }
    __finally
    {
        delete FileList;
    }
}
开发者ID:thinkinnight,项目名称:winscp,代码行数:38,代码来源:WinMain.cpp

示例15: SearchFiles

	bool SearchFiles(const TString& directory, TStrings & files, bool subFolders, const TString & mask)
	{
		if(!IsDirectoryExists(directory.c_str()))
			return false;

		TString path;
		HANDLE hFind;
		WIN32_FIND_DATA findData;
		TString searchPath;

		if(subFolders)
		{
			searchPath = CreatePath(directory, TEXT("*"));
			hFind = ::FindFirstFile(searchPath.c_str(), &findData);
			if(hFind != INVALID_HANDLE_VALUE) 
			{
				do 
				{
					TString name = findData.cFileName;
					if(name == TEXT(".") || name == TEXT(".."))
						continue;
					if((findData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
						SearchFiles(CreatePath(directory, name), files, subFolders, mask);
				} while(::FindNextFile(hFind, &findData)); 
				::FindClose(hFind);
			}
		}

		searchPath = CreatePath(directory, mask);
		hFind = ::FindFirstFile(searchPath.c_str(), &findData);
		if(hFind != INVALID_HANDLE_VALUE) 
		{
			do 
			{
				TString name = findData.cFileName;
				if(name == TEXT(".") || name == TEXT(".."))
					continue;
				if((findData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) == 0)
					files.push_back(CreatePath(directory, name));
			} while(::FindNextFile(hFind, &findData)); 
			::FindClose(hFind);
		}

		return true;
	}
开发者ID:flying19880517,项目名称:AntiDupl,代码行数:45,代码来源:adFileUtils.cpp


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