本文整理汇总了C++中OP_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ OP_ASSERT函数的具体用法?C++ OP_ASSERT怎么用?C++ OP_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OP_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFullPathName
OP_STATUS PlatformGadgetUtils::GetAbsolutePath(const OpString& file_path,
OpString& absolute_path)
{
const int abs_pathname_length =
GetFullPathName(file_path, 0, NULL, NULL) - 1;
if (0 != abs_pathname_length)
{
if (NULL != absolute_path.Reserve(abs_pathname_length))
{
const int actual_length =
GetFullPathName(file_path, abs_pathname_length + 1,
absolute_path.DataPtr(), NULL);
if (0 != actual_length)
{
OP_ASSERT(abs_pathname_length == actual_length);
OP_ASSERT(abs_pathname_length == absolute_path.Length());
return OpStatus::OK;
}
}
}
return OpStatus::ERR;
}
示例2: OP_ASSERT
void OpNumberEdit::OnChange(OpWidget *widget, BOOL changed_by_mouse /*= FALSE */)
{
OP_ASSERT(widget == m_edit);
// if (widget == m_edit)
{
if (listener)
{
listener->OnChange(this);
}
UpdateButtonState();
}
}
示例3: if
INT32 OpHotlistView::GetRootID()
{
if (IsContacts())
return HotlistModel::ContactRoot;
else if (IsNotes())
return HotlistModel::NoteRoot;
#ifdef WEBSERVER_SUPPORT
else if (IsUniteServices())
return HotlistModel::UniteServicesRoot;
#endif // WEBSERVER_SUPPORT
OP_ASSERT(!"Unkown view type");
return 0;
}
示例4: ShowProgress
void SyncPasswordImprovementDialog::OnInit()
{
ShowProgress(FALSE);
OpEdit* edit = static_cast<OpEdit*>(GetWidgetByName(SyncConstant::OLD_PASSWD_EDIT));
OP_ASSERT(edit);
if (edit)
edit->SetPasswordMode(TRUE);
BindEditWithPasswordStrength(SyncConstant::NEW_PASSWD_EDIT, SyncConstant::NEW_PASSWD_STRENGTH);
OpIcon* warning_icon = static_cast<OpIcon*>(GetWidgetByName(SyncConstant::WARNING_ICON));
OP_ASSERT(warning_icon);
if (warning_icon)
{
warning_icon->SetImage("Dialog Warning");
}
OpLabel* header_label = static_cast<OpLabel*>(GetWidgetByName(SyncConstant::HEADER_LABEL));
OP_ASSERT(header_label);
if (header_label)
{
header_label->SetRelativeSystemFontSize(SyncConstant::HEADER_LABEL_REL_SIZE);
SetLabelInBold(SyncConstant::HEADER_LABEL);
}
OpLabel* error_label = static_cast<OpLabel*>(GetWidgetByName(SyncConstant::ERROR_LABEL));
OP_ASSERT(error_label);
if (error_label)
{
error_label->SetForegroundColor(OP_RGB(255, 0, 0));
}
OpEdit* confirm_passwd_edit =
static_cast<OpEdit*>(GetWidgetByName(SyncConstant::CONFIRM_NEW_PASSWD_EDIT));
OP_ASSERT(confirm_passwd_edit);
if (confirm_passwd_edit)
confirm_passwd_edit->SetPasswordMode(TRUE);
}
示例5: OP_ASSERT
OP_STATUS PlatformGadgetList::Create(PlatformGadgetList** gadget_list)
{
OP_ASSERT(NULL != gadget_list);
if (NULL == gadget_list)
{
return OpStatus::ERR;
}
*gadget_list = OP_NEW(UnixGadgetList, ());
RETURN_OOM_IF_NULL(*gadget_list);
return OpStatus::OK;
}
示例6: OP_NEW_DBG
void
MediaSourceImpl::PauseBuffering()
{
OP_NEW_DBG("PauseBuffering", "MediaSource");
OP_DBG((""));
OP_ASSERT(m_state == LOADING && IsStreaming());
m_use_url->SetAttribute(URL::KPauseDownload, TRUE);
m_state = PAUSED;
for (OpListenersIterator iter(m_listeners); m_listeners.HasNext(iter);)
m_listeners.GetNext(iter)->OnIdle(this);
}
示例7: OP_ASSERT
OP_STATUS
ChatFileTransferManager::AddTransferItem( ChatFileTransfer& chat_transfer)
{
OP_ASSERT(GetTransferItem(chat_transfer) == 0);
OpString file_name;
RETURN_IF_ERROR(chat_transfer.GetFileName(file_name));
// Figure out where to save the file if we are receiving the file.
OpFileLength dummy_resume;
return AddTransferItem(chat_transfer, SEND, file_name, dummy_resume);
}
示例8: GetTransferItem
OP_STATUS
ChatFileTransferManager::FileSendBegin(const ChatFileTransfer& chat_transfer)
{
OpTransferItem* item = GetTransferItem(chat_transfer);
if (item == 0)
return OpStatus::ERR;
TransferItem* transfer_item = (TransferItem *)(item);
OP_ASSERT(transfer_item != 0);
// Update status.
return transfer_item->GetURL()->SetAttribute(URL::KLoadStatus, URL_LOADING);
}
示例9: OP_ASSERT
SSL_KEA_ACTION SSL_Certificate_st::ProcessMessage(SSL_ConnectionState *pending)
{
OP_ASSERT(pending && pending->session && pending->key_exchange);
pending->session->Site_Certificate = *this;
if(pending->session->Site_Certificate.Error())
return SSL_KEA_Handle_Errors;
#ifndef TLS_NO_CERTSTATUS_EXTENSION
if(pending->session->sent_ocsp_extensions.GetLength() != 0 || pending->session->ocsp_extensions_sent)
return SSL_KEA_No_Action;
#endif
return pending->key_exchange->ReceivedCertificate();
}
示例10: OP_NEW
void ExtensionsManagerDevListView::OnDeveloperExtensionAdded(
const ExtensionsModelItem& model_item)
{
ExtensionsManagerDevListViewItem* item =
OP_NEW(ExtensionsManagerDevListViewItem, (model_item));
OP_ASSERT(item);
if (!item)
{
return;
}
RETURN_VOID_IF_ERROR(AddToList(item));
}
示例11: PrintfTofile
URL_DataDescriptor::~URL_DataDescriptor()
{
#ifdef DEBUG_LOAD_STATUS
g_main_message_handler->UnsetCallBacks(this);
#endif
#ifdef _DEBUG_DD1
/*
if(position != url.ContentLoaded() || url.Status(FALSE) == URL_LOADING)
int stop = 1;
*/
#endif
#ifdef _DEBUG_DD1
OpFileLength registered_len=0;
url.GetAttribute(URL::KContentLoaded, ®istered_len);
PrintfTofile("urldd1.txt","\nDD Destructor- %s - %s - %lu:%lu (%u:%u)\n",
DebugGetURLstring(url), (url.GetAttribute(URL::KLoadStatus) == URL_LOADING ? "Not Loaded" : "Loaded"),
(unsigned long) position, (unsigned long) registered_len, buffer_used, buffer_len
);
#endif
OP_DELETE(sub_desc);
if(is_using_file && storage)
storage->DecFileCount();
if(InList())
Out();
if(buffer)
{
if(url.GetAttribute(URL::KCachePolicy_NoStore))
OPERA_cleanse_heap(buffer, buffer_len);
else
op_memset(buffer, 0, buffer_len);
OP_DELETEA(buffer);
}
g_charsetManager->DecrementCharsetIDReference(charset_id);
g_charsetManager->DecrementCharsetIDReference(parent_charset);
#ifdef DEBUG_LOAD_STATUS
OP_ASSERT(dd_counter >0);
dd_counter --;
#endif
#ifdef SELFTEST
Context_Manager *mng=urlManager->FindContextManager(url.GetContextId());
if(mng)
mng->RemoveDataDescriptorForStats(this);
#endif // SELFTEST
}
示例12: SetSkinned
OP_STATUS GenericThumbnail::Init(const Config& config)
{
m_config = config;
SetSkinned(TRUE);
RETURN_IF_ERROR(OpButton::Construct(&m_title_button, OpButton::TYPE_CUSTOM, OpButton::STYLE_IMAGE));
OP_ASSERT(m_title_button != NULL);
AddChild(m_title_button);
m_title_button->SetEllipsis(g_pcui->GetIntegerPref(PrefsCollectionUI::EllipsisInCenter) == 1 ? ELLIPSIS_CENTER : ELLIPSIS_END);
m_title_button->SetJustify(JUSTIFY_CENTER, FALSE);
m_title_button->GetBorderSkin()->SetImage(m_config.m_title_border_image);
m_title_button->SetIgnoresMouse(TRUE);
RETURN_IF_ERROR(OpButton::Construct(&m_close_button, OpButton::TYPE_CUSTOM, OpButton::STYLE_IMAGE));
OP_ASSERT(m_close_button != NULL);
AddChild(m_close_button);
m_close_button->GetBorderSkin()->SetImage(m_config.m_close_border_image);
m_close_button->GetForegroundSkin()->SetImage(m_config.m_close_foreground_image);
m_close_button->SetIgnoresMouse(TRUE);
m_close_button->SetVisibility(FALSE);
RETURN_IF_ERROR(OpProgressBar::Construct(&m_busy_spinner));
OP_ASSERT(m_busy_spinner != NULL);
AddChild(m_busy_spinner);
m_busy_spinner->GetBorderSkin()->SetImage(m_config.m_busy_border_image);
m_busy_spinner->SetSpinnerImage(m_config.m_busy_foreground_image);
m_busy_spinner->SetType(OpProgressBar::Spinner);
m_busy_spinner->SetIgnoresMouse(TRUE);
m_busy_spinner->SetVisibility(FALSE);
SetListener(this);
m_blend.AddWidgetToBlend(this);
m_blend.AddWidgetToBlend(m_title_button);
return OpStatus::OK;
}
示例13: OP_ASSERT
OP_STATUS
ES_TimeoutTimerEvent::SetCallable(ES_Object *callable_, ES_Value* argv_, int argc_)
{
OP_ASSERT(callable_);
OP_ASSERT(!callable);
OP_ASSERT(!program);
callable = callable_;
if (!runtime->Protect(callable))
{
callable = NULL;
return OpStatus::ERR_NO_MEMORY;
}
if ((callable_argc = argc_) > 0)
{
if (!(callable_argv = OP_NEWA(ES_Value, argc_)))
{
callable_argc = 0;
return OpStatus::ERR_NO_MEMORY;
}
for ( int i=0 ; i < argc_ ; i++ )
{
callable_argv[i] = argv_[i];
if (callable_argv[i].type == VALUE_OBJECT && !runtime->Protect(callable_argv[i].value.object) ||
callable_argv[i].type == VALUE_STRING && !(callable_argv[i].value.string = SetNewStr(callable_argv[i].value.string)))
{
callable_argv[i].type = VALUE_UNDEFINED;
return OpStatus::ERR_NO_MEMORY;
}
}
}
return OpStatus::OK;
}
示例14: OP_NEW_DBG
void OpSpeedDialView::HandleCallback(OpMessage msg, MH_PARAM_1 par1, MH_PARAM_2 par2)
{
OP_NEW_DBG("OpSpeedDialView::HandleCallback", "speeddial");
OP_DBG(("msg = %i", msg));
OP_DBG(("this = %p", this));
OP_DBG(("par1 = %i", par1));
switch (msg)
{
case MSG_SCROLL_SPEED_DIAL_PAGE_TO_VIEW:
{
g_main_message_handler->UnsetCallBack(this, MSG_SCROLL_SPEED_DIAL_PAGE_TO_VIEW, MH_PARAM_1(this));
const INT32 pos = par2;
OP_ASSERT(0 <= pos && unsigned(pos) < m_thumbnails.GetCount());
const OpRect r = m_thumbnails.Get(pos)->GetRect();
if (m_content)
m_content->SetScroll(r.y, TRUE);
g_main_message_handler->SetCallBack(this, MSG_ANIMATE_THUMBNAIL, par1);
g_main_message_handler->PostDelayedMessage(MSG_ANIMATE_THUMBNAIL, par1, pos, 100);
return;
}
case MSG_ANIMATE_THUMBNAIL:
{
g_main_message_handler->UnsetCallBack(this, MSG_ANIMATE_THUMBNAIL, par1);
const INT32 pos = par2;
OP_ASSERT(0 <= pos && unsigned(pos) < m_thumbnails.GetCount());
m_thumbnails.Get(pos)->AnimateThumbnailIn();
return;
}
}
OpWidget::HandleCallback(msg, par1, par2);
}
示例15: OP_ASSERT
void
Link::IntoStart(Head* list)
{
OP_ASSERT(!InList());
suc = list->first;
if (suc)
suc->pred = this;
else
list->last = this;
list->first = this;
parent = list;
}