• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ RETURN_IF_ERROR函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中RETURN_IF_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ RETURN_IF_ERROR函数的具体用法?C++ RETURN_IF_ERROR怎么用?C++ RETURN_IF_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了RETURN_IF_ERROR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:prestocore,项目名称:browser,代码行数:28,代码来源:KDEOpFileChooser.cpp


示例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; 
}
开发者ID:prestocore,项目名称:browser,代码行数:12,代码来源:WindowsGadgetUtils.cpp


示例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;
	}
开发者ID:prestocore,项目名称:browser,代码行数:12,代码来源:posix_interface.cpp


示例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;
}
开发者ID:prestocore,项目名称:browser,代码行数:12,代码来源:tempbuf.cpp


示例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;
}
开发者ID:prestocore,项目名称:browser,代码行数:12,代码来源:OpButtonStrip.cpp


示例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;
}
开发者ID:prestocore,项目名称:browser,代码行数:21,代码来源:upnp_soap.cpp


示例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;;
}
开发者ID:prestocore,项目名称:browser,代码行数:12,代码来源:UIReader.cpp


示例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;
	}
开发者ID:prestocore,项目名称:browser,代码行数:12,代码来源:probetimeline.cpp


示例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);
}
开发者ID:prestocore,项目名称:browser,代码行数:12,代码来源:SVGNavigation.cpp


示例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;
}
开发者ID:prestocore,项目名称:browser,代码行数:13,代码来源:QuickUICreator.cpp


示例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;
}
开发者ID:prestocore,项目名称:browser,代码行数:21,代码来源:WebServerStarter.cpp


示例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;
}
开发者ID:prestocore,项目名称:browser,代码行数:12,代码来源:WindowsGadgetUtils.cpp


示例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();
}
开发者ID:prestocore,项目名称:browser,代码行数:39,代码来源:mboxmonthly.cpp


示例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;
}
开发者ID:prestocore,项目名称:browser,代码行数:40,代码来源:connection.cpp


示例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;
}
开发者ID:prestocore,项目名称:browser,代码行数:40,代码来源:OpPluginCrashedBar.cpp


示例16: RETURN_IF_ERROR

OP_STATUS CollectionNavigationPane::DropURLItem(HotlistModelItem* target, DesktopDragObject* drag_object, DesktopDragObject::InsertType insert_type)
{
	INT32 new_selection_id = -1;
	INT32 target_id = target ? target->GetID() : -1;

	if (drag_object->GetURLs().GetCount() > 0)
	{
		BookmarkItemData item_data;
		RETURN_IF_ERROR(item_data.name.Set(drag_object->GetTitle()));
		RETURN_IF_ERROR(item_data.description.Set(DragDrop_Data_Utils::GetText(drag_object)));

		for (UINT32 i=0; i < drag_object->GetURLs().GetCount(); i++)
		{
			RETURN_IF_ERROR(item_data.url.Set(*drag_object->GetURLs().Get(i)));
			g_desktop_bookmark_manager->DropItem(item_data, target_id, insert_type, TRUE, drag_object->GetType(), &new_selection_id);
		}
	}
	else
	{
		BookmarkItemData item_data;
		RETURN_IF_ERROR(item_data.name.Set(drag_object->GetTitle()));
		RETURN_IF_ERROR(item_data.url.Set(drag_object->GetURL()));
		RETURN_IF_ERROR(item_data.description.Set(DragDrop_Data_Utils::GetText(drag_object)));
		g_desktop_bookmark_manager->DropItem(item_data, target_id, insert_type, TRUE, drag_object->GetType(), &new_selection_id);
	}

	return OpStatus::OK;
}
开发者ID:prestocore,项目名称:browser,代码行数:28,代码来源:CollectionNavigationPane.cpp


示例17: RETURN_IF_ERROR

/***********************************************************************************
 ** Gets the string for commands (e.g. "RFC822.HEADER BODY.PEEK[]"
 ** Empty string allowed
 ** If content exists, should end in a space
 **
 ** Fetch::GetFetchCommands
 ***********************************************************************************/
