本文整理汇总了C++中AttributeValueList::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ AttributeValueList::Append方法的具体用法?C++ AttributeValueList::Append怎么用?C++ AttributeValueList::Append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributeValueList
的用法示例。
在下文中一共展示了AttributeValueList::Append方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
void TransformerFunc::execute() {
ComValue objv(stack_arg(0));
ComValue transv(stack_arg(0));
reset_stack();
if (objv.object_compview()) {
ComponentView* compview = (ComponentView*)objv.obj_val();
if (compview && compview->GetSubject()) {
OverlayComp* comp = (OverlayComp*)compview->GetSubject();
Graphic* gr = comp->GetGraphic();
if (gr) {
Transformer* trans = gr->GetTransformer();
if (transv.is_unknown() || !transv.is_array() || transv.array_val()->Number()!=6) {
AttributeValueList* avl = new AttributeValueList();
float a00, a01, a10, a11, a20, a21;
trans->matrix(a00, a01, a10, a11, a20, a21);
avl->Append(new AttributeValue(a00));
avl->Append(new AttributeValue(a01));
avl->Append(new AttributeValue(a10));
avl->Append(new AttributeValue(a11));
avl->Append(new AttributeValue(a20));
avl->Append(new AttributeValue(a21));
ComValue retval(avl);
push_stack(retval);
} else {
float a00, a01, a10, a11, a20, a21;
AttributeValueList* avl = transv.array_val();
Iterator it;
AttributeValue* av;
avl->First(it);
av = avl->GetAttrVal(it);
a00 = av->float_val();
avl->Next(it);
av = avl->GetAttrVal(it);
a01 = av->float_val();
avl->Next(it);
av = avl->GetAttrVal(it);
a10 = av->float_val();
avl->Next(it);
av = avl->GetAttrVal(it);
a11 = av->float_val();
avl->Next(it);
av = avl->GetAttrVal(it);
a20 = av->float_val();
avl->Next(it);
av = avl->GetAttrVal(it);
a21 = av->float_val();
Transformer t(a00, a01, a10, a11, a20, a21);
*gr->GetTransformer()=t;
ComValue compval(new OverlayViewRef(comp), comp->class_symid());
push_stack(compval);
}
}
}
}
}
示例2: execute
void SymIdFunc::execute() {
// return id of each symbol in the arguments
boolean noargs = !nargs() && !nkeys();
int numargs = nargs();
if (!numargs) return;
int symbol_ids[numargs];
for (int i=0; i<numargs; i++) {
ComValue& val = stack_arg(i, true);
if (val.is_type(AttributeValue::CommandType))
symbol_ids[i] = val.command_symid();
else if (val.is_type(AttributeValue::StringType))
symbol_ids[i] = val.string_val();
else if (val.is_type(AttributeValue::SymbolType))
symbol_ids[i] = val.symbol_val();
else
symbol_ids[i] = -1;
}
reset_stack();
if (numargs>1) {
AttributeValueList* avl = new AttributeValueList();
ComValue retval(avl);
for (int i=0; i<numargs; i++)
avl->Append(new AttributeValue(symbol_ids[i], AttributeValue::IntType));
push_stack(retval);
} else {
ComValue retval (symbol_ids[0], AttributeValue::IntType);
push_stack(retval);
}
}
示例3: execute
void EvalFunc::execute() {
static int symret_sym = symbol_add("symret");
ComValue symretv(stack_key(symret_sym));
if (!comterp()->is_serv()) {
cerr << "need server mode comterp (or remote mode) for eval command\n";
reset_stack();
push_stack(ComValue::nullval());
return;
}
// evaluate every string fixed argument on the stack and return in array
int numargs = nargsfixed();
if (numargs>1) {
AttributeValueList* avl = nil;
for (int i=0; i<numargs; i++) {
ComValue argstrv (stack_arg(i));
if (argstrv.is_nil()) break;
if (argstrv.is_string()) {
ComValue* val = new ComValue(comterpserv()->run(argstrv.symbol_ptr(), true /* nested */));
if (val->is_nil() && symretv.is_true()) {
delete val;
val = new ComValue(argstrv.symbol_val(), AttributeValue::SymbolType);
}
if (!avl) avl = new AttributeValueList();
avl->Append(val);
}
}
reset_stack();
if (avl) {
ComValue retval(avl);
push_stack(retval);
}
}
/* unless only single argument */
else if (numargs==1) {
ComValue argstrv (stack_arg(0));
reset_stack();
if (argstrv.is_nil()) {
push_stack(ComValue::nullval());
} else if (argstrv.is_string()) {
ComValue val(comterpserv()->run(argstrv.symbol_ptr(), true /* nested */));
if (val.is_nil() && symretv.is_true()) {
val.assignval(ComValue(argstrv.symbol_val(), AttributeValue::SymbolType));
}
push_stack(val);
}
} else
reset_stack();
}
示例4: execute
void GrStreamFunc::execute() {
ComValue convertv(stack_arg_post_eval(0));
if (convertv.object_compview()) {
reset_stack();
static StreamNextFunc* snfunc = nil;
if (!snfunc) {
snfunc = new StreamNextFunc(comterp());
snfunc->funcid(symbol_add("stream"));
}
AttributeValueList* avl = new AttributeValueList();
Component* comp = ((ComponentView*)convertv.obj_val())->GetSubject();
if (!comp->IsA(OVERLAYS_COMP)) {
push_stack(ComValue::nullval());
return;
}
OverlaysComp* ovcomps = (OverlaysComp*)comp;
Iterator it;
for(ovcomps->First(it); !ovcomps->Done(it); ovcomps->Next(it)) {
OverlayComp* subcomp = (OverlayComp*) ovcomps->GetComp(it);
AttributeValue* av =
new AttributeValue(new OverlayViewRef(subcomp), subcomp->classid());
avl->Append(av);
}
ComValue stream(snfunc, avl);
stream.stream_mode(-1); // for internal use (use by this func)
push_stack(stream);
} else {
StreamFunc strmfunc(comterp());
strmfunc.exec(funcstate()->nargs(), funcstate()->nkeys(), pedepth());
return;
}
}
示例5: execute
void PostEvalFunc::execute() {
// evaluate every fixed argument on the stack and return in array
int numargs = nargstotal();
if (numargs) {
AttributeValueList* avl = nil;
for (int i=0; i<numargs; i++) {
ComValue* val = new ComValue(stack_arg_post_eval(i));
if (val->is_nil()) {
delete val;
break;
}
if (!avl) avl = new AttributeValueList();
avl->Append(val);
}
reset_stack();
if (avl) {
ComValue retval(avl);
push_stack(retval);
}
} else
reset_stack();
}