#include <string.h>
#include "ut_assert.h"
#include "ut_std_string.h"
#include "ut_string.h"
#include "ut_debugmsg.h"
#include "ut_iconv.h"
#include <iostream>
#include <sstream>
#include <list>
Functions | |
std::string | UT_escapeXML (const std::string &s) |
replacement for UT_UTF8String::escapeXML escapes '<', '>', '"' and '&' in the current string | |
std::string | UT_decodeXML (const std::string &s) |
Unescape (decode) XML. | |
std::string & | UT_std_string_vprintf (std::string &inStr, const char *format, va_list args1) |
std::string | UT_std_string_sprintf (const char *inFormat,...) |
std::string | UT_std_string_unicode (const UT_UCS4Char *unicode, UT_uint32 len) |
Create a string form a Unicode stream. | |
std::string | UT_std_stringFromEncoding (const char *bytes, const char *encoding) |
Returns a std::string (UTF-8) converted from an encoding. | |
bool | ends_with (const std::string &s, const std::string &ending) |
bool | starts_with (const std::string &s, const std::string &starting) |
true if fullstring starts with exactly prefix. | |
std::string | replace_all (const std::string &s, char oldc, char newc) |
std::string | replace_all (const std::string &s, const std::string &olds, const std::string &news) |
std::string & | UT_tolower (std::string &s) |
convert to lower case in-place. | |
std::string | UT_XML_cloneNoAmpersands (const std::string &src) |
std::vector< std::string > | UT_simpleSplit (const std::string &str, char separator) |
std::string | UT_ellipsisPath (const std::string &path, size_t maxlen, size_t cut) |
Shorten a path with ellispis of over maxlen. | |
std::string | UT_std_string_getPropVal (const std::string &sPropertyString, const std::string &sProp) |
void | UT_std_string_addPropertyString (std::string &sPropertyString, const std::string &sNewProp) |
void | UT_std_string_setProperty (std::string &sPropertyString, const std::string &sProp, const std::string &sVal) |
void | UT_std_string_removeProperty (std::string &sPropertyString, const std::string &sProp) |
const std::string | StreamToString (std::istream &iss) |
std::string | toTimeString (time_t TT) |
time_t | toTime (struct tm *tm) |
time_t | parseTimeString (const std::string &stddatestr) |
bool ends_with | ( | const std::string & | s, | |
const std::string & | ending | |||
) |
Referenced by AP_RDFSemanticItemGTKInjected< AP_RDFContact >::getExportToFileName(), and TFTEST_MAIN().
time_t parseTimeString | ( | const std::string & | stddatestr | ) |
References toTime(), and UT_strptime.
Referenced by PD_RDFEvent::PD_RDFEvent(), and AP_RDFEventGTK::updateFromEditorData().
std::string replace_all | ( | const std::string & | s, | |
char | oldc, | |||
char | newc | |||
) |
std::string replace_all | ( | const std::string & | s, | |
const std::string & | olds, | |||
const std::string & | news | |||
) |
bool starts_with | ( | const std::string & | s, | |
const std::string & | starting | |||
) |
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().
const std::string StreamToString | ( | std::istream & | iss | ) |
Referenced by PD_RDFEvent::importFromData(), and PD_RDFContact::importFromData().
time_t toTime | ( | struct tm * | tm | ) |
Referenced by parseTimeString().
std::string toTimeString | ( | time_t | TT | ) |
References s.
Referenced by setEntry(), PD_RDFEvent::setupStylesheetReplacementMapping(), and PD_RDFSemanticItem::updateTriple().
std::string UT_decodeXML | ( | const std::string & | ) |
Unescape (decode) XML.
Reverse of UT_escapeXML
Referenced by PP_cloneAndDecodeAttributes(), and TFTEST_MAIN().
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().
std::string UT_escapeXML | ( | const std::string & | s | ) |
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().
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().
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().
std::string UT_std_string_getPropVal | ( | const 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" 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().
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().
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().
std::string UT_std_string_sprintf | ( | const char * | inFormat, | |
... | ||||
) |
References UT_std_string_vprintf().
Referenced by IE_Imp_RTF::_appendHdrFtr(), IE_Imp_MsWord_97::_beginPara(), PD_Document::_buildAuthorProps(), ODi_Style_PageLayout::_buildSectionPropsString(), FV_View::_changeCellAttach(), FV_View::_changeCellParams(), FV_View::_changeCellTo(), _convertBorderThickness(), IE_Imp_OPML::_createBullet(), fl_BlockLayout::_createListLabel(), ODi_TextContent_ListenerState::_defineAbiTOCHeadingStyles(), ODi_Frame_ListenerState::_drawObject(), s_RTF_ListenerWriteDoc::_export_AbiWord_Cell_props(), s_RTF_ListenerWriteDoc::_fillTableProps(), GR_CairoGraphics::_findFont(), IE_Imp_RTF::_formRevisionAttr(), AP_Dialog_FormatTable::_getToggleButtonStatus(), AP_Dialog_FormatFrame::_getToggleButtonStatus(), AP_Dialog_Border_Shading::_getToggleButtonStatus(), s_KWord_1_Listener::_handleDataItems(), IE_Imp_MsWord_97::_handleImage(), IE_Imp_MsWord_97::_handleNotes(), IE_Imp_MsWord_97::_handleNotesText(), ODi_TextContent_ListenerState::_insertAnnotation(), FV_View::_insertCellAt(), IE_Imp_MsWord_97::_insertEndnote(), IE_Imp_MsWord_97::_insertFootnote(), IE_Imp_MsWord_97::_insertHeaderSection(), IE_Imp_StarOffice::_loadFile(), OpenWriter_ContentStream_Listener::_openCell(), IE_Exp_RTF::_output_LevelText(), ODi_Style_Style::_parse_style_paragraphProperties(), ODi_Style_Style::_parse_style_sectionProperties(), ODi_Style_Style::_parse_style_textProperties(), ODi_Table_ListenerState::_parseCellStart(), AP_Dialog_Styles::_populateAbiPreview(), FV_View::_restoreCellParams(), AD_Document::_restoreVersion(), ODi_Numbered_ListLevelStyle::_setAbiListType(), fp_MathRun::_updatePropValuesIfNeeded(), fp_EmbedRun::_updatePropValuesIfNeeded(), IE_Imp_T602::_write_fh(), IE_Imp_T602::_writePP(), IE_Imp_T602::_writeSP(), s_RTF_ListenerWriteDoc::_writeSPNumProp(), abi_widget_set_text_color(), PD_Document::addAuthorAttributeIfBlank(), IE_Imp_RTF::addFrame(), OXML_List::addToPT(), OXML_Element_Math::addToPT(), OXML_Element_Cell::addToPT(), AP_Dialog_Border_Shading::AP_Dialog_Border_Shading(), ap_sbf_PageInfo::ap_sbf_PageInfo(), AP_Dialog_Lists::Apply(), IE_Imp_Psion::applyPageAttributes(), IE_Imp_RTF::ApplyParagraphAttributes(), IE_Imp_RTF::ApplySectionAttributes(), PD_Document::areDocumentStylesheetsEqual(), AP_Dialog_FormatFrame::askForGraphicPathName(), RTF_msword97_level::buildAbiListProperties(), ODi_Style_Style::buildAbiPropsAttrString(), IE_Imp_RTF::buildAllProps(), IE_Imp_RTF::buildCharacterProps(), buildTemplateList(), fp_FieldPageReferenceRun::calculateValue(), IE_Imp_RTF::closePastedTableIfNeeded(), FV_View::cmdDeleteCol(), FV_View::cmdDeleteRow(), FV_View::cmdInsertCol(), FV_View::cmdInsertRow(), FV_View::cmdInsertTable(), FV_View::cmdSplitCells(), FV_View::cmdTextToTable(), IE_Imp_DocBook::createImage(), GR_CairoRasterImage::createImageSegment(), ODi_Style_PageLayout::definePageSizeTag(), Defun(), Defun1(), Defun_EV_GetToolbarItemState_Fn(), IE_Imp_RTF::EndAnnotation(), ODi_TextContent_ListenerState::endElement(), ODi_Frame_ListenerState::endElement(), IE_Imp_XHTML::endElement(), ODe_ManifestWriter::ensureDirectoryManifest(), IE_Exp_EPUB::EPUB2_writeNavigation(), IE_Exp_EPUB::EPUB2_writeStructure(), IE_Exp_EPUB::EPUB3_writeNavigation(), AP_UnixDialog_Border_Shading::event_BorderThicknessChanged(), AP_UnixDialog_Border_Shading::event_ShadingOffsetChanged(), AP_Dialog_RDFQuery::executeQuery(), GR_Graphics::findFont(), fl_BlockLayout::getListAttributesVector(), GR_Win32Font::GR_Win32Font(), IE_Imp_RTF::HandleAbiCell(), IE_Imp_RTF::HandleAbiEndTable(), IE_Imp_RTF::HandleAbiTable(), IE_Imp_RTF::HandleAnnotation(), IE_Imp_RTF::HandleNote(), IE_Imp_RTF::HandleNoteReference(), IE_Exp_HTML_StyleTree::IE_Exp_HTML_StyleTree(), FV_View::insertAnnotation(), FV_View::insertFootnote(), FV_View::insertHeaderFooter(), IE_Imp_RTF::InsertImage(), localizeButtonMarkup(), localizeLabelMarkup(), makeColor(), UT_VersionInfo::makeVersString(), FV_VisualInlineImage::mouseCopy(), FV_VisualInlineImage::mouseRelease(), ap_sbf_PageInfo::notify(), ODc_reorderDate(), ODi_Numbered_ListLevelStyle::ODi_Numbered_ListLevelStyle(), IE_Imp_WordPerfect::openEndnote(), IE_Imp_WordPerfect::openFootnote(), OO_PageStyle::parse(), IE_Imp_MSWrite::read_pic(), GR_PangoFont::reloadFont(), fl_BlockLayout::remItemFromList(), XAP_UnixDialog_MessageBox::runModal(), s_AbiWord_1_Listener::s_AbiWord_1_Listener(), s_append_font_size(), s_doInsertTableDlg(), s_props_append(), FV_View::setAnnotationText(), AP_Dialog_FormatFrame::setBGColor(), AP_Dialog_FormatTable::setBorderColor(), AP_Dialog_Border_Shading::setBorderColor(), AP_Dialog_FormatFrame::setBorderColorBottom(), AP_Dialog_FormatFrame::setBorderColorLeft(), AP_Dialog_FormatFrame::setBorderColorRight(), AP_Dialog_FormatFrame::setBorderColorTop(), AP_Dialog_FormatFrame::setBorderLineStyleBottom(), AP_Dialog_FormatFrame::setBorderLineStyleLeft(), AP_Dialog_FormatFrame::setBorderLineStyleRight(), AP_Dialog_FormatFrame::setBorderLineStyleTop(), AP_Dialog_Border_Shading::setBorderThickness(), ie_imp_cell::setBot(), AP_Dialog_FormatTable::setCurCellProps(), AP_Dialog_FormatFrame::setCurFrameProps(), XAP_UnixWidget::setLabelCStr(), setLabelMarkup(), ie_imp_cell::setLeft(), ie_imp_cell::setRight(), AP_Dialog_Border_Shading::setShadingColor(), AP_Win32Dialog_Stylist::setStyleInGUI(), ie_imp_cell::setTop(), XAP_UnixWidget::setValueFloat(), XAP_UnixWidget::setValueInt(), IE_Imp_RTF::StartAnnotation(), ODi_TextContent_ListenerState::startElement(), ODi_Bullet_ListLevelStyle::startElement(), IE_Imp_XSL_FO::startElement(), IE_Imp_XHTML::startElement(), IE_Imp_DocBook::startElement(), AP_Dialog_RDFEditor::statusIsTripleCount(), streamRead(), IE_Imp_TableHelper::tdStart(), AP_Dialog_FormatTable::toggleLineType(), AP_Dialog_FormatFrame::toggleLineType(), AP_Dialog_Border_Shading::toggleLineType(), IE_Imp_RTF::TranslateKeywordID(), AP_Dialog_FormatFootnotes::updateDocWithValues(), ODe_ManifestWriter::writeManifest(), OO_ManifestWriter::writeManifest(), ODe_MetaDataWriter::writeMetaData(), OO_MetaDataWriter::writeMetaData(), and OO_PicturesWriter::writePictures().
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().
std::string& UT_std_string_vprintf | ( | std::string & | inStr, | |
const char * | format, | |||
va_list | args1 | |||
) |
Referenced by _errorSAXFunc(), _fatalErrorSAXFunc(), abiDialogNew(), and UT_std_string_sprintf().
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().
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().
std::string UT_XML_cloneNoAmpersands | ( | const std::string & | src | ) |
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().