本文整理汇总了C++中XString::startsWith方法的典型用法代码示例。如果您正苦于以下问题:C++ XString::startsWith方法的具体用法?C++ XString::startsWith怎么用?C++ XString::startsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XString
的用法示例。
在下文中一共展示了XString::startsWith方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}