void __fastcall TfrmCompetitorCategoryResultEdit::bbtnEnterResultClick( TObject *Sender) { //Сохранить результаты текущего участника if(resultModified){ resetCallback(); //Выбрать нового участника int currentCompetitorId = TResult::getCurrentCompetitorId(); //Установить полученный результаты в выпадющем списке AnsiString fwok = cmboxFightWOKnifeRank->Text; AnsiString fwk = cmboxFightWKnifeRank->Text; AnsiString sht = cmboxShootRank->Text; AnsiString cmmn = cmboxCommonRank->Text; if(fwok.IsEmpty()){fwok = "0";} if(fwk.IsEmpty()){fwk = "0";} if(sht.IsEmpty()){sht = "0";} if(cmmn.IsEmpty()){cmmn = "0";} currentCompetitor.result.setFightWOKnifeRank( StrToInt(fwok)); currentCompetitor.result.setFightWKnifeRank( StrToInt(fwk)); currentCompetitor.result.setShootRank( StrToInt(sht)); currentCompetitor.result.setCommonRank( StrToInt(cmmn)); //Сохраним результат участника currentCompetitor.storeResult(currentCategory->getId()); //Отобразить список участников снова ShowCompetitorList(currentCategory); //Установить выбранную запись как текущуую TResult::setCurrentCompetitorById(currentCompetitorId); cmboxFightWOKnifeRank->Text = !fwok.AnsiCompare("0") ? AnsiString("") : fwok; cmboxFightWKnifeRank->Text = !fwk.AnsiCompare("0") ? AnsiString("") : fwk; cmboxShootRank->Text = !sht.AnsiCompare("0") ? AnsiString("") : sht; cmboxCommonRank->Text = !cmmn.AnsiCompare("0") ? AnsiString("") : cmmn; showResultScores(); HideResultChange(); setCallback(); } }
void DKIMSigner::Sign(boost::shared_ptr<Message> message) { AnsiString senderAddress = message->GetFromAddress(); AnsiString senderDomain = StringParser::ExtractDomain(senderAddress); // Check if signing is enabled for this domain. boost::shared_ptr<const Domain> pDomain = CacheContainer::Instance()->GetDomain(senderDomain); if (!pDomain || !pDomain->GetDKIMEnabled()) return; LOG_DEBUG("Signing message using DKIM..."); AnsiString selector = pDomain->GetDKIMSelector(); AnsiString domain = pDomain->GetName(); AnsiString privateKeyFile = pDomain->GetDKIMPrivateKeyFile(); if (selector.IsEmpty() || privateKeyFile.IsEmpty()) { ErrorManager::Instance()->ReportError(ErrorManager::Medium, 5305, "DKIMSigner::Sign", "Either the selector or private key file was not specified."); return; } Canonicalization::CanonicalizeMethod headerMethod = (Canonicalization::CanonicalizeMethod) pDomain->GetDKIMHeaderCanonicalizationMethod(); Canonicalization::CanonicalizeMethod bodyMethod = (Canonicalization::CanonicalizeMethod) pDomain->GetDKIMBodyCanonicalizationMethod(); HashCreator::HashType algorithm = (HashCreator::HashType) pDomain->GetDKIMSigningAlgorithm(); DKIM dkim; if (!dkim.Sign(message, domain, selector, privateKeyFile, algorithm, headerMethod, bodyMethod)) { ErrorManager::Instance()->ReportError(ErrorManager::Medium, 5306, "DKIMSigner::Sign", "Message signing using DKIM failed."); } }
AnsiString FloatTimeToStrTime(float v, bool _h, bool _m, bool _s, bool _ms) { AnsiString buf = ""; int h = 0, m = 0, s = 0, ms; AnsiString t; if (_h) { h = iFloor(v / 3600); t.sprintf("%02d", h); buf += t; } if (_m) { m = iFloor((v - h * 3600) / 60); t.sprintf("%02d", m); buf += buf.IsEmpty() ? t : ":" + t; } if (_s) { s = iFloor(v - h * 3600 - m * 60); t.sprintf("%02d", s); buf += buf.IsEmpty() ? t : ":" + t; } if (_ms) { ms = iFloor((v - h * 3600 - m * 60 - s)*1000.f); t.sprintf("%03d", ms); buf += buf.IsEmpty() ? t : "." + t; } return buf; }
//--------------------------------------------------------------------------- void __fastcall TFormOptsOplata::UpdateDatesInStatusBar(int selrow) { AnsiString Str; Str=StrGridOpts->Cells[1][selrow]; if (Str.IsEmpty()) Str="???"; StatusBar->Panels->Items[1]->Text=Str; Str=StrGridOpts->Cells[2][selrow]; if (Str.IsEmpty()) Str="??? - ???"; StatusBar->Panels->Items[4]->Text=Str; Str=StrGridOpts->Cells[3][selrow]; if (Str.IsEmpty()) Str="???"; StatusBar->Panels->Items[7]->Text=Str; }
//--------------------------------------------------------------------------- void __fastcall TMainForm::AddPhoto(AnsiString existingFileName) { AnsiString photoFile = ""; AnsiString hash = ""; if (existingFileName.IsEmpty()) { Randomize(); hash = GetMD5Hash(AnsiString(Random(99999999999999999999999999999999))); photoFile = GetAppPath()+"Photo\\"+hash+".jpg"; } else { hash = existingFileName; } photoFile = GetAppPath()+"Photo\\"+hash+".jpg"; if (OpenPictureDialog->Execute()) { if (!OpenPictureDialog->FileName.IsEmpty()) { if (FileExists(OpenPictureDialog->FileName)) { int ID = DBGrid->Fields[14]->AsInteger; AnsiString query = "UPDATE tblMembers SET mPhoto = '" + hash + "' WHERE ID = " + AnsiString(ID); CMData->ADOQuery->SQL->Clear(); CMData->ADOQuery->SQL->Add(query); CMData->ADOQuery->ExecSQL(); query = AnsiString("select mSur, mName, mPat, mBD, mCD, mNat, mAdd, mTel, mFam, mPro, ") + AnsiString ("mLife, mSug, mEtc, mPhoto, ID from tblMembers order by mSur, mName, mPat"); CMData->ADOQuery->SQL->Clear(); CMData->ADOQuery->SQL->Add(query); CMData->ADOQuery->Open(); CopyFile(OpenPictureDialog->FileName.c_str(), photoFile.c_str(), false); } else { MessageDlg("Файл '" + OpenPictureDialog->FileName + "' не найден!", mtError, TMsgDlgButtons() << mbOK, 0); } } } }
void ESceneLightTools::AppendLightControl(LPCSTR nm, u32* idx) { AnsiString name = nm; _Trim(name); if (name.IsEmpty()) return; if (FindLightControl(name.c_str())) return; lcontrols.push_back (xr_rtoken(name.c_str(),idx?*idx:lcontrol_last_idx++)); }
void TClipMaker::RealUpdateProperties() { m_RTFlags.set (flRT_UpdateProperties,FALSE); // clip props PropItemVec p_items; PropValue* V = 0; PHelper().CreateCaption (p_items,"Length", FloatTimeToStrTime(m_TotalLength,true,true,true,true).c_str()); V=PHelper().CreateFloat (p_items,"Zoom", &m_Zoom, 1.f,1000.f,0.1f,1); V->OnChangeEvent.bind (this,&TClipMaker::OnZoomChange); if (sel_clip){ ListItem* l_owner = m_ClipList->FindItem(*sel_clip->name); VERIFY(l_owner); V=PHelper().CreateName (p_items,"Current Clip\\Name", &sel_clip->name, l_owner); V->OnChangeEvent.bind (this,&TClipMaker::OnNameChange); V=PHelper().CreateFloat (p_items,"Current Clip\\Length",&sel_clip->length, 0.f,10000.f,0.1f,2); V->OnChangeEvent.bind (this,&TClipMaker::OnClipLengthChange); for (u16 k=0; k<4; k++){ AnsiString mname = sel_clip->CycleName(k); u16 slot = sel_clip->CycleSlot(k); if (mname.IsEmpty())continue; CMotionDef* MD = ATools->m_RenderObject.FindMotionDef (mname.c_str(),slot); CMotion* MI = ATools->m_RenderObject.FindMotionKeys (mname.c_str(),slot); SBonePart* BP = (k<(u16)m_CurrentObject->BoneParts().size())?&m_CurrentObject->BoneParts()[k]:0; shared_str tmp; if (MI) tmp.sprintf("%s [%3.2fs, %s]",mname.c_str(),MI->GetLength()/MD->Speed(),MD->bone_or_part?"stop at end":"looped"); if (BP) PHelper().CreateCaption (p_items,PrepareKey("Current Clip\\Cycles",BP->alias.c_str()), tmp); } if (sel_clip->fx.valid())PHelper().CreateFloat (p_items,PrepareKey("Current Clip\\FXs",*sel_clip->fx.name), &sel_clip->fx_power, 0.f, 1000.f); } m_ClipProps->AssignItems(p_items); }
bool __fastcall TEntryForm::InValidInteger(AnsiString label, TEditPlus *edit, int length) { if (edit->ReadOnly == true) return false; AnsiString ud = edit->Text; if (ud.IsEmpty() == true) { AnsiString msg = "The field "+label+" contains the value '"+edit->Text+"'." +" This is invalid for a non null integer field allowing" +" for "+length+" bytes of data"; Application->MessageBox(msg.c_str(), "No Data Entered", ID_OK); return true; } if (ud[1] == '-') ud.Delete(1,1); int n = ud.Length(); if (n <= length && strspn(ud.c_str(), "0123456789") == (unsigned)n) return false; AnsiString msg = "The field "+label+" contains the value '"+edit->Text+"'." +" This is invalid for a non null integer field allowing" +" for "+length+" bytes of data"; Application->MessageBox(msg.c_str(), "Invalid Number", ID_OK); return true; }
String MimeHeader::GetUnicodeFieldValue(const AnsiString &pszFieldName, const AnsiString &sRawFieldValue) { AnsiString sWideStr; sWideStr = ""; if (sRawFieldValue.IsEmpty()) { if (IniFileSettings::Instance()->GetLogLevel() > 99) LOG_DEBUG("MimeHeader::GetUnicodeFieldValue - sRawFieldValue.IsEmpty"); return sWideStr; } // De-code the value to plain text. AnsiString sRetVal; FieldCodeBase* pCoder = MimeEnvironment::CreateFieldCoder(pszFieldName); pCoder->SetInput(sRawFieldValue, sRawFieldValue.GetLength(), false); pCoder->GetOutput(sRetVal); AnsiString sCharset = pCoder->GetCharset(); delete pCoder; sWideStr = Charset::ToWideChar(sRetVal, sCharset); if (IniFileSettings::Instance()->GetLogLevel() > 99) LOG_DEBUG("MimeHeader::GetUnicodeFieldValue - sWideStr: " + sWideStr); return sWideStr; }
void __fastcall TfrmMain::LoadTimer(TObject *Sender) { LoadSetting(); if (FileExists(String(LoginerPath) +"\\Data\\"+ GameAccount + "\\Items.dat")) { TStringList *list = new TStringList(); list->LoadFromFile(String(LoginerPath) +"\\Data\\"+ GameAccount + "\\Items.dat"); for (int i = 0; i < list->Count; i++) { unsigned int ItemID; ItemID = _wtoi(list->Strings[i].w_str()); AnsiString name = String(GetItemName(ItemID)); if (name.IsEmpty()) { name.sprintf(TEXT("未知物品(編號:%d)"), ItemID); } int index = list_drop->Items->IndexOfObject((TObject *)ItemID); if (index > -1) list_drop->Items->Delete(index); index = list_filter->Items->IndexOfObject((TObject *)ItemID); if (index < 0) list_filter->Items->AddObject(name, (TObject *)ItemID); } delete list; } Load->Enabled = false; }
void TfrmText::InsertTextCP(const AnsiString& line, bool bCommas) { AnsiString txt = (bCommas)?AnsiString("\"")+line+AnsiString("\""):line; if (!txt.IsEmpty()){ AnsiString h = mmText->Lines->Strings[mmText->CaretPos.y]; h.Insert (txt,mmText->CaretPos.x+1); mmText->Lines->Strings[mmText->CaretPos.y] = h; } }
String MimeHeader::GetRawFilename() const { AnsiString sRawValue = GetParameter(CMimeConst::ContentDisposition(), CMimeConst::Filename()); if (sRawValue.IsEmpty()) sRawValue = GetParameter(CMimeConst::ContentType(), CMimeConst::Name()); return sRawValue; }
void TItemList::LoadSelection(TFormStorage* storage) { last_selected_items.clear(); int cnt = storage->ReadInteger("sel_cnt",0); for (int k=0; k<cnt;k++){ AnsiString tmp = storage->ReadString(AnsiString().sprintf("sel%d",k),""); if (!tmp.IsEmpty())last_selected_items.push_back(tmp.c_str()); } }
//--------------------------------------------------------------------------- AnsiString __fastcall TCopyProgress::GetNewName(AnsiString mask, AnsiString source) { //TODO: Add your source code here AnsiString temp = ExtractFileName(source); source = ExtractFilePath(source); if(source.IsEmpty()) return mask; return source + "\\" + mask;//??? }
void PuttyInitialize() { SaveRandomSeed = true; // make sure random generator is initialised, so random_save_seed() // in destructor can proceed random_ref(); flags = FLAG_VERBOSE/* | FLAG_SYNCAGENT*/; // verbose log sk_init(); AnsiString VersionString = AnsiString(GetSshVersionString()); DebugAssert(!VersionString.IsEmpty() && (static_cast<size_t>(VersionString.Length()) < _countof(sshver))); strncpy(sshver, VersionString.c_str(), sizeof(sshver)); AnsiString AppName = AnsiString(GetAppNameString()); DebugAssert(!AppName.IsEmpty() && (static_cast<size_t>(AppName.Length()) < _countof(appname_))); strncpy(appname_, AppName.c_str(), sizeof(appname_)); }
void _SequenceToList(AStringVec& lst, LPCSTR in, char separator) { lst.clear(); int t_cnt=_GetItemCount(in,separator); AnsiString T; for (int i=0; i<t_cnt; i++){ _GetItem(in,i,T,separator,0); _Trim(T); if (!T.IsEmpty()) lst.push_back(T); } }
void TfrmCompetitorCategoryResultEdit::showResultScores(void){ //Установить полученный результаты в выпадющем списке AnsiString fwok = cmboxFightWOKnifeRank->Text; int ifwok; AnsiString fwk = cmboxFightWKnifeRank->Text; int ifwk; AnsiString sht = cmboxShootRank->Text; int isht; AnsiString cmmn = cmboxCommonRank->Text; int icmmn; if(fwok.IsEmpty()){ifwok = 0;} else{ifwok = dmCurrentState->getScoreForRank(StrToInt(fwok));} if(fwk.IsEmpty()){ifwk = 0;} else{ifwk = dmCurrentState->getScoreForRank(StrToInt(fwk));} if(sht.IsEmpty()){isht = 0;} else{isht = dmCurrentState->getScoreForRank(StrToInt(sht));} if(cmmn.IsEmpty()){icmmn = 0;} else{icmmn = ifwok + ifwk + isht;} sttxtShootScore->Caption=IntToStr(isht); sttxtFightWOKnifeScore->Caption=IntToStr(ifwok); sttxtFightWKnifeScore->Caption=IntToStr(ifwk); sttxtCommonScore->Caption=IntToStr(icmmn); }
//--------------------------------------------------------------------------- void __fastcall PuttyInitialize() { SaveRandomSeed = true; InitializeCriticalSection(&putty_section); // make sure random generator is initialised, so random_save_seed() // in destructor can proceed random_ref(); flags = FLAG_VERBOSE | FLAG_SYNCAGENT; // verbose log sk_init(); AnsiString VersionString = SshVersionString(); assert(!VersionString.IsEmpty() && (static_cast<size_t>(VersionString.Length()) < LENOF(sshver))); strcpy(sshver, VersionString.c_str()); AnsiString AppName = AppNameString(); assert(!AppName.IsEmpty() && (static_cast<size_t>(AppName.Length()) < LENOF(appname_))); strcpy(appname_, AppName.c_str()); }
void Tdm1::SetupDB() { if(!g_szODBC.IsEmpty() && !g_szDBUser.IsEmpty() && !g_szDBPass.IsEmpty()) { int i; db1->Connected=false; for(i=0;i<db1->Params->Count;i++) { // if(strstr(db1->Params->Strings[i].c_str(),"DATABASE NAME=")!=NULL) // db1->Params->Strings[i]="DATABASE NAME="+g_szODBC; // else if(strstr(db1->Params->Strings[i].c_str(),"USER NAME=")!=NULL) db1->Params->Strings[i]="USER NAME="+g_szDBUser; else if(strstr(db1->Params->Strings[i].c_str(),"ODBC DSN=")!=NULL) db1->Params->Strings[i]="ODBC DSN="+g_szODBC; else if(strstr(db1->Params->Strings[i].c_str(),"PASSWORD="******"PASSWORD="+g_szDBPass; } db1->Connected=true; } }
void MimeHeader::SetUnicodeFieldValue(const AnsiString &sFieldName, const String & sFieldValue, const AnsiString & sCharset) { // Retrieve the current charset for this field. MimeField* pfd = GetField(sFieldName); if (sFieldValue.GetLength() == 0) { SetRawFieldValue(sFieldName, "", ""); return; } AnsiString sCharsetToUse = sCharset; // If client hasn't specified character set, assume it's the existing one. if (pfd && pfd->GetCharset() && sCharsetToUse.IsEmpty()) sCharsetToUse = pfd->GetCharset(); // If there's no existing charset, assume it's the same as for the email. if (sCharsetToUse.IsEmpty()) sCharsetToUse = GetCharset(); if (sCharsetToUse.IsEmpty()) sCharsetToUse = "utf-8"; AnsiString sMBText = Charset::ToMultiByte(sFieldValue, sCharsetToUse); // Encode the value FieldCodeBase* pCoder = MimeEnvironment::CreateFieldCoder(sFieldName); pCoder->SetInput(sMBText, sMBText.GetLength(), true); pCoder->SetCharset(sCharsetToUse.c_str()); AnsiString sEncodedValue; pCoder->GetOutput(sEncodedValue); delete pCoder; SetRawFieldValue(sFieldName, sEncodedValue, sCharsetToUse); }
void __fastcall TClipMaker::BPOnPaint(TObject *Sender) { TMxPanel* bp = dynamic_cast<TMxPanel*>(Sender); VERIFY(bp); CEditableObject* O = m_CurrentObject; VERIFY(O); TCanvas* canvas = bp->Canvas; canvas->Font->Name = "MS Sans Serif"; canvas->Font->Style = TFontStyles(); canvas->Font->Color = clBlack; canvas->Pen->Color = clBlack; canvas->Pen->Style = psSolid; canvas->Brush->Style= bsSolid; if (-2==bp->Tag){ for (UIClipIt it=clips.begin(); it!=clips.end(); it++){ canvas->Brush->Color= (*it==sel_clip)?(drag_obj==bp->Tag?BP_ACTIVE_DRAG_COLOR:BP_ACTIVE_COLOR):BP_INACTIVE_COLOR; TRect R = TRect((*it)->PLeft(), 1, (*it)->PRight()-1, 15); AnsiString fx_name = (*it)->FXName(); if (!fx_name.IsEmpty()){ canvas->Rectangle (R); R.Top += 1; R.Bottom -= 1; R.Left += 1; R.Right -= 1; canvas->TextRect (R,R.Left,R.Top,fx_name); } } }else if ((bp->Tag>=0)&&(bp->Tag<(int)O->BoneParts().size())){ AnsiString mn_prev = ""; for (UIClipIt it=clips.begin(); it!=clips.end(); it++){ AnsiString mn = (*it)->CycleName(u16(bp->Tag)); TRect R = TRect((*it)->PLeft(), 1, (*it)->PRight()-1, 15); if (!mn.IsEmpty()){ canvas->Brush->Color= (*it==sel_clip)?(drag_obj==bp->Tag?BP_ACTIVE_DRAG_COLOR:BP_ACTIVE_COLOR):BP_INACTIVE_COLOR; canvas->Rectangle (R); R.Top += 1; R.Bottom -= 1; R.Left += 1; R.Right -= 1; canvas->TextRect (R,R.Left,R.Top,mn); mn_prev = mn; }else if (!mn_prev.IsEmpty()){ canvas->MoveTo ((*it)->PLeft()+1,13); canvas->LineTo (R.Right,13); canvas->LineTo (R.Width()>5?R.Right-5:R.Right-R.Width(),8); R.Top += 1; R.Bottom -= 1; R.Left += 1; R.Right -= 1; } } } }
void __fastcall TFormReport::FrameList1GridView1DataControllerFilterChanged( TObject *Sender) { AnsiString str = ""; TMyFields::iterator iter; for(int i = 0; i<FrameList1->Query->Fields->Count; i++) { AnsiString fname = FrameList1->Query->Fields->Fields[i]->FieldName; AnsiString caption = (AnsiString)Fields[fname]; if(caption.IsEmpty()) caption = "false"; str += caption + (i < FrameList1->Query->Fields->Count-1?" ,":" "); } SetDisplayLabels(FrameList1->Query, FrameList1->GridView1->DataController,str); }
//--------------------------------------------------------------------------- // ƒобавл¤ю средство измерени¤ в список void __fastcall TListInstr::N1Click(TObject *Sender) { AnsiString nameOrType= InputBox("¬ведите наименование или тип прибора", "¬ведите наименование или тип прибора:", ""); if (nameOrType.IsEmpty()) return; AnsiString monufNumber = InputBox("¬ведите заводской номер прибора", "¬ведите заводской номер прибора:", ""); if (monufNumber.IsEmpty()) return; if (!Grid->Cells[0][1].IsEmpty()) // необходимость, если хошь иметь шапку { Grid->RowCount++; } // типа добавл¤ю int k = Grid->RowCount - Grid->FixedRows; Grid->Cells[0][k] = k; // номер строки Grid->Cells[1][k] = nameOrType; // наименование или тип Grid->Cells[2][k] = monufNumber; // заводской номер }
bool MimeBody::IsAttachment() const { /* Previously we looked at the ContentDisposition header and the Name header to determine whether it's an attachment or not. This was not safe, since a lot of attachments did not have these headers but just a Content-type header. The new strategy is: 1) If the ContentDisposition is of type attachment, we assume it's an attachment 2) If the main ContentType is text or multipart, we assume that it's not an attachment 3) In all other cases, we treat it as an attachment. discrete-type := "text" / "image" / "audio" / "video" / "application" / extension-token composite-type := "message" / "multipart" / extension-token */ // If the content-disposition is set to attachment, we always treats it as an attachment // even if the main type is set to multipart or text. AnsiString sDisposition = GetRawFieldValue(CMimeConst::ContentDisposition()); if (sDisposition.StartsWith(CMimeConst::Attachment())) return true; if (sDisposition.StartsWith(CMimeConst::Inline())) { AnsiString sFileName = GetParameter(CMimeConst::ContentDisposition(), "filename"); if (!sFileName.IsEmpty()) return true; } String sMainType = GetMainType(); if (sMainType.CompareNoCase(_T("multipart")) == 0) { // Multipart ... return false; } if (sMainType.CompareNoCase(_T("text")) == 0) { // This is just a text part. return false; } return true; }
//--------------------------------------------------------------------------- void __fastcall TRegAssociationsForm::ButtonDeleteClick(TObject *Sender) { AnsiString ext = ValueListEditorAssoc->Cells [0][ValueListEditorAssoc->Row]; if (!ext.IsEmpty()) { AnsiString msg = "’отите удалть запись (" + ext + ")?"; if (MessageBox (this->Handle, msg.c_str(), "", MB_YESNO) == IDNO) return; } try { ValueListEditorAssoc->DeleteRow (ValueListEditorAssoc->Row); } catch (...) { } }
std::vector<AnsiString> StringParser::SplitString(const AnsiString &sInput, const AnsiString &sSeperators) { std::vector<AnsiString> vecResult; int iBeginning = 0; int iEnd = sInput.Find(sSeperators); if (iEnd == -1) { // The separator was not found in the string. // We should put the entire string in the result. if (!sInput.IsEmpty()) vecResult.push_back(sInput); } int iSeperatorLen = sSeperators.GetLength(); while (iEnd >= 0) { int iSubStrLength = iEnd - iBeginning; String sSubString; sSubString = sInput.Mid(iBeginning, iSubStrLength); vecResult.push_back(sSubString); // Skip to the position where the next substring // can start iBeginning = iEnd + iSeperatorLen; iEnd = sInput.Find(sSeperators, iBeginning); } if (iBeginning > 0) { String sSubString = sInput.Mid(iBeginning); if (!sSubString.IsEmpty()) vecResult.push_back(sSubString); } return vecResult; }
AnsiString MimeHeader::GetUTF8FieldValue(const AnsiString &pszFieldName, const AnsiString &sRawFieldValue) { AnsiString sAnsiStr; if (sRawFieldValue.IsEmpty()) return sAnsiStr; // De-code the value to plain text. AnsiString sRetVal; FieldCodeBase* pCoder = MimeEnvironment::CreateFieldCoder(pszFieldName); pCoder->SetInput(sRawFieldValue, sRawFieldValue.GetLength(), false); pCoder->GetOutput(sRetVal); delete pCoder; sAnsiStr = Charset::ToUTF8(sRetVal); return sAnsiStr; }
//--------------------------------------------------------------------------- /// Metoda odpowiedzialna za dostosowanie wad i zalet do zapisu do bazy danych void __fastcall ParsujDane::DostosujWadyIZalety(AnsiString &AText) { int pozycjaZnacznik; AnsiString str, text, znakKonca; if (AText.IsEmpty()) return; znakKonca = "<ENDL>"; while (true) { pozycjaZnacznik = AText.Pos(znakKonca); if (pozycjaZnacznik > 0) AText.Delete(pozycjaZnacznik, znakKonca.Length()); if (pozycjaZnacznik == 0) break; text = AText.SubString(1, pozycjaZnacznik - 1); UsunZnacznik(text, ' '); str += text + "<ENDL>"; AText.Delete(1, pozycjaZnacznik); } AText = str; }
bool CFolderHelper::RenameItem(TElTree* tv, TElTreeItem* node, AnsiString& new_text, TOnItemRename OnRename) { R_ASSERT(OnRename); if (new_text.IsEmpty()) return false; new_text = new_text.LowerCase(); // find item with some name for (TElTreeItem* item=node->GetFirstSibling(); item; item=item->GetNextSibling()){ if ((item->Text==new_text)&&(item!=node)) return false; } AnsiString full_name; if (IsFolder(node)){ // is folder - rename all folder items for (TElTreeItem* item=node->GetFirstChild(); item&&(item->Level>node->Level); item=item->GetNext()){ if (IsObject(item)){ MakeName(item,0,full_name,false); VERIFY(node->Level<_GetItemCount(full_name.c_str(),'\\')); AnsiString new_full_name; _ReplaceItem(full_name.c_str(),node->Level,new_text.c_str(),new_full_name,'\\'); if (full_name!=new_full_name) OnRename(full_name.c_str(),new_full_name.c_str(),TYPE_OBJECT); } } AnsiString new_full_name; MakeName(node,0,full_name,true); _ReplaceItem(full_name.c_str(),node->Level,new_text.c_str(),new_full_name,'\\'); if (full_name!=new_full_name) OnRename(full_name.c_str(),new_full_name.c_str(),TYPE_FOLDER); }else if (IsObject(node)){ // is object - rename only this item MakeName(node,0,full_name,false); VERIFY(node->Level<_GetItemCount(full_name.c_str(),'\\')); AnsiString new_full_name; _ReplaceItem(full_name.c_str(),node->Level,new_text.c_str(),new_full_name,'\\'); if (full_name!=new_full_name) OnRename(full_name.c_str(),new_full_name.c_str(),TYPE_OBJECT); } tv->Selected=node; return true; }
void __fastcall TMainForm::ValueListEditorJParamMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { if (!m_show_hint) return; int row, col; ValueListEditorJParam->MouseToCell(X, Y, col, row); if (row >= 0 && col >= 0) { if (m_row != row || m_col != col) { m_row = row; m_col = col; AnsiString val = ValueListEditorJParam->Cells [col][row]; if (val.IsEmpty()) { m_hint->ReleaseHandle(); return; } TPoint p; p.x = X; p.y = Y; p = ValueListEditorJParam->ClientToScreen(p); TRect r = m_hint->CalcHintRect(20, val, 0); r.Left += p.x; r.Right += p.x; r.Top += p.y; r.Bottom += p.y; m_hint->ActivateHint(r, val); } } }