• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ NewStringEmpty函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中NewStringEmpty函数的典型用法代码示例。如果您正苦于以下问题:C++ NewStringEmpty函数的具体用法?C++ NewStringEmpty怎么用?C++ NewStringEmpty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: malloc

Wrapper *NewWrapper(void) {
  Wrapper *w;
  w = (Wrapper *) malloc(sizeof(Wrapper));
  w->localh = NewHash();
  w->locals = NewStringEmpty();
  w->code = NewStringEmpty();
  w->def = NewStringEmpty();
  return w;
}
开发者ID:SumiTomohiko,项目名称:Yog,代码行数:9,代码来源:wrapfunc.c


示例2: Swig_extend_merge

void Swig_extend_merge(Node *cls, Node *am) {
  Node *n;
  Node *csym;

  n = firstChild(am);
  while (n) {
    String *symname;
    if (Strcmp(nodeType(n),"constructor") == 0) {
      symname = Getattr(n,"sym:name");
      if (symname) {
	if (Strcmp(symname,Getattr(n,"name")) == 0) {
	  /* If the name and the sym:name of a constructor are the same,
             then it hasn't been renamed.  However---the name of the class
             itself might have been renamed so we need to do a consistency
             check here */
	  if (Getattr(cls,"sym:name")) {
	    Setattr(n,"sym:name", Getattr(cls,"sym:name"));
	  }
	}
      } 
    }

    symname = Getattr(n,"sym:name");
    DohIncref(symname);
    if ((symname) && (!Getattr(n,"error"))) {
      /* Remove node from its symbol table */
      Swig_symbol_remove(n);
      csym = Swig_symbol_add(symname,n);
      if (csym != n) {
	/* Conflict with previous definition.  Nuke previous definition */
	String *e = NewStringEmpty();
	String *en = NewStringEmpty();
	String *ec = NewStringEmpty();
	Printf(ec,"Identifier '%s' redefined by %%extend (ignored),",symname);
	Printf(en,"%%extend definition of '%s'.",symname);
	SWIG_WARN_NODE_BEGIN(n);
	Swig_warning(WARN_PARSE_REDEFINED,Getfile(csym),Getline(csym),"%s\n",ec);
	Swig_warning(WARN_PARSE_REDEFINED,Getfile(n),Getline(n),"%s\n",en);
	SWIG_WARN_NODE_END(n);
	Printf(e,"%s:%d:%s\n%s:%d:%s\n",Getfile(csym),Getline(csym),ec, 
	       Getfile(n),Getline(n),en);
	Setattr(csym,"error",e);
	Delete(e);
	Delete(en);
	Delete(ec);
	Swig_symbol_remove(csym);              /* Remove class definition */
	Swig_symbol_add(symname,n);            /* Insert extend definition */
      }
    }
    n = nextSibling(n);
  }
}
开发者ID:kkaempf,项目名称:swig,代码行数:52,代码来源:extend.c


示例3: SwigType_namestr

String *Swig_name_disown(const_String_or_char_ptr nspace, const_String_or_char_ptr classname) {
  String *r;
  String *f;
  String *rclassname;
  char *cname;
  rclassname = SwigType_namestr(classname);
  r = NewStringEmpty();
  if (!naming_hash)
    naming_hash = NewHash();
  f = Getattr(naming_hash, "disown");
  if (!f) {
    Append(r, "disown_%n%c");
  } else {
    Append(r, f);
  }

  cname = Char(rclassname);
  if ((strncmp(cname, "struct ", 7) == 0) || ((strncmp(cname, "class ", 6) == 0)) || ((strncmp(cname, "union ", 6) == 0))) {
    cname = strchr(cname, ' ') + 1;
  }

  replace_nspace(r, nspace);
  Replace(r, "%c", cname, DOH_REPLACE_ANY);
  Delete(rclassname);
  return r;
}
开发者ID:progranism,项目名称:Allegro-5-SWIG-Wrapper,代码行数:26,代码来源:naming.c


