本文整理汇总了C++中TStrings类的典型用法代码示例。如果您正苦于以下问题:C++ TStrings类的具体用法?C++ TStrings怎么用?C++ TStrings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TStrings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ecmd_readfsdetect
/** return FS detection list.
Function returns parsed [fsdetect] section contents, in the single module
owned heap block. Last entry in this list is zero-filled */
fs_detect_list* ecmd_readfsdetect() {
TStrings lst;
if (!ecmd_readsec("fsdetect",lst)) return 0;
u32t ii, blen = 0, nlen = 0, ecnt = 0;
for (ii=0; ii<lst.Count(); ii++) {
// filter out commented lines
if (lst[ii][0]!=';') {
spstr val = lst.Value(ii);
if (val.words(",")==2) {
blen += val.word(2,",").words();
nlen += lst.Name(ii).trim().length()+1;
ecnt++;
continue;
}
}
lst[ii].clear();
}
if (!blen || !nlen) return 0;
// alloc/calc block pointers
u32t listlen = sizeof(fs_detect_list)*(ecnt+1), idx;
fs_detect_list *res = (fs_detect_list*)malloc(listlen+blen+nlen);
char *nptr = (char*)res + listlen;
u8t *dptr = (u8t*)nptr + nlen;
// zero last entry
memset(res+ecnt, 0, sizeof(fs_detect_list));
// build return information in the single memory block
for (ii=0, idx=0; ii<lst.Count(); ii++)
if (lst[ii].length()) {
spstr val = lst.Value(ii),
key = lst.Name(ii).trim();
spstr bstr = val.word(2,",");
res[idx].fsname = nptr;
res[idx].offset = val.word_Dword(1,",");
res[idx].size = bstr.words();
res[idx].cmpdata = dptr;
// fa name
memcpy(nptr, key(), key.length()+1);
nptr += key.length()+1;
// binary data to cmp
for (u32t ll=0; ll<res[idx].size; ll++)
*dptr++ = strtoul(bstr() + bstr.wordpos(ll+1), 0, 16);
idx++;
}
return res;
}
开发者ID:OS2World,项目名称:SYSTEM-LOADER-QSINIT,代码行数:50,代码来源:ldrini.cpp
示例17: TStringList
//---------------------------------------------------------------------------
void __fastcall TSup1011::addItensExecute(TObject *Sender)
{
TStrings *SQL = new TStringList();
SQL->Add("SELECT p.cod_produto, p.den_produto, p.cod_unid_medida, 0 val_produto");
SQL->Add("FROM tbl_produto p");
SQL->Add("WHERE p.cod_familia = :cod_familia");
SQL->Add("AND p.ies_ativo = 'S'");
SQL->Add("ORDER BY p.cod_produto");
TSup1004 *Sup1004 = new TSup1004(Application);
Sup1004->OnConfirmList = &addItensConfirm;
Sup1004->QyCnsProduto->SQL->Assign(SQL);
Sup1004->edtQtd->Text = '1';
Sup1004->edtQtd->Visible = false;
Sup1004->lbQtde->Visible = false;
Sup1004->ShowModal();
delete Sup1004;
delete SQL;
}
开发者ID:jpwerka,项目名称:SistemaSFG,代码行数:19,代码来源:uSup1011.cpp
示例18: get_keylist
str_list* get_keylist(TINIFile *ini, const char *Section, str_list**values) {
TStrings lst;
ini->ReadSectionKeys(Section,lst);
if (!values) {
lst.TrimEmptyLines();
} else {
TStrings vlst;
ini->ReadSectionValues(Section,vlst);
int ii;
while (ii<=lst.Max()) {
spstr sk(lst[ii]), sv(vlst[ii]);
if (!sk.trim().length() && !sv.trim().length())
{ lst.Delete(ii); vlst.Delete(ii); } else ii++;
}
*values = str_getlist_local(vlst.Str);
}
return str_getlist_local(lst.Str);
}
开发者ID:OS2World,项目名称:SYSTEM-LOADER-QSINIT,代码行数:18,代码来源:ldrini.cpp
示例19: str_mergeargs
char* _std str_mergeargs(str_list*list) {
TStrings lst;
str_getstrs(list,lst);
return strdup(lst.MergeCmdLine()());
}
开发者ID:OS2World,项目名称:SYSTEM-LOADER-QSINIT,代码行数:5,代码来源:ldrini.cpp
示例20: GetBookmarkList
//---------------------------------------------------------------------------
bool __fastcall TLocationProfilesDialog::AddAsBookmark(TObject * Sender, bool Initial)
{
TBookmarkList * BookmarkList = GetBookmarkList(Sender);
TTreeView * ProfilesView = GetProfilesView(Sender);
assert(!LocalDirectory.IsEmpty() || !RemoteDirectory.IsEmpty());
bool Result;
UnicodeString BookmarkName;
if ((OperationSide == osLocal && !LocalDirectory.IsEmpty()) ||
RemoteDirectory.IsEmpty())
{
BookmarkName = LocalDirectory;
}
else
{
BookmarkName = RemoteDirectory;
}
TTreeNode * Selected = ProfilesView->Selected;
TBookmark * SelectedBookmark = NULL;
UnicodeString SelectedNode;
if (Selected != NULL)
{
assert(!Initial);
SelectedBookmark = (TBookmark *)Selected->Data;
if (SelectedBookmark != NULL)
{
SelectedNode = SelectedBookmark->Node;
}
else
{
SelectedNode = Selected->Text;
}
}
TStrings * PeerBookmarks = new TStringList();
try
{
for (int Index = 0; Index < BookmarkList->Count; Index++)
{
TBookmark * Bookmark = BookmarkList->Bookmarks[Index];
if (Bookmark->Node == SelectedNode)
{
PeerBookmarks->Add(Bookmark->Name);
}
}
TBookmarkNameDialog * Dialog = new TBookmarkNameDialog(PeerBookmarks, Initial);
try
{
bool Shared = WinConfiguration->UseSharedBookmarks;
Result = Dialog->Execute(BookmarkName, Shared);
if (Result)
{
if (Initial)
{
WinConfiguration->UseSharedBookmarks = Shared;
BookmarkList = GetBookmarkList(GetProfilesSheet());
ProfilesView = GetProfilesView(GetProfilesSheet());
}
TBookmark * Bookmark = BookmarkList->FindByName(SelectedNode, BookmarkName);
if (Bookmark != NULL)
{
Bookmark->Local = LocalDirectory;
Bookmark->Remote = RemoteDirectory;
for (int Index = 0; Index < ProfilesView->Items->Count; Index++)
{
TTreeNode * Node = ProfilesView->Items->Item[Index];
if (Node->Data == Bookmark)
{
Selected = Node;
break;
}
}
}
else
{
Bookmark = new TBookmark();
Bookmark->Name = BookmarkName;
Bookmark->Local = LocalDirectory;
Bookmark->Remote = RemoteDirectory;
if (SelectedBookmark != NULL)
{
Bookmark->Node = SelectedBookmark->Node;
BookmarkList->InsertBefore(SelectedBookmark, Bookmark);
Selected = ProfilesView->Items->InsertObject(Selected, BookmarkText(Bookmark), Bookmark);
}
else if ((Selected != NULL) && (SelectedBookmark == NULL))
{
// must be a folder
assert(!Selected->Parent); // more than one level of folders is not supported
Bookmark->Node = Selected->Text;
BookmarkList->Add(Bookmark);
Selected = ProfilesView->Items->AddChildObject(Selected, BookmarkText(Bookmark), Bookmark);
}
else
//.........这里部分代码省略.........
开发者ID:elazzi,项目名称:winscp,代码行数:101,代码来源:LocationProfiles.cpp
注:本文中的TStrings类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论