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.


#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_IS_NSM(x)   ((x) & FRIBIDI_MASK_NSM)


typedef FriBidiCharType UT_BidiCharType


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


Referenced by UT_UCS4_isalpha().

#define UT_BIDI_IS_NSM (   x  )     ((x) & FRIBIDI_MASK_NSM)

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_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.

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


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  ) 
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,
ABI_EXPORT char* UT_UCS4_strncpy_to_char ( char *  dest,
const UT_UCS4Char src,
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 (

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