示例4: pcre_compile

/* -----------------------------------------------------------------------------
 * Swig_string_regex()
 *
 * Executes a regular expression substitution. For example:
 *
 *   Printf(stderr,"gsl%(regex:/GSL_.*_/\\1/)s","GSL_Hello_") -> gslHello
 * ----------------------------------------------------------------------------- */
String *Swig_string_regex(String *s) {
  const int pcre_options = 0;

  String *res = 0;
  pcre *compiled_pat = 0;
  const char *pcre_error, *input;
  int pcre_errorpos;
  String *pattern = 0, *subst = 0;
  int captures[30];

  if (split_regex_pattern_subst(s, &pattern, &subst, &input)) {
    int rc;

    compiled_pat = pcre_compile(
          Char(pattern), pcre_options, &pcre_error, &pcre_errorpos, NULL);
    if (!compiled_pat) {
      Swig_error("SWIG", Getline(s), "PCRE compilation failed: '%s' in '%s':%i.\n",
          pcre_error, Char(pattern), pcre_errorpos);
      exit(1);
    }
    rc = pcre_exec(compiled_pat, NULL, input, (int)strlen(input), 0, 0, captures, 30);
    if (rc >= 0) {
      res = replace_captures(rc, input, subst, captures, pattern, s);
    } else if (rc != PCRE_ERROR_NOMATCH) {
      Swig_error("SWIG", Getline(s), "PCRE execution failed: error %d while matching \"%s\" using \"%s\".\n",
	rc, Char(pattern), input);
      exit(1);
    }
  }

  DohDelete(pattern);
  DohDelete(subst);
  pcre_free(compiled_pat);
  return res ? res : NewStringEmpty();
}
开发者ID:EemeliSyynimaa,项目名称:yam2d,代码行数:42,代码来源:misc.c


示例5: NewStringEmpty

String *SwigType_lcaststr(const SwigType *s, const_String_or_char_ptr name) {
  String *result;

  result = NewStringEmpty();

  if (SwigType_isarray(s)) {
    String *lstr = SwigType_lstr(s, 0);
    Printf(result, "(%s)%s", lstr, name);
    Delete(lstr);
  } else if (SwigType_isreference(s)) {
    String *str = SwigType_str(s, 0);
    Printf(result, "(%s)", str);
    Delete(str);
    if (name)
      Append(result, name);
  } else if (SwigType_isqualifier(s)) {
    String *lstr = SwigType_lstr(s, 0);
    Printf(result, "(%s)%s", lstr, name);
    Delete(lstr);
  } else {
    if (name)
      Append(result, name);
  }
  return result;
}
开发者ID:Distrotech,项目名称:swig,代码行数:25,代码来源:stype.c


示例6: NewStringEmpty

String *Swig_string_escape(String *s) {
  String *ns;
  int c;
  ns = NewStringEmpty();

  while ((c = Getc(s)) != EOF) {
    if (c == '\n') {
      Printf(ns, "\\n");
    } else if (c == '\r') {
      Printf(ns, "\\r");
    } else if (c == '\t') {
      Printf(ns, "\\t");
    } else if (c == '\\') {
      Printf(ns, "\\\\");
    } else if (c == '\'') {
      Printf(ns, "\\'");
    } else if (c == '\"') {
      Printf(ns, "\\\"");
    } else if (c == ' ') {
      Putc(c, ns);
    } else if (!isgraph(c)) {
      if (c < 0)
	c += UCHAR_MAX + 1;
      Printf(ns, "\\%o", c);
    } else {
      Putc(c, ns);
    }
  }
  return ns;
}
开发者ID:EemeliSyynimaa,项目名称:yam2d,代码行数:30,代码来源:misc.c


示例7: NewStringEmpty

