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

C++ Len函数代码示例

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

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



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

示例1: _DeformFn

static Bool _DeformFn(BaseDocument *doc, BaseList2D *op, HairObject *hair, HairGuides *guides, Vector *padr, LONG cnt, LONG scnt)
{
	LONG i,l;
	BaseContainer *bc=op->GetDataInstance();

	const SReal *pCombX=NULL,*pCombY=NULL,*pCombZ=NULL;

	HairLibrary hlib;
	RootObjectData rData;
	hair->GetRootObject(NULL,NULL,&rData);

	if (!rData.pObject) return TRUE;

	Real strength=bc->GetReal(HAIR_DEFORMER_STRENGTH);

	VertexMapTag *pVTag=(VertexMapTag*)bc->GetLink(HAIR_DEFORMER_COMB_X,doc,Tvertexmap);
	if (pVTag && pVTag->GetObject()==rData.pObject) pCombX=pVTag->GetDataAddressR();

	pVTag=(VertexMapTag*)bc->GetLink(HAIR_DEFORMER_COMB_Y,doc,Tvertexmap);
	if (pVTag && pVTag->GetObject()==rData.pObject) pCombY=pVTag->GetDataAddressR();

	pVTag=(VertexMapTag*)bc->GetLink(HAIR_DEFORMER_COMB_Z,doc,Tvertexmap);
	if (pVTag && pVTag->GetObject()==rData.pObject) pCombZ=pVTag->GetDataAddressR();

	if (!(pCombX || pCombY || pCombZ)) return TRUE;

	const CPolygon *vadr=rData.pPolygon;

	if (!padr || !vadr) return TRUE;

	for (i=0;i<cnt;i++)
	{
		Vector comb,dn(DC);
		HairRootData hroot=guides->GetRoot(i);

		LONG p=hroot.m_ID;
		Real s=hroot.m_S,t=hroot.m_T;

		if (hroot.m_Type==HAIR_ROOT_TYPE_POLY)
		{
			if (pCombX) comb.x=hlib.MixST(s,t,pCombX[vadr[p].a],pCombX[vadr[p].b],pCombX[vadr[p].c],pCombX[vadr[p].d],vadr[p].c!=vadr[p].d)-0.5;
			if (pCombY) comb.y=hlib.MixST(s,t,pCombY[vadr[p].a],pCombY[vadr[p].b],pCombY[vadr[p].c],pCombY[vadr[p].d],vadr[p].c!=vadr[p].d)-0.5;
			if (pCombZ) comb.z=hlib.MixST(s,t,pCombZ[vadr[p].a],pCombZ[vadr[p].b],pCombZ[vadr[p].c],pCombZ[vadr[p].d],vadr[p].c!=vadr[p].d)-0.5;
		}
		else if (hroot.m_Type==HAIR_ROOT_TYPE_VERTEX)
		{
			if (pCombX) comb.x=pCombX[p];
			if (pCombY) comb.y=pCombX[p];
			if (pCombZ) comb.z=pCombX[p];
		}
		else
			continue;

		dn=!(padr[i*scnt+1]-padr[i*scnt]);

		Real cs=Len(comb)*strength;
		if (Abs(cs)<1e-5) continue;
		
		comb=comb/cs;
		dn=!Mix(dn,comb,cs);

		Vector ax=comb%dn;
		Real theta=dn*comb;

		Matrix tm=RotAxisToMatrix(ax,theta);

		for (l=1;l<scnt;l++)
		{
			padr[i*scnt+l]=((padr[i*scnt+l]-padr[i*scnt])^tm)+padr[i*scnt];
		}
	}

	return TRUE;
}
开发者ID:vidarn,项目名称:color4d,代码行数:74,代码来源:hair_deformer.cpp


示例2: log

// init prob of a cascade in an empty graph
void TCascade::InitProb() {
    CurProb = log(Eps) * Len();
    for (int i = 0; i < Len(); i++) {
        NIdHitH[i].Parent = -1; }
}
开发者ID:hmipakchi,项目名称:FinalYearProject,代码行数:6,代码来源:test_cascade_inference.cpp


