Defines | Functions

ut_string.cpp File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <ctype.h>
#include "ut_types.h"
#include "ut_misc.h"
#include "ut_assert.h"
#include "ut_string.h"
#include "ut_debugmsg.h"
#include "ut_growbuf.h"
#include <fribidi.h>
#include "ut_mbtowc.h"
#include "ut_wctomb.h"
#include "ut_string_class.h"
#include "xap_EncodingManager.h"
#include "ut_case.h"




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

Define Documentation


Function Documentation

static const char* s_pass_name ( const char *&  csstr,
char  end 
) [static]
static const char* s_pass_string ( const char *&  csstr_ptr  )  [static]

Referenced by UT_parse_attributes().

static const char* s_pass_value ( const char *&  csstr  )  [static]
static void s_pass_whitespace ( const char *&  csstr  )  [static]
const char* std_size_string ( float  f  ) 
UT_BidiCharType UT_bidiGetCharType ( UT_UCS4Char  c  ) 
bool UT_bidiGetMirrorChar ( UT_UCS4Char  c,
UT_UCS4Char mc 
bool UT_bidiMapLog2Vis ( const UT_UCS4Char pStrIn,
UT_uint32  len,
UT_BidiCharType  baseDir,
UT_uint32 pL2V,
UT_uint32 pV2L,
UT_Byte pEmbed 
bool UT_bidiReorderString ( const UT_UCS4Char pStrIn,
UT_uint32  len,
UT_BidiCharType  baseDir,
UT_UCS4Char pStrOut 

pStrOut needs to contain space for len characters + terminating 0

References UT_ASSERT_HARMLESS, UT_return_val_if_fail, and UT_UCS4_strncpy().

void UT_decodeUTF8string ( const gchar *  pString,
UT_uint32  len,
UT_GrowBuf pResult 
bool UT_isSmartQuotableCharacter ( UT_UCSChar  c  ) 
bool UT_isSmartQuotedCharacter ( UT_UCSChar  c  ) 
bool UT_isValidXML ( const char *  s  ) 
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 PP_AttrProp::setAttribute(), and PP_AttrProp::setProperty().

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

References UT_UCS4_tolower().

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

UT_uint32 UT_UCS4_strlen_as_char ( const UT_UCS4Char string  ) 
UT_UCS4Char* UT_UCS4_strncpy ( UT_UCS4Char dest,
const UT_UCS4Char src,
UT_uint32  n 
UT_UCS4Char* UT_UCS4_strncpy_char ( UT_UCS4Char dest,
const char *  src,
int  n 
char* UT_UCS4_strncpy_to_char ( char *  dest,
const UT_UCS4Char src,
int  n 
UT_UCS4Char* UT_UCS4_strnrev ( UT_UCS4Char src,
UT_uint32  n 
UT_UCS4Char* UT_UCS4_strstr ( const UT_UCS4Char phaystack,
const UT_UCS4Char pneedle 
UT_UCS4Char UT_UCS4_tolower ( UT_UCS4Char  c  ) 
UT_UCS4Char UT_UCS4_toupper ( UT_UCS4Char  c  ) 
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 PP_AttrProp::setAttribute(), and PP_AttrProp::setProperty().

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

References gchar, and UT_calloc().

Referenced by localizeMenuItem().

bool UT_XML_cloneNoAmpersands ( gchar *&  rszDest,
const gchar *  szSource 

References gchar, and UT_calloc().

const gchar* UT_XML_transNoAmpersands ( const gchar *  szSource  ) 

References gchar, and UT_calloc().