Defines | Typedefs | Functions

ut_string.h File Reference

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

Go to the source code of this file.

Defines

#define UT_UCS4_isalnum(x)   (UT_UCS4_isalpha(x) || UT_UCS4_isdigit(x))
#define UT_UCS4_ispunct(x)   ((!UT_UCS4_isspace(x) && !UT_UCS4_isalnum(x) && (x)>' '))
#define UT_strptime   strptime
#define UT_BIDI_LTR   FRIBIDI_TYPE_LTR
#define UT_BIDI_RTL   FRIBIDI_TYPE_RTL
#define UT_BIDI_WS   FRIBIDI_TYPE_WS
#define UT_BIDI_EN   FRIBIDI_TYPE_EN
#define UT_BIDI_ES   FRIBIDI_TYPE_ES
#define UT_BIDI_ET   FRIBIDI_TYPE_ET
#define UT_BIDI_AN   FRIBIDI_TYPE_AN
#define UT_BIDI_CS   FRIBIDI_TYPE_CS
#define UT_BIDI_BS   FRIBIDI_TYPE_BS
#define UT_BIDI_SS   FRIBIDI_TYPE_SS
#define UT_BIDI_AL   FRIBIDI_TYPE_AL
#define UT_BIDI_NSM   FRIBIDI_TYPE_NSM
#define UT_BIDI_RLE   FRIBIDI_TYPE_RLE
#define UT_BIDI_LRE   FRIBIDI_TYPE_LRE
#define UT_BIDI_LRO   FRIBIDI_TYPE_LRO
#define UT_BIDI_RLO   FRIBIDI_TYPE_RLO
#define UT_BIDI_PDF   FRIBIDI_TYPE_PDF
#define UT_BIDI_ON   FRIBIDI_TYPE_ON
#define UT_BIDI_UNSET   FRIBIDI_TYPE_UNSET
#define UT_BIDI_IGNORE   FRIBIDI_TYPE_IGNORE
#define UT_BIDI_IS_STRONG   FRIBIDI_IS_STRONG
#define UT_BIDI_IS_WEAK   FRIBIDI_IS_WEAK
#define UT_BIDI_IS_NUMBER   FRIBIDI_IS_NUMBER
#define UT_BIDI_IS_RTL   FRIBIDI_IS_RTL
#define UT_BIDI_IS_NEUTRAL   FRIBIDI_IS_NEUTRAL
#define UT_BIDI_IS_LETTER   FRIBIDI_IS_LETTER
#define UT_BIDI_IS_NSM(x)   ((x) & FRIBIDI_MASK_NSM)

Typedefs

typedef FriBidiCharType UT_BidiCharType

Functions

G_BEGIN_DECLS ABI_EXPORT bool UT_XML_cloneNoAmpersands (gchar *&rszDest, const gchar *szSource)
ABI_EXPORT bool UT_XML_cloneConvAmpersands (gchar *&rszDest, const gchar *szSource)
ABI_EXPORT const gchar * UT_XML_transNoAmpersands (const gchar *szSource)
ABI_EXPORT void UT_decodeUTF8string (const gchar *p, UT_uint32 len, UT_GrowBuf *pResult)
ABI_EXPORT bool UT_ensureValidXML (std::string &s)
 Ensure a key or property is valid XML.