示例3: return

int RingBuffer::AvailForPut()
{
   return (mBufferSize-4) - Len();
}
开发者ID:AthiVarathan,项目名称:audacity,代码行数:4,代码来源:RingBuffer.cpp


示例4: look


//.........这里部分代码省略.........
    case 72:			/* Possibly CUSTOM DELIMITER string */
    case 73:
    case 74:
      if ((c = nextchar(s)) == 0) {
	state = 76;
      }
      else if (c=='\"') {
	retract(s, 1); /* Definitely custom delimiter u, U or L string */
	str_delimiter = NewStringEmpty();
	state = 1000;
      }
      else {
	if (state==72) {
	  retract(s, 1); /* Definitely an identifier. Retract ? */
	}
	else if (state==73) {
	  retract(s, 2); /* Definitely an identifier. Retract R? */
	}
	else if (state==74) {
	  retract(s, 3); /* Definitely an identifier. Retract 8R? */
	}
	state = 70;
      }
      
      break;

    case 75:			/* Special identifier $ */
      if ((c = nextchar(s)) == 0)
	return SWIG_TOKEN_DOLLAR;
      if (isalnum(c) || (c == '_') || (c == '*') || (c == '&')) {
	state = 70;
      } else {
	retract(s,1);
	if (Len(s->text) == 1) return SWIG_TOKEN_DOLLAR;
	state = 76;
      }
      break;

    case 76:			/* Identifier or true/false */
      if (cparse_cplusplus) {
	if (Strcmp(s->text, "true") == 0)
	  return SWIG_TOKEN_BOOL;
	else if (Strcmp(s->text, "false") == 0)
	  return SWIG_TOKEN_BOOL;
	}
      return SWIG_TOKEN_ID;
      break;

    case 77: /*identifier or wide string literal*/
      if ((c = nextchar(s)) == 0)
	return SWIG_TOKEN_ID;
      else if (c == '\"') {
	s->start_line = s->line;
	Clear(s->text);
	state = 78;
      }
      else if (c == '\'') {
	s->start_line = s->line;
	Clear(s->text);
	state = 79;
      }
      else if (isalnum(c) || (c == '_') || (c == '$'))
	state = 7;
      else {
	retract(s, 1);
	return SWIG_TOKEN_ID;
开发者ID:diorcety,项目名称:swig,代码行数:67,代码来源:scanner.c


示例5: free

 free(ptr);

 ptr=At2("LIGNE DE TEXTE","de","1","\0");
 printf("min,maj:%s:\n",ptr);
 free(ptr);


 ptr=At2("LIGNE DE TEXTE","DE","2","\0");
 printf("occurence introuvable (trop fort indice):%s:\n",ptr);
 free(ptr);

 ptr=At2("LIGNE DE TEXTE","DEX","1","\0");
 printf("occurence introuvable (chaine inexistante):%s:\n",ptr);
 free(ptr);

 ptr=Len("Herve","\0");
 printf("Len:%s:\n",ptr);
 free(ptr);

 ptr=Len("Herve\t","\0");
 printf(":%s:\n",ptr);
 free(ptr);

 ptr=Len(" ","\0");
 printf(":%s:\n",ptr);
 free(ptr);

 ptr=Len("","\0");
 printf(":%s:\n",ptr);
 free(ptr);
开发者ID:hervethouzard,项目名称:divers_c,代码行数:30,代码来源:TESTCALL.C


示例6: StartsWithOperation

TExpressionPtr ExpressionParser::ParseOperationExpression(StringPtrLen str) const
{
   BracketsBalancer balancer;
   auto max_operation = OperationType::None;
   auto max_operation_amount = -1L;
   auto tail = str;

   // Find operation with zero bracket balance and with maximum value.
   // Maximum value means minimal arithmetic priority.
   for (; tail.Len() > 0; tail.RemoveLeft(1))
   {
      if (!balancer.ProcessChar(tail.At(0)) && balancer.GetBalance() == 0)
      {
         OperationType operation = StartsWithOperation(tail);
         // TODO: Skip the whole operation symbols
         if (operation != OperationType::None)
         {
            if (operation > max_operation)
            {
               max_operation = operation;
               max_operation_amount = 1;
            }
            else if (operation == max_operation)
            {
               ++max_operation_amount;
            }
         }
      }
   }

   if (OperationType::None == max_operation)
   {
      // No operations with zero balance
      return TExpressionPtr();
   }

   assert(balancer.GetBalance() == 0);

   auto max_operation_str = OperationTypeToString(max_operation);
   auto max_operation_str_len = std::strlen(max_operation_str);

   if (OperationType::Negation == max_operation)
   {
      if (!str.StartsWith(max_operation_str))
      {
         Error("Incorrect usage of unary operation '", max_operation_str, "'.");
      }

      str.RemoveLeft(max_operation_str_len);
      auto child_expression = ParseExpression(str);
      return std::make_unique<OperationExpression>(std::move(child_expression));
   }

   TExpressionPtrVector children_expressions;
   children_expressions.reserve(max_operation_amount + 1);

   tail = str;
   while (tail.Len() > 0)
   {
      if (!balancer.ProcessChar(tail.At(0)) && balancer.GetBalance() == 0)
      {
         if (tail.StartsWith(max_operation_str))
         {
            auto child_expression = ParseExpression(str.Left(tail.Ptr()));
            children_expressions.push_back(std::move(child_expression));
            tail.RemoveLeft(max_operation_str_len);
            str = tail;
            continue;
         }
      }
      tail.RemoveLeft(1);
   }

   auto child_expression = ParseExpression(str);
   children_expressions.push_back(std::move(child_expression));

   return std::make_unique<OperationExpression>(max_operation, std::move(children_expressions));
}
开发者ID:RomeoMontekky,项目名称:dm,代码行数:78,代码来源:expression_parser.cpp


示例7: SwigType_typename_replace

void SwigType_typename_replace(SwigType *t, String *pat, String *rep) {
  String *nt;
  int i, ilen;
  List *elem;

  if (!Strstr(t, pat))
    return;

  if (Equal(t, pat)) {
    Replace(t, pat, rep, DOH_REPLACE_ANY);
    return;
  }
  nt = NewStringEmpty();
  elem = SwigType_split(t);
  ilen = Len(elem);
  for (i = 0; i < ilen; i++) {
    String *e = Getitem(elem, i);
    if (SwigType_issimple(e)) {
      if (Equal(e, pat)) {
	/* Replaces a type of the form 'pat' with 'rep<args>' */
	Replace(e, pat, rep, DOH_REPLACE_ANY);
      } else if (SwigType_istemplate(e)) {
	/* Replaces a type of the form 'pat<args>' with 'rep' */
	if (Equal(e, pat)) {
	  String *repbase = SwigType_templateprefix(rep);
	  Replace(e, pat, repbase, DOH_REPLACE_ID | DOH_REPLACE_FIRST);
	  Delete(repbase);
	}
	{
	  String *tsuffix;
	  List *tparms = SwigType_parmlist(e);
	  int j, jlen;
	  String *nt = SwigType_templateprefix(e);
	  Append(nt, "<(");
	  jlen = Len(tparms);
	  for (j = 0; j < jlen; j++) {
	    SwigType_typename_replace(Getitem(tparms, j), pat, rep);
	    Append(nt, Getitem(tparms, j));
	    if (j < (jlen - 1))
	      Putc(',', nt);
	  }
	  tsuffix = SwigType_templatesuffix(e);
	  Printf(nt, ")>%s", tsuffix);
	  Delete(tsuffix);
	  Clear(e);
	  Append(e, nt);
	  Delete(nt);
	  Delete(tparms);
	}
      } else if (Swig_scopename_check(e)) {
	String *first, *rest;
	first = Swig_scopename_first(e);
	rest = Swig_scopename_suffix(e);
	SwigType_typename_replace(rest, pat, rep);
	SwigType_typename_replace(first, pat, rep);
	Clear(e);
	Printv(e, first, "::", rest, NIL);
	Delete(first);
	Delete(rest);
      }
    } else if (SwigType_isfunction(e)) {
      int j, jlen;
      List *fparms = SwigType_parmlist(e);
      Clear(e);
      Append(e, "f(");
      jlen = Len(fparms);
      for (j = 0; j < jlen; j++) {
	SwigType_typename_replace(Getitem(fparms, j), pat, rep);
	Append(e, Getitem(fparms, j));
	if (j < (jlen - 1))
	  Putc(',', e);
      }
      Append(e, ").");
      Delete(fparms);
    } else if (SwigType_isarray(e)) {
      Replace(e, pat, rep, DOH_REPLACE_ID);
    }
    Append(nt, e);
  }
  Clear(t);
  Append(t, nt);
  Delete(nt);
  Delete(elem);
}
开发者ID:Distrotech,项目名称:swig,代码行数:84,代码来源:stype.c


示例8: NewStringEmpty

SwigType *SwigType_default_deduce(const SwigType *t) {
  SwigType *r = NewStringEmpty();
  List *l;
  Iterator it;
  int numitems;

  l = SwigType_split(t);

  numitems = Len(l);
  if (numitems >= 1) {
    String *last_subtype = Getitem(l, numitems-1);
    int is_enum = SwigType_isenum(last_subtype);

    if (numitems >=2 ) {
      String *subtype = Getitem(l, numitems-2); /* last but one */
      if (SwigType_isarray(subtype)) {
	if (is_enum) {
	  /* enum deduction, enum SWIGTYPE => SWIGTYPE */
	  Setitem(l, numitems-1, NewString("SWIGTYPE"));
	} else {
	  /* array deduction, a(ANY). => a(). => p. */
	  String *deduced_subtype = 0;
	  if (Strcmp(subtype, "a().") == 0) {
	    deduced_subtype = NewString("p.");
	  } else if (Strcmp(subtype, "a(ANY).") == 0) {
	    deduced_subtype = NewString("a().");
	  } else {
	    assert(0);
	  }
	  Setitem(l, numitems-2, deduced_subtype);
	}
      } else if (SwigType_ismemberpointer(subtype)) {
	/* member pointer deduction, m(CLASS). => p. */
	Setitem(l, numitems-2, NewString("p."));
      } else if (is_enum && !SwigType_isqualifier(subtype)) {
	/* enum deduction, enum SWIGTYPE => SWIGTYPE */
	Setitem(l, numitems-1, NewString("SWIGTYPE"));
      } else {
	/* simple type deduction, eg, r.p.p. => r.p. */
	/* also function pointers eg, p.f(ANY). => p. */
	Delitem(l, numitems-2);
      }
    } else {
      if (is_enum) {
	/* enum deduction, enum SWIGTYPE => SWIGTYPE */
	Setitem(l, numitems-1, NewString("SWIGTYPE"));
      } else {
	/* delete the only item, we are done with deduction */
	Delitem(l, 0);
      }
    }
  } else {
    assert(0);
  }

  for (it = First(l); it.item; it = Next(it)) {
    Append(r, it.item);
  }

  if (Len(r) == 0) {
    Delete(r);
    r = 0;
  }

  Delete(l);
  return r;
}
开发者ID:Distrotech,项目名称:swig,代码行数:67,代码来源:stype.c


示例9: Resize

void TMOut::AppendBf(const void* LBf, const TSize& LBfL) {
  Resize(Len() + (int)LBfL);
  memcpy(Bf + BfL, LBf, LBfL);
  BfL += (int)LBfL;
}
开发者ID:Zala,项目名称:qminer,代码行数:5,代码来源:fl.cpp


示例10: cparse_template_expand

static int cparse_template_expand(Node *n, String *tname, String *rname, String *templateargs, List *patchlist, List *typelist, List *cpatchlist) {
  static int expanded = 0;
  int ret;
  String *nodeType;
  if (!n)
    return 0;
  nodeType = nodeType(n);
  if (Getattr(n, "error"))
    return 0;

  if (Equal(nodeType, "template")) {
    /* Change the node type back to normal */
    if (!expanded) {
      expanded = 1;
      set_nodeType(n, Getattr(n, "templatetype"));
      ret = cparse_template_expand(n, tname, rname, templateargs, patchlist, typelist, cpatchlist);
      expanded = 0;
      return ret;
    } else {
      /* Called when template appears inside another template */
      /* Member templates */

      set_nodeType(n, Getattr(n, "templatetype"));
      ret = cparse_template_expand(n, tname, rname, templateargs, patchlist, typelist, cpatchlist);
      set_nodeType(n, "template");
      return ret;
    }
  } else if (Equal(nodeType, "cdecl")) {
    /* A simple C declaration */
    SwigType *t, *v, *d;
    String *code;
    t = Getattr(n, "type");
    v = Getattr(n, "value");
    d = Getattr(n, "decl");

    code = Getattr(n, "code");

    Append(typelist, t);
    Append(typelist, d);
    Append(patchlist, v);
    Append(cpatchlist, code);

    if (Getattr(n, "conversion_operator")) {
      Append(cpatchlist, Getattr(n, "name"));
      if (Getattr(n, "sym:name")) {
	Append(cpatchlist, Getattr(n, "sym:name"));
      }
    }

    add_parms(Getattr(n, "parms"), cpatchlist, typelist);
    add_parms(Getattr(n, "throws"), cpatchlist, typelist);

  } else if (Equal(nodeType, "class")) {
    /* Patch base classes */
    {
      int b = 0;
      for (b = 0; b < 3; ++b) {
	List *bases = Getattr(n, baselists[b]);
	if (bases) {
	  int i;
	  int ilen = Len(bases);
	  for (i = 0; i < ilen; i++) {
	    String *name = Copy(Getitem(bases, i));
	    Setitem(bases, i, name);
	    Append(typelist, name);
	  }
	}
      }
    }
    /* Patch children */
    {
      Node *cn = firstChild(n);
      while (cn) {
	cparse_template_expand(cn, tname, rname, templateargs, patchlist, typelist, cpatchlist);
	cn = nextSibling(cn);
      }
    }
  } else if (Equal(nodeType, "constructor")) {
    String *name = Getattr(n, "name");
    if (!(Getattr(n, "templatetype"))) {
      String *symname;
      String *stripped_name = SwigType_templateprefix(name);
      if (Strstr(tname, stripped_name)) {
	Replaceid(name, stripped_name, tname);
      }
      Delete(stripped_name);
      symname = Getattr(n, "sym:name");
      if (symname) {
	stripped_name = SwigType_templateprefix(symname);
	if (Strstr(tname, stripped_name)) {
	  Replaceid(symname, stripped_name, tname);
	}
	Delete(stripped_name);
      }
      if (strchr(Char(name), '<')) {
	Append(patchlist, Getattr(n, "name"));
      } else {
	Append(name, templateargs);
      }
      name = Getattr(n, "sym:name");
//.........这里部分代码省略.........
开发者ID:veeramarni,项目名称:xuggle-swig,代码行数:101,代码来源:templ.c


示例11: NewString

String *SwigType_str(const SwigType *s, const_String_or_char_ptr id) {
  String *result;
  String *element = 0;
  String *nextelement;
  String *forwardelement;
  List *elements;
  int nelements, i;

  if (id) {
    /* stringify the id expanding templates, for example when the id is a fully qualified templated class name */
    String *id_str = NewString(id); /* unfortunate copy due to current const limitations */
    result = SwigType_str(id_str, 0);
    Delete(id_str);
  } else {
    result = NewStringEmpty();
  }

  elements = SwigType_split(s);
  nelements = Len(elements);

  if (nelements > 0) {
    element = Getitem(elements, 0);
  }
  /* Now, walk the type list and start emitting */
  for (i = 0; i < nelements; i++) {
    if (i < (nelements - 1)) {
      nextelement = Getitem(elements, i + 1);
      forwardelement = nextelement;
      if (SwigType_isqualifier(nextelement)) {
	if (i < (nelements - 2))
	  forwardelement = Getitem(elements, i + 2);
      }
    } else {
      nextelement = 0;
      forwardelement = 0;
    }
    if (SwigType_isqualifier(element)) {
      DOH *q = 0;
      q = SwigType_parm(element);
      Insert(result, 0, " ");
      Insert(result, 0, q);
      Delete(q);
    } else if (SwigType_ispointer(element)) {
      Insert(result, 0, "*");
      if ((forwardelement) && ((SwigType_isfunction(forwardelement) || (SwigType_isarray(forwardelement))))) {
	Insert(result, 0, "(");
	Append(result, ")");
      }
    } else if (SwigType_ismemberpointer(element)) {
      String *q;
      q = SwigType_parm(element);
      Insert(result, 0, "::*");
      Insert(result, 0, q);
      if ((forwardelement) && ((SwigType_isfunction(forwardelement) || (SwigType_isarray(forwardelement))))) {
	Insert(result, 0, "(");
	Append(result, ")");
      }
      Delete(q);
    } else if (SwigType_isreference(element)) {
      Insert(result, 0, "&");
      if ((forwardelement) && ((SwigType_isfunction(forwardelement) || (SwigType_isarray(forwardelement))))) {
	Insert(result, 0, "(");
	Append(result, ")");
      }
    } else if (SwigType_isarray(element)) {
      DOH *size;
      Append(result, "[");
      size = SwigType_parm(element);
      Append(result, size);
      Append(result, "]");
      Delete(size);
    } else if (SwigType_isfunction(element)) {
      DOH *parms, *p;
      int j, plen;
      Append(result, "(");
      parms = SwigType_parmlist(element);
      plen = Len(parms);
      for (j = 0; j < plen; j++) {
	p = SwigType_str(Getitem(parms, j), 0);
	Append(result, p);
	if (j < (plen - 1))
	  Append(result, ",");
      }
      Append(result, ")");
      Delete(parms);
    } else {
      if (strcmp(Char(element), "v(...)") == 0) {
	Insert(result, 0, "...");
      } else {
	String *bs = SwigType_namestr(element);
	Insert(result, 0, " ");
	Insert(result, 0, bs);
	Delete(bs);
      }
    }
    element = nextelement;
  }
  Delete(elements);
  Chop(result);
  return result;
//.........这里部分代码省略.........
开发者ID:Distrotech,项目名称:swig,代码行数:101,代码来源:stype.c


示例12: Len

////////////////////////////////////////////////////////////////////////////////////////
// Normalize
////////////////////////////////////////////////////////////////////////////////////////
float	CVec4::Norm()
{
	float	L = Len();
	(*this)/=L;
	return L;
} 
开发者ID:BSzili,项目名称:OpenJK,代码行数:9,代码来源:CVec.cpp


示例13: buildHeap

void buildHeap(int *p)
{
    for(int i=(Len(p)-1)/2;i>0;i--)
        down(p,i);
}
开发者ID:svenFeng,项目名称:CLRS_NOTES,代码行数:5,代码来源:heapSort.c


示例14: Swig_file_extension

String *Swig_file_basename(const_String_or_char_ptr filename) {
  String *extension = Swig_file_extension(filename);
  String *basename = NewStringWithSize(filename, Len(filename) - Len(extension));
  Delete(extension);
  return basename;
}
开发者ID:Distrotech,项目名称:swig,代码行数:6,代码来源:include.c


示例15: Wrapper_compact_print

void Wrapper_compact_print(String *str, File *f) {
  String *ts, *tf;		/*temp string & temp file */
  int level = 0;
  int c, i;
  int empty = 1;
  int indent = 2;

  ts = NewStringEmpty();
  tf = NewStringEmpty();
  Seek(str, 0, SEEK_SET);

  while ((c = Getc(str)) != EOF) {
    if (c == '\"') {		/* string 1 */
      empty = 0;
      Putc(c, ts);
      while ((c = Getc(str)) != EOF) {
	if (c == '\\') {
	  Putc(c, ts);
	  c = Getc(str);
	}
	Putc(c, ts);
	if (c == '\"')
	  break;
      }
    } else if (c == '\'') {	/* string 2 */
      empty = 0;
      Putc(c, ts);
      while ((c = Getc(str)) != EOF) {
	if (c == '\\') {
	  Putc(c, ts);
	  c = Getc(str);
	}
	Putc(c, ts);
	if (c == '\'')
	  break;
      }
    } else if (c == '{') {	/* start of {...} */
      empty = 0;
      Putc(c, ts);
      if (Len(tf) == 0) {
	for (i = 0; i < level; i++)
	  Putc(' ', tf);
      } else if ((Len(tf) + Len(ts)) < Max_line_size) {
	Putc(' ', tf);
      } else {
	Putc('\n', tf);
	Printf(f, "%s", tf);
	Clear(tf);
	for (i = 0; i < level; i++)
	  Putc(' ', tf);
      }
      Append(tf, ts);
      Clear(ts);
      level += indent;
      while ((c = Getc(str)) != EOF) {
	if (!isspace(c)) {
	  Ungetc(c, str);
	  break;
	}
      }
    } else if (c == '}') {	/* end of {...} */
      empty = 0;
      if (Len(tf) == 0) {
	for (i = 0; i < level; i++)
	  Putc(' ', tf);
      } else if ((Len(tf) + Len(ts)) < Max_line_size) {
	Putc(' ', tf);
      } else {
	Putc('\n', tf);
	Printf(f, "%s", tf);
	Clear(tf);
	for (i = 0; i < level; i++)
	  Putc(' ', tf);
      }
      Append(tf, ts);
      Putc(c, tf);
      Clear(ts);
      level -= indent;
    } else if (c == '\n') {	/* line end */
      while ((c = Getc(str)) != EOF) {
	if (!isspace(c))
	  break;
      }
      if (c == '#') {
	Putc('\n', ts);
      } else if (c == '}') {
	Putc(' ', ts);
      } else if ((c != EOF) || (Len(ts) != 0)) {
	if (Len(tf) == 0) {
	  for (i = 0; i < level; i++)
	    Putc(' ', tf);
	} else if ((Len(tf) + Len(ts)) < Max_line_size) {
	  Putc(' ', tf);
	} else {
	  Putc('\n', tf);
	  Printf(f, "%s", tf);
	  Clear(tf);
	  for (i = 0; i < level; i++)
	    Putc(' ', tf);
	}
//.........这里部分代码省略.........
开发者ID:SumiTomohiko,项目名称:Yog,代码行数:101,代码来源:wrapfunc.c


示例16: brackets_pop

/* -----------------------------------------------------------------------------
 * brackets_pop()
 *
 * Decreases the depth of brackets.
 * Usually called when ')' is found.
 * ----------------------------------------------------------------------------- */
static void brackets_pop(Scanner *s) {
  if (Len(s->brackets) > 0) /* protect against unbalanced ')' brackets */
    Delitem(s->brackets, 0);
}
开发者ID:diorcety,项目名称:swig,代码行数:10,代码来源:scanner.c


示例17: ParseCommandLine

	bool ParseCommandLine(int argc, PWSTR argv[])
	{
		bool ret = false;

		for (int i = 1; i < argc; ++i) {
			// first check if command line option
			if ((argv[i][0] == L'-' || argv[i][0] == L'/')) {
				if (Len(argv[i]) == 2) {
					switch (argv[i][1]) {
						case L'?':
							logInfo(L"%s\n", argv[0]);
							PrintHelp();
							return false;
							break;
						case L'a':
							AttrMustMatch = true;
							break;
						case L'd':
							setLogLevel (LOG_DEBUG);
							break;
						case L'h':
							SkipHidden = true;
							break;
						case L'j':
							SkipJunct = true;
							break;
						case L'l':
							hardlink = true;
							break;
						case L'm':
							LinkSmall = true;
							break;
						case L'q':
							setLogLevel (LOG_ERROR);
							showStatistics = false;
							break;
						case L'r':
							recursive = true;
							break;
						case L's':
							SkipSystem = true;
							break;
						case L't':
							TimeMustMatch = true;
							break;
						case L'v':
							setLogLevel (LOG_VERBOSE);
							break;
						case L'w':
							showStatistics = true;
							break;
						default:
							logError(L"Illegal Command line option! Use /? to see valid options!\n");
							return false;
					}
				} else {
					logError(L"Illegal Command line option! Use /? to see valid options!\n");
					return false;
				}
			} else {
				Path* dir = parsePath(argv[i]);
				if (dir) {
					AddPath(dir);
					ret = true;
				}
			}
		}

		if (!ret) {
			logError(L"You need to specify at least one folder to process!\nUse /? to see valid options!\n");
		}
		return ret;
	}
开发者ID:pombreda,项目名称:main,代码行数:73,代码来源:main.cpp


示例18: EOS

	bool EOS() { return Tell()==Len()?true:false;}
开发者ID:anandrathi,项目名称:MyCDR,代码行数:1,代码来源:sqstdio.cpp


示例19: Swig_cparse_template_expand


//.........这里部分代码省略.........
	String *name, *value, *valuestr, *tydef, *tmp, *tmpr;
	int sz, i;
	String *dvalue = 0;
	String *qvalue = 0;

	name = Getattr(tp, "name");
	value = Getattr(p, "value");
	tydef = Getattr(p, "typedef");

	if (name) {
	  if (!value)
	    value = Getattr(p, "type");
	  qvalue = Swig_symbol_typedef_reduce(value, tsdecl);
	  dvalue = Swig_symbol_type_qualify(qvalue, tsdecl);
	  if (SwigType_istemplate(dvalue)) {
	    String *ty = Swig_symbol_template_deftype(dvalue, tscope);
	    Delete(dvalue);
	    dvalue = ty;
	  }

	  assert(dvalue);
	  valuestr = SwigType_str(dvalue, 0);
	  /* Need to patch default arguments */
	  {
	    Parm *rp = nextSibling(p);
	    while (rp) {
	      String *rvalue = Getattr(rp, "value");
	      if (rvalue) {
		Replace(rvalue, name, dvalue, DOH_REPLACE_ID);
	      }
	      rp = nextSibling(rp);
	    }
	  }
	  sz = Len(patchlist);
	  for (i = 0; i < sz; i++) {
	    String *s = Getitem(patchlist, i);
	    Replace(s, name, dvalue, DOH_REPLACE_ID);
	  }
	  sz = Len(typelist);
	  for (i = 0; i < sz; i++) {
	    String *s = Getitem(typelist, i);
	    /*      Replace(s,name,value, DOH_REPLACE_ID); */
	    /*      Printf(stdout,"name = '%s', value = '%s', tbase = '%s', iname='%s' s = '%s' --> ", name, dvalue, tbase, iname, s); */
	    SwigType_typename_replace(s, name, dvalue);
	    SwigType_typename_replace(s, tbase, iname);
	    /*      Printf(stdout,"'%s'\n", s); */
	  }

	  if (!tydef) {
	    tydef = dvalue;
	  }
	  tmp = NewStringf("#%s", name);
	  tmpr = NewStringf("\"%s\"", valuestr);

	  sz = Len(cpatchlist);
	  for (i = 0; i < sz; i++) {
	    String *s = Getitem(cpatchlist, i);
	    Replace(s, tmp, tmpr, DOH_REPLACE_ID);
	    /*  Replace(s,name,tydef, DOH_REPLACE_ID); */
	    Replace(s, name, valuestr, DOH_REPLACE_ID);
	  }
	  Delete(tmp);
	  Delete(tmpr);
	  Delete(valuestr);
	  Delete(dvalue);
	  Delete(qvalue);
开发者ID:veeramarni,项目名称:xuggle-swig,代码行数:67,代码来源:templ.c


示例20: Len

inline bool wxTarHeaderBlock::WriteField(wxOutputStream& out, int id)
{
    return out.Write(Get(id), Len(id)).LastWrite() == Len(id);
}
开发者ID:catalinr,项目名称:wxWidgets,代码行数:4,代码来源:tarstrm.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ LengthNoFlush函数代码示例发布时间:2022-05-30
下一篇:
C++ LeftRotate函数代码示例发布时间: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