String *replace_captures(int num_captures, const char *input, String *subst, int captures[], String *pattern, String *s)
{
  String *result = NewStringEmpty();
  const char *p = Char(subst);

  while (*p) {
    /* Copy part without substitutions */
    const char *q = strchr(p, '\\');
    if (!q) {
      Write(result, p, strlen(p));
      break;
    }
    Write(result, p, q - p);
    p = q + 1;

    /* Handle substitution */
    if (*p == '\0') {
      Putc('\\', result);
    } else if (isdigit((unsigned char)*p)) {
      int group = *p++ - '0';
      if (group < num_captures) {
	int l = captures[group*2], r = captures[group*2 + 1];
	if (l != -1) {
	  Write(result, input + l, r - l);
	}
      } else {
	Swig_error("SWIG", Getline(s), "PCRE capture replacement failed while matching \"%s\" using \"%s\" - request for group %d is greater than the number of captures %d.\n",
	    Char(pattern), input, group, num_captures-1);
      }
    }
  }

  return result;
}
开发者ID:Distrotech,项目名称:swig,代码行数:34,代码来源:misc.c


示例8: NewHash

SwigType *SwigType_strip_qualifiers(SwigType *t) {
  static Hash *memoize_stripped = 0;
  SwigType *r;
  List *l;
  Iterator ei;

  if (!memoize_stripped)
    memoize_stripped = NewHash();
  r = Getattr(memoize_stripped, t);
  if (r)
    return Copy(r);

  l = SwigType_split(t);
  r = NewStringEmpty();

  for (ei = First(l); ei.item; ei = Next(ei)) {
    if (SwigType_isqualifier(ei.item))
      continue;
    Append(r, ei.item);
  }
  Delete(l);
  {
    String *key, *value;
    key = Copy(t);
    value = Copy(r);
    Setattr(memoize_stripped, key, value);
    Delete(key);
    Delete(value);
  }
  return r;
}
开发者ID:charlie5,项目名称:swig4ada,代码行数:31,代码来源:typeobj.c


示例9: NewStringEmpty

String *Swig_cconstructor_call(String_or_char *name) {
  DOH *func;

  func = NewStringEmpty();
  Printf(func, "(%s *) calloc(1, sizeof(%s))", name, name);
  return func;
}
开发者ID:abhishekgahlot,项目名称:Python-Fingerprint-Attendance-System,代码行数:7,代码来源:cwrap.c


示例10: DohSetDouble

void
DohSetDouble(DOH *obj, const DOH *name, double value) {
  DOH *temp;
  temp = NewStringEmpty();
  Printf(temp,"%0.17f",value);
  Setattr(obj,(DOH *) name,temp);
}
开发者ID:LorenzMeier,项目名称:swig-wx,代码行数:7,代码来源:base.c


示例11: DohSetInt

void
DohSetInt(DOH *obj, const DOH *name, int value) {
  DOH *temp;
  temp = NewStringEmpty();
  Printf(temp,"%d",value);
  Setattr(obj,(DOH *) name,temp);
}
开发者ID:LorenzMeier,项目名称:swig-wx,代码行数:7,代码来源:base.c


示例12: NewStringEmpty

String *replace_captures(const char *input, String *subst, int captures[])
{
  String *result = NewStringEmpty();
  const char *p = Char(subst);

  while (*p) {
    /* Copy part without substitutions */
    const char *q = strchr(p, '\\');
    if (!q) {
      Write(result, p, strlen(p));
      break;
    }
    Write(result, p, q - p);
    p = q + 1;

    /* Handle substitution */
    if (*p == '\0') {
      Putc('\\', result);
    } else if (isdigit(*p)) {
      int group = *p++ - '0';
      int l = captures[group*2], r = captures[group*2 + 1];
      if (l != -1) {
        Write(result, input + l, r - l);
      }
    }
  }

  return result;
}
开发者ID:JensMunkHansen,项目名称:swig-matlab,代码行数:29,代码来源:misc.c