ABI_EXPORT bool UT_isValidXML (const char *s)
ABI_EXPORT bool UT_validXML (char *s)
ABI_EXPORT bool UT_isSmartQuotableCharacter (UT_UCSChar c)
ABI_EXPORT bool UT_isSmartQuotedCharacter (UT_UCSChar c)
ABI_EXPORT UT_uint32 UT_UCS2_strlen (const UT_UCS2Char *string)
ABI_EXPORT bool UT_UCS4_isupper (UT_UCS4Char c)
ABI_EXPORT bool UT_UCS4_islower (UT_UCS4Char c)
ABI_EXPORT bool UT_UCS4_isalpha (UT_UCS4Char c)
ABI_EXPORT bool UT_UCS4_isSentenceSeparator (UT_UCS4Char c)
ABI_EXPORT bool UT_UCS4_isdigit (UT_UCS4Char c)
ABI_EXPORT bool UT_UCS4_isspace (UT_UCS4Char c)
ABI_EXPORT UT_sint32 UT_UCS4_strcmp (const UT_UCS4Char *left, const UT_UCS4Char *right)
ABI_EXPORT UT_UCS4CharUT_UCS4_strstr (const UT_UCS4Char *phaystack, const UT_UCS4Char *pneedle)
ABI_EXPORT UT_UCS4CharUT_UCS4_stristr (const UT_UCS4Char *phaystack, const UT_UCS4Char *pneedle)
ABI_EXPORT UT_uint32 UT_UCS4_strlen (const UT_UCS4Char *string)
ABI_EXPORT UT_uint32 UT_UCS4_strlen_as_char (const UT_UCS4Char *string)
ABI_EXPORT UT_UCS4CharUT_UCS4_strcpy (UT_UCS4Char *dest, const UT_UCS4Char *src)
ABI_EXPORT UT_UCS4CharUT_UCS4_strcpy_char (UT_UCS4Char *dest, const char *src)
ABI_EXPORT UT_UCS4CharUT_UCS4_strncpy_char (UT_UCS4Char *dest, const char *src, int)
ABI_EXPORT UT_UCS4CharUT_UCS4_strcpy_utf8_char (UT_UCS4Char *dest, const char *src)
ABI_EXPORT char * UT_UCS4_strcpy_to_char (char *dest, const UT_UCS4Char *src)
ABI_EXPORT char * UT_UCS4_strncpy_to_char (char *dest, const UT_UCS4Char *src, int)
ABI_EXPORT bool UT_UCS4_cloneString (UT_UCS4Char **dest, const UT_UCS4Char *src)
ABI_EXPORT bool UT_UCS4_cloneString_char (UT_UCS4Char **dest, const char *src)
ABI_EXPORT UT_UCS4CharUT_UCS4_strncpy (UT_UCS4Char *dest, const UT_UCS4Char *src, UT_uint32 n)
ABI_EXPORT UT_UCS4CharUT_UCS4_strnrev (UT_UCS4Char *dest, UT_uint32 n)
ABI_EXPORT UT_UCS4Char UT_UCS4_tolower (UT_UCS4Char c)
ABI_EXPORT UT_UCS4Char UT_UCS4_toupper (UT_UCS4Char c)
 Convert a given character to uppercase.
ABI_EXPORT void UT_parse_attributes (const char *attributes, std::map< std::string, std::string > &map)
ABI_EXPORT void UT_parse_properties (const char *props, std::map< std::string, std::string > &map)
ABI_EXPORT const char * std_size_string (float f)
ABI_EXPORT UT_BidiCharType UT_bidiGetCharType (UT_UCS4Char c)
ABI_EXPORT bool UT_bidiMapLog2Vis (const UT_UCS4Char *pStrIn, UT_uint32 len, UT_BidiCharType baseDir, UT_uint32 *pL2V, UT_uint32 *pV2L, UT_Byte *pEmbed)
ABI_EXPORT bool UT_bidiReorderString (const UT_UCS4Char *pStrIn, UT_uint32 len, UT_BidiCharType baseDir, UT_UCS4Char *pStrOut)
ABI_EXPORT bool UT_bidiGetMirrorChar (UT_UCS4Char c, UT_UCS4Char &mc)

Define Documentation

#define UT_BIDI_AL   FRIBIDI_TYPE_AL
#define UT_BIDI_AN   FRIBIDI_TYPE_AN
#define UT_BIDI_BS   FRIBIDI_TYPE_BS
#define UT_BIDI_CS   FRIBIDI_TYPE_CS
#define UT_BIDI_EN   FRIBIDI_TYPE_EN
#define UT_BIDI_ES   FRIBIDI_TYPE_ES
#define UT_BIDI_ET   FRIBIDI_TYPE_ET
#define UT_BIDI_IGNORE   FRIBIDI_TYPE_IGNORE
#define UT_BIDI_IS_LETTER   FRIBIDI_IS_LETTER

Referenced by UT_UCS4_isalpha().

