本文整理汇总了C++中UT_return_if_fail函数的典型用法代码示例。如果您正苦于以下问题:C++ UT_return_if_fail函数的具体用法?C++ UT_return_if_fail怎么用?C++ UT_return_if_fail使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UT_return_if_fail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UT_return_if_fail
void XAP_Win32DialogBase::setControlInt(UT_sint32 controlId, int value)
{
UT_return_if_fail(IsWindow(m_hDlg));
SetDlgItemInt(m_hDlg, controlId, value, TRUE);
}
示例2: pf_Frag
pf_Frag_Object::pf_Frag_Object(pt_PieceTable * pPT,
PTObjectType objectType,
PT_AttrPropIndex indexAP)
: pf_Frag(pPT, pf_Frag::PFT_Object, pf_FRAG_OBJECT_LENGTH)
{
m_pObjectSubclass = NULL;
m_objectType = objectType;
m_indexAP = indexAP;
const PP_AttrProp * pAP = NULL;
xxx_UT_DEBUGMSG(("Frag Object created indexAP %x \n",m_indexAP));
m_pPieceTable->getAttrProp(m_indexAP,&pAP);
UT_return_if_fail (pAP);
const gchar* pszType = NULL;
const gchar* pszName = NULL;
const gchar* pszParam = NULL;
pAP->getAttribute(static_cast<const gchar *>("type"), pszType);
pAP->getAttribute(static_cast<const gchar *>("name"), pszName);
pAP->getAttribute(static_cast<const gchar *>("param"), pszParam);
fd_Field::FieldType fieldType = fd_Field::FD_None;
if (objectType==PTO_Field)
{
if(pszType == NULL)
{
UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
pszType = "test";
}
switch(*pszType)
{
case 'a':
if (0 == strcmp(pszType, "app_ver"))
{
fieldType = fd_Field::FD_App_Version;
}
else if (0 == strcmp(pszType, "app_id"))
{
fieldType = fd_Field::FD_App_ID;
}
else if (0 == strcmp(pszType, "app_options"))
{
fieldType = fd_Field::FD_App_Options;
}
else if (0 == strcmp(pszType, "app_target"))
{
fieldType = fd_Field::FD_App_Target;
}
else if (0 == strcmp(pszType, "app_compiledate"))
{
fieldType = fd_Field::FD_App_CompileDate;
}
else if (0 == strcmp(pszType, "app_compiletime"))
{
fieldType = fd_Field::FD_App_CompileTime;
}
else
{
UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
//Better than segfaulting I figure
fieldType = fd_Field::FD_None;
}
break;
case 'c':
if (0 == strcmp(pszType, "char_count"))
{
fieldType = fd_Field::FD_Doc_CharCount;
}
else
{
UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
//Better than segfaulting I figure
fieldType = fd_Field::FD_None;
}
break;
case 'd':
if (0 == strcmp(pszType, "date"))
{
fieldType = fd_Field::FD_Date;
}
else if (0 == strcmp(pszType, "date_mmddyy"))
{
fieldType = fd_Field::FD_Date_MMDDYY;
}
else if (0 == strcmp(pszType, "date_ddmmyy"))
{
fieldType = fd_Field::FD_Date_DDMMYY;
}
else if (0 == strcmp(pszType, "date_mdy"))
{
fieldType = fd_Field::FD_Date_MDY;
}
else if (0 == strcmp(pszType, "date_mthdy"))
{
fieldType = fd_Field::FD_Date_MthDY;
}
else if (0 == strcmp(pszType, "date_dfl"))
{
fieldType = fd_Field::FD_Date_DFL;
}
//.........这里部分代码省略.........
示例3: setSensitivity
/*!
* This method sets the sensitivity of the radio buttons to above/below/left/right merges
* Because we can't merge to the left of column zero for example.
*
* Call this right after contructing the widget and before dropping into the main loop.
*/
void AP_Dialog_SplitCells::setAllSensitivities(void)
{
FV_View * pView = 0;
if (XAP_Frame * pFrame = getApp()->getLastFocussedFrame())
{
pView = static_cast<FV_View *>(pFrame->getCurrentView());
}
if (!pView)
{
setSensitivity(vert_above, false);
setSensitivity(vert_mid, false);
setSensitivity(vert_below, false);
setSensitivity(hori_left, false);
setSensitivity(hori_mid, false);
setSensitivity(hori_right, false);
return;
}
if (!pView->isInTable())
{
setSensitivity(vert_above, false);
setSensitivity(vert_mid, false);
setSensitivity(vert_below, false);
setSensitivity(hori_left, false);
setSensitivity(hori_mid, false);
setSensitivity(hori_right, false);
return;
}
PT_DocPosition iCurPos = pView->getPoint();
m_iCellSource = iCurPos;
pView->getCellParams(iCurPos,&m_iLeft,&m_iRight,&m_iTop,&m_iBot);
//
// Now find the number of rows and columns inthis table. This is easiest to
// get from the table container
//
fl_BlockLayout * pBL = pView->getLayout()->findBlockAtPosition(iCurPos);
fp_Run * pRun;
UT_sint32 xPoint,yPoint,xPoint2,yPoint2,iPointHeight;
bool bDirection;
pRun = pBL->findPointCoords(iCurPos, false, xPoint,
yPoint, xPoint2, yPoint2,
iPointHeight, bDirection);
UT_return_if_fail(pRun);
fp_Line * pLine = pRun->getLine();
UT_return_if_fail(pLine);
fp_Container * pCon = pLine->getContainer();
UT_return_if_fail(pCon);
fp_TableContainer * pTab = static_cast<fp_TableContainer *>(pCon->getContainer());
UT_return_if_fail(pTab);
UT_return_if_fail(pTab->getContainerType() == FP_CONTAINER_TABLE);
m_pTab = pTab;
m_iNumRows = pTab->getNumRows();
m_iNumCols = pTab->getNumCols();
if(m_iBot > m_iTop+2)
{
setSensitivity(vert_above,true);
setSensitivity(vert_below,true);
}
else
{
setSensitivity(vert_above,false);
setSensitivity(vert_below,false);
}
UT_sint32 diff = m_iBot - m_iTop;
if((m_iBot - m_iTop == 1) || (2*(diff/2) == diff))
{
setSensitivity(vert_mid,true);
}
else
{
setSensitivity(vert_mid,false);
}
if(m_iRight > m_iLeft+2)
{
setSensitivity(hori_left,true);
setSensitivity(hori_right,true);
}
else
{
setSensitivity(hori_left,false);
setSensitivity(hori_right,false);
}
diff = m_iRight - m_iLeft;
if((m_iRight - m_iLeft == 1) || (2*(diff/2) == diff))
{
setSensitivity(hori_mid,true);
}
else
{
//.........这里部分代码省略.........
示例4: getDoc
void FV_Selection::pasteRowOrCol(void)
{
pf_Frag_Strux* cellSDH, *tableSDH;
PT_DocPosition pos = m_pView->getPoint();
if(m_iPrevSelectionMode == FV_SelectionMode_TableColumn)
{
//
// GLOB stuff together so it undo's in one go.
//
getDoc()->beginUserAtomicGlob();
//
// Insert a column after the current column
//
m_pView->cmdInsertCol(m_pView->getPoint(),false);
//
// Now do all the encapsulating stuff for piecetable manipulations.
//
// Signal PieceTable Change
m_pView->_saveAndNotifyPieceTableChange();
// Turn off list updates
getDoc()->disableListUpdates();
if (!m_pView->isSelectionEmpty())
{
m_pView->_clearSelection();
}
getDoc()->setDontImmediatelyLayout(true);
pos = m_pView->getPoint();
PT_DocPosition posTable,posCell;
UT_sint32 iLeft,iRight,iTop,iBot;
posCell = 0;
m_pView->getCellParams(pos, &iLeft, &iRight,&iTop,&iBot);
bool bRes = getDoc()->getStruxOfTypeFromPosition(pos,PTX_SectionCell,&cellSDH);
bRes = getDoc()->getStruxOfTypeFromPosition(pos,PTX_SectionTable,&tableSDH);
UT_return_if_fail(bRes);
posTable = getDoc()->getStruxPosition(tableSDH) + 1;
UT_sint32 numRows = 0;
UT_sint32 numCols = 0;
UT_sint32 i = 0;
getDoc()-> getRowsColsFromTableSDH(tableSDH, m_pView->isShowRevisions(), m_pView->getRevisionLevel(),
&numRows, &numCols);
PD_DocumentRange DocRange(getDoc(),posCell,posCell);
for(i=0; i<getNumSelections(); i++)
{
posCell = m_pView->findCellPosAt(posTable,i,iLeft)+2;
m_pView->setPoint(posCell);
PD_DocumentRange * pR = getNthSelection(i);
if(pR->m_pos1 == pR->m_pos2)
{
//
// Dont paste empty cells
//
continue;
}
UT_ByteBuf * pBuf = m_vecSelRTFBuffers.getNthItem(i);
const unsigned char * pData = pBuf->getPointer(0);
UT_uint32 iLen = pBuf->getLength();
DocRange.m_pos1 = posCell;
DocRange.m_pos2 = posCell;
IE_Imp_RTF * pImpRTF = new IE_Imp_RTF(getDoc());
pImpRTF->pasteFromBuffer(&DocRange,pData,iLen);
DELETEP(pImpRTF);
fl_SectionLayout * pSL = m_pView->getCurrentBlock()->getSectionLayout();
pSL->checkAndAdjustCellSize();
}
getDoc()->endUserAtomicGlob();
getDoc()->setDontImmediatelyLayout(false);
m_pView->_generalUpdate();
// restore updates and clean up dirty lists
getDoc()->enableListUpdates();
getDoc()->updateDirtyLists();
// Signal PieceTable Changes have finished
m_pView->_restorePieceTableState();
// Put the insertion point in a legal position
//
m_pView->notifyListeners(AV_CHG_MOTION);
m_pView->_fixInsertionPointCoords();
m_pView->_ensureInsertionPointOnScreen();
}
else
{
}
}
示例5: s_restart_toggled
static void s_restart_toggled(GtkWidget * /*btn*/, AP_UnixDialog_HdrFtr * dlg)
{
UT_return_if_fail(dlg);
dlg->RestartChanged();
}
示例6: UT_return_if_fail
void AP_Preview_Annotation::setDescription(const gchar * pDescription)
{
UT_return_if_fail(pDescription);
m_sDescription = pDescription;
}
示例7: UT_return_if_fail
void AP_UnixDialog_GenericProgress::setProgress(UT_uint32 progress)
{
UT_return_if_fail(m_wProgress);
UT_return_if_fail(/*progress >= 0 &&*/ progress <= 100);
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(m_wProgress), progress / 100.0f);
}
示例8: UT_return_if_fail
void AP_UnixPreview_Annotation::activate(void)
{
UT_return_if_fail(m_pPreviewWindow);
gdk_window_raise(gtk_widget_get_window(m_pPreviewWindow));
}
示例9: UT_return_if_fail
void GR_MathManager::setDefaultFontSize(UT_sint32 uid, UT_sint32 iSize)
{
SmartPtr<libxml2_MathView> pMathView = m_vecMathView.getNthItem(uid);
UT_return_if_fail(pMathView);
pMathView->setDefaultFontSize(iSize);
}
示例10: UT_DEBUGMSG
void AbiCollab::import(SessionPacket* pPacket, BuddyPtr collaborator)
{
UT_DEBUGMSG(("AbiCollab::import()\n"));
UT_return_if_fail(pPacket);
if (m_bDoingMouseDrag)
{
// we block incoming packets while dragging the mouse; this prevents
// scary race conditions from occuring, like importing a 'delete image' packet
// when you are just dragging said image around
UT_DEBUGMSG(("We are currently dragging something around; deferring packet import until after the release!\n"));
m_vIncomingQueue.push_back(
std::make_pair(static_cast<SessionPacket*>(pPacket->clone()), collaborator));
return;
}
// record the incoming packet
if (m_pRecorder)
m_pRecorder->storeIncoming(pPacket, collaborator);
// execute an alternative packet handling path when this session is being
// taken over by another collaborator
if (AbstractSessionTakeoverPacket::isInstanceOf(*pPacket))
{
AbstractSessionTakeoverPacket* astp = static_cast<AbstractSessionTakeoverPacket*>(pPacket);
bool res = _handleSessionTakeover(astp, collaborator);
if (!res)
{
// TODO: implement/handle an offending collaborator
UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
}
return;
}
/*
Session packets are only allowed to come in from a collaborator when:
1. no session takeover is in progress, or
2a. if this session is a slave: always
2b. if this session is a master: until the collaborator has responded to a
SessionTakeoverRequest from us with a SessionTakeoverAck packet
*/
// TODO: implement/handle an offending collaborator
UT_return_if_fail(
(m_eTakeoveState == STS_NONE) ||
(!isLocallyControlled()) ||
(isLocallyControlled() && m_eTakeoveState == STS_SENT_TAKEOVER_REQUEST && !_hasAckedSessionTakeover(collaborator))
);
// import the packet; note that it might be denied due to collisions
maskExport();
if (AbstractChangeRecordSessionPacket::isInstanceOf(*pPacket))
m_pActivePacket = static_cast<const AbstractChangeRecordSessionPacket*>(pPacket);
m_vCollaborators[collaborator] = pPacket->getDocUUID().utf8_str(); // FIXME: this is redunant after we set this the first time
m_Import.import(*pPacket, collaborator);
m_pActivePacket = NULL;
const std::vector<SessionPacket*>& maskedPackets = unmaskExport();
if (isLocallyControlled() && maskedPackets.size() > 0)
{
UT_DEBUGMSG(("Forwarding message (%u packets) from %s\n", maskedPackets.size(), collaborator->getDescription().utf8_str()));
// It seems we are in the center of a collaboration session.
// It's our duty to reroute the packets to the other collaborators
for (std::map<BuddyPtr, std::string>::iterator it = m_vCollaborators.begin(); it != m_vCollaborators.end(); it++)
{
// send all masked packets during import to everyone, except to the
// person who initialy sent us the packet
BuddyPtr pBuddy = (*it).first;
UT_continue_if_fail(pBuddy);
if (pBuddy != collaborator)
{
UT_DEBUGMSG(("Forwarding message from %s to %s\n", collaborator->getDescription().utf8_str(), pBuddy->getDescription().utf8_str()));
for (std::vector<SessionPacket*>::const_iterator cit = maskedPackets.begin(); cit != maskedPackets.end(); cit++)
{
SessionPacket* maskedPacket = (*cit);
push(maskedPacket, pBuddy);
}
}
}
}
}
示例11: UT_return_if_fail
void AbiCollab::removeMouse(EV_Mouse* pMouse)
{
UT_return_if_fail(pMouse);
m_mMouseListenerIds.erase(pMouse);
}
示例12: getApp
void XAP_Win32Dialog_PluginManager::event_Load()
{
const XAP_StringSet * pSS = m_pApp->getStringSet();
XAP_DialogFactory * pDialogFactory
= (XAP_DialogFactory *) getApp()->findValidFrame()->getDialogFactory();
XAP_Dialog_FileOpenSaveAs * pDialog
= (XAP_Dialog_FileOpenSaveAs *)(pDialogFactory->requestDialog(XAP_DIALOG_ID_FILE_OPEN));
UT_return_if_fail(pDialog);
// set the intial plugin directory to the user-local plugin directory
// could also set to: XAP_App::getApp()->getUserPrivateDirectory()\plugins
// could also set to: XAP_App::getApp()->getAbiSuiteLibDir()\plugins
UT_String pluginDir (XAP_App::getApp()->getAbiSuiteAppDir());
pluginDir += "\\plugins";
pDialog->setCurrentPathname (pluginDir.c_str());
pDialog->setSuggestFilename(false);
UT_uint32 filterCount = 1;
const char ** szDescList = (const char **) UT_calloc(filterCount + 1,
sizeof(char *));
UT_return_if_fail(szDescList);
const char ** szSuffixList = (const char **) UT_calloc(filterCount + 1,
sizeof(char *));
if(!szSuffixList)
{
UT_ASSERT_HARMLESS(szSuffixList);
FREEP(szDescList);
return;
}
IEFileType * nTypeList = (IEFileType *) UT_calloc(filterCount + 1,
sizeof(IEFileType));
if(!nTypeList)
{
UT_ASSERT_HARMLESS(nTypeList);
FREEP(szDescList);
FREEP(szSuffixList);
return;
}
// we probably shouldn't hardcode this
// HP-UX uses .sl, for instance
szDescList[0] = "AbiWord Plugin (.dll)";
szSuffixList[0] = "*.dll";
nTypeList[0] = (IEFileType)1;
pDialog->setFileTypeList(szDescList, szSuffixList,
(const UT_sint32 *) nTypeList);
pDialog->setDefaultFileType((IEFileType)1);
// todo: cd to the proper plugin directory
pDialog->runModal(getApp()->findValidFrame());
XAP_Dialog_FileOpenSaveAs::tAnswer ans = pDialog->getAnswer();
bool bOK = (ans == XAP_Dialog_FileOpenSaveAs::a_OK);
if (bOK)
{
const char * szResultPathname = pDialog->getPathname();
if (szResultPathname && *szResultPathname)
{
if( activatePlugin(szResultPathname) )
{
// worked!
refreshPluginList();
}
else
{
// error message
getApp()->findValidFrame()->showMessageBox( pSS->getValue(XAP_STRING_ID_DLG_PLUGIN_MANAGER_COULDNT_LOAD),
XAP_Dialog_MessageBox::b_O,
XAP_Dialog_MessageBox::a_OK );
}
}
}
FREEP(szDescList);
FREEP(szSuffixList);
FREEP(nTypeList);
pDialogFactory->releaseDialog(pDialog);
}
示例13: UT_return_if_fail
void AP_Win32Dialog_Annotation::runModal(XAP_Frame * pFrame)
{
UT_return_if_fail (m_id == AP_DIALOG_ID_ANNOTATION);
createModal(pFrame, MAKEINTRESOURCEW(AP_RID_DIALOG_ANNOTATION));
}
示例14: UT_return_if_fail
void AP_Win32Dialog_New::_doChoose()
{
XAP_Dialog_Id id = XAP_DIALOG_ID_FILE_OPEN;
XAP_DialogFactory * pDialogFactory
= (XAP_DialogFactory *) m_pFrame->getDialogFactory();
XAP_Dialog_FileOpenSaveAs * pDialog
= (XAP_Dialog_FileOpenSaveAs *)(pDialogFactory->requestDialog(id));
UT_return_if_fail (pDialog);
pDialog->setCurrentPathname(0);
pDialog->setSuggestFilename(false);
UT_uint32 filterCount = IE_Imp::getImporterCount();
const char ** szDescList = (const char **) UT_calloc(filterCount + 1,
sizeof(char *));
UT_return_if_fail(szDescList);
const char ** szSuffixList = (const char **) UT_calloc(filterCount + 1,
sizeof(char *));
if(!szSuffixList)
{
UT_ASSERT_HARMLESS(szSuffixList);
FREEP(szDescList);
return;
}
IEFileType * nTypeList = (IEFileType *) UT_calloc(filterCount + 1,
sizeof(IEFileType));
if(!nTypeList)
{
UT_ASSERT_HARMLESS(nTypeList);
FREEP(szDescList);
FREEP(szSuffixList);
return;
}
UT_uint32 k = 0;
while (IE_Imp::enumerateDlgLabels(k, &szDescList[k],
&szSuffixList[k], &nTypeList[k]))
k++;
pDialog->setFileTypeList(szDescList, szSuffixList,
(const UT_sint32 *) nTypeList);
pDialog->setDefaultFileType(IE_Imp::fileTypeForSuffix(".abw"));
pDialog->runModal(m_pFrame);
XAP_Dialog_FileOpenSaveAs::tAnswer ans = pDialog->getAnswer();
bool bOK = (ans == XAP_Dialog_FileOpenSaveAs::a_OK);
if (bOK)
{
const char * szResultPathname = pDialog->getPathname();
if (szResultPathname && *szResultPathname)
{
// update the entry box
_win32Dialog.setControlText( AP_RID_DIALOG_NEW_EBX_EXISTING,
szResultPathname);
setFileName (szResultPathname);
}
}
}
示例15: UT_return_if_fail
/*! After the construction of a new AP, use this method to mark it read-only.
It returns if the AP is already read-only; otherwise it marks [this] AP
as read-only and then computes its checksum in order to speed subsequent
equivalence testing. There is no return value.
*/
void PP_AttrProp::markReadOnly(void)
{
UT_return_if_fail (!m_bIsReadOnly);
m_bIsReadOnly = true;
_computeCheckSum();
}