本文整理汇总了C++中FSM::filesize方法的典型用法代码示例。如果您正苦于以下问题:C++ FSM::filesize方法的具体用法?C++ FSM::filesize怎么用?C++ FSM::filesize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSM
的用法示例。
在下文中一共展示了FSM::filesize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
void operator()(
Event const &,
FSM & fsm,
SourceState&,
TargetState&
)
{
namespace instant = mf::api::upload::instant;
auto request = instant::Request( fsm.filename(), fsm.hash(),
fsm.filesize());
switch (fsm.onDuplicateAction())
{
case OnDuplicateAction::Fail:
// This is the default, same as "skip" and doesn't need to be
// set.
break;
case OnDuplicateAction::Replace:
request.SetActionOnDuplicate(instant::ActionOnDuplicate::Replace);
break;
case OnDuplicateAction::AutoRename:
request.SetActionOnDuplicate(instant::ActionOnDuplicate::Keep);
break;
default:
assert(!"Invalid duplicate action.");
break;
}
UploadTarget target_folder = fsm.targetFolder();
boost::apply_visitor(TargetSetter(&request), target_folder);
auto fsmp = fsm.AsFrontShared();
fsm.GetSessionMaintainer()->Call(
request,
[fsmp](const instant::Response & response)
{
if (response.error_code)
{
fsmp->ProcessEvent(event::Error{response.error_code,
"Failed to instant upload file."});
}
else
{
fsmp->ProcessEvent(event::InstantSuccess{ response.quickkey,
response.filename });
}
});
}