#define UT_BIDI_IS_NEUTRAL   FRIBIDI_IS_NEUTRAL
#define UT_BIDI_IS_NSM (   x  )     ((x) & FRIBIDI_MASK_NSM)
#define UT_BIDI_IS_NUMBER   FRIBIDI_IS_NUMBER
#define UT_BIDI_IS_RTL   FRIBIDI_IS_RTL
#define UT_BIDI_IS_STRONG   FRIBIDI_IS_STRONG
#define UT_BIDI_IS_WEAK   FRIBIDI_IS_WEAK
#define UT_BIDI_LRE   FRIBIDI_TYPE_LRE
#define UT_BIDI_LRO   FRIBIDI_TYPE_LRO
#define UT_BIDI_LTR   FRIBIDI_TYPE_LTR
#define UT_BIDI_NSM   FRIBIDI_TYPE_NSM
#define UT_BIDI_ON   FRIBIDI_TYPE_ON
#define UT_BIDI_PDF   FRIBIDI_TYPE_PDF
#define UT_BIDI_RLE   FRIBIDI_TYPE_RLE
#define UT_BIDI_RLO   FRIBIDI_TYPE_RLO
#define UT_BIDI_RTL   FRIBIDI_TYPE_RTL

Referenced by AP_Preview_Paragraph::_appendLine(), IE_Imp_RTF::_appendSpan(), GR_XPRenderInfo::_calculateCharAdvances(), fp_Line::_calculateWidthOfRun(), fp_EndOfParagraphRun::_clearScreen(), fp_DirectionMarkerRun::_clearScreen(), fp_Line::_createMapOfRuns(), fp_Line::_doClearScreenFromRunToEnd(), fp_TextRun::_draw(), fp_EndOfParagraphRun::_draw(), fp_ForcedLineBreakRun::_draw(), IE_Imp_MsWord_97::_flush(), fp_TextRun::_getPartRect(), IE_Imp_RTF::_insertSpan(), GR_CairoGraphics::_measureExtent(), s_RTF_ListenerWriteDoc::_outputData(), fp_TextRun::_refreshDrawBuffer(), GR_XPRenderInfo::_stripLigaturePlaceHolders(), AP_Preview_Paragraph::AP_Preview_Paragraph(), IE_Imp_RTF::ApplyParagraphAttributes(), IE_Imp_RTF::ApplySectionAttributes(), IE_Imp_RTF::buildCharacterProps(), fp_Line::calculateWidthOfRun(), FV_View::cmdCharInsert(), GR_XPRenderInfo::cut(), Defun1(), AP_Lists_preview::draw(), fl_BlockLayout::findNextTabStop(), fp_TextRun::findPointCoords(), fl_BlockLayout::findPrevTabStop(), fl_BlockLayout::getListPropertyVector(), fp_Run::getOffsetFirstVis(), fp_Run::getOffsetLog(), fl_BlockLayout::getPreviousListOfSameMargin(), fp_Run::getVisPosition(), fp_Line::getWorkingDirectionAndTabstops(), GR_CairoGraphics::justify(), fp_Line::layout(), fp_TextRun::mapXYToPosition(), GR_CairoGraphics::measureString(), Text_Listener::populate(), GR_CairoGraphics::renderChars(), FV_View::setBlockFormat(), fp_TextRun::setDirOverride(), XAP_DiskStringSet::setValue(), GR_Win32USPGraphics::shape(), GR_Graphics::shape(), GR_CairoGraphics::shape(), fl_BlockLayout::StartList(), and fl_BlockLayout::StopListInBlock().

#define UT_BIDI_SS   FRIBIDI_TYPE_SS
#define UT_BIDI_UNSET   FRIBIDI_TYPE_UNSET
#define UT_BIDI_WS   FRIBIDI_TYPE_WS
#define UT_strptime   strptime

Referenced by ODc_reorderDate(), and parseTimeString().

#define UT_UCS4_isalnum (   x  )     (UT_UCS4_isalpha(x) || UT_UCS4_isdigit(x))
#define UT_UCS4_ispunct (   x  )     ((!UT_UCS4_isspace(x) && !UT_UCS4_isalnum(x) && (x)>' '))

Referenced by whatKindOfChar().


Typedef Documentation

typedef FriBidiCharType UT_BidiCharType

Function Documentation

ABI_EXPORT const char* std_size_string ( float  f  ) 
ABI_EXPORT UT_BidiCharType UT_bidiGetCharType ( UT_UCS4Char  c  ) 
ABI_EXPORT bool UT_bidiGetMirrorChar ( UT_UCS4Char  c,
UT_UCS4Char mc 
)

Referenced by s_getMirrorChar().