示例13: NewStringEmpty

String *Swig_stringify_with_location(DOH *object) {
  String *str = NewStringEmpty();

  if (!init_fmt)
    Swig_error_msg_format(DEFAULT_ERROR_MSG_FORMAT);

  if (object) {
    int line = Getline(object);
    String *formatted_filename = format_filename(Getfile(object));
    if (line > 0) {
      Printf(str, diag_line_fmt, formatted_filename, line);
    } else {
      Printf(str, diag_eof_fmt, formatted_filename);
    }
    if (Len(object) == 0) {
      Printf(str, "[EMPTY]");
    } else {
      Printf(str, "[%s]", object);
    }
    Delete(formatted_filename);
  } else {
    Printf(str, "[NULL]");
  }

  return str;
}
开发者ID:FlorianDeconinck,项目名称:angel2d,代码行数:26,代码来源:error.c


示例14: NewStringEmpty

String *Swig_cconstructor_call(const_String_or_char_ptr name) {
    DOH *func;

    func = NewStringEmpty();
    Printf(func, "calloc(1, sizeof(%s))", name);
    return func;
}
开发者ID:sunaku,项目名称:swig-ruby-ffi,代码行数:7,代码来源:cwrap.c


示例15: va_start

DOHString *DohNewStringf(const DOHString_or_char *fmt, ...) {
  va_list ap;
  DOH *r;
  va_start(ap, fmt);
  r = NewStringEmpty();
  DohvPrintf(r, Char(fmt), ap);
  va_end(ap);
  return (DOHString *) r;
}
开发者ID:GSGroup,项目名称:swig-v8,代码行数:9,代码来源:string.c


示例16: Swig_warning

void Swig_warning(int wnum, const String_or_char *filename, int line, const char *fmt, ...) {
  String *out;
  char *msg;
  int wrn = 1;
  va_list ap;
  if (silence)
    return;
  if (!init_fmt)
    Swig_error_msg_format(DEFAULT_ERROR_MSG_FORMAT);

  va_start(ap, fmt);

  out = NewStringEmpty();
  vPrintf(out, fmt, ap);

  msg = Char(out);
  if (isdigit((unsigned char) *msg)) {
    unsigned long result = strtoul(msg, &msg, 10);
    if (msg != Char(out)) {
      msg++;
      wnum = result;
    }
  }

  /* Check in the warning filter */
  if (filter) {
    char temp[32];
    char *c;
    char *f = Char(filter);
    sprintf(temp, "%d", wnum);
    while (*f != '\0' && (c = strstr(f, temp))) {
      if (*(c - 1) == '-') {
	wrn = 0;		/* Warning disabled */
        break;
      }
      if (*(c - 1) == '+') {
	wrn = 1;		/* Warning enabled */
        break;
      }
      f += strlen(temp);
    }
  }
  if (warnall || wrn) {
    String *formatted_filename = format_filename(filename);
    if (wnum) {
      Printf(stderr, wrn_wnum_fmt, formatted_filename, line, wnum);
    } else {
      Printf(stderr, wrn_nnum_fmt, formatted_filename, line);
    }
    Printf(stderr, "%s", msg);
    nwarning++;
    Delete(formatted_filename);
  }
  Delete(out);
  va_end(ap);
}
开发者ID:veeramarni,项目名称:xuggle-swig,代码行数:56,代码来源:error.c


示例17: Char

