本文整理汇总了C++中Primitive::run方法的典型用法代码示例。如果您正苦于以下问题:C++ Primitive::run方法的具体用法?C++ Primitive::run怎么用?C++ Primitive::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Primitive
的用法示例。
在下文中一共展示了Primitive::run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fork
LIU_DEFINE_NATIVE_METHOD(OldDictionary, make) {
LIU_FIND_LAST_MESSAGE;
OldDictionary *dict = fork();
for(int i = 0; i < message->numInputs(); ++i) {
Node *key = NULL;
Primitive *primitive = message->input(i)->hasLabel();
if(!primitive) LIU_THROW(ArgumentException, "missing key in Dictionary initialization");
if(primitive->hasNext()) LIU_THROW(ArgumentException, "invalid key in Dictionary initialization");
Message *msg = Message::dynamicCast(primitive->value());
if(msg) {
if(msg->inputs(false) || msg->outputs(false) || msg->isEscaped() || msg->isParented()
|| msg->isEllipsed() || msg->hasCodeInput())
LIU_THROW(ArgumentException, "invalid key in Dictionary initialization");
key = Text::make(msg->name());
} else
key = primitive->run();
dict->set(key, message->runInput(i));
}
return dict;
}
示例2: i
LIU_DEFINE_NATIVE_METHOD(OldDictionary, each) {
LIU_FIND_LAST_PRIMITIVE;
Primitive *nextPrimitive = primitive->hasNext();
if(!nextPrimitive) LIU_THROW(InterpreterException, QString("missing code after an each statement"));
LIU_FIND_LAST_MESSAGE;
LIU_CHECK_INPUT_SIZE(2);
Message *msg = Message::dynamicCast(message->firstInput()->value()->value());
if(!msg) LIU_THROW(ArgumentException, "first argument should be a message");
QString valueName = msg->name();
msg = Message::dynamicCast(message->secondInput()->value()->value());
if(!msg) LIU_THROW(ArgumentException, "second argument should be a message");
QString keyName = msg->name();
Iterator i(this);
while(i.hasNext()) {
i.next();
context()->addOrSetChild(keyName, i.key());
context()->addOrSetChild(valueName, i.value());
nextPrimitive->run();
}
Primitive::skip(this);
}