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


C++ Class函数代码示例

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


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

示例1: switch

bool Player::setIntByHash(uint16_t propHash, LevelObjValue value, const Level* level) noexcept
{
	switch (propHash)
	{
	case str2int16("strength"):
		strength = std::clamp(value, 0, Class()->MaxStrength());
		break;
	case str2int16("magic"):
		magic = std::clamp(value, 0, Class()->MaxMagic());
		break;
	case str2int16("dexterity"):
		dexterity = std::clamp(value, 0, Class()->MaxDexterity());
		break;
	case str2int16("vitality"):
		vitality = std::clamp(value, 0, Class()->MaxVitality());
		break;
	case str2int16("lifeDamage"):
		lifeDamage = std::max(value, 0);
		break;
	case str2int16("manaDamage"):
		manaDamage = std::max(value, 0);
		break;
	default:
		return false;
	}
	updateNameAndDescr = true;
	return true;
}
开发者ID:dgengin,项目名称:DGEngine,代码行数:28,代码来源:Player.cpp

示例2: environment_variable_get

Variable environment_variable_get(Scope* scope, Variable variable){
    for(unsigned int v = 0; v < scope->variables.size(); v++){
        if( (scope->variables[v].name == variable.name or variable.name==IGNORE)
        and (scope->variables[v].type.name == variable.type.name or variable.type.name==IGNORE)){
            return scope->variables[v];
        }
    }

    if(scope->parent == NULL){
        #ifdef DEV_ERRORS
        fail(DEV_BLANK_TYPE);
        #endif // DEV_ERRORS

        return Variable("", Class(), false, false);
    }

    if(environment_variable_exists(scope->parent, variable)){
        return environment_variable_get(scope->parent, variable);
    }

    #ifdef DEV_ERRORS
    fail(DEV_BLANK_TYPE);
    #endif // DEV_ERRORS

    return Variable("", Class(), false, false);
}
开发者ID:IsaacShelton,项目名称:Boomslang,代码行数:26,代码来源:scope.cpp

示例3: connectPrereqsToTargets

void connectPrereqsToTargets(const std::string & s, Graph & g) {
    auto it = s.begin();
    std::set<Class>::iterator targetIt;
    while (it != s.end()) {
        if (*it == ':') {
            std::string target(s.begin(), it);
            targetIt = g.classes.find(Class(target));
            assert(targetIt != g.classes.end());
            ++it;
            break;
        }
        ++it;
    }
    while (it != s.end()) {
        ++it;
        auto endit = it;
        while (endit != s.end() && *endit != ' ') { ++endit; }
        std::string prereq(std::string(it, endit));
        std::set<Class>::iterator prereqIt =
            g.classes.find(Class(prereq));
        assert(prereqIt != g.classes.end());
        g.connect(targetIt, prereqIt);
        it = endit;
    }
}
开发者ID:chrzhang,项目名称:abc,代码行数:25,代码来源:main.cpp

示例4: assert

static at *call_method(at *obj, struct hashelem *hx, at *args)
{
   at *fun = hx->function;
   assert(FUNCTIONP(fun));
   
   if (Class(fun) == de_class) {
      // DE
      at *p = eval_arglist(args);
      return with_object(obj, fun, p, hx->sofar);

   } else if (Class(fun) == df_class) {
      // DF
      return with_object(obj, fun, args, hx->sofar);

   } else if (Class(fun) == dm_class) {
      // DM
      at *p = new_cons(new_cons(fun, args), NIL);
      at *q = with_object(obj, at_mexpand, p, hx->sofar);
      return eval(q);
      
   } else {
      // DX, DY, DH
      at *p = new_cons(fun, new_cons(obj, args));
      return Class(fun)->listeval(fun, p);
   }
}
开发者ID:barak,项目名称:lush,代码行数:26,代码来源:oostruct.c

示例5: lush_delete

void lush_delete(at *p)
{
   if (!p || ZOMBIEP(p))
      return;

   class_t *cl = classof(p);
   if (cl->dontdelete)
      error(NIL, "cannot delete this object", p);
   
   run_notifiers(p);
   
   if (cl->has_compiled_part) {
      assert(isa(p, object_class));
      /* OO objects may have two parts          */
      /* lush_delete has to delete both of them */
      object_t *obj = Mptr(p);
      struct CClass_object *cobj = obj->cptr;
      oostruct_dispose(obj);
      cobj->Vtbl->Cdestroy(cobj);
      
   } else {
      if (Class(p)->dispose)
         Mptr(p) = Class(p)->dispose(Mptr(p));
      else
         Mptr(p) = NULL;
   }
   zombify(p);
}
开发者ID:barak,项目名称:lush,代码行数:28,代码来源:oostruct.c

示例6: return

bool Player::hasMaxStats() const noexcept
{
	return (strength >= Class()->MaxStrength() &&
		magic >= Class()->MaxMagic() &&
		dexterity >= Class()->MaxDexterity() &&
		vitality >= Class()->MaxVitality());
}
开发者ID:dgengin,项目名称:DGEngine,代码行数:7,代码来源:Player.cpp

示例7: Header_new

