本文整理汇总了C++中FilterPtr::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ FilterPtr::getName方法的具体用法?C++ FilterPtr::getName怎么用?C++ FilterPtr::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilterPtr
的用法示例。
在下文中一共展示了FilterPtr::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: console_filter_selection
int console_filter_selection(ContextPtr env, char *cmd) {
if(!cmd) return 0;
LinkList<Filter> &list = env->getFilters();
LinkList<Filter>::iterator it = std::find_if(list.begin(), list.end(), [&](FilterPtr filter) {
return filter->getName() == cmd;
});
if(it == list.end()) {
::error("filter not found: %s", cmd);
return 0;
}
FilterPtr filt = *it;
ViewPortPtr screen = getSelectedScreen();
if(!screen) {
::error("no screen currently selected");
return 0;
}
LayerPtr lay = getSelectedLayer();
if(!lay) {
::error("no layer selected for effect %s", filt->getName().c_str());
return 0;
}
if(!filt->new_instance()->apply(lay)) {
::error("error applying filter %s on layer %s", filt->getName().c_str(), lay->getName().c_str());
return 0;
}
// select automatically the new filter
// lay->filters.sel(0);
// ff->sel(true);
return 1;
}
示例2: console_filter_completion
int console_filter_completion(ContextPtr env, char *cmd) {
if(!cmd) return 0;
// Find completions
FilterPtr exactFilter;
LinkList<Filter> retList;
LinkList<Filter> &list = env->getFilters();
std::string cmdString(cmd);
std::transform(cmdString.begin(), cmdString.end(), cmdString.begin(), ::tolower);
std::copy_if(list.begin(), list.end(), retList.begin(), [&] (FilterPtr filter) {
std::string name = filter->getName();
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
if(name == cmdString) {
exactFilter = filter;
}
return name.compare(cmdString) == 0;
});
if(retList.empty()) return 0;
if(exactFilter != NULL) {
::notice("%s :: %s", exactFilter->getName().c_str(), exactFilter->getDescription().c_str());
snprintf(cmd, MAX_CMDLINE, "%s", exactFilter->getName().c_str());
return 1;
}
if(cmdString.empty()) {
notice("List available filters");
} else {
notice("List available filters with \"%s\"", cmd);
}
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;
}