本文整理汇总了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;
}
示例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);
}
示例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;
}
}
示例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);
}
}
示例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);
}
示例6: return
bool Player::hasMaxStats() const noexcept
{
return (strength >= Class()->MaxStrength() &&
magic >= Class()->MaxMagic() &&
dexterity >= Class()->MaxDexterity() &&
vitality >= Class()->MaxVitality());
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
}
示例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
));
}
示例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};
}
示例13: Class
Variable::Variable(){
name = "";
type = Class("");
is_final = false;
is_static = false;
is_private = false;
}
示例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);
}
示例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);
}
}