ut_std_string.h File Reference

#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <locale>
#include "ut_types.h"

Go to the source code of this file.


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)

Function Documentation

ABI_EXPORT bool ends_with ( const std::string &  fullstring,
const std::string &  ending 
ABI_EXPORT time_t parseTimeString ( const std::string &  stddatestr  ) 
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 
ABI_EXPORT const std::string StreamToString ( std::istream &  iss  ) 
ABI_EXPORT time_t toTime ( struct tm *  tm  ) 

Referenced by parseTimeString().

ABI_EXPORT std::string toTimeString ( time_t  TT  ) 
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 &   ) 
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;" 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;" Return the value of the property sProp or NULL if it is not present.


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;" 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 
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.
the std::string. Empty string if an invalid parameter or error.

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)
an UTF-8 enconded std::string

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  )