本文整理汇总了C++中Plugin::getPath方法的典型用法代码示例。如果您正苦于以下问题:C++ Plugin::getPath方法的具体用法?C++ Plugin::getPath怎么用?C++ Plugin::getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugin
的用法示例。
在下文中一共展示了Plugin::getPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Class
LibraryClass::LibraryClass() : Class("lib", Class::library) {
createBuiltinMember("new", 2, AbstractSyntaxTree::createBuiltinMethode(metatype(), [] (Cursor *cursor) {
size_t base = get_stack_base(cursor);
Reference &rvalue = *cursor->stack().at(base);
Reference &self = *cursor->stack().at(base - 1);
if (Plugin *plugin = Plugin::load(to_string(rvalue))) {
self.data<Library>()->plugin = plugin;
cursor->stack().pop_back();
}
else {
cursor->stack().pop_back();
cursor->stack().pop_back();
cursor->stack().push_back(SharedReference::unique(Reference::create<None>()));
}
}));
createBuiltinMember("call", VARIADIC 2, AbstractSyntaxTree::createBuiltinMethode(metatype(), [] (Cursor *cursor) {
size_t base = get_stack_base(cursor);
SharedReference va_args = cursor->stack().at(base);
SharedReference function = cursor->stack().at(base - 1);
SharedReference self = cursor->stack().at(base - 2);
std::string func_name = to_string(*function);
Plugin *plugin = self->data<Library>()->plugin;
cursor->stack().pop_back();
cursor->stack().pop_back();
cursor->stack().pop_back();
for (Iterator::ctx_type::value_type &arg : va_args->data<Iterator>()->ctx) {
cursor->stack().push_back(arg);
}
int signature = static_cast<int>(va_args->data<Iterator>()->ctx.size());
if (!plugin->call(func_name, signature, cursor)) {
error("no function '%s' taking %d arguments found in plugin '%s'", func_name.c_str(), signature, plugin->getPath().c_str());
}
}));
}