Classes | Defines | Typedefs | Functions

ut_misc.h File Reference

#include "ut_types.h"
#include <string>

Go to the source code of this file.

Classes

class  UT_Rect
struct  UT_Point
class  UT_UniqueId
class  UT_VersionInfo

Defines

#define UT_MAX(A, B)   (((A) > (B)) ? (A) : (B))
#define UT_MIN(A, B)   (((A) < (B)) ? (A) : (B))
#define UT_ABS(A)   ( ((A) < 0) ? (-(A)) : (A) )
#define UT_UID_INVALID   0xffffffff

Typedefs

typedef unsigned char UT_EthernetAddress [6]
typedef void AbiNativeWidget

Functions

std::string UT_pathSuffix (std::string path)
bool UT_addOrReplacePathSuffix (std::string &sPath, const char *sSuffix)
bool UT_isWordDelimiter (UT_UCSChar currentChar, UT_UCSChar followChar, UT_UCSChar prevChar)
ABI_EXPORT const gchar * UT_getAttribute (const gchar *name, const gchar **atts)
 Get the attribute "name" from atts or NULL if no such attribute is in atts.
ABI_EXPORT bool isTrue (const char *s)
 s is not null and is not a string that is "0" or false or something sane that indicates "false".
UT_sint32 signedHiWord (UT_uint32 dw)
UT_sint32 signedLoWord (UT_uint32 dw)
UT_uint32 UT_HeadingDepth (const char *szHeadName)
ABI_EXPORT bool UT_parseBool (const char *param, bool dfl)
 UT_parseBool.
void UT_gettimeofday (struct timeval *tv)
bool UT_getEthernetAddress (UT_EthernetAddress &a)
ABI_EXPORT const gchar ** UT_splitPropsToArray (gchar *props)
UT_uint64 UT_hash64 (const char *p, UT_uint32 bytelen=0)
UT_uint32 UT_hash32 (const char *p, UT_uint32 bytelen=0)

Define Documentation

#define UT_ABS (   A  )     ( ((A) < 0) ? (-(A)) : (A) )
#define UT_MAX (   A,
  B 
)    (((A) > (B)) ? (A) : (B))

Referenced by GR_Caret::_blink(), fp_FieldRun::_defaultDraw(), FV_View::_deleteSelection(), fp_TextRun::_draw(), fp_ImageRun::_draw(), fp_EndOfParagraphRun::_draw(), fp_ForcedLineBreakRun::_draw(), fp_TabRun::_draw(), fp_RDFAnchorRun::_draw(), fp_MathRun::_draw(), fp_EmbedRun::_draw(), fp_DirectionMarkerRun::_draw(), fp_AnnotationRun::_draw(), fp_TabRun::_drawArrow(), AP_TopRuler::_drawBar(), AP_TopRuler::_drawCellProperties(), fp_TextRun::_drawInvisibleSpaces(), FV_View::_drawSelection(), AP_TopRuler::_drawTabProperties(), AP_TopRuler::_drawTicks(), FV_View::_findNext(), AP_TopRuler::_getFirstPixelInColumn(), FV_View::_getMouseContext(), AP_TopRuler::_getTabToggleRect(), AP_TopRuler::_getUnitsFromRulerLeft(), FV_View::_MergeCells(), fp_Page::_reformatColumns(), fp_TableContainer::_size_allocate_pass1(), fp_TableContainer::_size_allocate_pass2(), fp_TableContainer::_size_request_pass1(), fp_TableContainer::_size_request_pass2(), AP_TopRuler::_xorGuide(), PD_Document::acceptRejectRevision(), AD_Document::areDocumentHistoriesEqual(), fp_Page::breakPage(), FV_View::cmdTextToTable(), Defun1(), FV_View::doesSelectionContainRevision(), XAP_Preview_FontPreview::draw(), fp_CellContainer::draw(), fp_FrameContainer::draw(), fp_FootnoteContainer::draw(), fp_VerticalContainer::draw(), fp_CellContainer::drawBroken(), fp_Run::drawDecors(), fp_Page::getAvailableHeightForColumn(), fp_Page::getFilledHeight(), AD_Document::getHighestRevisionId(), FV_View::getInsertionPointContext(), fp_TableContainer::getMarginAfter(), fp_Line::getMarginAfter(), fp_Line::getMarginBefore(), fl_BlockLayout::getMaxNonBreakableRun(), AP_TopRuler::getTabToggleAreaWidth(), AP_TopRuler::mouseMotion(), AP_TopRuler::mouseRelease(), AP_TopRuler::notify(), GR_Graphics::polygon(), fp_Line::recalcHeight(), AP_TopRuler::scrollRuler(), AP_TopRuler::setTableLineDrag(), AP_LeftRuler::setTableLineDrag(), fp_TableContainer::tableAttach(), UT_Rect::unionRect(), FV_SelectionHandles::updateSelectionEnd(), and fp_TableContainer::wantVBreakAtNoFootnotes().

#define UT_MIN (   A,
  B 
)    (((A) < (B)) ? (A) : (B))

Referenced by FV_View::_adjustDeletePosition(), GR_Caret::_blink(), s_RTF_ListenerGetProps::_check_revs_for_color(), s_RTF_ListenerGetProps::_check_revs_for_font(), XAP_CocoaFrameImpl::_createTopLevelWindow, fp_FieldRun::_defaultDraw(), pt_PieceTable::_deleteComplexSpan(), pt_PieceTable::_deleteComplexSpan_norec(), FV_View::_deleteSelection(), fl_BlockLayout::_doInsertTextSpan(), pt_PieceTable::_doTheDo(), fp_TextRun::_draw(), fp_ImageRun::_draw(), fp_EndOfParagraphRun::_draw(), fp_ForcedLineBreakRun::_draw(), fp_TabRun::_draw(), fp_RDFAnchorRun::_draw(), fp_MathRun::_draw(), fp_EmbedRun::_draw(), fp_DirectionMarkerRun::_draw(), fp_AnnotationRun::_draw(), fp_TabRun::_drawArrow(), fp_Page::_drawCropMarks(), FV_View::_drawSelection(), FV_View::_findPrev(), FV_View::_getMouseContext(), s_AbiWord_1_Listener::_handleDataItems(), IE_Imp_MsWord_97::_insertTOC(), IE_Imp_RTF::_isBidiDocument(), pf_Frag_Text::_isContentEqual(), ODi_Abi_Data::_loadStream(), FV_View::_MergeCells(), AP_Win32App::_pasteFormatFromClipboard(), XAP_Win32Dialog_FileOpenSaveAs::_previewPicture(), pt_PieceTable::_realChangeSpanFmt(), IE_Imp_Text::_recognizeEncoding(), GR_Win32USPGraphics::_scriptBreak(), fp_FieldRun::_setValue(), PD_Document::acceptRejectRevision(), PD_Document::areDocumentContentsEqual(), PD_Document::areDocumentFormatsEqual(), AD_Document::areDocumentHistoriesEqual(), XAP_Dialog_Modeless::BuildWindowName(), fp_FieldListLabelRun::calculateValue(), FV_View::calculateZoomPercentForWholePage(), pt_PieceTable::changeSpanFmt(), IE_MailMerge::constructMerger(), FV_View::countWords(), Defun1(), Defun_EV_GetToolbarItemState_Fn(), pt_PieceTable::deleteSpan(), FV_View::doesSelectionContainRevision(), fp_FrameContainer::draw(), AP_Lists_preview::draw(), fp_Run::drawDecors(), PD_Document::explodeRevisions(), PD_Document::findFirstDifferenceInContent(), fp_TextRun::findPointCoords(), FV_View::getInsertionPointContext(), AP_Dialog_Lists::getListLabel(), FV_View::getTextBetweenPos(), FV_View::getVisibleDocumentPagesAndRectangles(), loadStream(), fp_VerticalContainer::mapXYToPosition(), GR_CairoGraphics::measureString(), AP_TopRuler::mouseMotion(), AP_CocoaApp::pasteFromClipboard(), GR_Graphics::polygon(), AP_Dialog_Lists::PopulateDialogData(), XAP_UnixDialog_FileOpenSaveAs::previewPicture(), IE_ImpGraphicSniffer::recognizeContents(), IE_Imp_OpenWriter_Sniffer::recognizeContents(), IE_ImpSniffer::recognizeContents(), FV_View::toggleCase(), UT_Rect::unionRect(), fp_TextRun::updateOnDelete(), fp_Run::updateOnDelete(), and FV_SelectionHandles::updateSelectionStart().

#define UT_UID_INVALID   0xffffffff

Typedef Documentation

typedef void AbiNativeWidget
typedef unsigned char UT_EthernetAddress[6]

Function Documentation

ABI_EXPORT bool isTrue ( const char *  s  ) 

s is not null and is not a string that is "0" or false or something sane that indicates "false".

Referenced by AbiCommand::parseTokens().

UT_sint32 signedHiWord ( UT_uint32  dw  ) 
UT_sint32 signedLoWord ( UT_uint32  dw  ) 
bool UT_addOrReplacePathSuffix ( std::string &  sPath,
const char *  sSuffix 
)

Take a path name and search for the suffix. replace it the supplied suffix.

References s.

Referenced by XAP_UnixDialog_Print::setupPrint().

ABI_EXPORT const gchar* UT_getAttribute ( const gchar *  name,
const gchar **  atts 
)

Get the attribute "name" from atts or NULL if no such attribute is in atts.

References gchar, and UT_return_val_if_fail.

Referenced by ODi_Frame_ListenerState::_getFrameProperties(), IE_Imp_XML::_getXMLPropValue(), OpenWriter_ContentStream_Listener::_insertImage(), ODi_TextContent_ListenerState::_insureInSection(), ODi_Style_Style::_parse_style_background_image(), ODi_Style_Style::_parse_style_graphicProperties(), ODi_Style_Style::_parse_style_paragraphProperties(), ODi_Style_Style::_parse_style_sectionProperties(), ODi_Style_Style::_parse_style_style(), ODi_Style_Style::_parse_style_tableCellProperties(), ODi_Style_Style::_parse_style_tableColumnProperties(), ODi_Style_Style::_parse_style_tableProperties(), ODi_Style_Style::_parse_style_tableRowProperties(), ODi_Style_Style::_parse_style_tabStopProperties(), ODi_Style_Style::_parse_style_textProperties(), ODi_Style_PageLayout::_parseBackgroundImage(), ODi_Table_ListenerState::_parseCellStart(), ODi_Table_ListenerState::_parseColumnStart(), ODi_Style_PageLayout::_parseHeaderFooterProperties(), ODi_Style_PageLayout::_parsePageLayoutProperties(), ODi_Table_ListenerState::_parseRowStart(), ODi_Table_ListenerState::_parseTableStart(), ODi_TextContent_ListenerState::_startParagraphElement(), ODi_Office_Styles::addDefaultStyle(), ODi_Abi_Data::addImageDataItem(), ODi_Office_Styles::addList(), ODi_Office_Styles::addMasterPage(), ODi_Office_Styles::addNotesConfiguration(), ODi_Abi_Data::addObjectDataItem(), ODi_Office_Styles::addPageLayout(), ODi_Style_Style_Family::addStyle(), ODi_Office_Styles::addStyle(), PP_RevisionAttr::getHighestRevisionNumberWithAttribute(), OO_Style::parse(), OO_PageStyle::parse(), UT_XML_Decoder::startElement(), ODi_TextContent_ListenerState::startElement(), ODi_TableOfContent_ListenerState::startElement(), ODi_Style_Style::startElement(), ODi_Style_PageLayout::startElement(), ODi_Style_MasterPage::startElement(), ODi_Style_List::startElement(), ODi_NotesConfiguration::startElement(), ODi_ManifestStream_ListenerState::startElement(), ODi_Numbered_ListLevelStyle::startElement(), ODi_Bullet_ListLevelStyle::startElement(), ODi_ListLevelStyle::startElement(), ODi_FontFaceDecls::startElement(), ODi_ContentStreamAnnotationMatcher_ListenerState::startElement(), IE_MailMerge_XML_Listener::startElement(), OpenWriter_ContentStream_Listener::startElement(), OpenWriter_StylesStream_Listener::startElement(), OpenWriter_MetaStream_Listener::startElement(), OpfListener::startElement(), ContainerListener::startElement(), BarbarismChecker::startElement(), and UT_getLatestAttribute().

bool UT_getEthernetAddress ( UT_EthernetAddress A  ) 

retrieve the 6-byte address of the network card; returns true on success

retrieve the 6-byte address of the network card; returns true on success This implementation is from libuuid; it has not been debugged or even compiled

References _ASTAT::adapt, UT_ASSERT, UT_DEBUGMSG, UT_NOT_IMPLEMENTED, UT_return_val_if_fail, and UT_UNUSED.

Referenced by UT_UUID::_makeUUID().

void UT_gettimeofday ( struct timeval *  tv  ) 

UT_gettimeofday() fills in the timeval structure with current time; the platform implementation needs to be as accurate as possible since this function is used in the UT_UUID class.

UT_gettimeofday() fills in the timeval structure with current time; the platform implementation needs to be as accurate as possible since this function is used in the UT_UUID class.

this implementation is from: http://bugzilla.vovida.org/bugzilla/show_bug.cgi?id=751

Referenced by UT_UUID::_getClock().

UT_uint32 UT_hash32 ( const char *  p,
UT_uint32  bytelen = 0 
)
UT_uint64 UT_hash64 ( const char *  p,
UT_uint32  bytelen = 0 
)

References MYZERO, and UT_return_val_if_fail.

UT_uint32 UT_HeadingDepth ( const char *  szHeadingName  ) 

Strips off the first numeric part of string and returns it as a uint32. ie. "Numbered Heading 5" would return 5.

Referenced by FV_View::setStyleAtPos(), and TFTEST_MAIN().

bool UT_isWordDelimiter ( UT_UCSChar  currentChar,
UT_UCSChar  followChar,
UT_UCSChar  prevChar 
)
ABI_EXPORT bool UT_parseBool ( const char *  param,
bool  dfl 
)

UT_parseBool.

Returns true if param is [true, 1, yes, allow, enable, on] Returns false if param is [false, 0, no, disallow, disable, off] Returns dfl otherwise, including if param is null

References UT_return_val_if_fail.

Referenced by IE_Exp_OpenDocument::_openFile(), IE_Exp_OpenDocument::_writeDocument(), IE_Exp_HTML::_writeDocument(), IE_Exp_AbiWord_1::_writeDocument(), IE_Exp_S5::_writeHeader(), and AP_Convert::print().

std::string UT_pathSuffix ( std::string  path  ) 
ABI_EXPORT const gchar** UT_splitPropsToArray ( gchar *  pProps  ) 

splits the xml property string (font-size:24pt;font-face:Arial') into names and values and stores them in an array

the caller has to delete[] the array; the process is destructive to props

References gchar, and UT_return_val_if_fail.

Referenced by ODi_TextContent_ListenerState::_insureInSection(), pt_PieceTable::appendLastStruxFmt(), and pt_PieceTable::changeLastStruxFmtNoUndo().