本文整理汇总了C++中ContextPtr::getGenerators方法的典型用法代码示例。如果您正苦于以下问题:C++ ContextPtr::getGenerators方法的具体用法?C++ ContextPtr::getGenerators怎么用?C++ ContextPtr::getGenerators使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContextPtr
的用法示例。
在下文中一共展示了ContextPtr::getGenerators方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: console_generator_selection
int console_generator_selection(ContextPtr env, char *cmd) {
GeneratorLayerPtr tmp = MakeShared<GeneratorLayer>();
if(!tmp) return 0;
ViewPortPtr screen = getSelectedScreen();
if(!screen) {
::error("no screen currently selected");
return 0;
}
const Geometry &geo = screen->getGeometry();
if(!tmp->init(geo.getSize().x(), geo.getSize().y(), geo.getBpp())) {
error("can't initialize generator layer");
return 0;
}
// this is something specific to the generator layer
// it needs this from the environment..
tmp->register_generators(&env->getGenerators());
if(!tmp->open(cmd)) {
error("generator %s is not found", cmd);
return 0;
}
screen->add_layer(tmp);
notice("generator %s successfully created", tmp->getName().c_str());
return 1;
}
示例2: console_generator_completion
int console_generator_completion(ContextPtr env, char *cmd) {
if(!cmd) return 0;
LinkList<Filter> &list = env->getGenerators();
FilterPtr exactGenerator;
LinkList<Filter> retList;
std::string cmdString(cmd);
std::transform(cmdString.begin(), cmdString.end(), cmdString.begin(), ::tolower);
std::copy_if(list.begin(), list.end(), retList.begin(), [&] (FilterPtr generator) {
std::string name = generator->getName();
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
if(name == cmdString) {
exactGenerator = generator;
}
return name.compare(cmdString) == 0;
});
if(retList.empty()) return 0;
if(exactGenerator != NULL) {
::notice("%s :: %s", exactGenerator->getName().c_str(), exactGenerator->getDescription().c_str());
snprintf(cmd, MAX_CMDLINE, "%s", exactGenerator->getName().c_str());
return 1;
}
int c = 0;
char tmp[256];
std::for_each(retList.begin(), retList.end(), [&] (FilterPtr f) {
if(c % 4 == 0) {
if(c != 0) {
::act("%s", tmp);
}
tmp[0] = '\0';
}
strncat(tmp, "\t", sizeof(tmp) - 1);
strncat(tmp, f->getName().c_str(), sizeof(tmp) - 1);
++c;
});
return c;
}