本文整理汇总了C++中AnsiString::LastDelimiter方法的典型用法代码示例。如果您正苦于以下问题:C++ AnsiString::LastDelimiter方法的具体用法?C++ AnsiString::LastDelimiter怎么用?C++ AnsiString::LastDelimiter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnsiString
的用法示例。
在下文中一共展示了AnsiString::LastDelimiter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StringAlign
//разбивает строку на несколько с учётом максимально допустимой ширины
//str - исходная строка
//AlignText - результирующий текст
//Width - максимальная ширина
void CTextAlign::StringAlign ( const AnsiString &str, TStrings *AlignText, int Width )
{
if ( Width <= 0 )
{
AlignText->Add ( str );
return;
}
if ( str.Length() <= Width )
{
AlignText->Add ( str );
return;
}
AnsiString FirstPart = str.SubString ( 1, Width );
AnsiString LastPart = str.SubString ( Width + 1, str.Length() - Width );
int pos = FirstPart.LastDelimiter(" ");
if ( pos == 0 )
{
//если нет пробелов в строке
AlignText->Add ( FirstPart );
StringAlign ( LastPart, AlignText, Width );
}else
{
AlignText->Add ( FirstPart.SubString ( 1, pos ) );
LastPart = FirstPart.SubString ( pos + 1, FirstPart.Length() - pos ) + LastPart;
StringAlign ( LastPart, AlignText, Width );
}
}
示例2: withPath
//-----------------------------------------------------------------------------
bool withPath( AnsiString asPath )
{
if ( asPath.LastDelimiter(":\\") > 0 )
return true;
else
return false;
}
示例3: getPathFromStr
//---------------------------------------------------------------------------
bool getPathFromStr( AnsiString asStr, AnsiString &asPath )
{
int iLD = asStr.LastDelimiter(":\\");
if (iLD <= 0)
return false;
asPath = asStr.SubString( 1, iLD );
return true;
}
示例4: Button_MeasureClick
//---------------------------------------------------------------------------
void __fastcall TGammaMeasurementForm::Button_MeasureClick(TObject * Sender)
{
using namespace std;
using namespace cms::util;
using namespace cms::measure;
using namespace cms::measure::meter;
MainForm->setMeterMeasurementWaitTimes();
String_ptr filename = this->TOutputFileFrame1->getOutputFilename();
string stlfilename = filename->c_str();
if (!Util::deleteExist(stlfilename))
{
ShowMessage("File is locked!");
return;
}
bool imageMeasure = CheckBox_ImageMeasure->Checked;
try
{
Button_Measure->Enabled = false;
MainForm->showProgress(ProgressBar1);
if (imageMeasure) //20140609 skyforce, 可用圖片做pattern的量測功能
{
AnsiString Dir = "D:\\";
SelectDirectory("選擇目錄", "", Dir);
AnsiString finalDirName =
Dir.SubString(Dir.LastDelimiter("\\") + 1, Dir.Length());
// this->Edit_Directory->Text = Dir + " \\ ";
int start = this->Edit_StartLevel->Text.ToInt();
int end = this->Edit_EndLevel->Text.ToInt();
int step = this->ComboBox_LevelStep->Text.ToInt();
AnsiString s;
// int waitTimes = MainForm->geti
bptr < MeterMeasurement > mm = MainForm->mm;
int waitTimes = mm->WaitTimes;
bptr < Meter > meter = mm->getMeter();
XYZ_vector_ptr XYZVector(new XYZ_vector());
MeasureWindow->Visible = true;
for (int graylevel = start; graylevel >= end; graylevel -= step)
{
AnsiString filename =
s.sprintf("%s\\%s_%03d.bmp", Dir, finalDirName, graylevel);
// AnsiString filename = s.sprintf(" % d.", graylevel) + " bmp ";
if (FileExists(filename))
{
MeasureWindow->setImageFilename(filename.c_str());
Application->ProcessMessages();
Sleep(waitTimes);
if (MainForm->linkCA210)
{
double_array XYZValues = meter->triggerMeasurementInXYZ();
XYZ_ptr XYZ(new Indep::CIEXYZ(XYZValues));
XYZVector->push_back(XYZ);
}
else
{
XYZ_ptr XYZ(new Indep::CIEXYZ(1, 2, 3));
XYZVector->push_back(XYZ);
}
}
else
{
ShowMessage("Image " + filename +
" is not exisit ! Stop measure.");
break;
}
}
MeasureWindow->Visible = false;
MeasureWindow->setImageOff();
// String_ptr astr = this->TOutputFileFrame1->getOutputFilename();
// string filename = astr->c_str();
if (XYZVector->size() != 0)
{
Util::storeXYZxyVector(stlfilename, XYZVector, "no");
ShowMessage("Ok!");
Util::shellExecute(stlfilename);
}
}
else
{
bool_vector_ptr rgbw(new bool_vector(4));
int_vector_ptr background(new int_vector(3));
bool flicker = this->CheckBox_FlickerFMA->Checked;
(*rgbw)[0] = this->CheckBox_R->Checked;
(*rgbw)[1] = this->CheckBox_G->Checked;
(*rgbw)[2] = this->CheckBox_B->Checked;
(*rgbw)[3] = this->CheckBox_W->Checked;
(*background)[0] = Edit_BackgroundR->Text.ToInt();
(*background)[1] = Edit_BackgroundG->Text.ToInt();
//.........这里部分代码省略.........
示例5: CheckVersion
//---------------------------------------------------------------------------
// Check to see if SelfImage is up-to-date - notify the user if it isn't
//
void CheckVersion(void) {
TDateTime *dtLastCheck = NULL;
char *filename = NULL;
char *buffer = NULL;
char *verbuff = NULL;
unsigned nVersionInfoSize;
int nBuildPos;
static AnsiString sMyVersion = "";
static int nMyBuild = 0;
AnsiString sCurrentVersion, sURL;
int nCurrentBuild = 0;
TIdHTTP *HTTP;
DWORD nDummy;
__ENTERFUNCTION__;
try {
try {
formSelfImageNewVersionNotify = NULL;
if (!SelfImageConfig->Values["Update Notify"]) {
LOG(LOG_DEBUG, "Update Notify is turned off - not checking for new version.");
goto END; // Ugly - C++ Builder silently ignores a __finally block if a return is process from a nested try.
} // if (!SelfImageConfig->Values["Update Notify"])
if (String(SelfImageConfig->Values["Last Version Check"]).IsEmpty())
SelfImageConfig->Values["Last Version Check"] = (Now()-1).DateTimeString();
dtLastCheck = new TDateTime(String(SelfImageConfig->Values["Last Version Check"]));
if (!DaysBetween(Now(), *dtLastCheck)) {
LOG1(LOG_DEBUG, "Last new version check was performed %s - not checking again.", dtLastCheck->DateTimeString().c_str());
goto END; // Ugly - C++ Builder silently ignores a __finally block if a return is process from a nested try.
} // if (!DaysBetween(Now(), *dtLastCheck))
SelfImageConfig->Values["Last Version Check"] = Now().DateTimeString();
// Get this executable's version - this is a pain, so let's just do it once for each time SelfImage is instantiated
if (!nMyBuild) {
LOG(LOG_DEBUG, "Retrieving internal version number.");
filename = (char *)malloc(MAXPATH);
GetModuleFileName(HInstance, filename, MAXPATH);
nVersionInfoSize = GetFileVersionInfoSize(filename, &nDummy);
// These following three exceptions should never make it to the user except through the logs in a debug build.
// Since they are only for logging, they are allowed to have text that doesn't come from the string table.
if (!nVersionInfoSize)
throw ESelfImageSystemError("GetFileVersionInfoSize() failed: " + GetLastErrorMessage());
buffer = (char *)malloc(nVersionInfoSize);
if (!GetFileVersionInfo(filename, NULL, nVersionInfoSize, buffer))
throw ESelfImageSystemError("GetFileVersionInfo() failed:" + GetLastErrorMessage());
if (!VerQueryValue(buffer, "\\StringFileInfo\\100904E4\\FileVersion", (void **)&verbuff, NULL))
throw ESelfImageSystemError("VerQueryValue() failed:" + GetLastErrorMessage());
sMyVersion = verbuff;
nBuildPos = sMyVersion.LastDelimiter(".");
nMyBuild = sMyVersion.SubString(nBuildPos + 1, sMyVersion.Length() - nBuildPos).ToInt();
sMyVersion = sMyVersion.SubString(1,nBuildPos-1) + " (Build " + String(nMyBuild) + ")";
LOG1(LOG_MESSAGE, "Internal version string retrieved from resources: \"%s\".", sMyVersion.c_str());
} // if (sMyVersion.IsEmpty())
// Get SelfImage's current version from the interweb - woo, this is cool
HTTP = new TIdHTTP(NULL);
sURL = SelfImageConfig->Values["Version URL"];
LOG1(LOG_DEBUG, "Attempting to retrieve version string from URL \"%s\".", sURL.c_str());
try {
sCurrentVersion = HTTP->Get(SelfImageConfig->Values["Version URL"]);
nBuildPos = sCurrentVersion.Pos("(Build ");
nCurrentBuild = sCurrentVersion.SubString(nBuildPos + 7, sCurrentVersion.Length() - nBuildPos - 7).ToInt();
}
catch (...) { sCurrentVersion = ""; }
delete HTTP;
#ifdef __LOGGINGENABLED__
if (!sCurrentVersion.IsEmpty())
LOG2(LOG_MESSAGE, "Version string \"%s\" retrieved from %s.", sCurrentVersion.c_str(), sURL.c_str())
else
LOG2(LOG_WARNING, "Unable to retrieve version string from URL \"%s\": %s", sURL.c_str(), HTTP->ResponseText.c_str());
#endif
// Compare the two...
if (nCurrentBuild && nMyBuild < nCurrentBuild && sCurrentVersion != String(SelfImageConfig->Values["Notify Squelch"])) {
LOG(LOG_DEBUG, "Notifying user of new version.");
formSelfImageNewVersionNotify = new TformSelfImageNewVersionNotify(NULL, sMyVersion, sCurrentVersion);
if (formSelfImageNewVersionNotify->ShowModal() == mrCancel)
SelfImageConfig->Values["Notify Squelch"] = sCurrentVersion;
} // if (different versions)
} // inner try
catch (Exception &e) {
LOG2(LOG_ERROR, "Exception of type \"%s\" raised during new version check with message \"%s\"", String(e.ClassName()).c_str(), e.Message.c_str());
} // catch
} // outer try
__finally {
if (dtLastCheck)
delete dtLastCheck;
if (filename)
free(filename);
if (buffer)
free(buffer);
if (formSelfImageNewVersionNotify) {
delete formSelfImageNewVersionNotify;
formSelfImageNewVersionNotify = NULL;
//.........这里部分代码省略.........