当前位置: 首页>>代码示例>>C++>>正文


C++ XString::replace方法代码示例

本文整理汇总了C++中XString::replace方法的典型用法代码示例。如果您正苦于以下问题:C++ XString::replace方法的具体用法?C++ XString::replace怎么用?C++ XString::replace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XString的用法示例。


在下文中一共展示了XString::replace方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: kbasicPath

XString kbasicPath(XString s)
{
  
  //if (sKBasicPath.isNull()) sKBasicPath = "c:\\kbasic16";

  XString k = sKBasicPath;
  k = k.replace("/cache", "");
  k = k + "/"+ s; 
 
  //k = k.replace("/", "\\");
  
  //QMessageBox::information(0, "", k);


  return k;
}
开发者ID:DamianSuess,项目名称:kbasic,代码行数:16,代码来源:main.cpp

示例2: kbc


//.........这里部分代码省略.........
    }
    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);

	char *acText;
  bool b = true;
开发者ID:DamianSuess,项目名称:kbasic,代码行数:66,代码来源:main.cpp

示例3: 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

示例4: atoi

char *prepareSourceCodeDefinition(const char *acFile, const char *acText, bool bForm)
{
  XString sText;

  sText = acText; sText = sText.replace("\r", "");
  int n = 0;

  XString sSQLName = "";
  XString sSQLControls = "";
  XString sAdditonalCode = "";
  XString sAdditional = "";

  int nBorderLeft = 0;
  int nBorderRight = 0;
  int nBorderTop = 0;
  int nBorderBottom = 0;

  int nHeight = 0;
  
  n = sText.find("Height = ");
  if (n >= 0){
    n += 9;
    int n2 = sText.find("\n", n);
    nHeight = atoi(sText.mid(n, n2 - n).ascii());
  }

  n = sText.find("BorderLeft = ");
  if (n >= 0){
    n += 13;
    int n2 = sText.find("\n", n);
    nBorderLeft = atoi(sText.mid(n, n2 - n).ascii());
  }

  n = sText.find("BorderRight = ");
  if (n >= 0){
    n += 14;
    int n2 = sText.find("\n", n);
    nBorderRight = atoi(sText.mid(n, n2 - n).ascii());
  }

  n = sText.find("BorderTop = ");
  if (n >= 0){
    n += 12;
    int n2 = sText.find("\n", n);
    nBorderTop = atoi(sText.mid(n, n2 - n).ascii());
  }

  n = sText.find("BorderBottom = ");
  if (n >= 0){
    n += 15;
    int n2 = sText.find("\n", n);
    nBorderBottom = atoi(sText.mid(n, n2 - n).ascii());
  }

  n = sText.find("SQLControls = \"");
  if (n >= 0){
    n += 15;
    int n2 = sText.find("\"", n);
    sSQLControls = sText.mid(n, n2 - n);
  }

  n = sText.find("SQLName = \"");
  if (n >= 0){
    n += 11;
    int n2 = sText.find("\"", n);
    sSQLName = sText.mid(n, n2 - n);
  }

  n = 0;

  
  n++;

  static XString sDefinition;
  sDefinition = "";
  XString sConstructor = "";

  sDefinition += "\n";



  do {
    n = sText.find("Begin ", n);
    if (n == -1) break;

    int n2 = sText.find("\n", n);
    n += 6;
    XString sLine = sText.mid(n, n2 - n);
    int n3 = sLine.find(" ");
    XString sType = sLine.mid(0, n3);
    XString sName = sLine.mid(n3 + 1);
    sName = sName.stripWhiteSpace();

    sDefinition += "Public ";
    sDefinition += sName;
    sDefinition += " As ";
    sDefinition += sType;
    sDefinition += "\n";

    sConstructor += sName;
//.........这里部分代码省略.........
开发者ID:DamianSuess,项目名称:kbasic,代码行数:101,代码来源:main.cpp


注:本文中的XString::replace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。