本文整理汇总了C++中Class函数的典型用法代码示例。如果您正苦于以下问题:C++ Class函数的具体用法?C++ Class怎么用?C++ Class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Class函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: DOC_BEGIN
JSBool
pango::JSContext::Constructor(::JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
DOC_BEGIN("");
DOC_END;
if (JSA_GetClass(cx,obj) != Class()) {
JS_ReportError(cx,"Constructor for %s bad object; did you forget a 'new'?",ClassName());
return JS_FALSE;
}
pango::JSContext * myNewObject = 0;
NATIVE * newNative = 0;
if (argc == 0) {
PangoContext * myContext = pango_context_new();
newNative = new NATIVE(myContext, false);
} else {
JS_ReportError(cx,"Constructor for %s: bad number of arguments: expected none () %d",ClassName(), argc);
return JS_FALSE;
}
myNewObject = new pango::JSContext(OWNERPTR(newNative), newNative);
if (myNewObject) {
JS_SetPrivate(cx,obj,myNewObject);
return JS_TRUE;
}
JS_ReportError(cx,"pango::JSContext::Constructor: bad parameters");
return JS_FALSE;
}
开发者ID:artcom,项目名称:y60,代码行数:34,代码来源:JSPangoContext.cpp
示例17: SimpleName
void Player::updateNameAndDescriptions() const
{
if (updateNameAndDescr == true)
{
updateNameAndDescr = false;
if (Class()->getFullName(*this, name) == false &&
name.empty() == true)
{
name = SimpleName();
}
for (size_t i = 0; i < descriptions.size(); i++)
{
Class()->getDescription(i, *this, descriptions[i]);
}
}
}
开发者ID:dgengin,项目名称:DGEngine,代码行数:16,代码来源:Player.cpp
示例18: updateItemQuantityCache
bool Player::setItem(size_t invIdx, size_t itemIdx, std::unique_ptr<Item>& item,
std::unique_ptr<Item>& oldItem)
{
if (invIdx >= inventories.size())
{
return false;
}
auto itemPtr = item.get();
auto& inventory = inventories[invIdx];
auto ret = inventory.set(itemIdx, item, oldItem);
if (ret == true)
{
if (itemPtr != nullptr)
{
updateItemQuantityCache(itemPtr->Class()->IdHash16());
itemPtr->clearMapPosition();
itemPtr->updateOwner(this);
}
else if (oldItem != nullptr)
{
updateItemQuantityCache(oldItem->Class()->IdHash16());
oldItem->updateOwner(nullptr);
}
if (bodyInventoryIdx == invIdx)
{
updateProperties();
}
}
return ret;
}
开发者ID:dgengin,项目名称:DGEngine,代码行数:30,代码来源:Player.cpp
示例19: UnsupportedProcess_delete
void UnsupportedProcess_delete(Object* cast) {
Process* this = (Process*) cast;
Object_setClass(this, Class(Process));
Process_done((Process*)cast);
// free platform-specific fields here
free(this);
}
开发者ID:scragg0x,项目名称:htop,代码行数:7,代码来源:UnsupportedProcess.c
示例20: DOC_BEGIN
JSBool
JSColorSelectionDialog::Constructor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
DOC_BEGIN("");
DOC_END;
ensureParamCount(argc,1,5);
if (JSA_GetClass(cx,obj) != Class()) {
JS_ReportError(cx,"Constructor for %s bad object; did you forget a 'new'?",ClassName());
return JS_FALSE;
}
NATIVE * newNative = 0;
JSColorSelectionDialog * myNewObject = 0;
if ( argc == 1) {
string myTitle;
convertFrom(cx, argv[0], myTitle);
newNative = new NATIVE(myTitle);
} else {
newNative = new NATIVE();
}
myNewObject = new JSColorSelectionDialog(OWNERPTR(newNative), newNative);
if (myNewObject) {
JS_SetPrivate(cx,obj,myNewObject);
return JS_TRUE;
}
JS_ReportError(cx,"JSColorSelectionDialog::Constructor: failed");
return JS_FALSE;
}
开发者ID:artcom,项目名称:y60,代码行数:32,代码来源:JSColorSelectionDialog.cpp
注:本文中的Class函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论