ABI_EXPORT bool UT_bidiMapLog2Vis ( const UT_UCS4Char pStrIn,
UT_uint32  len,
UT_BidiCharType  baseDir,
UT_uint32 pL2V,
UT_uint32 pV2L,
UT_Byte pEmbed 
)
ABI_EXPORT bool UT_bidiReorderString ( const UT_UCS4Char pStrIn,
UT_uint32  len,
UT_BidiCharType  baseDir,
UT_UCS4Char pStrOut 
)
ABI_EXPORT void UT_decodeUTF8string ( const gchar *  p,
UT_uint32  len,
UT_GrowBuf pResult 
)
ABI_EXPORT bool UT_ensureValidXML ( std::string &  str  ) 

Ensure a key or property is valid XML.

Return true if it was and false if it needed fixing.

Ensure a key or property is valid XML.

This function removes any illegal characters and invalid utf-8 sequences.

Parameters:
str the string to modify in place
Return values:
%true if the string was valid before. false if it needed changes.

References gchar, s, UT_ASSERT_HARMLESS, UT_NOT_IMPLEMENTED, and xxx_UT_DEBUGMSG.

Referenced by PP_AttrProp::setAttribute(), PP_AttrProp::setProperty(), and TFTEST_MAIN().

ABI_EXPORT bool UT_isSmartQuotableCharacter ( UT_UCSChar  c  ) 
ABI_EXPORT bool UT_isSmartQuotedCharacter ( UT_UCSChar  c  ) 
ABI_EXPORT bool UT_isValidXML ( const char *  pString  ) 
Parameters:
s The string of characters which is to be checked for XML-validity.
Return values:
TRUE if the characters are all valid for XML, FALSE if any one of them is not.

NB: this function also checks that the string is valid utf-8

References s.

Referenced by TFTEST_MAIN().

ABI_EXPORT void UT_parse_attributes ( const char *  attributes,
std::map< std::string, std::string > &  map 
)
ABI_EXPORT void UT_parse_properties ( const char *  props,
std::map< std::string, std::string > &  map 
)
ABI_EXPORT UT_uint32 UT_UCS2_strlen ( const UT_UCS2Char string  ) 
ABI_EXPORT bool UT_UCS4_cloneString ( UT_UCS4Char **  dest,
const UT_UCS4Char src 
)
ABI_EXPORT bool UT_UCS4_cloneString_char ( UT_UCS4Char **  dest,
const char *  src 
)
ABI_EXPORT bool UT_UCS4_isalpha ( UT_UCS4Char  c  ) 
ABI_EXPORT bool UT_UCS4_isdigit ( UT_UCS4Char  c  ) 
ABI_EXPORT bool UT_UCS4_islower ( UT_UCS4Char  c  ) 
ABI_EXPORT bool UT_UCS4_isSentenceSeparator ( UT_UCS4Char  c  ) 
ABI_EXPORT bool UT_UCS4_isspace ( UT_UCS4Char  c  ) 
ABI_EXPORT bool UT_UCS4_isupper ( UT_UCS4Char  c  ) 
ABI_EXPORT UT_sint32 UT_UCS4_strcmp ( const UT_UCS4Char left,
const UT_UCS4Char right 
)
ABI_EXPORT UT_UCS4Char* UT_UCS4_strcpy ( UT_UCS4Char dest,
const UT_UCS4Char src 
)
ABI_EXPORT UT_UCS4Char* UT_UCS4_strcpy_char ( UT_UCS4Char dest,
const char *  src 
)
ABI_EXPORT char* UT_UCS4_strcpy_to_char ( char *  dest,
const UT_UCS4Char src 
)
ABI_EXPORT UT_UCS4Char* UT_UCS4_strcpy_utf8_char ( UT_UCS4Char dest,
const char *  src 
)
ABI_EXPORT UT_UCS4Char* UT_UCS4_stristr ( const UT_UCS4Char phaystack,
const UT_UCS4Char pneedle 
)

References UT_UCS4_tolower().

ABI_EXPORT UT_uint32 UT_UCS4_strlen ( const UT_UCS4Char string  ) 

Referenced by AP_Win32Dialog_Spell::_change(), AP_Win32Dialog_Spell::_changeAll(), EV_Win32Toolbar::_ComboWndProc(), FV_View::_computeFindPrefix(), fp_FieldRun::_defaultDraw(), fp_EndOfParagraphRun::_draw(), fp_ForcedLineBreakRun::_draw(), fp_Run::_drawTextLine(), FV_View::_findNext(), FV_View::_findPrev(), FV_View::_findReplace(), FV_View::_findReplaceReverse(), s_AbiWord_1_Listener::_handleRevisions(), fp_EndOfParagraphRun::_lookupProperties(), fp_ForcedLineBreakRun::_lookupProperties(), AP_Win32Dialog_Replace::_onCommand(), AP_Dialog_Styles::_populateAbiPreview(), AP_CocoaDialog_Replace::_populateWindowData, fp_FieldRun::_recalcWidth(), fp_FieldRun::_setValue(), AP_Win32Dialog_Spell::_showMisspelledWord(), _ucs4ToLatin1(), _ucsToAscii(), _ucsToUTF8(), s_RTF_ListenerWriteDoc::_writeFieldTrailer(), AP_Dialog_Spell::addChangeAll(), AP_Dialog_MarkRevisions::addRevision(), AiksaurusABI_ucsToAscii(), fp_FieldListLabelRun::calculateValue(), AP_Dialog_Spell::changeWordWith(), XAP_Dictionary::countCommonChars(), XAP_Preview_Zoom::draw(), XAP_Preview_FontPreview::draw(), AP_Preview_PageNumbers::draw(), AP_Lists_preview::draw(), XAP_Dialog_FontChooser::event_previewExposed(), UT_Win32LocaleString::fromUCS4(), AP_Dialog_MarkRevisions::getComment1(), AP_Dialog_Lists::getListLabel(), AP_Dialog_ListRevisions::getNthItemText(), FV_View::gotoTarget(), AP_UnixDialog_Spell::onChangeAllClicked(), AP_UnixDialog_Spell::onChangeClicked(), UT_UCS4String::operator+=(), UT_UCS4String::operator=(), AP_Dialog_Lists::PopulateDialogData(), s_doInsertDateTime(), XAP_Dictionary::save(), XAP_Dialog_FontChooser::setDrawString(), AP_Preview_Paragraph_Block::setText(), BarbarismChecker::suggestExactWord(), XAP_Dictionary::suggestWord(), fd_Field::update(), UT_UCS4_cloneString(), and IE_Exp_OpenXML::writeText().

ABI_EXPORT UT_uint32 UT_UCS4_strlen_as_char ( const UT_UCS4Char string  ) 
ABI_EXPORT UT_UCS4Char* UT_UCS4_strncpy ( UT_UCS4Char dest,
const UT_UCS4Char src,
UT_uint32  n 
)
ABI_EXPORT UT_UCS4Char* UT_UCS4_strncpy_char ( UT_UCS4Char dest,
const char *  src,
int   
)
ABI_EXPORT char* UT_UCS4_strncpy_to_char ( char *  dest,
const UT_UCS4Char src,
int   
)
ABI_EXPORT UT_UCS4Char* UT_UCS4_strnrev ( UT_UCS4Char dest,
UT_uint32  n 
)
ABI_EXPORT UT_UCS4Char* UT_UCS4_strstr ( const UT_UCS4Char phaystack,
const UT_UCS4Char pneedle 
)
ABI_EXPORT UT_UCS4Char UT_UCS4_tolower ( UT_UCS4Char  c  ) 
ABI_EXPORT UT_UCS4Char UT_UCS4_toupper ( UT_UCS4Char  c  ) 
ABI_EXPORT bool UT_validXML ( char *  pString  ) 

XML cannot contain any control characters except ,
, , see bug 8565 (http://www.w3.org/TR/REC-xml/#charsets)

This function removes any illegal characters and invalid utf-8 sequences.

The return value of true indicates that the string was modified

References UT_String::c_str(), gchar, UT_String::length(), UT_String::reserve(), s, UT_ASSERT, UT_ASSERT_HARMLESS, and UT_NOT_IMPLEMENTED.

Referenced by TFTEST_MAIN().

ABI_EXPORT bool UT_XML_cloneConvAmpersands ( gchar *&  rszDest,
const gchar *  szSource 
)

References gchar, and UT_calloc().

Referenced by localizeMenuItem().

G_BEGIN_DECLS ABI_EXPORT bool UT_XML_cloneNoAmpersands ( gchar *&  rszDest,
const gchar *  szSource 
)

References gchar, and UT_calloc().

ABI_EXPORT const gchar* UT_XML_transNoAmpersands ( const gchar *  szSource  ) 

References gchar, and UT_calloc().