Header* Header_new(ProcessList* pl) {
   Header* this = calloc(1, sizeof(Header));
   this->leftMeters = Vector_new(Class(Meter), true, DEFAULT_SIZE);
   this->rightMeters = Vector_new(Class(Meter), true, DEFAULT_SIZE);
   this->margin = true;
   this->pl = pl;
   return this;
}
开发者ID:adnandzebic,项目名称:htop,代码行数:8,代码来源:Header.c

示例8: sprintf

static const char *generic_name(at *p)
{
   if (Class(p)->classname)
      sprintf(string_buffer, "::%s:%p", NAMEOF(Class(p)->classname),Mptr(p));
   else
      sprintf(string_buffer, "::%p:%p", Class(p), Mptr(p));
   
   return mm_strdup(string_buffer);
}
开发者ID:barak,项目名称:lush,代码行数:9,代码来源:oostruct.c

示例9: environment_generic_method_exists

bool environment_generic_method_exists(TokenContext context, Scope* scope, Method method, Class actual_class, Class generic_class){
    for(size_t i = 0; i < scope->methods.size(); i++){
        if( (scope->methods[i].name == method.name or method.name==IGNORE)
        and (scope->methods[i].parent == method.parent or method.parent==NULL)
        and (context_class_compare(context, Class(scope->methods[i].return_type), Class(method.return_type)) or method.return_type == IGNORE_CLASS)
        and (generic_arguments_equal(context, scope->methods[i].arguments, method.arguments, actual_class, generic_class))){
            return true;
        }
    }

    return false;
}
开发者ID:IsaacShelton,项目名称:Boomslang,代码行数:12,代码来源:scope.cpp

示例10: heuristicid

/* linux driver says the release id is not always right */
static int
heuristicid(uint32_t csp, uint32_t maxpkt)
{
	if(Class(csp) == 0x02)
		return TypeH;
	else if(maxpkt == 0x40)
		return TypeHX;
	else if(Class(csp) == 0x00 || Class(csp) == 0xFF)
		return TypeH;
	else{
		fprint(2, "serial: chip unknown, setting to HX version\n");
		return TypeHX;
	}
}
开发者ID:dalmonian,项目名称:harvey,代码行数:15,代码来源:prolific.c

示例11: class_

void Component::classes(void){
	class_(Component::StencilType, Class(
		"Stencil",
		Stencil::page,
		Stencil::request,
		Stencil::call
	));
	class_(Component::ThemeType, Class(
		"Theme",
		Theme::page,
		nullptr,
		Theme::call
	));
}
开发者ID:gitter-badger,项目名称:stencila,代码行数:14,代码来源:component-instance.cpp

示例12: environment_method_get

Method environment_method_get(TokenContext context, Scope* scope, Method method){
    for(size_t i = 0; i < scope->methods.size(); i++){
        if( (scope->methods[i].name == method.name or method.name==IGNORE)
        and (scope->methods[i].parent == method.parent or method.parent==NULL)
        and (context_class_compare(context, Class(scope->methods[i].return_type), Class(method.return_type)) or method.return_type == IGNORE_CLASS)
        and (arguments_equal(context, scope->methods[i].arguments, method.arguments))){
            return scope->methods[i];
        }
    }

    #ifdef DEV_ERRORS
    fail(DEV_BLANK_TYPE);
    #endif // DEV_ERRORS

    return Method{"", NULL, IGNORE_ARGS, IGNORE_CLASS};
}
开发者ID:IsaacShelton,项目名称:Boomslang,代码行数:16,代码来源:scope.cpp

示例13: Class

Variable::Variable(){
    name = "";
    type = Class("");
    is_final = false;
    is_static = false;
    is_private = false;
}
开发者ID:IsaacShelton,项目名称:Boomslang,代码行数:7,代码来源:scope.cpp

示例14: sizeof

aConfItem	*make_conf(void)
{
	Reg	aConfItem *aconf;

	aconf = (struct ConfItem *)MyMalloc(sizeof(aConfItem));

#ifdef	DEBUGMODE
	aconfs.inuse++;
#endif
	istat.is_conf++;
	istat.is_confmem += sizeof(aConfItem);

	bzero((char *)&aconf->ipnum, sizeof(struct IN_ADDR));
	aconf->clients = aconf->port = 0;
	aconf->next = NULL;
	aconf->host = aconf->passwd = aconf->name = aconf->name2 = NULL;
#ifdef XLINE
	aconf->name3 = NULL;
#endif
	aconf->ping = NULL;
	aconf->status = CONF_ILLEGAL;
	aconf->pref = -1;
	aconf->hold = time(NULL);
	aconf->source_ip = NULL;
	aconf->flags = 0L;
	Class(aconf) = NULL;
	return (aconf);
}
开发者ID:DanielOaks,项目名称:irc2-mirror,代码行数:28,代码来源:list.c

示例15: lush_delete_maybe

/* similar to lush_delete, but don't raise error with permanent objects */
void lush_delete_maybe(at *p)
{
   if (p) {
      if (!Class(p)->dontdelete)
         lush_delete(p);
   }
}
开发者ID:barak,项目名称:lush,代码行数:8,代码来源:oostruct.c


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