SwigType *SwigType_add_qualifier(SwigType *t, const_String_or_char_ptr qual) {
  List *qlist;
  String *allq, *newq;
  int i, sz;
  const char *cqprev = 0;
  const char *c = Char(t);
  const char *cqual = Char(qual);

  /* if 't' has no qualifiers and 'qual' is a single qualifier, simply add it */
  if ((strncmp(c, "q(", 2) != 0) && (strstr(cqual, " ") == 0)) {
    String *temp = NewStringf("q(%s).", cqual);
    Insert(t, 0, temp);
    Delete(temp);
    return t;
  }

  /* create string of all qualifiers */
  if (strncmp(c, "q(", 2) == 0) {
    allq = SwigType_parm(t);
    Append(allq, " ");
    SwigType_del_element(t);     /* delete old qualifier list from 't' */
  } else {
    allq = NewStringEmpty();
  }
  Append(allq, qual);

  /* create list of all qualifiers from string */
  qlist = Split(allq, ' ', INT_MAX);
  Delete(allq);

  /* sort in alphabetical order */
  SortList(qlist, Strcmp);

  /* create new qualifier string from unique elements of list */
  sz = Len(qlist);
  newq = NewString("q(");
  for (i = 0; i < sz; ++i) {
    String *q = Getitem(qlist, i);
    const char *cq = Char(q);
    if (cqprev == 0 || strcmp(cqprev, cq) != 0) {
      if (i > 0) {
        Append(newq, " ");
      }
      Append(newq, q);
      cqprev = cq;
    }
  }
  Append(newq, ").");
  Delete(qlist);

  /* replace qualifier string with new one */
  Insert(t, 0, newq);
  Delete(newq);
  return t;
}
开发者ID:0xb1dd1e,项目名称:swig,代码行数:55,代码来源:typeobj.c


示例18: assert

/* Remove all arrays */
SwigType *SwigType_pop_arrays(SwigType *t) {
  String *ta;
  assert(SwigType_isarray(t));
  ta = NewStringEmpty();
  while (SwigType_isarray(t)) {
    SwigType *td = SwigType_pop(t);
    Append(ta, td);
    Delete(td);
  }
  return ta;
}
开发者ID:charlie5,项目名称:swig4ada,代码行数:12,代码来源:typeobj.c


示例19: Wrapper_print

void Wrapper_print(Wrapper *w, File *f) {
  String *str;

  str = NewStringEmpty();
  Printf(str, "%s\n", w->def);
  Printf(str, "%s\n", w->locals);
  Printf(str, "%s\n", w->code);
  if (Compact_mode == 1)
    Wrapper_compact_print(str, f);
  else
    Wrapper_pretty_print(str, f);

  Delete(str);
}
开发者ID:SumiTomohiko,项目名称:Yog,代码行数:14,代码来源:wrapfunc.c


示例20: Swig_symbol_qualified

String *Swig_name_decl(Node *n) {
  String *qname;
  String *decl;
  String *qualifier = Swig_symbol_qualified(n);
  String *name = Swig_scopename_last(Getattr(n, "name"));
  if (qualifier)
    qualifier = SwigType_namestr(qualifier);

  /* Very specific hack for template constructors/destructors */
  if (SwigType_istemplate(name)) {
    String *nodetype = nodeType(n);
    if (nodetype && (Equal(nodetype, "constructor") || Equal(nodetype, "destructor"))) {
      String *nprefix = NewStringEmpty();
      String *nlast = NewStringEmpty();
      String *tprefix;
      Swig_scopename_split(name, &nprefix, &nlast);
      tprefix = SwigType_templateprefix(nlast);
      Delete(nlast);
      Delete(name);
      name = tprefix;
    }
  }

  qname = NewString("");
  if (qualifier && Len(qualifier) > 0)
    Printf(qname, "%s::", qualifier);
  Printf(qname, "%s", SwigType_str(name, 0));

  decl = NewStringf("%s(%s)%s", qname, ParmList_errorstr(Getattr(n, "parms")), SwigType_isconst(Getattr(n, "decl")) ? " const" : "");

  Delete(name);
  Delete(qualifier);
  Delete(qname);

  return decl;
}
开发者ID:progranism,项目名称:Allegro-5-SWIG-Wrapper,代码行数:36,代码来源:naming.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NewStringWithSize函数代码示例发布时间:2022-05-30
下一篇:
C++ NewString函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap