Defines | Functions

ut_misc.cpp File Reference

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <glib.h>
#include "ut_string_class.h"
#include "ut_types.h"
#include "ut_misc.h"
#include "ut_assert.h"
#include "ut_string.h"
#include "ut_std_string.h"
#include "ut_go_file.h"
#include "ut_debugmsg.h"
#include <limits.h>

Defines

#define AUTO_LIST_RESERVED   1000
#define R_RIGHT(pr)   (((pr)->left)+((pr)->width))
#define R_BOTTOM(pr)   (((pr)->top)+((pr)->height))
#define MYZERO   0LL

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)
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.
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 signedLoWord (UT_uint32 dw)
UT_sint32 signedHiWord (UT_uint32 dw)
UT_uint32 UT_HeadingDepth (const char *szHeadingName)
void * UT_calloc (UT_uint32 nmemb, UT_uint32 size)
bool UT_parseBool (const char *param, bool dfl)
 UT_parseBool.
const gchar ** UT_splitPropsToArray (gchar *pProps)
UT_uint64 UT_hash64 (const char *p, UT_uint32 bytelen)
UT_uint32 UT_hash32 (const char *p, UT_uint32 bytelen)

Define Documentation

#define AUTO_LIST_RESERVED   1000
#define MYZERO   0LL

Referenced by UT_hash64().

#define R_BOTTOM (   pr  )     (((pr)->top)+((pr)->height))

Referenced by UT_Rect::intersectsRect().

#define R_RIGHT (   pr  )     (((pr)->left)+((pr)->width))

Referenced by UT_Rect::intersectsRect().


Function Documentation

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().

void* UT_calloc ( UT_uint32  nmemb,
UT_uint32  size 
)

Referenced by AP_Preview_Paragraph::_appendLine(), UT_ByteBuf::_byteBuf(), FV_View::_computeFindPrefix(), AP_Win32Dialog_New::_doChoose(), FV_View::_findGetNextBlockBuffer(), FV_View::_findGetPrevBlockBuffer(), FV_View::_findNext(), FV_View::_findPrev(), XAP_Dialog_Print::_getPrintToFilePathname(), UT_GrowBuf::_growBuf(), XAP_UnixDialog_FileOpenSaveAs::_loadXPM(), IE_ImpGraphic_GdkPixbuf::_loadXPM(), AP_CocoaDialog_Replace::_populateWindowData, AP_Dialog_Spell::addChangeAll(), XAP_Dictionary::addWord(), AP_Dialog_FormatTable::askForGraphicPathName(), AP_Dialog_FormatFrame::askForGraphicPathName(), Defun1(), AP_Win32App::doesStringSetExist(), EV_Toolbar_ActionSet::EV_Toolbar_ActionSet(), EV_Toolbar_LabelSet::EV_Toolbar_LabelSet(), EV_Toolbar_Layout::EV_Toolbar_Layout(), XAP_Win32Dialog_PluginManager::event_Load(), XAP_UnixDialog_PluginManager::event_Load(), AP_UnixDialog_New::event_ToggleOpenExisting(), AP_CocoaDialog_New::event_ToggleOpenExisting, AP_Dialog_MailMerge::eventOpen(), FileTypeArray::FileTypeArray(), AP_Dialog_MarkRevisions::getComment1(), XAP_Win32DialogBase::getControlText(), GR_Win32Graphics::getDocInfo(), AP_Dialog_ListRevisions::getNthItemText(), GR_Win32Graphics::getPrinterGraphics(), AP_Dialog_MarkRevisions::getRadio1Label(), FV_View::getSelectionText(), FV_View::gotoTarget(), AP_Dialog_Spell::inChangeAll(), AP_Win32App::initialize(), AbiCommand::insertText(), XAP_Dictionary::isWord(), AbiCommand::parseTokens(), GR_Win32Graphics::polyLine(), XAP_Win32Slurp::processCommand(), AbiCommand::replaceAll(), AbiCommand::replaceNext(), s_AskForGOComponentPathname(), s_AskForGraphicPathname(), s_AskForPathname(), s_AskForScriptName(), AP_CocoaPlugin_Document::selectMailMergeSource, XAP_Dictionary::suggestWord(), UT_GetDefaultPrinterName(), UT_UCS4_cloneString(), UT_UCS4_cloneString_char(), UT_XML_cloneConvAmpersands(), UT_XML_cloneNoAmpersands(), UT_XML_transNoAmpersands(), UT_Xpm2Bmp(), XAP_Args::XAP_Args(), and XAP_Win32Dialog_Print::XAP_Win32Dialog_Print().

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().

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

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 
)
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  ) 
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().