#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"
#define UT_STRING_CPP |
static const char* s_pass_name | ( | const char *& | csstr, | |
char | end | |||
) | [static] |
References UT_UTF8Stringbuf::charCode(), and UT_UCS4_isspace().
Referenced by UT_parse_attributes(), and UT_parse_properties().
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] |
References UT_UTF8Stringbuf::charCode(), and UT_UCS4_isspace().
Referenced by UT_parse_properties().
static void s_pass_whitespace | ( | const char *& | csstr | ) | [static] |
References UT_UTF8Stringbuf::charCode(), and UT_UCS4_isspace().
Referenced by UT_parse_attributes(), and UT_parse_properties().
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 | |||
) |
References UT_ASSERT_HARMLESS, and UT_return_val_if_fail.
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 | |||
) |
References UT_GrowBuf::append(), gchar, and UT_ASSERT.
Referenced by XAP_Prefs::savePrefsFile(), XAP_DiskStringSet::setValue(), and AP_DiskStringSet::setValue().
bool UT_ensureValidXML | ( | std::string & | str | ) |
XML cannot contain any control characters except ,
, , see bug 8565 (http://www.w3.org/TR/REC-xml/#charsets).
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 |
%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().
bool UT_isSmartQuotableCharacter | ( | UT_UCSChar | c | ) |
bool UT_isSmartQuotedCharacter | ( | UT_UCSChar | c | ) |
References UCS_LDBLQUOTE, UCS_LQUOTE, UCS_RDBLQUOTE, and UCS_RQUOTE.
Referenced by fp_TextRun::isOneItem().
bool UT_isValidXML | ( | const char * | s | ) |
s | The string of characters which is to be checked for XML-validity. |
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().
void UT_parse_attributes | ( | const char * | attributes, | |
std::map< std::string, std::string > & | map | |||
) |
References s_pass_name(), s_pass_string(), and s_pass_whitespace().
void UT_parse_properties | ( | const char * | properties, | |
std::map< std::string, std::string > & | map | |||
) |
References s_pass_name(), s_pass_value(), and s_pass_whitespace().
Referenced by AP_Convert::print(), IE_Imp::setProps(), and IE_Exp::setProps().
UT_uint32 UT_UCS2_strlen | ( | const UT_UCS2Char * | string | ) |
Referenced by IE_Imp_MsWord_97::_getBookmarkName().
bool UT_UCS4_cloneString | ( | UT_UCS4Char ** | dest, | |
const UT_UCS4Char * | src | |||
) |
References UT_calloc(), and UT_UCS4_strlen().
Referenced by AP_UnixDialog_Spell::_convertFromMB(), AP_Dialog_Paragraph::_createPreviewFromGC(), AP_Dialog_Replace::_manageList(), FV_View::findGetFindString(), FV_View::findGetReplaceString(), FV_View::findSetFindString(), FV_View::findSetReplaceString(), XAP_Dialog_FontChooser::setDrawString(), XAP_Preview_Zoom::setString(), AP_Preview_Paragraph_Block::setText(), XAP_Dictionary::suggestWord(), BarbarismChecker::suggestWord(), and utf8_to_utf32().
bool UT_UCS4_cloneString_char | ( | UT_UCS4Char ** | dest, | |
const char * | src | |||
) |
References UT_calloc(), and UT_UCS4_strcpy_char().
Referenced by fp_Line::_calculateWidthOfRun(), fp_ForcedPageBreakRun::_draw(), fp_ForcedColumnBreakRun::_draw(), AP_Preview_PageNumbers::AP_Preview_PageNumbers(), XAP_Dialog_FontChooser::event_previewExposed(), ODe_Style_Style::ParagraphProps::fetchAttributesFromAbiProps(), FV_View::findGetFindString(), FV_View::findGetReplaceString(), AP_Dialog_Replace::getFindString(), AP_Dialog_Replace::getReplaceString(), s_doInsertDateTime(), s_getUCSText(), XAP_Dialog_FontChooser::setDrawString(), XAP_Preview_Zoom::setString(), XAP_FontPreview::setText(), XAP_CocoaDialog_FontChooser::updatePreview, XAP_Dialog_FontChooser::XAP_Dialog_FontChooser(), and XAP_FontPreview::XAP_FontPreview().
bool UT_UCS4_isalpha | ( | UT_UCS4Char | c | ) |
References UT_BIDI_IS_LETTER, and UT_bidiGetCharType().
Referenced by FV_View::toggleCase(), UT_isWordDelimiter(), and whatKindOfChar().
bool UT_UCS4_isdigit | ( | UT_UCS4Char | c | ) |
References digits_table, and s_cmp_digits().
Referenced by AP_Win32Dialog_Goto::_onCommand(), IE_Exp_RTF::_write_rtf_header(), and RTF_msword97_level::ParseLevelText().
bool UT_UCS4_islower | ( | UT_UCS4Char | c | ) |
References case_table, s_cmp_case(), and case_entry::type.
Referenced by _toggleToggle(), BarbarismChecker::suggestWord(), and FV_View::toggleCase().
bool UT_UCS4_isSentenceSeparator | ( | UT_UCS4Char | c | ) |
Referenced by fl_BlockLayout::isSentenceSeparator(), and FV_View::toggleCase().
bool UT_UCS4_isspace | ( | UT_UCS4Char | c | ) |
References whitespace_table.
Referenced by FV_View::_isSpaceBefore(), _toggleFirstCapital(), AbiGoogle_invoke(), fp_TextRun::canMergeWithNext(), IE_Imp_Applix::s_getTagName(), s_pass_name(), s_pass_value(), s_pass_whitespace(), FV_View::toggleCase(), UT_UCS4String::UT_UCS4String(), UT_UTF8_Base64Decode(), and whatKindOfChar().
bool UT_UCS4_isupper | ( | UT_UCS4Char | c | ) |
References case_table, s_cmp_case(), and case_entry::type.
Referenced by BarbarismChecker::suggestWord().
UT_sint32 UT_UCS4_strcmp | ( | const UT_UCS4Char * | left, | |
const UT_UCS4Char * | right | |||
) |
References UT_ASSERT.
Referenced by AP_Dialog_Replace::_manageList(), fp_FieldRun::_setValue(), operator<(), operator==(), IE_Imp_RTF::ReadRevisionTable(), and AP_Dialog_Replace::setFindString().
UT_UCS4Char* UT_UCS4_strcpy | ( | UT_UCS4Char * | dest, | |
const UT_UCS4Char * | src | |||
) |
References UT_ASSERT.
Referenced by fp_FieldRun::_setValue(), AP_Dialog_Spell::addChangeAll(), and UT_UCS4_strcpy_utf8_char().
UT_UCS4Char* UT_UCS4_strcpy_char | ( | UT_UCS4Char * | dest, | |
const char * | src | |||
) |
References XAP_EncodingManager::get_instance(), UT_UCS4_mbtowc::mbtowc(), and UT_ASSERT.
Referenced by AP_TopRuler::_drawTickMark(), AP_Dialog_Styles::_populateAbiPreview(), XAP_Win32Dialog_Insert_Symbol::_setFontFromCombo(), XAP_Dictionary::addWord(), fp_FieldShortFileNameRun::calculateValue(), fp_FieldFileNameRun::calculateValue(), fp_FieldDateRun::calculateValue(), fp_FieldTimeRun::calculateValue(), fp_FieldEndnoteRefRun::calculateValue(), fp_FieldEndnoteAnchorRun::calculateValue(), fp_FieldFootnoteAnchorRun::calculateValue(), fp_FieldFootnoteRefRun::calculateValue(), fp_FieldTimeZoneRun::calculateValue(), fp_FieldDateTimeCustomRun::calculateValue(), fp_FieldAMPMRun::calculateValue(), fp_FieldMilTimeRun::calculateValue(), fp_FieldDOYRun::calculateValue(), fp_FieldWkdayRun::calculateValue(), fp_FieldDefaultDateNoTimeRun::calculateValue(), fp_FieldDefaultDateRun::calculateValue(), fp_FieldMthDayYearRun::calculateValue(), fp_FieldMonthDayYearRun::calculateValue(), fp_FieldDDMMYYRun::calculateValue(), fp_FieldMMDDYYRun::calculateValue(), AP_LeftRuler::drawLU(), AbiCommand::insertText(), UT_UCS4String::operator+=(), AbiCommand::parseTokens(), AbiCommand::replaceAll(), AbiCommand::replaceNext(), AP_Win32App::s_fromWinLocaleToUCS4(), fd_Field::update(), and UT_UCS4_cloneString_char().
char* UT_UCS4_strcpy_to_char | ( | char * | dest, | |
const UT_UCS4Char * | src | |||
) |
References XAP_EncodingManager::get_instance(), UT_ASSERT, and UT_Wctomb::wctomb_or_fallback().
Referenced by AP_CocoaDialog_Replace::_populateWindowData, XAP_Dictionary::addWord(), AP_Dialog_MarkRevisions::getComment1(), AP_Dialog_ListRevisions::getNthItemText(), and AP_Dialog_InsertHyperlink::setDoc().
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 | ) |
References XAP_EncodingManager::get_instance(), and UT_Wctomb::wctomb_or_fallback().
Referenced by AP_Dialog_InsertHyperlink::setDoc().
UT_UCS4Char* UT_UCS4_strncpy | ( | UT_UCS4Char * | dest, | |
const UT_UCS4Char * | src, | |||
UT_uint32 | n | |||
) |
References UT_ASSERT.
Referenced by AD_Document::addRevision(), GR_XPRenderInfo::append(), PD_Document::changeDocPropeties(), GR_XPRenderInfo::cut(), GR_XPRenderInfo::split(), and UT_bidiReorderString().
UT_UCS4Char* UT_UCS4_strncpy_char | ( | UT_UCS4Char * | dest, | |
const char * | src, | |||
int | n | |||
) |
References XAP_EncodingManager::get_instance(), UT_UCS4_mbtowc::mbtowc(), and UT_ASSERT.
char* UT_UCS4_strncpy_to_char | ( | char * | dest, | |
const UT_UCS4Char * | src, | |||
int | n | |||
) |
References XAP_EncodingManager::get_instance(), UT_ASSERT, and UT_Wctomb::wctomb_or_fallback().
Referenced by AP_Dialog_Spell::addChangeAll(), and AP_Dialog_Spell::inChangeAll().
UT_UCS4Char* UT_UCS4_strnrev | ( | UT_UCS4Char * | src, | |
UT_uint32 | n | |||
) |
Referenced by fp_TextRun::_refreshDrawBuffer().
UT_UCS4Char* UT_UCS4_strstr | ( | const UT_UCS4Char * | phaystack, | |
const UT_UCS4Char * | pneedle | |||
) |
Referenced by XAP_Dictionary::countCommonChars().
UT_UCS4Char UT_UCS4_tolower | ( | UT_UCS4Char | c | ) |
References case_table, XAP_EncodingManager::get_instance(), case_entry::other, s_cmp_case(), and case_entry::type.
Referenced by IE_Imp_MsWord_97::_appendChar(), FV_View::_computeFindPrefix(), FV_View::_findNext(), FV_View::_findPrev(), _toggleFirstCapital(), _toggleLower(), _toggleToggle(), ev_Win32Keyboard::onKeyDown(), BarbarismChecker::suggestWord(), and UT_UCS4_stristr().
UT_UCS4Char UT_UCS4_toupper | ( | UT_UCS4Char | c | ) |
Convert a given character to uppercase.
References case_table, XAP_EncodingManager::get_instance(), case_entry::other, s_cmp_case(), and case_entry::type.
Referenced by _toggleFirstCapital(), _toggleToggle(), _toggleUpper(), BarbarismChecker::suggestWord(), and FV_View::toggleCase().
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().
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().