本文整理汇总了C++中TStringList类的典型用法代码示例。如果您正苦于以下问题:C++ TStringList类的具体用法?C++ TStringList怎么用?C++ TStringList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TStringList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShowMessage
//---------------------------------------------------------------------------
void __fastcall TMainForm::SpeedButtonTxtLoadClick(TObject *Sender){
if (ComboBoxTxtTerminal->Text =="") {
ShowMessage("请先选好出票终端,请确认文件游戏玩法数据此终端可以出票。");
return;
}
//打开彩票号码的文本文件,简单的校验一下,导入表格中
if (OpenDialogTxt->Execute()){
TStringList *lines =new TStringList();
lines->LoadFromFile(OpenDialogTxt->FileName);
if (lines->Count >=999) {
ShowMessage("每次文本出票张数不能超过1000张,请分次导入出票!");
delete lines;
return;
}
for (int i =0, lineIdx=1; i <lines->Count; i++) {
AnsiString line =lines->operator [](i);
if (line[1] =='#') continue; //忽略注释行
char *lineChars =line.c_str();
char *delim ="\t";
char *item;
int itemIndex =1;
item =strtok(lineChars, delim);
StringGridTxt->Cells[itemIndex++][lineIdx] =item;
while(item =strtok(NULL, delim)){
StringGridTxt->Cells[itemIndex++][lineIdx] =item;
if (itemIndex >7) break;
}
lineIdx ++;
}
if (lines->Count >0) {
ComboBoxTxtTerminal->Enabled =false;
SpeedButtonTxtPrint->Enabled =true;
}
delete lines;
}
}
示例2: GetDCMapSys
void __fastcall TPreferencencesForm::FillGroup(AnsiString Name)
{
g_pLocalStrings->SelectSection("PreferencencesForm");
String Caption = g_pLocalStrings->GetSectionStringW(Name.c_str());
AnsiString PluginClassName = "PPrefs_"+Name;
IDCMapSys* pSys = GetDCMapSys();
TStringList* List = new TStringList;
if(pSys->SelectClass(PluginClassName.c_str()))
{
TTreeNode* pNode = TreeView->Items->Add(0,Caption);
do
{
List->Add(pSys->GetPluginName());
}
while(pSys->Next());
List->Sort();
for(int i=0;i<List->Count;i++)
{
IDCMapVCLPanel* pPanel;
pPanel = GetDCMapCore()->CreateModuleTyped<IDCMapVCLPanel>(PluginClassName.c_str(),List->Strings[i].c_str());
if(!pPanel)continue;
TFrame* pFrame = pPanel->CreateFrame();
pFrame->Align = alClient;
pFrame->Visible = false;
pFrame->Parent = ClientPanel;
m_vecPanels.push_back(pPanel);
TreeView->Items->AddChildObject(pNode,pPanel->GetCaption(),pFrame);
}
delete List;
}
}
示例3: ReadAntList
//---------------------------------------------------------------------------
void __fastcall TOptDialog::ReadAntList(void)
{
AnsiString AntPcvFile_Text=AntPcvFile->Text;
TStringList *list;
pcvs_t pcvs={0};
char *p;
if (!readpcv(AntPcvFile_Text.c_str(),&pcvs)) return;
list=new TStringList;
list->Add("");
list->Add("*");
for (int i=0;i<pcvs.n;i++) {
if (pcvs.pcv[i].sat) continue;
if ((p=strchr(pcvs.pcv[i].type,' '))) *p='\0';
if (i>0&&!strcmp(pcvs.pcv[i].type,pcvs.pcv[i-1].type)) continue;
list->Add(pcvs.pcv[i].type);
}
RovAnt->Items=list;
RefAnt->Items=list;
free(pcvs.pcv);
}
示例4: RemoveComments
//***************************************************
int Logic::RemoveComments(TStringList Lines)
{
int CommentDepth = 0;
for(CurLine=0;CurLine<Lines.num;CurLine++){
string Line = Lines.at(CurLine);
string NewLine;
bool InQuotes = false;
for ( unsigned i=0; i<Line.size(); ++i ){
if ( !InQuotes ){
if (CommentDepth==0 && Line[i] == '[')
break;
if (i<Line.size()-1){
if (CommentDepth==0 && Line.substr(i,2) == "//")
break;
else if ( Line.substr(i,2) == "/*"){
++CommentDepth;
++i;
continue;
}
}
else if (CommentDepth>0 && Line.substr(i,2) == "*/" ){
--CommentDepth;
++i;
continue;
}
}
if ( CommentDepth == 0 ){
if(Line[i]=='\"' && (i==0 || Line[i-1] != '\\'))
InQuotes = !InQuotes;
NewLine += Line[i];
}
}
Lines.replace(CurLine,NewLine);
}
return 0;
}
示例5: ReadSectionValues
void TIniFile::ReadSectionValues(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)
{
V = GetValue(FFileBuffer->Item(I), N);
Strings.Add(N + IniSeparator + V);
}
++I;
}
}
}
} /* ? *//* FINALLY */
catch (...)
{
Strings.EndUpdate();
}
}
示例6: addEntry
void AutoSearchFrame::addEntry(AutoSearch& search, int index) {
TStringList l;
l.push_back(Text::toT(search.searchString));
l.push_back(Text::toT(TypeModesToString(search.sourceType)));
l.push_back(Text::toT(SizeModesToString(search.sizeModes)));
l.push_back(Text::toT(Util::toString(search.size)));
l.push_back(Text::toT(SizeTypeToString(search.typeFileSize)));
l.push_back(Text::toT(FdmUtil::toString(FdmUtil::toBool(search.onlyIfOp))));
int itemCount = items->insert(l, 0, index);
if(index == -1)
index = itemCount;
items->setChecked(index, search.isActive);
items->ensureVisible(index);
}
示例7: UpdateSearch
// Update a specific search item
void ADLSearchFrame::UpdateSearch(int index, BOOL doDelete)
{
ADLSearchManager::SearchCollection& collection = ADLSearchManager::getInstance()->collection;
// Check args
if(index >= (int)collection.size())
{
return;
}
ADLSearch& search = collection[index];
// Delete from list control
if(doDelete)
{
ctrlList.DeleteItem(index);
}
// Generate values
TStringList line;
tstring fs;
line.push_back(Text::toT(search.searchString));
line.push_back(search.SourceTypeToDisplayString(search.sourceType));
line.push_back(Text::toT(search.destDir));
fs = _T("");
if(search.minFileSize >= 0)
{
fs = Util::toStringW(search.minFileSize);
fs += _T(" ");
fs += search.SizeTypeToDisplayString(search.typeFileSize);
}
line.push_back(fs);
fs = _T("");
if(search.maxFileSize >= 0)
{
fs = Util::toStringW(search.maxFileSize);
fs += _T(" ");
fs += search.SizeTypeToDisplayString(search.typeFileSize);
}
line.push_back(fs);
// Insert in list control
ctrlList.insert(index, line);
// Update 'Active' check box
ctrlList.SetCheckState(index, search.isActive);
}
示例8: addEntry
void FavoriteHubsFrame::addEntry(const FavoriteHubEntry* entry, int pos, int groupIndex) {
TStringList l;
l.push_back(Text::toT(entry->getName()));
l.push_back(Text::toT(entry->getDescription()));
l.push_back(Text::toT(entry->getNick(false)));
l.push_back(tstring(entry->getPassword().size(), 0x25CF));
l.push_back(Text::toT(entry->getServer()));
l.push_back(Text::toT(entry->getUserDescription()));
bool b = entry->getConnect();
int i = ctrlHubs.insert(pos, l, 0, (LPARAM)entry);
ctrlHubs.SetCheckState(i, b);
LVITEM lvItem = { 0 };
lvItem.mask = LVIF_GROUPID;
lvItem.iItem = i;
lvItem.iSubItem = 0;
lvItem.iGroupId = groupIndex;
ctrlHubs.SetItem( &lvItem );
}
示例9: GetData
//---------------------------------------------------------------------------
void __fastcall XmlDataProvider::GetData(TStringList &MyValues)
{
String xmlfile = "items.xml";
CoInitialize(NULL);
ISAXXMLReader* pRdr = NULL;
HRESULT hr = CoCreateInstance(
__uuidof(SAXXMLReader),
NULL,
CLSCTX_ALL,
__uuidof(ISAXXMLReader),
(void **)&pRdr);
if (!FAILED(hr))
{
ISAXContentHandler* pContentHandler = new CSaxContentHandlerImp(MyValues);
pRdr->putContentHandler(pContentHandler);
//SAXErrorHandlerImpl * pEc = new SAXErrorHandlerImpl();
//hr = pRdr->putErrorHandler(pEc);
// SAXDTDHandlerImpl * pDc = new SAXDTDHandlerImpl();
// hr = pRdr->putDTDHandler(pDc);
if (FAILED((hr = pRdr->parseURL((wchar_t*)(xmlfile.c_str())))))
MyValues.Add("parsing failed");
pRdr->Release();
delete pContentHandler;
}
else
{
ShowMessage("Error creating COM object");
}
CoUninitialize();
}
示例10: TStringList
void __fastcall TForm1::FileSaveAs1Accept(TObject *Sender)
{
String a = FileSaveAs1->Dialog->FileName;
if (a!=""){
// Speichern
if (ExtractFileExt(a).UpperCase()!=".AD")a=a.SubString(1,a.Length()-ExtractFileExt(a).Length())+".ad";
TStringList *List = new TStringList();
List->Add(IntToStr(Max));
List->Add(Edit1->Text);
for (int i=0;i<Max;i++){
List->Add(ListBox1->Items->Strings[i]);
for (int b=0;b<66;b++){
List->Add(IntToStr(Data[i][b]));
}
}
List->SaveToFile(a);
}
}
示例11: GetBookmarkList
//---------------------------------------------------------------------------
void __fastcall TLocationProfilesDialog::RemoveBookmark(TObject * Sender)
{
TBookmarkList * BookmarkList = GetBookmarkList(Sender);
TTreeView * ProfilesView = GetProfilesView(Sender);
TStringList * Folders = GetFolders(Sender);
assert(ProfilesView->Selected);
TTreeNode * Node = ProfilesView->Selected;
if (Node->Data)
{
BookmarkList->Delete((TBookmark *)Node->Data);
TTreeNode * ParentNode = Node->Parent;
Node->Delete();
if (ParentNode && !ParentNode->Count)
{
assert(Folders->IndexOfObject(ParentNode) >= 0);
Folders->Delete(Folders->IndexOfObject(ParentNode));
ParentNode->Delete();
}
}
else
{
UnicodeString Message = MainInstructions(LoadStr(DELETE_BOOKMARK_FOLDER));
if (MessageDialog(Message, qtConfirmation,
qaYes | qaNo, HELP_LOCATION_PROFILE_DELETE) == qaYes)
{
assert(Node->Count);
for (int i = 0; i < Node->Count; i++)
{
BookmarkList->Delete((TBookmark *)Node->Item[i]->Data);
}
assert(Folders->IndexOfObject(Node) >= 0);
Folders->Delete(Folders->IndexOfObject(Node));
Node->Delete();
}
}
UpdateControls();
}
示例12: new
void __fastcall TfMain::FormShow(TObject *Sender)
{
TStringList* sl = new(TStringList);
sl->NameValueSeparator = '=';
TFile f;
if(f.Exists(ExtractFileDir(Application->ExeName) + "\\Library.lb")){
sl->LoadFromFile(GetCurrentDir() + "\\Library.lb");
for(int i = 0; i < sl->Count; i++){
TListItem* Item = lvLib->Items->Add();
Item->Caption = ExtractFileName(sl->Names[i]);
Item->GroupID = 0;
Item->SubItems->Add(sl->Names[i]); //path [0]
TStringList* ss = new(TStringList);
ss->NameValueSeparator = '/';
ss->Add(sl->ValueFromIndex[i]);
Item->SubItems->Add(ss->Names[0]); //bookmark [1]
Item->SubItems->Add(ss->ValueFromIndex[0]); //size [2]
ss->~TStringList();
}
}
sl->Clear();
if(f.Exists(ExtractFileDir(Application->ExeName) + "\\Settings.ini")){
sl->LoadFromFile(GetCurrentDir() + "\\Settings.ini");
leLogin->Text = sl->ValueFromIndex[0];
lePass->Text = sl->ValueFromIndex[1];
if(sl->ValueFromIndex[2] == "1")
cbRememberPass->Checked = true;
else
cbRememberPass->Checked = false;
leServer->Text = sl->ValueFromIndex[3];
}
sl->~TStringList();
}
示例13: BOOST_FIXTURE_TEST_CASE
BOOST_FIXTURE_TEST_CASE(test1, base_fixture_t)
{
if (1)
{
UnicodeString Text = ::StringOfChar(' ', 4);
BOOST_CHECK_EQUAL(" ", W2MB(Text.c_str()).c_str());
}
if (1)
{
UnicodeString Message = L"long long long long long long long long long text";
TStringList MessageLines;
int MaxMessageWidth = 20;
FarWrapText(Message, &MessageLines, MaxMessageWidth);
BOOST_TEST_MESSAGE("MessageLines = " << W2MB(MessageLines.GetText().c_str()));
BOOST_CHECK_EQUAL(4, MessageLines.GetCount());
BOOST_CHECK_EQUAL("long long long", W2MB(MessageLines.GetString(0).c_str()).c_str());
BOOST_CHECK_EQUAL("long long long", W2MB(MessageLines.GetString(1).c_str()).c_str());
BOOST_CHECK_EQUAL("long long long", W2MB(MessageLines.GetString(2).c_str()).c_str());
BOOST_CHECK_EQUAL("text", W2MB(MessageLines.GetString(3).c_str()).c_str());
}
}
示例14: PropPage
FavoriteDirsPage::FavoriteDirsPage(dwt::Widget* parent) : PropPage(parent) {
createDialog(IDD_FAVORITE_DIRSPAGE);
setHelpId(IDH_FAVORITE_DIRSPAGE);
WinUtil::setHelpIds(this, helpItems);
PropPage::translate(handle(), texts);
attachChild(directories, IDC_FAVORITE_DIRECTORIES);
directories->setTableStyle(LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT);
TStringList columns;
columns.push_back(T_("Favorite name"));
columns.push_back(T_("Directory"));
directories->createColumns(columns);
directories->setColumnWidth(0, 100);
directories->setColumnWidth(1, directories->getSize().x - 120);
StringPairList dirs = FavoriteManager::getInstance()->getFavoriteDirs();
for(StringPairIter j = dirs.begin(); j != dirs.end(); j++) {
TStringList row;
row.push_back(Text::toT(j->second));
row.push_back(Text::toT(j->first));
directories->insert(row);
}
directories->onDblClicked(std::tr1::bind(&FavoriteDirsPage::handleDoubleClick, this));
directories->onKeyDown(std::tr1::bind(&FavoriteDirsPage::handleKeyDown, this, _1));
directories->onRaw(std::tr1::bind(&FavoriteDirsPage::handleItemChanged, this, _1, _2), dwt::Message(WM_NOTIFY, LVN_ITEMCHANGED));
onDragDrop(std::tr1::bind(&FavoriteDirsPage::handleDragDrop, this, _1));
attachChild<Button>(IDC_RENAME)->onClicked(std::tr1::bind(&FavoriteDirsPage::handleRenameClicked, this));
attachChild<Button>(IDC_REMOVE)->onClicked(std::tr1::bind(&FavoriteDirsPage::handleRemoveClicked, this));
attachChild<Button>(IDC_ADD)->onClicked(std::tr1::bind(&FavoriteDirsPage::handleAddClicked, this));
}
示例15: TMemoryStream
void __fastcall TFrListMail::RzToolButton1Click(TObject *Sender)
{ TMemoryStream *pms= new TMemoryStream();
TStringList *LS =new TStringList();
struct rMail rMail;
AnsiString NewFileName;
int i,viTmpMINfTurn;
AnsiString vsQRaspRaspNameRTF;
//Если распоряжение уже рассылалось, то не рассылать, если не имеешь на то дополнительных прав.
/* vsSQLQw="SELECT Id24NameStatus FROM bm_Rasp "
" WHERE Idn=:D0 ; ";
Qw->Close();Qw->SQL->Clear();Qw->SQL->Add(vsSQLQw);
Qw->Parameters->Items[0]->Value= IdRasp;
Qw->Open();
if((Qw->Fields->Fields[0]->AsInteger==5448350)&&(!MainForm->flEditAllRasp)) // Id24NameStatus=5448350//На утверждении
{ShowMessage(AnsiString("Это распоряжени уже разосланно на утверждение")); return; }
*/ //Просто не Enable кнопку рассылки
///
if (pcSoglasovanieRassilka->ActivePage==tsSoglasovanie)
{ ///проверка на отсутствие "_Копия" и "Новый подписной индекс"
StartProcedure:
vsSQLQw = " SELECT TOP 1 Idn FROM bm_RaspDetail "
" WHERE idRasp=:D0 AND DateDel is NULL "
" AND LTRIM(RTRIM(NameRaspDetail)) LIKE '%_Копия%'; "; //? Копия_
Qw->Close();Qw->SQL->Clear();Qw->SQL->Add(vsSQLQw);
Qw->Parameters->Items[0]->Value=IdRasp;
Qw->Open();
if(Qw->RecordCount>0)// { ShowMessage("Рассылка невозможна. \n В названиях подписных индексов присутствует слово '_Копия'"); return;}
{
if (MessageDlg("Рассылка невозможна. \n В названиях присутствует слово '_Копия'. Редактировать?",mtConfirmation,TMsgDlgButtons()<<mbYes<<mbNo,0)!=mrYes)
{return;}else
{
{try{Opts.Clear();locvalues[0]=Variant(Qw->Fields->Fields[0]->AsInteger);FrBisniessMenedger->QRaspDetail->Locate("Idn",locvalues,Opts);}catch(...){};};
FrBisniessMenedger->btUpdRaspDetailClick(Sender);
goto StartProcedure;
}
}
vsSQLQw = " SELECT TOP 1 Idn, isnull(PIdn,0) FROM bm_RaspDetail "
" WHERE idRasp=:D0 AND DateDel is NULL "
" AND LTRIM(RTRIM(NameRaspDetail))='Новый подписной индекс' ; ";
Qw->Close();Qw->SQL->Clear();Qw->SQL->Add(vsSQLQw);
Qw->Parameters->Items[0]->Value=IdRasp;
Qw->Open();
if(Qw->RecordCount>0)
{
if (MessageDlg("Рассылка невозможна. \n В названиях подписных индексов присутствует 'Новый подписной индекс'. Удалить?",mtConfirmation,TMsgDlgButtons()<<mbYes<<mbNo,0)!=mrYes)
{ if (MessageDlg(" Редактировать 'Новый подписной индекс'?",mtConfirmation,TMsgDlgButtons()<<mbYes<<mbNo,0)!=mrYes)
{return;}else
{
{try{Opts.Clear();locvalues[0]=Variant(Qw->Fields->Fields[0]->AsInteger);FrBisniessMenedger->QRaspDetail->Locate("Idn",locvalues,Opts);}catch(...){};};
FrBisniessMenedger->btUpdRaspDetailClick(Sender);
goto StartProcedure;
}
}//Сделать переход к редактированию.
else
{ int TmpIdnPIForDel,TmpIdnComplForDel;
TmpIdnComplForDel=0;
TmpIdnPIForDel=Qw->Fields->Fields[0]->AsInteger;
TmpIdnComplForDel=Qw->Fields->Fields[1]->AsInteger;
vsSQLQw = " DECLARE @Idn int; SET @Idn=:D0; "
" DELETE FROM bm_RaspDetail "
" WHERE [email protected] OR [email protected]; ";
Qw->Close();Qw->SQL->Clear();Qw->SQL->Add(vsSQLQw);
Qw->Parameters->Items[0]->Value=TmpIdnPIForDel;
Qw->ExecSQL();
if(TmpIdnComplForDel>0)
{
vsSQLQw= " DECLARE @IdInsMod int, @Idn int, @CostWithNDS money, @CostWithoutNDS money, @CostMINWithNDS money, @CostMINWithoutNDS money"
" SET @Idn=:D0"
" SET @IdInsMod=:D1"
" SELECT @CostWithoutNDS=SUM(CostWithoutNDS),@CostWithNDS=SUM(CostWithNDS),@CostMINWithoutNDS=SUM(CostMINWithoutNDS),@CostMINWithNDS=SUM(CostMINWithNDS)"
" FROM bm_RaspDetail"
" WHERE fType=2 AND PIdn [email protected] and DateDel is null;"
" UPDATE bm_RaspDetail SET"
" CostWithNDS [email protected] "
" ,CostWithoutNDS [email protected] "
" ,CostMINWithNDS [email protected] "
" ,CostMINWithoutNDS [email protected] "
" ,DateMod = GetDate() "
" ,IdMod [email protected] "
" WHERE Idn= @Idn ;" ;
Qw->Close();Qw->SQL->Clear();Qw->SQL->Add(vsSQLQw);
Qw->Parameters->Items[0]->Value=TmpIdnComplForDel;
Qw->Parameters->Items[1]->Value=PermisHdr.KeyUserStartProgramm;;
Qw->ExecSQL();
}
ShowMessage("Подписной индекс с наименованием 'Новый подписной индекс' удален.\n Рассылка запустится повторно. ");
goto StartProcedure;
// return;
//.........这里部分代码省略.........