OP_STATUS ImapCommands::Fetch::GetFetchCommands(OpString8& commands) const
{
	if (m_flags & BODY)
		RETURN_IF_ERROR(commands.Append("BODY.PEEK[TEXT] "));

	if (m_flags & COMPLETE)
		RETURN_IF_ERROR(commands.Append("BODY.PEEK[] "));

	if (m_flags & HEADERS)
	{
		OpString8 needed_headers;
		RETURN_IF_ERROR(MessageEngine::GetInstance()->GetIndexer()->GetNeededHeaders(needed_headers));
		RETURN_IF_ERROR(commands.AppendFormat("RFC822.SIZE BODY.PEEK[HEADER.FIELDS (%s%s%s)] ",
											  GetDefaultHeaders(),
											  needed_headers.HasContent() ? " " : "",
											  needed_headers.HasContent() ? needed_headers.CStr() : ""));
	}

	if (m_flags & ALL_HEADERS)
		RETURN_IF_ERROR(commands.Append("RFC822.SIZE BODY.PEEK[HEADER] "));

	if (m_flags & BODYSTRUCTURE)
		RETURN_IF_ERROR(commands.Append("BODYSTRUCTURE "));
	
	return OpStatus::OK;
}
开发者ID:prestocore,项目名称:browser,代码行数:33,代码来源:MessageSetCommand.cpp


示例18: RETURN_IF_ERROR

OP_STATUS ExtensionsPanel::RefreshCounterLabels()
{
	if (m_extensions_view)
	{
		OpString str, counter_label_fmt;
		RETURN_IF_ERROR(
				g_languageManager->GetString(Str::D_EXTENSION_PANEL_COUNTER, 
					counter_label_fmt));
		RETURN_IF_ERROR(
				str.AppendFormat(counter_label_fmt.CStr(), m_normal_count));
		RETURN_IF_ERROR(
				m_counter_label->SetText(str.CStr()));
	}

	if (m_extensions_dev_view)
	{
		OpString str, counter_label_fmt;
		RETURN_IF_ERROR(
				g_languageManager->GetString(Str::D_EXTENSION_PANEL_DEV_COUNTER, 
					counter_label_fmt));
		RETURN_IF_ERROR(
				str.AppendFormat(counter_label_fmt.CStr(), m_dev_count));
		RETURN_IF_ERROR(
				m_dev_counter_label->SetText(str.CStr()));
	}
	
	return OpStatus::OK;
}
开发者ID:prestocore,项目名称:browser,代码行数:28,代码来源:ExtensionsPanel.cpp


示例19: CleanUp

OP_STATUS GadgetTooltipHandler::Init()
{
	CleanUp();

	m_listener = OP_NEW(TooltipListener, ());
	RETURN_OOM_IF_NULL(m_listener);

	m_tooltip = OP_NEW(OpToolTip, ());
	RETURN_OOM_IF_NULL(m_tooltip);
	RETURN_IF_ERROR(m_tooltip->Init());

	return OpStatus::OK;
}
开发者ID:prestocore,项目名称:browser,代码行数:13,代码来源:GadgetTooltipHandler.cpp


示例20: localities

/**
This method calculates the distance between two given localities (a source
locality and a target locality). An estimate of the accuracy of the result
is also provided.
Both the distance and the distance delta are given as TReal64 values which  
is needed when used in other calculations.
This method assumes that all arguments already have been error checked.
 
@param aSrc
@param aTar
@param aDistance
@param aDelta
  */
TInt Distance64(const TLocality& aSrc,
                const TLocality& aTar,
                TReal64& aDistance,
                TReal64& aDelta)
	{
    // Calculate the distance between the localities
    RETURN_IF_ERROR(Distance64(aSrc, aTar, aDistance));

    // Calculate the distance delta
    aDelta = aSrc.HorizontalAccuracy() + aTar.HorizontalAccuracy();
                                    
    return KErrNone;
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:26,代码来源:LbsCalculations.cpp



注:本文中的RETURN_IF_ERROR函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ RETURN_IF_EXCEPTION函数代码示例发布时间:2022-05-30
下一篇:
C++ RETURN_G_RC_MODE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap