本文整理汇总了C++中etl::handle::get_name方法的典型用法代码示例。如果您正苦于以下问题:C++ handle::get_name方法的具体用法?C++ handle::get_name怎么用?C++ handle::get_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类etl::handle
的用法示例。
在下文中一共展示了handle::get_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: canvas_specific
bool
Action::System::perform_action(etl::handle<Action::Base> action)
{
if (getenv("SYNFIG_DEBUG_ACTIONS"))
synfig::info("%s:%d perform_action: '%s'", __FILE__, __LINE__, action->get_name().c_str());
handle<UIInterface> uim(get_ui_interface());
assert(action);
if(!action->is_ready())
{
uim->error(action->get_local_name()+": "+_("Action is not ready."));
return false;
}
most_recent_action_name_=action->get_name();
static bool inuse=false;
if(inuse) return false;
inuse=true;
try {
assert(action);
Action::CanvasSpecific* canvas_specific(dynamic_cast<Action::CanvasSpecific*>(action.get()));
if(canvas_specific && canvas_specific->get_canvas())
{
handle<CanvasInterface> canvas_interface=static_cast<Instance*>(this)->find_canvas_interface(canvas_specific->get_canvas());
assert(canvas_interface);
uim=canvas_interface->get_ui_interface();
}
handle<Action::Undoable> undoable_action=handle<Action::Undoable>::cast_dynamic(action);
// If we cannot undo this action, make sure
// that the user knows this.
if(!undoable_action)
{
if(uim->yes_no(
action->get_local_name(),
_("This action cannot be undone! Are you sure you want to continue?"),
UIInterface::RESPONSE_NO
) == UIInterface::RESPONSE_NO
)
return false;
else
{
// Because this action cannot be undone,
// we need to clear the undo stack
clear_undo_stack();
}
}
else
assert(undoable_action->is_active());
// Perform the action
try { action->perform(); }
catch(Action::Error err)
{
uim->task(action->get_local_name()+' '+_("Failed"));
inuse=false;
if(err.get_type()!=Action::Error::TYPE_UNABLE)
{
if(err.get_desc().empty())
uim->error(action->get_local_name()+": "+strprintf("%d",err.get_type()));
else
uim->error(action->get_local_name()+": "+err.get_desc());
}
// If action failed for whatever reason, just return false and do
// not add the action onto the list
return false;
}
catch(std::exception err)
{
uim->task(action->get_local_name()+' '+_("Failed"));
inuse=false;
uim->error(action->get_local_name()+": "+err.what());
// If action failed for whatever reason, just return false and do
// not add the action onto the list
return false;
}
catch(...)
{
uim->task(action->get_local_name()+' '+_("Failed"));
inuse=false;
// If action failed for whatever reason, just return false and do
// not add the action onto the list
return false;
}
// Clear the redo stack
//.........这里部分代码省略.........