本文整理汇总了C++中AnsiString类的典型用法代码示例。如果您正苦于以下问题:C++ AnsiString类的具体用法?C++ AnsiString怎么用?C++ AnsiString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AnsiString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SGnewSetEditText
void __fastcall TMainForm::SGnewSetEditText(TObject *Sender, int ACol,
int ARow, const AnsiString Value){
if (ACol == 3 && Value.Length()>=1){WriteToMemory(ARow-1, Value);}
}
示例2: Trim
// редактирование информации о КХР
bool TController::editKHR()
{
// происходит проверка на заполненность полей
if(Trim(formKHR->edtOrderNum->Text) == "" || Trim(formKHR->edtKHRNum->Text) == "" ||
Trim(formKHR->edtName->Text) == "" || Trim(formKHR->edtShort->Text) == "")
{
// какие-то данные не заполнены
//ShowMessage("Не все данные заполнены!");
return false;
}
string nfile;
selectedKHR->szOrder = STR(formKHR->edtOrderNum->Text);
selectedKHR->szNumber = STR(formKHR->edtKHRNum->Text);
selectedKHR->szTitle = STR(formKHR->edtName->Text);
selectedKHR->dtStartDate = formKHR->dtStartDate->Date;
selectedKHR->szFileName = STR(formKHR->edtShort->Text);
selectedKHR->selected = true;
for (unsigned int i=0; i < selectedKHR->Executors.size(); i++)
delete selectedKHR->Executors[i];
selectedKHR->Executors.clear();
for (unsigned int i=0; i < selectedKHR->Signatures.size(); i++)
delete selectedKHR->Signatures[i];
selectedKHR->Signatures.clear();
int execid = 1;
for(int i=0; i < formKHR->sgExecutors->RowCount; i++)
{
if (Trim(formKHR->sgExecutors->Cells[0][i])!="")
{
TExecutor *exec = new TExecutor;
exec->id = execid++;
AnsiString tt = formKHR->sgExecutors->Cells[0][i];
// exec->szName = formKHR->sgExecutors->Cells[0][i].c_str();
exec->szName = tt.c_str();
selectedKHR->Executors.push_back(exec);
}
}
for(int i=0; i < formKHR->sgSigns->RowCount; i++)
{
if (Trim(formKHR->sgSigns->Cells[0][i])!=""&&Trim(formKHR->sgSigns->Cells[1][i])!="")
{
TSignature *sig = new TSignature;
sig->szChair = STR(formKHR->sgSigns->Cells[0][i]);
sig->szName = STR(formKHR->sgSigns->Cells[1][i]);
selectedKHR->Signatures.push_back(sig);
}
}
formKHR->edtOrderNum -> Text = "";
formKHR->edtKHRNum -> Text = "";
formKHR->edtName -> Text = "";
for(int i=0; i < formKHR->sgSigns->RowCount; i++)
{
formKHR->sgSigns->Cells[0][i]="";
formKHR->sgSigns->Cells[1][i]="";
}
for(int i=0; i < formKHR->sgExecutors->RowCount; i++)
formKHR->sgExecutors->Cells[0][i]="";
clearSelected();
formKHR->Close();
showAll();
return true;
}
示例3: Open
/*#$%
==============================================================
通信回線をオープンしスレッドをアクティブにする
--------------------------------------------------------------
PortName : 回線の名前
pCP : COMMPARAのポインタ(ヌルの時はデフォルトで初期化)
pWnd : メッセージ送信先のウインドウクラスのポインタ(ヌルの時はメインフレームウインドウ)
nID : データ受信時のメッセージID
RBufSize : 受信バッファのサイズ(default=2048)
TBufSize : 送信バッファのサイズ(default=2048)
--------------------------------------------------------------
TRUE/FALSE
--------------------------------------------------------------
==============================================================
*/
BOOL __fastcall CCradio::Open(CRADIOPARA *cp, HWND hwnd, UINT uMsg, UINT nID)
{
if( m_CreateON == TRUE ) Close();
m_RigHz = m_FreqHz = 0;
m_TxAbort = FALSE;
m_PSKGNRId = 0;
m_OpenGNR = 0;
if( !strcmpi(cp->StrPort, "PSKGNR") || !strcmpi(cp->StrPort, "WD5GNR") || !strcmpi(cp->StrPort, "LOGGER")){
m_PSKGNRId = ::RegisterWindowMessage("PSKGNRFUNC");
m_CreateON = TRUE;
if( RADIO.openGNR && (!RADIO.cmdGNR.IsEmpty()) && (strcmpi(cp->StrPort, "LOGGER")) ){
if( FindWindow("ThunderRT6Main", NULL) == NULL ){
::WinExec(RADIO.cmdGNR.c_str(), SW_HIDE);
m_OpenGNR = 1;
}
}
return m_CreateON;
}
m_fHnd = ::CreateFile(cp->StrPort, GENERIC_READ | GENERIC_WRITE,
0, NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL
);
if( m_fHnd == INVALID_HANDLE_VALUE ){
AnsiString as = "\\\\.\\";
as += cp->StrPort;
m_fHnd = ::CreateFile(as.c_str(), GENERIC_READ | GENERIC_WRITE,
0, NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL
);
}
m_wHnd = hwnd;
m_uMsg = uMsg;
m_ID = nID;
if( m_fHnd == INVALID_HANDLE_VALUE ) goto _mmr;
// setup device buffers
if( ::SetupComm( m_fHnd, DWORD(RADIO_COMBUFSIZE), DWORD(RADIO_COMBUFSIZE) ) == FALSE ){
::CloseHandle(m_fHnd);
_mmr:;
m_pRadio = new CMMRadio(hwnd, uMsg);
if( m_pRadio->Open(cp->StrPort) ){
m_CreateON = TRUE;
Priority = tpLower;
Resume(); // スレッドの実行
return TRUE;
}
else {
delete m_pRadio;
m_pRadio = NULL;
return FALSE;
}
}
// purge any information in the buffer
::PurgeComm( m_fHnd, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR );
// set up for overlapped I/O
COMMTIMEOUTS TimeOut;
TimeOut.ReadIntervalTimeout = 0xffffffff;
TimeOut.ReadTotalTimeoutMultiplier = 0;
TimeOut.ReadTotalTimeoutConstant = 0;
TimeOut.WriteTotalTimeoutMultiplier = 0;
TimeOut.WriteTotalTimeoutConstant = 20000;
// TimeOut.WriteTotalTimeoutConstant = 1;
if( !::SetCommTimeouts( m_fHnd, &TimeOut ) ){
::CloseHandle( m_fHnd );
return FALSE;
}
::GetCommState( m_fHnd, &m_dcb );
m_dcb.BaudRate = cp->BaudRate;
m_dcb.fBinary = TRUE;
m_dcb.ByteSize = USHORT(cp->BitLen ? 8 : 7);
const UCHAR _tp[]={NOPARITY, EVENPARITY, ODDPARITY};
m_dcb.Parity = _tp[cp->Parity];
const UCHAR _ts[]={ONESTOPBIT,TWOSTOPBITS};
m_dcb.StopBits = _ts[cp->Stop];
if( cp->usePTT ){
m_dcb.fRtsControl = RTS_CONTROL_DISABLE; // 送信禁止
m_dcb.fDtrControl = DTR_CONTROL_DISABLE; // 送信禁止
}
else {
//.........这里部分代码省略.........
示例4: switch
//---------------------------------------------------------------------------
void __fastcall TParallelPort::OKClick(TObject *Sender)
{
if (OutFile) { fclose(OutFile); OutFile=NULL; }
if (ComPort->Connected) ComPort->Close();
switch(ComPortList->ItemIndex)
{
case 0:
Port=PORTNOTHING;
break;
case 1:
Port=PORTFILE;
OutFile=fopen((OutputFileEdit->Text).c_str(), "wb");
break;
case 2:
Port=PORTTCPIP;
ClientSocket->Host = TCPAddress->Text;
ClientSocket->Port = atoi((TCPPort->Text).c_str());
if ((ClientSocket->Host != "") && (ClientSocket->Port!=0))
ClientSocket->Open();
break;
default:
AnsiString Port=ComPortList->Items->Strings[ComPortList->ItemIndex];
if (Port.SubString(1,3)=="LPT")
{
Port=PORTFILE;
OutFile=fopen(Port.c_str(), "wb");
}
else
{
Port=PORTRS232;
ComPort->Port=Port;
switch(DataBits->ItemIndex)
{
case 0: ComPort->DataBits = dbFive; break;
case 1: ComPort->DataBits = dbSix; break;
case 2: ComPort->DataBits = dbSeven; break;
case 3: ComPort->DataBits = dbEight; break;
default: ComPort->DataBits = dbEight; break;
}
switch(StopBits->ItemIndex)
{
case 0: ComPort->StopBits = sbOneStopBit; break;
case 1: ComPort->StopBits = sbOne5StopBits; break;
case 2: ComPort->StopBits = sbTwoStopBits; break;
default: ComPort->StopBits = sbOneStopBit; break;
}
switch(Parity->ItemIndex)
{
case 0: ComPort->Parity->Bits = prNone; ComPort->Parity->Check=false; break;
case 1: ComPort->Parity->Bits = prOdd; ComPort->Parity->Check=true; break;
case 2: ComPort->Parity->Bits = prEven; ComPort->Parity->Check=true; break;
case 3: ComPort->Parity->Bits = prMark; ComPort->Parity->Check=true; break;
case 4: ComPort->Parity->Bits = prSpace; ComPort->Parity->Check=true; break;
}
ComPort->BaudRate=brCustom;
if (BaudRate->ItemIndex==0)
ComPort->CustomBaudRate=atoi((BaudRate->Items->Strings[BaudRate->ItemIndex]).c_str());
try { ComPort->Open(); }
catch(EComPort &E)
{
AnsiString Msg = "Could not open port ";
Msg += ComPortList->Items->Strings[ComPortList->ItemIndex];
if (Sender) Application->MessageBox(Msg.c_str(),"Error", MB_OK | MB_ICONERROR);
}
}
break;
}
if (ComPort->Connected)
ComPort->ClearBuffer(true,true);
Close();
}
示例5: SaveConfig
void TConfDlg::SaveConfig(const AnsiString &File) {
HANDLE file;
DWORD type,Written;
int i;
CHostRef *host;
AnsiString FailedName="NONE";
file = CreateFileA(File.c_str(),GENERIC_WRITE,0,0,CREATE_ALWAYS,
FILE_FLAG_SEQUENTIAL_SCAN,0);
if(file == INVALID_HANDLE_VALUE) {
Application->MessageBox("Cannot create file!","Error",MB_OK|MB_ICONERROR);
return;
}
// Remove the configuration from hosts
// That do not have an individual configuration
for(i =0;i<LastList->Count;++i) {
host = (CHostRef*)(LastList->Objects[i]);
if(host) host->RemoveConfigRefs();
}
FailedName="MAGIC";
type = MAGIC;
if(!WriteFile(file,&type,sizeof(DWORD),&Written,0)) goto Remove;
FailedName="FILE_VERSION";
type = FILE_VERSION;
if(!WriteFile(file,&type,sizeof(DWORD),&Written,0)) goto Remove;
FailedName="Plugin";
if(!WritePlugin(file,PluginManager.GetActualPlugin())) goto Remove;
FailedName = "WriteConfigData";
if(!WriteConfigData(file,&GlobalConfig)) goto Remove;
FailedName="WriteHost";
for(i=0;i<LastList->Count;++i) {
if(!WriteHost(file,(HostData*)*(CHostRef*)LastList->Objects[i]))
goto Remove;
}
//SI: 13.06.05 Write Account at last position
//SI: 14.06.05 save without Write Account possible
FailedName="WriteAccount";
//if(!WriteAccount(file,&GlobalConfig)) goto Remove;
if(!WriteAccount(file,&GlobalConfig))
Application->MessageBox("Could not save account information in config!","Error",MB_ICONERROR|MB_OK);;
type = TYPE_NONE;
WriteFile(file,&type,sizeof(DWORD),&Written,0);
CloseHandle(file);
for(i=0;i<LastList->Count;++i) {
host=(CHostRef*)LastList->Objects[i];
// If the host has no individual configuration then
// set a reference to the global config.
host->SetConfigRef(&GlobalConfig);
}
return;
Remove:
CloseHandle(file);
DeleteFileA(File.c_str());
FailedName = FailedName + " failed. Could not save config!";
Application->MessageBox(FailedName.c_str(),"Error",MB_ICONERROR|MB_OK);
return;
}
示例6: SaveOpt
//---------------------------------------------------------------------------
void __fastcall TOptDialog::SaveOpt(AnsiString file)
{
AnsiString ProxyAddrE_Text=ProxyAddrE->Text;
AnsiString ExSatsE_Text=ExSatsE->Text;
AnsiString FieldSep_Text=FieldSep->Text;
AnsiString RovAnt_Text=RovAnt->Text,RefAnt_Text=RefAnt->Text;
AnsiString SatPcvFile_Text=SatPcvFile->Text;
AnsiString AntPcvFile_Text=AntPcvFile->Text;
AnsiString StaPosFile_Text=StaPosFile->Text;
AnsiString GeoidDataFile_Text=GeoidDataFile->Text;
AnsiString DCBFile_Text=DCBFile->Text;
AnsiString LocalDir_Text=LocalDir->Text;
int itype[]={STR_SERIAL,STR_TCPCLI,STR_TCPSVR,STR_NTRIPCLI,STR_FILE,STR_FTP,STR_HTTP};
int otype[]={STR_SERIAL,STR_TCPCLI,STR_TCPSVR,STR_NTRIPSVR,STR_FILE};
TEdit *editu[]={RovPos1,RovPos2,RovPos3};
TEdit *editr[]={RefPos1,RefPos2,RefPos3};
char buff[1024],*p,id[32],comment[256],s[64];
int sat,ex;
prcopt_t prcopt=prcopt_default;
solopt_t solopt=solopt_default;
filopt_t filopt={""};
for (int i=0;i<8;i++) {
strtype[i]=i<3?itype[MainForm->Stream[i]]:otype[MainForm->Stream[i]];
strfmt[i]=MainForm->Format[i];
if (!MainForm->StreamC[i]) {
strtype[i]=STR_NONE;
strcpy(strpath[i],"");
}
else if (strtype[i]==STR_SERIAL) {
strcpy(strpath[i],MainForm->Paths[i][0].c_str());
}
else if (strtype[i]==STR_FILE) {
strcpy(strpath[i],MainForm->Paths[i][2].c_str());
}
else if (strtype[i]<=STR_NTRIPCLI) {
strcpy(strpath[i],MainForm->Paths[i][1].c_str());
}
else if (strtype[i]<=STR_HTTP) {
strcpy(strpath[i],MainForm->Paths[i][3].c_str());
}
}
nmeareq =MainForm->NmeaReq;
nmeapos[0]=MainForm->NmeaPos[0];
nmeapos[1]=MainForm->NmeaPos[1];
svrcycle =SvrCycleE ->Text.ToInt();
timeout =TimeoutTimeE->Text.ToInt();
reconnect =ReconTimeE ->Text.ToInt();
nmeacycle =NmeaCycleE ->Text.ToInt();
buffsize =SvrBuffSizeE->Text.ToInt();
navmsgsel =NavSelectS ->ItemIndex;
strcpy(proxyaddr,ProxyAddrE_Text.c_str());
fswapmargin =FileSwapMarginE->Text.ToInt();
prcopt.sbassatsel=SbasSatE->Text.ToInt();
prcopt.mode =PosMode ->ItemIndex;
prcopt.nf =Freq ->ItemIndex+1;
prcopt.soltype =Solution ->ItemIndex;
prcopt.elmin =str2dbl(ElMask ->Text)*D2R;
prcopt.dynamics =DynamicModel->ItemIndex;
prcopt.tidecorr =TideCorr ->ItemIndex;
prcopt.ionoopt =IonoOpt ->ItemIndex;
prcopt.tropopt =TropOpt ->ItemIndex;
prcopt.sateph =SatEphem ->ItemIndex;
if (ExSatsE->Text!="") {
strcpy(buff,ExSatsE_Text.c_str());
for (p=strtok(buff," ");p;p=strtok(NULL," ")) {
if (*p=='+') {ex=2; p++;} else ex=1;
if (!(sat=satid2no(p))) continue;
prcopt.exsats[sat-1]=ex;
}
}
prcopt.navsys = (NavSys1->Checked?SYS_GPS:0)|
(NavSys2->Checked?SYS_GLO:0)|
(NavSys3->Checked?SYS_GAL:0)|
(NavSys4->Checked?SYS_QZS:0)|
(NavSys5->Checked?SYS_SBS:0)|
(NavSys6->Checked?SYS_CMP:0);
prcopt.posopt[0]=PosOpt1->Checked;
prcopt.posopt[1]=PosOpt2->Checked;
prcopt.posopt[2]=PosOpt3->Checked;
prcopt.posopt[3]=PosOpt4->Checked;
prcopt.posopt[4]=PosOpt5->Checked;
prcopt.modear =AmbRes ->ItemIndex;
prcopt.glomodear=GloAmbRes ->ItemIndex;
prcopt.thresar[0]=str2dbl(ValidThresAR->Text);
prcopt.maxout =str2dbl(OutCntResetAmb->Text);
prcopt.minfix =str2dbl(FixCntHoldAmb->Text);
prcopt.minlock =str2dbl(LockCntFixAmb->Text);
prcopt.elmaskar =str2dbl(ElMaskAR ->Text)*D2R;
prcopt.elmaskhold=str2dbl(ElMaskHold->Text)*D2R;
prcopt.maxtdiff =str2dbl(MaxAgeDiff ->Text);
prcopt.maxgdop =str2dbl(RejectGdop ->Text);
prcopt.maxinno =str2dbl(RejectThres->Text);
prcopt.thresslip=str2dbl(SlipThres ->Text);
prcopt.niter =str2dbl(NumIter ->Text);
//.........这里部分代码省略.........
示例7: ebCreateItemClick
//---------------------------------------------------------------------------
void __fastcall TfraLeftBar::ebCreateItemClick(TObject *Sender)
{
AnsiString folder = STools->Current()->ViewGetCurrentItem(true);
STools->Current()->AppendItem(folder.c_str());
}
示例8: InsertLine
void TfrmText::InsertLine(const AnsiString& line)
{
if (!line.IsEmpty())
mmText->Lines->Insert(mmText->CaretPos.y,line);
}
示例9: AnsiReplaceStr
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmSearch::AnalyseScript()
{
AnsiString Script;
AnsiString s;
for(int n = 0;n < SkyEdit2->Lines->Count;n++)
{
s = SkyEdit2->Lines->Strings[n];
s = AnsiReplaceStr(AnsiReplaceStr(AnsiReplaceStr(AnsiReplaceStr(s,"\n"," "),"\r"," ")," "," "),"\t"," ");
if(s.SubString(1,1) == "'" || s.SubString(1,4).LowerCase() == "rem "||s.SubString(1,4).LowerCase() == "rem\t") //注释行
continue;
Script = Script + " " + SkyEdit2->Lines->Strings[n];
}
Script = AnsiReplaceStr(AnsiReplaceStr(AnsiReplaceStr(Script,"\n"," "),"\r"," "),"\t"," ");
AnsiString LowerCaseScript = Script.LowerCase();
AnsiString ParamString;
TBillField * BillField;
AnsiString LowerCaseFieldName;
AnsiString ParamName;
int Pos;
for(int n = 0;n < BillFile->FieldCount;n++)
{
BillField = BillFile->GetBillField(n);
LowerCaseFieldName = BillField->FieldName.LowerCase();
Pos = LowerCaseScript.Pos(LowerCaseFieldName);
if(Pos < 1)
continue;
//ParamName = BillField->FieldName.LowerCase();
if(ParamString == "")
//ParamString = ParamString + ParamName;
ParamString = ParamString + BillField->FieldName;
else
//ParamString = ParamString + "," + ParamName;
ParamString = ParamString + "," + BillField->FieldName;
//将原字符串中的字段名替换为ParamName
int k = 1;
while(k <= LowerCaseScript.Length())
{
if(LowerCaseScript.SubString(k,LowerCaseFieldName.Length()) == LowerCaseFieldName)
{
Script = StuffString(Script,k,LowerCaseFieldName.Length(),BillField->FieldName);
LowerCaseScript = StuffString(LowerCaseScript,k,LowerCaseFieldName.Length(),LowerCaseFieldName);
}
++k;
}
MatchFieldList->AddObject(BillField->FieldName,(TObject *)BillField);
}
ParamString = "(" + ParamString + ")";
Script = "'执行过程\nFunction MatchBill" + ParamString + "\n"
+ "if " + Script + " then \n"\
" MatchBill = 1\n"\
"else\n MatchBill = 0\n"\
"end if\n"\
"End Function";
SkyEdit1->Text = Script;
//脚本语法检查
TScriptControl * ScriptControl = new TScriptControl(this);
ScriptControl->Language = "VBScript";
ScriptControl->AllowUI = false;
LPSAFEARRAY Params; //传递给脚本的参数
Params = SafeArrayCreateVector(VT_VARIANT, 0, MatchFieldList->Count);
VARIANT * pData = NULL;
SafeArrayAccessData(Params, (void **)&pData); //锁定数据
TList * ParamList = new TList; //参数列表
VARIANT * pDataTmp;
for(int n = 0;n < MatchFieldList->Count;n++)
{
pDataTmp = new VARIANT;
pDataTmp->vt = VT_BSTR;
ParamList->Add((TObject *)pDataTmp);
}
ScriptControl->AddCode(WideString(Script).c_bstr());
bool ScriptSucceed;
ScriptControl->Error->get_Number();
ScriptSucceed = ScriptControl->Error->Number == 0;
if(!ScriptSucceed)//ScriptControl->Error->Number > 0)
{
MessageBox(Handle,("查询脚本错误:第 " + AnsiString(ScriptControl->Error->Line) \
+ " 行,第 " + AnsiString(ScriptControl->Error->Column) \
+ "列出现错误 " + AnsiString(ScriptControl->Error->Number) \
+ " (" + AnsiString(ScriptControl->Error->Description) + ")").c_str(),"错误",MB_OK | MB_ICONSTOP);
//ScriptSucceed = false;
}
else
{
//生成参数列表
for(int p = 0;p < MatchFieldList->Count;p++)
{
pDataTmp = (VARIANT *)ParamList->Items[p];
switch(((TBillField *)MatchFieldList->Objects[p])->SortType)
{
case SORT_AS_STR:
pDataTmp->bstrVal = SysAllocString(L"000");
break;
case SORT_AS_DATETIME:
pDataTmp->bstrVal = SysAllocString(L"2000-01-01 00:00:00");
break;
case SORT_AS_NUMBER:
pDataTmp->bstrVal = SysAllocString(L"1000");
//.........这里部分代码省略.........
示例10: LoadSettings
//--------------------------------------------------------------------------
// Loads all the editor settings from file. True and false settings are saved
// as 1 and 0.
// If the contents of settings.dat to not match expected then default values
// are used.
void __fastcall TOptions::LoadSettings()
{
try {
const int SIZE = 256;
AnsiString str;
str = ExtractFilePath(Application->ExeName) + "settings.dat";
char fileName[SIZE];
strcpy(fileName, str.c_str()); // fileName is path + settings.dat
defaultSettings(); // start with default settings
if(FileExists(fileName)) //check if settings file exists
{ //if it did then load all the settings
char buffer[SIZE+1];
char temp[SIZE+1]; //temp storage
unsigned int index; //looping index
ifstream File(fileName); //open settings file
// read and set flags from file
File.getline(buffer, SIZE); //first line contains version number
File.getline(buffer, SIZE); // 'generate list' setting
if (!strcmp(&buffer[1],"$generate list")) { // if expected setting
if(buffer[0] == '1') {
listFlag = true;
chkGenList->Checked = true;
} else {
listFlag = false;
chkGenList->Checked = false;
}
}
File.getline(buffer, SIZE); // 'generate s-record' setting
if (!strcmp(&buffer[1],"$generate s-record")) { // if expected setting
if(buffer[0] == '1') {
objFlag = true;
chkGenSRec->Checked = true;
} else {
objFlag = false;
chkGenSRec->Checked = false;
}
}
File.getline(buffer, SIZE); // 'save before assemble' setting
if (!strcmp(&buffer[1],"$save then assemble")) { // if expected setting
if(buffer[0] == '1') {
bSave = true;
chkSave->Checked = true;
} else {
bSave = false;
chkSave->Checked = false;
}
}
File.getline(buffer, SIZE); // 'Show Warnings' setting
if (!strcmp(&buffer[1],"$show warnings")) { // if expected setting
if(buffer[0] == '1') {
WARflag = true;
chkShowWarnings->Checked = true;
} else {
WARflag = false;
chkShowWarnings->Checked = false;
}
}
File.getline(buffer, SIZE); // 'cross reference' setting
if (!strcmp(&buffer[1],"$cross reference")) { // if expected setting
if(buffer[0] == '1') {
CREflag = true;
chkCrossRef->Checked = true;
} else {
CREflag = false;
chkCrossRef->Checked = false;
}
}
File.getline(buffer, SIZE); // 'macro expanded setting' setting
if (!strcmp(&buffer[1],"$macros expanded")) { // if expected setting
if(buffer[0] == '1') {
MEXflag = true;
chkMacEx->Checked = true;
} else {
MEXflag = false;
chkMacEx->Checked = false;
}
}
File.getline(buffer, SIZE); // 'structured assembly expanded setting' setting
if (!strcmp(&buffer[1],"$structured expand")) { // if expected setting
if(buffer[0] == '1') {
SEXflag = true;
chkStrucEx->Checked = true;
} else {
SEXflag = false;
chkStrucEx->Checked = false;
//.........这里部分代码省略.........
示例11: defaultSettings
//--------------------------------------------------------------------------
void __fastcall TOptions::defaultSettings()
// default settings
{
try {
AnsiString str;
str = ExtractFilePath(Application->ExeName) + "settings.dat";
char fileName[256];
strcpy(fileName, str.c_str()); // fileName is path + settings.dat
listFlag = chkGenList->Checked;
objFlag = chkGenSRec->Checked;
bSave = chkSave->Checked;
WARflag = chkShowWarnings->Checked;
CREflag = chkCrossRef->Checked;
MEXflag = chkMacEx->Checked;
SEXflag = chkStrucEx->Checked;
CEXflag = chkConstantsEx->Checked;
if (EditorOptionsForm->FixedTabs->Checked)
tabType = Fixed;
else
tabType = Assembly;
autoIndent = EditorOptionsForm->AutoIndent->Checked;
realTabs = EditorOptionsForm->RealTabs->Checked;
BITflag = chkBitfield->Checked;
codeStyle.color = DEFAULT_CODE_COLOR;
codeStyle.bold = false;
codeStyle.italic = false;
codeStyle.underline = false;
unknownStyle.color = DEFAULT_UNKNOWN_COLOR;
unknownStyle.bold = false;
unknownStyle.italic = false;
unknownStyle.underline = false;
directiveStyle.color = DEFAULT_DIRECTIVE_COLOR;
directiveStyle.bold = false;
directiveStyle.italic = false;
directiveStyle.underline = false;
commentStyle.color = DEFAULT_COMMENT_COLOR;
commentStyle.bold = false;
commentStyle.italic = false;
commentStyle.underline = false;
labelStyle.color = DEFAULT_LABEL_COLOR;
labelStyle.bold = false;
labelStyle.italic = false;
labelStyle.underline = false;
structureStyle.color = DEFAULT_STRUCTURE_COLOR;
structureStyle.bold = false;
structureStyle.italic = false;
structureStyle.underline = false;
errorStyle.color = DEFAULT_ERROR_COLOR;
errorStyle.bold = false;
errorStyle.italic = false;
errorStyle.underline = false;
textStyle.color = DEFAULT_TEXT_COLOR;
textStyle.bold = false;
textStyle.italic = false;
textStyle.underline = false;
highlightDisabled = false;
backColor = DEFAULT_BACK_COLOR;
}
catch( ... ) {
MessageDlg("Error configuring default editor settings",mtInformation, TMsgDlgButtons() << mbOK,0);
return;
}
}
示例12: SaveSettings
void __fastcall TOptions::SaveSettings()
//saves editor settings to file, true & false settings are saved as 1 and 0
{
maximizedEdit = false;
//grab active mdi child
TTextStuff *Active = (TTextStuff*)Main->ActiveMDIChild;
if (Active) {
if (Active->WindowState == wsMaximized)
maximizedEdit = true;
}
try {
AnsiString str;
str = ExtractFilePath(Application->ExeName) + "settings.dat";
char fileName[256];
strcpy(fileName, str.c_str()); // fileName is path + settings.dat
ofstream File(fileName); //open settings file
if (EditorOptionsForm->AssemblyTabs->Checked)
tabType = Assembly;
else
tabType = Fixed;
//save all assembler and editor flags
File << "$Settings for " << TITLE << " DO NOT EDIT THIS FILE!!!!\n"
<< listFlag << "$generate list\n"
<< objFlag << "$generate s-record\n"
<< bSave << "$save then assemble\n"
<< chkShowWarnings->Checked << "$show warnings\n"
<< chkCrossRef->Checked << "$cross reference\n"
<< chkMacEx->Checked << "$macros expanded\n"
<< chkStrucEx->Checked << "$structured expand\n"
<< chkConstantsEx->Checked << "$constants expand\n"
<< EditorOptionsForm->cbFont->Text.c_str() << "$font name\n"
<< EditorOptionsForm->cbSize->Text.c_str() << "$font size\n"
<< tabType << "$tab type\n"
<< EditorOptionsForm->FixedTabSize->Value << "$fixed tab size\n"
<< maximizedEdit << "$maximized edit\n"
<< autoIndent << "$auto indent\n"
<< realTabs << "$real tabs\n"
<< chkBitfield->Checked << "$assemble bit field\n"
<< Main->Top << "$main top\n"
<< Main->Left << "$main left\n"
<< Main->Height << "$main height\n"
<< Main->Width << "$main width\n"
<< codeStyle.color << "$code color\n"
<< codeStyle.bold << "$code bold\n"
<< codeStyle.italic << "$code italic\n"
<< codeStyle.underline << "$code underline\n"
<< unknownStyle.color << "$unknown color\n"
<< unknownStyle.bold << "$unknown bold\n"
<< unknownStyle.italic << "$unknown italic\n"
<< unknownStyle.underline << "$unknown underline\n"
<< directiveStyle.color << "$directive color\n"
<< directiveStyle.bold << "$directive bold\n"
<< directiveStyle.italic << "$directive italic\n"
<< directiveStyle.underline << "$directive underline\n"
<< commentStyle.color << "$comment color\n"
<< commentStyle.bold << "$comment bold\n"
<< commentStyle.italic << "$comment italic\n"
<< commentStyle.underline << "$comment underline\n"
<< labelStyle.color << "$label color\n"
<< labelStyle.bold << "$label bold\n"
<< labelStyle.italic << "$label italic\n"
<< labelStyle.underline << "$label underline\n"
<< structureStyle.color << "$structure color\n"
<< structureStyle.bold << "$structure bold\n"
<< structureStyle.italic << "$structure italic\n"
<< structureStyle.underline << "$structure underline\n"
<< errorStyle.color << "$error color\n"
<< errorStyle.bold << "$error bold\n"
<< errorStyle.italic << "$error italic\n"
<< errorStyle.underline << "$error underline\n"
<< textStyle.color << "$text color\n"
<< textStyle.bold << "$text bold\n"
<< textStyle.italic << "$text italic\n"
<< textStyle.underline << "$text underline\n"
<< highlightDisabled << "$highlight disabled\n"
<< EditorOptionsForm->PrintBlack->Checked << "$print w/black\n"
<< backColor << "$background color\n";
File.close();
}
catch( ... ) {
MessageDlg("Error saving editor settings",mtInformation, TMsgDlgButtons() << mbOK,0);
return;
}
}
示例13:
int AnsiString::operator <=(AnsiString S) {
return operator <=(S.c_str());
}
示例14: AnsiString
bool TEventLauncher::Load(cParser *parser)
{ // wczytanie wyzwalacza zdarzeñ
AnsiString str;
std::string token;
parser->getTokens();
*parser >> dRadius; // promieñ dzia³ania
if (dRadius > 0.0)
dRadius *= dRadius; // do kwadratu, pod warunkiem, ¿e nie jest ujemne
parser->getTokens(); // klawisz steruj¹cy
*parser >> token;
str = AnsiString(token.c_str());
if (str != "none")
{
if (str.Length() == 1)
iKey = VkKeyScan(str[1]); // jeden znak jest konwertowany na kod klawisza
else
iKey = str.ToIntDef(0); // a jak wiêcej, to jakby numer klawisza jest
}
parser->getTokens();
*parser >> DeltaTime;
if (DeltaTime < 0)
DeltaTime = -DeltaTime; // dla ujemnego zmieniamy na dodatni
else if (DeltaTime > 0)
{ // wartoœæ dodatnia oznacza wyzwalanie o okreœlonej godzinie
iMinute = int(DeltaTime) % 100; // minuty s¹ najm³odszymi cyframi dziesietnymi
iHour = int(DeltaTime - iMinute) / 100; // godzina to setki
DeltaTime = 0; // bez powtórzeñ
WriteLog("EventLauncher at " + IntToStr(iHour) + ":" +
IntToStr(iMinute)); // wyœwietlenie czasu
}
parser->getTokens();
*parser >> token;
asEvent1Name = AnsiString(token.c_str()); // pierwszy event
parser->getTokens();
*parser >> token;
asEvent2Name = AnsiString(token.c_str()); // drugi event
if ((asEvent2Name == "end") || (asEvent2Name == "condition"))
{ // drugiego eventu mo¿e nie byæ, bo s¹ z tym problemy, ale ciii...
str = asEvent2Name; // rozpoznane s³owo idzie do dalszego przetwarzania
asEvent2Name = "none"; // a drugiego eventu nie ma
}
else
{ // gdy s¹ dwa eventy
parser->getTokens();
*parser >> token;
str = AnsiString(token.c_str());
}
if (str == AnsiString("condition"))
{ // obs³uga wyzwalania warunkowego
parser->getTokens();
*parser >> token;
asMemCellName = AnsiString(token.c_str());
parser->getTokens();
*parser >> token;
SafeDeleteArray(szText);
szText = new char[256];
strcpy(szText, token.c_str());
if (token.compare("*") != 0) //*=nie braæ command pod uwagê
iCheckMask |= conditional_memstring;
parser->getTokens();
*parser >> token;
if (token.compare("*") != 0) //*=nie braæ wartoœci 1. pod uwagê
{
iCheckMask |= conditional_memval1;
str = AnsiString(token.c_str());
fVal1 = str.ToDouble();
}
else
fVal1 = 0;
parser->getTokens();
*parser >> token;
if (token.compare("*") != 0) //*=nie braæ wartoœci 2. pod uwagê
{
iCheckMask |= conditional_memval2;
str = AnsiString(token.c_str());
fVal2 = str.ToDouble();
}
else
fVal2 = 0;
parser->getTokens(); // s³owo zamykaj¹ce
*parser >> token;
}
示例15: GetOpt
//---------------------------------------------------------------------------
void __fastcall TOptDialog::GetOpt(void)
{
TEdit *editu[]={RovPos1,RovPos2,RovPos3};
TEdit *editr[]={RefPos1,RefPos2,RefPos3};
AnsiString s;
PosMode ->ItemIndex=PrcOpt.mode;
Freq ->ItemIndex=PrcOpt.nf-1>NFREQ-1?NFREQ-1:PrcOpt.nf-1;
ElMask ->Text =s.sprintf("%.0f",PrcOpt.elmin*R2D);
DynamicModel ->ItemIndex=PrcOpt.dynamics;
TideCorr ->ItemIndex=PrcOpt.tidecorr;
IonoOpt ->ItemIndex=PrcOpt.ionoopt;
TropOpt ->ItemIndex=PrcOpt.tropopt;
SatEphem ->ItemIndex=PrcOpt.sateph;
AmbRes ->ItemIndex=PrcOpt.modear;
GloAmbRes ->ItemIndex=PrcOpt.glomodear;
ValidThresAR ->Text =s.sprintf("%.1f",PrcOpt.thresar[0]);
OutCntResetAmb->Text =s.sprintf("%d", PrcOpt.maxout);
LockCntFixAmb->Text =s.sprintf("%d", PrcOpt.minlock);
FixCntHoldAmb->Text =s.sprintf("%d", PrcOpt.minfix);
ElMaskAR ->Text =s.sprintf("%.0f",PrcOpt.elmaskar*R2D);
ElMaskHold ->Text =s.sprintf("%.0f",PrcOpt.elmaskhold*R2D);
MaxAgeDiff ->Text =s.sprintf("%.1f",PrcOpt.maxtdiff);
RejectGdop ->Text =s.sprintf("%.1f",PrcOpt.maxgdop);
RejectThres ->Text =s.sprintf("%.1f",PrcOpt.maxinno);
SlipThres ->Text =s.sprintf("%.3f",PrcOpt.thresslip);
NumIter ->Text =s.sprintf("%d", PrcOpt.niter);
SyncSol ->ItemIndex=PrcOpt.syncsol;
ExSatsE ->Text =ExSats;
NavSys1 ->Checked =PrcOpt.navsys&SYS_GPS;
NavSys2 ->Checked =PrcOpt.navsys&SYS_GLO;
NavSys3 ->Checked =PrcOpt.navsys&SYS_GAL;
NavSys4 ->Checked =PrcOpt.navsys&SYS_QZS;
NavSys5 ->Checked =PrcOpt.navsys&SYS_SBS;
NavSys6 ->Checked =PrcOpt.navsys&SYS_CMP;
PosOpt1 ->Checked =PrcOpt.posopt[0];
PosOpt2 ->Checked =PrcOpt.posopt[1];
PosOpt3 ->Checked =PrcOpt.posopt[2];
PosOpt4 ->Checked =PrcOpt.posopt[3];
PosOpt5 ->Checked =PrcOpt.posopt[4];
SolFormat ->ItemIndex=SolOpt.posf;
TimeFormat ->ItemIndex=SolOpt.timef==0?0:SolOpt.times+1;
TimeDecimal ->Text =s.sprintf("%d",SolOpt.timeu);
LatLonFormat ->ItemIndex=SolOpt.degf;
FieldSep ->Text =SolOpt.sep;
OutputHead ->ItemIndex=SolOpt.outhead;
OutputOpt ->ItemIndex=SolOpt.outopt;
OutputDatum ->ItemIndex=SolOpt.datum;
OutputHeight ->ItemIndex=SolOpt.height;
OutputGeoid ->ItemIndex=SolOpt.geoid;
NmeaIntv1 ->Text =s.sprintf("%.2g",SolOpt.nmeaintv[0]);
NmeaIntv2 ->Text =s.sprintf("%.2g",SolOpt.nmeaintv[1]);
DebugStatus ->ItemIndex=DebugStatusF;
DebugTrace ->ItemIndex=DebugTraceF;
BaselineConst->Checked =BaselineC;
BaselineLen->Text =s.sprintf("%.3f",Baseline[0]);
BaselineSig->Text =s.sprintf("%.3f",Baseline[1]);
MeasErrR1 ->Text =s.sprintf("%.1f",PrcOpt.eratio[0]);
MeasErrR2 ->Text =s.sprintf("%.1f",PrcOpt.eratio[1]);
MeasErr2 ->Text =s.sprintf("%.3f",PrcOpt.err[1]);
MeasErr3 ->Text =s.sprintf("%.3f",PrcOpt.err[2]);
MeasErr4 ->Text =s.sprintf("%.3f",PrcOpt.err[3]);
MeasErr5 ->Text =s.sprintf("%.3f",PrcOpt.err[4]);
PrNoise1 ->Text =s.sprintf("%.2E",PrcOpt.prn[0]);
PrNoise2 ->Text =s.sprintf("%.2E",PrcOpt.prn[1]);
PrNoise3 ->Text =s.sprintf("%.2E",PrcOpt.prn[2]);
PrNoise4 ->Text =s.sprintf("%.2E",PrcOpt.prn[3]);
PrNoise5 ->Text =s.sprintf("%.2E",PrcOpt.prn[4]);
SatClkStab ->Text =s.sprintf("%.2E",PrcOpt.sclkstab);
RovPosTypeP ->ItemIndex=RovPosTypeF;
RefPosTypeP ->ItemIndex=RefPosTypeF;
RovAntPcv ->Checked =RovAntPcvF;
RefAntPcv ->Checked =RefAntPcvF;
RovAnt ->Text =RovAntF;
RefAnt ->Text =RefAntF;
RovAntE ->Text =s.sprintf("%.4f",RovAntDel[0]);
RovAntN ->Text =s.sprintf("%.4f",RovAntDel[1]);
RovAntU ->Text =s.sprintf("%.4f",RovAntDel[2]);
RefAntE ->Text =s.sprintf("%.4f",RefAntDel[0]);
RefAntN ->Text =s.sprintf("%.4f",RefAntDel[1]);
RefAntU ->Text =s.sprintf("%.4f",RefAntDel[2]);
SetPos(RovPosTypeP->ItemIndex,editu,RovPos);
SetPos(RefPosTypeP->ItemIndex,editr,RefPos);
SatPcvFile ->Text =SatPcvFileF;
AntPcvFile ->Text =AntPcvFileF;
StaPosFile ->Text =StaPosFileF;
GeoidDataFile->Text =GeoidDataFileF;
DCBFile ->Text =DCBFileF;
EOPFile ->Text =EOPFileF;
TLEFile ->Text =TLEFileF;
TLESatFile ->Text =TLESatFileF;
LocalDir ->Text =LocalDirectory;
ReadAntList();
//.........这里部分代码省略.........