本文整理汇总了C++中RETURN_IF_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ RETURN_IF_ERROR函数的具体用法?C++ RETURN_IF_ERROR怎么用?C++ RETURN_IF_ERROR使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RETURN_IF_ERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RETURN_IF_ERROR
/***********************************************************************************
** Add an extension filter argument to the argument creator
** Format of KDE extension filters:
** "*.x *.y |Description for x, y\n*.p *.q |Description for p, q"
**
** KDEOpFileChooser::AddExtensionFilter
***********************************************************************************/
OP_STATUS KDEOpFileChooser::AddExtensionFilter(const DesktopFileChooserRequest& request, ArgumentCreator& argument_creator)
{
OpString filter;
for (unsigned i = 0; i < request.extension_filters.GetCount(); i++)
{
if (filter.HasContent())
filter.Append("\n");
OpFileSelectionListener::MediaType* media_type = request.extension_filters.Get(i);
// extensions
for (unsigned j = 0; j < media_type->file_extensions.GetCount(); j++)
RETURN_IF_ERROR(filter.AppendFormat(UNI_L("%s "), media_type->file_extensions.Get(j)->CStr()));
// description
RETURN_IF_ERROR(filter.AppendFormat(UNI_L("|%s"), media_type->media_type.CStr()));
}
return argument_creator.AddArgument(filter);
}
示例2: config_file
OP_STATUS PlatformGadgetUtils::GetGadgetProfileName(
const OpStringC& gadget_path, OpString& profile_name)
{
OpAutoPtr<GadgetConfigFile> config_file(GadgetConfigFile::Read(gadget_path));
if (NULL == config_file.get())
{
return OpStatus::ERR;
}
RETURN_IF_ERROR(profile_name.Set(config_file->GetProfileName()));
return OpStatus::OK;
}
示例3: Notice
OP_STATUS Notice(const PosixNetworkAddress *what, bool up)
{
const enum OpSocketAddressNetType type = GetNetType();
if (type == NETTYPE_UNDETERMINED ||
(m_up == up ? type < what->GetNetType() : up))
{
RETURN_IF_ERROR(Import(what));
m_up = up;
}
return OpStatus::OK;
}
示例4: CHECK_INVARIANTS
OP_STATUS TempBuffer::Expand( size_t capacity )
{
CHECK_INVARIANTS();
if (capacity == 0)
capacity = 1;
RETURN_IF_ERROR( EnsureConstructed( capacity ) );
CHECK_INVARIANTS();
return OpStatus::OK;
}
示例5: OP_ASSERT
OP_STATUS OpButtonStrip::SetButtonInfo(int id, OpInputAction* action, const OpStringC& text, BOOL enabled, BOOL visible, const OpStringC8& name)
{
OP_ASSERT(0 <= id && (unsigned)id < m_buttons.GetCount());
SetButtonAction(id, action);
RETURN_IF_ERROR(SetButtonText(id, text));
EnableButton(id, enabled);
ShowButton(id, visible);
SetButtonName(id, name);
return OpStatus::OK;
}
示例6: RETURN_IF_ERROR
OP_STATUS HTTPMessageWriter::setURL(const uni_char *hostAddress, const uni_char *pageURL, UINT16 port)
{
RETURN_IF_ERROR(host.Set(hostAddress));
if(!pageURL)
return OpStatus::ERR_NULL_POINTER;
if(URLStartWithHTTP(pageURL))
{
URL url=g_url_api->GetURL(pageURL);
RETURN_IF_ERROR(url.GetAttribute(URL::KPathAndQuery_L, page));
httpPort=url.GetServerPort();
}
else
{
RETURN_IF_ERROR(page.Set(pageURL));
httpPort=port;
}
return OpStatus::OK;
}
示例7: RETURN_IF_ERROR
OP_STATUS UIReader::GetNodeFromMap(const OpStringC8 &name, ParserNodeMapping* node)
{
ParserNodeIDTableData * data;
RETURN_IF_ERROR(m_logger.Evaluate(m_ui_element_hash.GetData(name.CStr(), &data), "ERROR: could not find widget with name '%s'", name));
if (!m_ui_document.GetNodeByID(data->data_id, *node))
{
m_logger.OutputEntry("ERROR: could not retrieve widget node");
return OpStatus::ERR;
}
return OpStatus::OK;;
}
示例8: RETURN_IF_ERROR
OP_STATUS
OpProbeTimeline::Construct(Timer *timer)
{
RETURN_IF_ERROR(m_stack.Push(&m_root));
if (!timer)
{
// Use default timer if none was provided.
m_default_timer = OP_NEW(OpProbeSystemInfoTimer, ());
RETURN_OOM_IF_NULL(m_default_timer);
timer = m_default_timer;
}
示例9: RETURN_IF_ERROR
OP_STATUS SVGFocusIterator::TestElement(HTML_Element* test_elm, HTML_Element* layouted_elm)
{
if (layouted_elm->IsText())
return OpSVGStatus::SKIP_ELEMENT;
RETURN_IF_ERROR(TestRelevantForDisplay(layouted_elm));
if (!g_svg_manager_impl->IsFocusableElement(m_doc_ctx->GetDocument(), layouted_elm))
return OpSVGStatus::SKIP_ELEMENT;
return TestVisible(test_elm, layouted_elm);
}
示例10: RETURN_IF_ERROR
////////// GetTranslatedScalarStringFromMap
OP_STATUS
QuickUICreator::GetTranslatedScalarStringFromMap(const OpStringC8 & key, OpString & translated_string)
{
OpString8 text_str;
RETURN_IF_ERROR(GetScalarStringFromMap(key, text_str));
if (text_str.HasContent())
{
return TranslateString(text_str, translated_string);
}
return OpStatus::OK;
}
示例11: RETURN_IF_ERROR
OP_STATUS WebServerStarter::Start()
{
const WebserverListeningMode listening_mode =
WebServerPrefs::ReadListeningMode();
if (!g_webserver) return OpStatus::OK;
#ifdef WEBSERVER_RENDEZVOUS_SUPPORT
OpString8 shared_secret;
RETURN_IF_ERROR(WebServerPrefs::ReadSharedSecret(shared_secret));
RETURN_IF_ERROR(g_webserver->Start(listening_mode, shared_secret));
#else
RETURN_IF_ERROR(g_webserver->Start(listening_mode));
#endif // WEBSERVER_RENDEZVOUS_SUPPORT
OpStatus::Ignore(WebServerPrefs::WriteIsConfigured(TRUE));
OpStatus::Ignore(WebServerPrefs::WriteIsStarted(TRUE));
return OpStatus::OK;
}
示例12: RETURN_IF_ERROR
OP_STATUS PlatformGadgetUtils::ExecuteGadget(
const GadgetInstallerContext& context)
{
OpString gadget_starter_path;
RETURN_IF_ERROR(WindowsGadgetUtils::MakeGadgetStarterPath(
context, gadget_starter_path));
WindowsLaunchPI launcher;
const BOOL result = launcher.Launch(gadget_starter_path.CStr(), 0, NULL);
return result ? OpStatus::OK : OpStatus::ERR;
}
示例13: RETURN_IF_ERROR
/***********************************************************************************
** Fully update an existing message in the store (overwrites existing message)
**
** MboxMonthly::UpdateMessage
** @param message Message to update
** @param mbx_data Existing mbx_data from the store if there was any, 0 otherwise.
** Might be changed by this function to have new mbx_data.
** @return OpStatus::OK if save was successful, error codes otherwise
***********************************************************************************/
OP_STATUS MboxMonthly::UpdateMessage(StoreMessage& message,
INT64& mbx_data)
{
// Construct file - will be closed on destruction
OpFile file;
// Get sent time of message
time_t date;
RETURN_IF_ERROR(message.GetDateHeaderValue(Header::DATE, date));
// Prepare file for writing
RETURN_IF_ERROR(PrepareFile(file, message.GetId(), message.GetAccountId(), date, FALSE, mbx_data != 0));
// Go to correct position (if there already was mbx_data), which is past the from header - else write the from header
if (mbx_data != 0)
RETURN_IF_ERROR(file.SetFilePos(mbx_data));
else
RETURN_IF_ERROR(WriteFromLine(message, file));
// Set the mbx_data past the from header, start of the raw message
OpFileLength length;
RETURN_IF_ERROR(file.GetFilePos(length));
mbx_data = length;
// Write message to file
RETURN_IF_ERROR(WriteRawMessage(message, file));
// Close file, making sure it's written to disk
return file.SafeClose();
}
示例14: OP_NEW
OP_STATUS P2PConnection::ConnectTo(OpString& address, WORD port)
{
ENTER_METHOD;
if (address.IsEmpty())
return OpStatus::ERR;
m_input = OP_NEW(OpByteBuffer, ());
if (!m_input)
return OpStatus::ERR_NO_MEMORY;
// Create a socket address to connect to.
RETURN_IF_ERROR(OpSocketAddress::Create(&m_socket_address));
// BT_RESOURCE_ADD("socket_address", m_socket_address);
m_socket_address->FromString(address.CStr());
if (!m_socket_address->IsValid())
return OpStatus::ERR;
m_socket_address->SetPort(port);
// Create a socket.
OpSocket *socket;
RETURN_IF_ERROR(SocketWrapper::CreateTCPSocket(&socket, this, 0));
m_socket.Attach(socket);
// BT_RESOURCE_ADD("socket", socket);
RETURN_IF_ERROR(socket->Connect(m_socket_address));
DEBUGTRACE_CONNECT(UNI_L("CONNECTING TO... %s\n"), (uni_char *)address);
m_address.Set(address);
LEAVE_METHOD;
return OpStatus::OK;
}
示例15: RETURN_OOM_IF_NULL
OP_STATUS OpPluginCrashedBar::ShowCrash(const OpStringC& path, const OpMessageAddress& address)
{
time_t crash_time = g_timecache->CurrentTime();
m_logsender.reset(OP_NEW(LogSender, (false)));
RETURN_OOM_IF_NULL(m_logsender.get());
m_logsender->SetCrashTime(g_timecache->CurrentTime());
m_logsender->SetListener(this);
RETURN_IF_ERROR(FindFile(crash_time));
PluginViewer* plugin = g_plugin_viewers->FindPluginViewerByPath(path);
OpLabel* label = static_cast<OpLabel*>(GetWidgetByName("tbb_plugin_crashed_desc"));
if (plugin && label)
{
OpString description;
RETURN_IF_ERROR(I18n::Format(description, Str::D_PLUGIN_CRASH_DESCRIPTION, plugin->GetProductName()));
RETURN_IF_ERROR(label->SetText(description));
}
m_spinner = static_cast<OpProgressBar*>(GetWidgetByType(WIDGET_TYPE_PROGRESSBAR, FALSE));
if (!m_spinner)
return OpStatus::ERR;
m_spinner->SetType(OpProgressBar::Only_Label);
m_spinner->SetText(NULL);
m_send_button = GetWidgetByName("tbb_crash_report");
if (!m_send_button)
return OpStatus::ERR;
m_address = address;
m_sending_report = false;
m_sending_failed = false;
RETURN_IF_ERROR(s_visible_bars.Append(this));
Show();
return OpStatus::OK;
}