#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <locale>
#include "ut_types.h"
Go to the source code of this file.
Functions | |
ABI_EXPORT std::string | UT_escapeXML (const std::string &) |
replacement for UT_UTF8String::escapeXML escapes '<', '>', '"' and '&' in the current string | |
ABI_EXPORT std::string | UT_decodeXML (const std::string &) |
Unescape (decode) XML. | |
ABI_EXPORT std::string & | UT_std_string_vprintf (std::string &inStr, const char *format, va_list args1) ABI_PRINTF_FORMAT(2 |
ABI_EXPORT std::string &ABI_EXPORT std::string | UT_std_string_sprintf (const char *inFormat,...) ABI_PRINTF_FORMAT(1 |
ABI_EXPORT std::string &ABI_EXPORT std::string ABI_EXPORT std::string | UT_std_string_unicode (const UT_UCS4Char *unicode, UT_uint32 len) |
Create a string form a Unicode stream. | |
ABI_EXPORT std::string | UT_std_stringFromEncoding (const char *bytes, const char *encoding) |
Returns a std::string (UTF-8) converted from an encoding. | |
ABI_EXPORT bool | starts_with (const std::string &fullstring, const std::string &prefix) |
true if fullstring starts with exactly prefix. | |
ABI_EXPORT bool | ends_with (const std::string &fullstring, const std::string &ending) |
ABI_EXPORT std::string | replace_all (const std::string &s, char oldc, char newc) |
ABI_EXPORT std::string | replace_all (const std::string &s, const std::string &olds, const std::string &news) |
ABI_EXPORT std::string & | UT_tolower (std::string &s) |
convert to lower case in-place. | |
ABI_EXPORT std::string | UT_XML_cloneNoAmpersands (const std::string &szSource) |
ABI_EXPORT std::vector < std::string > | UT_simpleSplit (const std::string &str, char separator= ' ') |
ABI_EXPORT std::string | UT_ellipsisPath (const std::string &path, size_t maxlen, size_t cut) |
Shorten a path with ellispis of over maxlen. | |
ABI_EXPORT std::string | UT_std_string_getPropVal (const std::string &sPropertyString, const std::string &sProp) |
ABI_EXPORT void | UT_std_string_removeProperty (std::string &sPropertyString, const std::string &sProp) |
ABI_EXPORT void | UT_std_string_setProperty (std::string &sPropertyString, const std::string &sProp, const std::string &sVal) |
ABI_EXPORT void | UT_std_string_addPropertyString (std::string &sPropertyString, const std::string &sNewProp) |
ABI_EXPORT const std::string | StreamToString (std::istream &iss) |
ABI_EXPORT std::string | toTimeString (time_t TT) |
ABI_EXPORT time_t | toTime (struct tm *tm) |
ABI_EXPORT time_t | parseTimeString (const std::string &stddatestr) |
ABI_EXPORT bool ends_with | ( | const std::string & | fullstring, | |
const std::string & | ending | |||
) |
Referenced by AP_RDFSemanticItemGTKInjected< AP_RDFContact >::getExportToFileName(), and TFTEST_MAIN().
ABI_EXPORT time_t parseTimeString | ( | const std::string & | stddatestr | ) |
References toTime(), and UT_strptime.
Referenced by PD_RDFEvent::PD_RDFEvent(), and AP_RDFEventGTK::updateFromEditorData().
ABI_EXPORT std::string replace_all | ( | const std::string & | s, | |
char | oldc, | |||
char | newc | |||
) |
ABI_EXPORT std::string replace_all | ( | const std::string & | s, | |
const std::string & | olds, | |||
const std::string & | news | |||
) |
ABI_EXPORT bool starts_with | ( | const std::string & | fullstring, | |
const std::string & | prefix | |||
) |
true if fullstring starts with exactly prefix.
Referenced by PD_XMLIDCreator::createUniqueXMLID(), AP_RDFSemanticItemGTKInjected< AP_RDFContact >::getExportToFileName(), AP_RDFSemanticItemGTKInjected< AP_RDFContact >::getImportFromFileName(), AbiCommand::parseTokens(), TFTEST_MAIN(), AbiCommand::tokenizeString(), and PD_RDFModel::uriToPrefixed().
ABI_EXPORT const std::string StreamToString | ( | std::istream & | iss | ) |
Referenced by PD_RDFEvent::importFromData(), and PD_RDFContact::importFromData().
ABI_EXPORT time_t toTime | ( | struct tm * | tm | ) |
Referenced by parseTimeString().
ABI_EXPORT std::string toTimeString | ( | time_t | TT | ) |
References s.
Referenced by setEntry(), PD_RDFEvent::setupStylesheetReplacementMapping(), and PD_RDFSemanticItem::updateTriple().
ABI_EXPORT std::string UT_decodeXML | ( | const std::string & | ) |
Unescape (decode) XML.
Reverse of UT_escapeXML
Referenced by PP_cloneAndDecodeAttributes(), and TFTEST_MAIN().
ABI_EXPORT std::string UT_ellipsisPath | ( | const std::string & | path, | |
size_t | maxlen, | |||
size_t | cut | |||
) |
Shorten a path with ellispis of over maxlen.
Then keep the last cut chars
References s.
Referenced by XAP_Dialog_History::getHeaderValue(), XAP_Dialog_DocComparison::getPath1(), XAP_Dialog_DocComparison::getPath2(), and TFTEST_MAIN().
ABI_EXPORT std::string UT_escapeXML | ( | const std::string & | ) |
replacement for UT_UTF8String::escapeXML escapes '<', '>', '"' and '&' in the current string
Referenced by s_WML_Listener::_emitTOC(), s_DocBook_Listener::_handleMetaData(), s_DocBook_Listener::_handleTOC(), IE_Exp_S5::_writeHeader(), IE_Exp_EPUB::escapeForId(), fl_AutoNum::getAttributes(), IE_Exp_HTML_StyleTree::print(), OXML_Element_Image::serialize(), IE_Exp_OpenXML::startStyle(), TFTEST_MAIN(), and OO_MetaDataWriter::writeMetaData().
ABI_EXPORT std::vector<std::string> UT_simpleSplit | ( | const std::string & | str, | |
char | separator | |||
) |
simplesplit splits the referring string along the character 'separator', removing the separator character, and placing the resulting strings in a vector.
Referenced by AbiTest_invoke(), EV_Menu::addMenuItem(), and TFTEST_MAIN().
ABI_EXPORT void UT_std_string_addPropertyString | ( | std::string & | sPropertyString, | |
const std::string & | sNewProp | |||
) |
Assuming a string of standard abiword properties eg. "fred:nerk; table-width:1.0in; table-height:10.in" Add aother propety string, updating previously defined properties with values in the new string.
References UT_std_string_setProperty().
Referenced by ie_imp_cell::addPropString(), FV_View::cmdInsertEmbed(), FV_View::cmdUpdateEmbed(), TFTEST_MAIN(), and AP_Dialog_Styles::updateCurrentStyle().
ABI_EXPORT std::string UT_std_string_getPropVal | ( | const std::string & | sPropertyString, | |
const std::string & | sProp | |||
) |
Some functions to add/subtract and extract std::string properties from a std::string of properties.
Assuming a string of standard abiword properties eg. "fred:nerk; table-width:1.0in; table-height:10.in" Return the value of the property sProp or NULL if it is not present.
References UT_ASSERT, and UT_SHOULD_NOT_HAPPEN.
Referenced by s_RTF_ListenerWriteDoc::_export_AbiWord_Cell_props(), s_RTF_ListenerWriteDoc::_getPropString(), IE_Imp_StarOffice::_loadFile(), ODi_TextContent_ListenerState::_openAbiSection(), ie_imp_table::getPropVal(), ie_imp_cell::getPropVal(), IE_Imp_RTF::HandleAbiCell(), IE_Imp_RTF::HandleAbiEmbed(), IE_Imp_RTF::HandleAbiMathml(), IE_Imp_RTF::HandleAbiTable(), and TFTEST_MAIN().
ABI_EXPORT void UT_std_string_removeProperty | ( | std::string & | sPropertyString, | |
const std::string & | sProp | |||
) |
Assuming a string of standard abiword properties eg. "fred:nerk; table-width:1.0in; table-height:10.in" Remove the property sProp and it's value from the string of properties.
Referenced by IE_Imp_StarOffice::_loadFile(), IE_Imp_RTF::HandleAbiEmbed(), IE_Imp_RTF::HandleAbiMathml(), IE_Imp_RTF::HandleAbiTable(), TFTEST_MAIN(), and UT_std_string_setProperty().
ABI_EXPORT void UT_std_string_setProperty | ( | std::string & | sPropertyString, | |
const std::string & | sProp, | |||
const std::string & | sVal | |||
) |
Assuming a string of standard abiword properties eg. "fred:nerk; table-width:1.0in; table-height:10.in" Add the property sProp with value sVal to the string of properties. If the property is already present, replace the old value with the new value.
References UT_std_string_removeProperty().
Referenced by s_RTF_ListenerWriteDoc::_export_AbiWord_Cell_props(), s_RTF_ListenerWriteDoc::_fillCellProps(), s_RTF_ListenerWriteDoc::_fillTableProps(), IE_Imp_StarOffice::_loadFile(), s_RTF_ListenerWriteDoc::_openTag(), IE_Imp_RTF::_setStringProperty(), IE_Imp_RTF::addFrame(), IE_Exp_DocRangeListener::assembleAtts(), IE_Imp_RTF::closePastedTableIfNeeded(), FV_View::cmdInsertEmbed(), FV_View::cmdInsertLatexMath(), FV_View::cmdInsertPositionedGraphic(), FV_View::cmdSplitCells(), FV_View::cmdUpdateEmbed(), Defun1(), IE_Imp_RTF::FlushCellProps(), FV_View::getCellFormat(), IE_Imp_RTF::HandleAbiCell(), FV_VisualInlineImage::mouseRelease(), s_doFormatImageDlg(), fl_DocSectionLayout::setHdrFtrHeightChange(), CellHelper::setProp(), ie_imp_table::setProp(), ie_imp_cell::setProp(), ODi_TextContent_ListenerState::startElement(), TFTEST_MAIN(), AP_Dialog_Styles::updateCurrentStyle(), and UT_std_string_addPropertyString().
ABI_EXPORT std::string& ABI_EXPORT std::string UT_std_string_sprintf | ( | const char * | inFormat, | |
... | ||||
) |
ABI_EXPORT std::string& ABI_EXPORT std::string ABI_EXPORT std::string UT_std_string_unicode | ( | const UT_UCS4Char * | unicode, | |
UT_uint32 | len | |||
) |
Create a string form a Unicode stream.
Will be UTF8 encoded.
unicode | the Unicode UCS4 string. Can't be NULL | |
len | the length of the Unicode UCS4 string. Must match the length. |
References abicollab::service::error(), gchar, s, and UT_DEBUGMSG.
Referenced by AbiTest_invoke(), and TFTEST_MAIN().
ABI_EXPORT std::string& UT_std_string_vprintf | ( | std::string & | inStr, | |
const char * | format, | |||
va_list | args1 | |||
) |
ABI_EXPORT std::string UT_std_stringFromEncoding | ( | const char * | bytes, | |
const char * | encoding | |||
) |
Returns a std::string (UTF-8) converted from an encoding.
bytes | the input bytes (not NULL) | |
encoding | the encoding (not NULL) |
References FREEP, UT_ASSERT, and UT_convert().
Referenced by ap_sbf_InputMode::notify(), and AP_StatusBar::setStatusMessage().
ABI_EXPORT std::string& UT_tolower | ( | std::string & | s | ) |
convert to lower case in-place.
Use std::tolower.
s | the string to lower case. Mutable. |
Referenced by s_removeWhiteSpace(), TFTEST_MAIN(), and UT_HTML::UT_HTML().
ABI_EXPORT std::string UT_XML_cloneNoAmpersands | ( | const std::string & | szSource | ) |
References FREEP, gchar, and UT_XML_cloneNoAmpersands().
Referenced by AP_UnixDialog_Tab::_constructWindow(), AP_UnixDialog_Paragraph::_constructWindow(), AP_UnixDialog_Paragraph::_constructWindowContents(), XAP_Dialog_Insert_Symbol::ConstructWindowName(), AP_Dialog_WordCount::ConstructWindowName(), AP_Dialog_SplitCells::ConstructWindowName(), AP_Dialog_Replace::ConstructWindowName(), AP_Dialog_Modeless::ConstructWindowName(), AP_Dialog_MergeCells::ConstructWindowName(), AP_Dialog_Latex::ConstructWindowName(), AP_Dialog_Goto::ConstructWindowName(), AP_Dialog_FormatTable::ConstructWindowName(), AP_Dialog_FormatFrame::ConstructWindowName(), AP_Dialog_Border_Shading::ConstructWindowName(), localizeButton(), localizeLabel(), localizeLabelMarkup(), Markup(), and UT_XML_cloneNoAmpersands().