當前位置: 首頁>>代碼示例>>C++>>正文


C++ XString::endsWith方法代碼示例

本文整理匯總了C++中XString::endsWith方法的典型用法代碼示例。如果您正苦於以下問題:C++ XString::endsWith方法的具體用法?C++ XString::endsWith怎麽用?C++ XString::endsWith使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XString的用法示例。


在下文中一共展示了XString::endsWith方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: kbc


//.........這裏部分代碼省略.........
    if (finfo.open(Truncate)){ sprintf(acInfo, "Scanning..."); finfo.writeBlock(acInfo, strlen(acInfo)); finfo.close(); }
    
    if (finfo.open(Truncate)){ sprintf(acInfo, "%s", cachePath("default.kbasic").ascii()); finfo.writeBlock(acInfo, strlen(acInfo)); finfo.close(); }

    if (b && (b = utility::readSourceFile(&acText, cachePath("default.kbasic").ascii(), myTextbuffer))){

      acText = utility::eatUTF16DOM(acText);
    }

    if (b && (b = myScanner->scan(acText, (char *) cachePath("default.kbasic").ascii(), bSilent, bDebug, false, bUseCache))){} // filename

    if (b){
      int n = 0;
      int n0 = 0;

      bool bFirst = true;
      do {
        n = sFiles.find("\n", n);
        XString s = sFiles.mid(n0, n >= 0 ? n - n0 : sFiles.length());
        if (n == -1 & bFirst == false) break;
        bFirst = false;
        n0 = n + 1;
        n++;
        
        const char *ac99 = s.ascii();

        if (b && (b = utility::readSourceFile(&acText, ac99, myTextbuffer))){
          acText = utility::eatUTF16DOM(acText);
        }


        XString sFile = ac99;

        if (sFile.endsWith(".kbasic_form")){
     
          XString sLanguage = "";
          XString sExt = getFilenameExtension(sFile);
          XString q = sFile.left(sFile.length() - sExt.length() - 1);

          if (q.count(".") > 1){
            sLanguage = getFilenameExtension(q);
            if (sLanguage.contains("/") || sLanguage.contains("\\")){
              sLanguage = "";
            }
          }
        
          if (sLanguage.length() == 0){
   //       if (!sTranslation.contains(sLanguage, false)){
            acText = prepareSourceCode(ac99, acText, sFile); 
          } else {
/*
            char ac[1111];
            sprintf(ac, "omit %s %s", sFile.ascii(), sLanguage.ascii());
            CONSOLE printError(ac);*/
            continue;
//            acText = "";
          }

        } else if (sFile.endsWith(".kbasic_menubar")){

          XString sLanguage = "";
          XString sExt = getFilenameExtension(sFile);
          XString q = sFile.left(sFile.length() - sExt.length() - 1);

          if (q.count(".") > 1){
            sLanguage = getFilenameExtension(q);
開發者ID:DamianSuess,項目名稱:kbasic,代碼行數:67,代碼來源:main.cpp

示例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();

}
開發者ID:DamianSuess,項目名稱:kbasic,代碼行數:93,代碼來源:main.cpp


注:本文中的XString::endsWith方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。