本文整理匯總了C++中XString::contains方法的典型用法代碼示例。如果您正苦於以下問題:C++ XString::contains方法的具體用法?C++ XString::contains怎麽用?C++ XString::contains使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類XString
的用法示例。
在下文中一共展示了XString::contains方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: e_mail_check
//---------------------------------------------------
// E-mail check: return 0 (not correct) or 1 (valid).
//---------------------------------------------------
bool e_mail_check(XString email)
{
// athena limits
if (email.size() < 3 || email.size() > 39)
return 0;
// part of RFC limits (official reference of e-mail description)
XString::iterator at = std::find(email.begin(), email.end(), '@');
if (at == email.end())
return 0;
XString username = email.xislice_h(at);
XString hostname = email.xislice_t(at + 1);
if (!username || !hostname)
return 0;
if (hostname.contains('@'))
return 0;
if (hostname.front() == '.' || hostname.back() == '.')
return 0;
if (hostname.contains_seq(".."))
return 0;
if (email.contains_any(" ;"))
return 0;
return email.is_print();
}
示例2: if
char *prepareSourceCode(const char *acFile, const char *acText, const XString & sFile)
{
static XString sText;
XString sClass = "";
bool bReport = false;
bool bModule = false;
bool bClass = false;
if (sFile.endsWith(".kbasic_form")){
sClass = "Form";
} else if (sFile.endsWith(".kbasic_menubar")){
sClass = "MenuBar";
} else if (sFile.endsWith(".kbasic_toolbar")){
sClass = "ToolBar";
} else if (sFile.endsWith(".kbasic_module")){
bModule = true;
} else if (sFile.endsWith(".kbasic_class")){
bClass = true;
} else if (sFile.endsWith(".kbasic_report")){
sClass = "Report";
bReport = true;
}
XString sHeader = "";
if (bModule){
sText = acText; sText = sText.replace("\r", "");
if (sText.contains("\nEnd Module ", false)) return (char *) sText.ascii();
if (sText.contains("\nEnd Module\n", false)) return (char *) sText.ascii();
if (sText.contains("\nEnd Module'", false)) return (char *) sText.ascii();
if (sText.contains("\nEnd Module/*", false)) return (char *) sText.ascii();
if (sText.endsWith("End Module", false)) return (char *) sText.ascii();
if (sText.startsWith("Module ", false)) return (char *) sText.ascii();
if (sText.startsWith("\nModule ", false)) return (char *) sText.ascii();
sHeader = sHeader.append("Module ");
sHeader = sHeader.append(getFilenameWithoutPathAndExtension(acFile));
sHeader = sHeader.append(" : ");
sText = sText.prepend(sHeader);
sText = sText.append("\nEnd Module\n");
} else if (bClass){
sText = acText; sText = sText.replace("\r", "");
if (sText.contains("\nEnd Class ", false)) return (char *) sText.ascii();
if (sText.contains("\nEnd Class\n", false)) return (char *) sText.ascii();
if (sText.contains("\nEnd Class'", false)) return (char *) sText.ascii();
if (sText.contains("\nEnd Class/*", false)) return (char *) sText.ascii();
if (sText.endsWith("End Class", false)) return (char *) sText.ascii();
if (sText.startsWith("Class ", false)) return (char *) sText.ascii();
if (sText.startsWith("\nClass ", false)) return (char *) sText.ascii();
sHeader = sHeader.append("Class ");
sHeader = sHeader.append(getFilenameWithoutPathAndExtension(acFile));
if (sFile.endsWith("myEvent.kbasic_class", false)){
sHeader = sHeader.append(" Inherits Event ");
}
sHeader = sHeader.append(" : ");
sText = sText.prepend(sHeader);
sText = sText.append("\nEnd Class\n");
} else {
XString sFind = "\nEnd " + sClass + "\n";
sText = acText; sText = sText.replace("\r", "");
sText = sText.mid(sText.find(sFind) + sFind.length());
sHeader = sHeader.append("Class ");
sHeader = sHeader.append(getFilenameWithoutPathAndExtension(acFile));
sHeader = sHeader.append(" Inherits ");
sHeader = sHeader.append(bReport ? "Form" : sClass); // actually Report is a form
sHeader = sHeader.append("\n");
sText = sText.prepend(sHeader);
XString sDefinition = "";
if (sFile.endsWith(".kbasic_form")){
sDefinition = prepareSourceCodeDefinition(acFile, acText, true);
} else if (sFile.endsWith(".kbasic_report")){
sDefinition = prepareSourceCodeDefinition(acFile, acText, false);
}
sText = sText.append(sDefinition);
sText = sText.append("\nEnd Class\n");
}
return (char *) sText.ascii();
}
示例3: kbc
//.........這裏部分代碼省略.........
acMenu = (char *) ac + 5;
if (acMenu == 0) sMenu = ""; else sMenu = acMenu;
}
else break;
}
/*
bSilent = false;
bDebug = false;
bUseCache = true;
sProjectName = "KBasic Default Project";
sProjectType = "With Forms MainWindow (you must have myMenuBar created)";
sTranslation = "&Window;Help;C&ontents;A&bout;Cl&ose;Close &All;&Tile;&Cascade;Arrange &icons;Ne&xt;Pre&vious;";
sSQL = "QPSQL;localhost;test;postgres;test";
*/
// if (bUseCache) printf("!!!!!");
// sprintf(ac, "");
//if (MAIN_argc > 1 && i <= MAIN_argc) sprintf(ac, "%s", MAIN_argv[i]);
//sprintf(ac, "C:/kbasic16/kbide/examples/kbasic/builtin/__class__.kbasic");
//if (utility::my_stricmp(ac, "") == 0) return 0;
//bUseCache = false;
{
sKBasicPath = MAIN_argv[0];
bool bDebug = false;
#ifdef WINDOWS // HIDE
bDebug = sKBasicPath.contains("Debug"); // HIDE
#endif // HIDE
sKBasicPath = sKBasicPath.replace("\\", "/");
#ifdef WINDOWS // HIDE
sKBasicPath = sKBasicPath.replace("/Debug", "", false); // HIDE
sKBasicPath = sKBasicPath.replace("/Release", "", false); // HIDE
sKBasicPath = sKBasicPath.replace(".exe", "", false); // HIDE
#endif // HIDE
if (bDebug){
int n = sKBasicPath.findRev("/");
if (n >= 0) sKBasicPath = sKBasicPath.left(n);
sKBasicPath = sKBasicPath.replace("kbc", "kbide/ide/cache");
} else {
sKBasicPath = sKBasicPath.replace("kbc", "ide/cache");
}
if (sKBasicPath.isEmpty()) return 0;
}
// if (checkLicense(acLicense) == false) return 0;
// checkSerialNo();
textbuffer *myTextbuffer = new textbuffer(); // needed to truncate big input strings or zero terminate them
cache *my_cache = new cache();
token *myToken = new token();
scanner *myScanner = new scanner(myToken, my_cache);
示例4: atoi
//.........這裏部分代碼省略.........
sName = sName.stripWhiteSpace();
sDefinition += "Public ";
sDefinition += sName;
sDefinition += " As ";
sDefinition += sType;
sDefinition += "\n";
sConstructor += sName;
sConstructor += " = Control(\"";
sConstructor += sName;
sConstructor += "\")\n";
n = sText.find("End\n", n); // proceed to the end of that control defintion
} while (true);
int X = 0;
int nFocusOrder = 1000;
if (!sSQLName.isEmpty() && bForm)
{
if (sSQLControls.isEmpty()){
createSQLControl("Recordset", 90, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls);
createSQLControl("First", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls);
createSQLControl("Previous", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls);
createSQLControl("GoTo", 60, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls);
createSQLControl("Next", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls);
createSQLControl("Last", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls);
createSQLControl("AddNew", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls);
X += 5;
createSQLControl("Info", 110, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls);
X += 20;
createSQLControl("Update", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls);
X += 20;
createSQLControl("Delete", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls);
} else {
if (sSQLControls.contains("Recordset")){ createSQLControl("Recordset", 90, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls); }
if (sSQLControls.contains("First")){ createSQLControl("First", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls); }
if (sSQLControls.contains("Previous")){ createSQLControl("Previous", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls); }
if (sSQLControls.contains("GoTo")){ createSQLControl("GoTo", 50, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls); }
if (sSQLControls.contains("Next")){ createSQLControl("Next", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls); }
if (sSQLControls.contains("Last")){ createSQLControl("Last", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls); }
if (sSQLControls.contains("AddNew")){ createSQLControl("AddNew", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls); }
X += 5;
if (sSQLControls.contains("Info")){ createSQLControl("Info", 90, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls); }
X += 20;
if (sSQLControls.contains("Update")){ createSQLControl("Update", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls); }
X += 20;
if (sSQLControls.contains("Delete")){ createSQLControl("Delete", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight, nFocusOrder++, &sSQLControls); }
/*
X += 20;
if (sSQLControls.contains("Requery")){ createSQLControl("Requery", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight); }
if (sSQLControls.contains("Seek")){ createSQLControl("Seek", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight); }
if (sSQLControls.contains("ClearFilter")){ createSQLControl("ClearFilter", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight); }
if (sSQLControls.contains("AddFilter")){ createSQLControl("AddFilter", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight); }
if (sSQLControls.contains("AddNotFilter")){ createSQLControl("AddNotFilter", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight); }
if (sSQLControls.contains("SetFilter")){ createSQLControl("SetFilter", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight); }
if (sSQLControls.contains("SetNotFilter")){ createSQLControl("SetNotFilter", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight); }
if (sSQLControls.contains("SortAscending")){ createSQLControl("SortAscending", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight); }
if (sSQLControls.contains("SortDescending")){ createSQLControl("SortDescending", 20, &sDefinition, &sAdditonalCode, &sAdditional, &X, nBorderLeft, nBorderBottom, nHeight); }
*/
}
}
sDefinition += "\n\nConstructor ";
sDefinition += getFilenameWithoutPathAndExtension(acFile);
sDefinition += "()\n";
sDefinition += "\nLoad(\"";
sDefinition += getFilenameWithoutPathAndExtension(acFile);
sDefinition += "\")\n\n";
sDefinition += sConstructor;
sDefinition += "\nFinish()\n\n";
sDefinition += sAdditonalCode;
sDefinition += "\nEnd Constructor\n";
sDefinition += sAdditional;
if (!sSQLName.isEmpty() && bForm)
{
sDefinition += "Sub Form_OnGoTo2()\n";
if (sSQLControls.isEmpty() || sSQLControls.contains("GoTo")) sDefinition += " SQLGoTo.Value = \"\" & Me.Position()\n";
if (sSQLControls.isEmpty() || sSQLControls.contains("Info")){
sDefinition += " If IsFilterActive() Then\nSQLInfo.Caption = \"of \" & Me.Length() & \" record(s) (Filter)\"\nElse\nSQLInfo.Caption = \"of \" & Me.Length() & \" record(s)\"\nEnd If\n";
}
sDefinition += "End Sub\n";
}
return (char *) sDefinition.ascii();
}