From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03924.html | 846 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 846 insertions(+) create mode 100644 docs/doxygen/nel/a03924.html (limited to 'docs/doxygen/nel/a03924.html') diff --git a/docs/doxygen/nel/a03924.html b/docs/doxygen/nel/a03924.html new file mode 100644 index 00000000..c2aa04f8 --- /dev/null +++ b/docs/doxygen/nel/a03924.html @@ -0,0 +1,846 @@ + + +NeL: ucstring class Reference + + + +
+

ucstring Class Reference

#include <ucstring.h> +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

const uccharc_str () const
void fromUtf8 (const std::string &stringUtf8)
 Convert the utf8 string into this ucstring (16 bits char).

ucstringoperator+= (const ucstringbase &str)
ucstringoperator+= (const std::string &str)
ucstringoperator+= (const char *str)
ucstringoperator+= (ucchar c)
ucstringoperator= (const ucstringbase &str)
ucstringoperator= (const std::string &str)
ucstringoperator= (const char *str)
ucstringoperator= (ucchar c)
std::string toString () const
 Converts the controlled ucstring and returns the resulting string.

void toString (std::string &str) const
 Converts the controlled ucstring to a string str.

std::string toUtf8 () const
 Convert this ucstring (16bits char) into a utf8 string.

 ucstring (const std::string &str)
 ucstring (const ucstringbase &str)
 ucstring ()
 ~ucstring ()
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
ucstring::ucstring  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 46 of file ucstring.h. +

+

00046 {}
+
+

+ + + + +
+ + + + + + + + + + +
ucstring::ucstring const ucstringbase str  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 48 of file ucstring.h. +

+References ucstringbase. +

+

00048 : ucstringbase (str) {}
+
+

+ + + + +
+ + + + + + + + + + +
ucstring::ucstring const std::string &  str  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 50 of file ucstring.h. +

+References ucstringbase. +

+

00050                                         : ucstringbase ()
+00051         {
+00052                 *this=str;
+00053         }
+
+

+ + + + +
+ + + + + + + + + +
ucstring::~ucstring  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 55 of file ucstring.h. +

+

00055 {}
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + +
const ucchar* ucstring::c_str  )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 125 of file ucstring.h. +

+References size, and ucchar. +

+Referenced by NLMISC::CI18N::readTextFile(). +

+

00126         {
+00127                 const ucchar *tmp = ucstringbase::c_str();
+00128                 const_cast<ucchar*>(tmp)[size()] = 0;
+00129                 return tmp;
+00130         }
+
+

+ + + + +
+ + + + + + + + + + +
void ucstring::fromUtf8 const std::string &  stringUtf8  )  [inline]
+
+ + + + + +
+   + + +

+Convert the utf8 string into this ucstring (16 bits char). +

+ +

+Definition at line 191 of file ucstring.h. +

+References nlwarning, sint, ucchar, and uint8. +

+Referenced by NLMISC::CI18N::readTextBuffer(). +

+

00192         {
+00193                 // clear the string
+00194                 erase();
+00195 
+00196                 uint8 c;
+00197                 ucchar code;
+00198                 sint iterations = 0;
+00199 
+00200                 std::string::const_iterator first(stringUtf8.begin()), last(stringUtf8.end());
+00201                 for (; first != last; )
+00202                 {
+00203                         c = *first++;
+00204                         code = c;
+00205 
+00206                         if ((code & 0xFE) == 0xFC)
+00207                         {
+00208                                 code &= 0x01;
+00209                                 iterations = 5;
+00210                         }
+00211                         else if ((code & 0xFC) == 0xF8)
+00212                         {
+00213                                 code &= 0x03;
+00214                                 iterations = 4;
+00215                         }
+00216                         else if ((code & 0xF8) == 0xF0)
+00217                         {
+00218                                 code &= 0x07;
+00219                                 iterations = 3;
+00220                         }
+00221                         else if ((code & 0xF0) == 0xE0)
+00222                         {
+00223                                 code &= 0x0F;
+00224                                 iterations = 2;
+00225                         }
+00226                         else if ((code & 0xE0) == 0xC0)
+00227                         {
+00228                                 code &= 0x1F;
+00229                                 iterations = 1;
+00230                         }
+00231                         else if ((code & 0x80) == 0x80)
+00232                         {
+00233                                 nlwarning ("UCS: Invalid UTF-8 character");
+00234                         }
+00235                         else
+00236                         {
+00237                                 push_back(code);
+00238                                 iterations = 0;
+00239                         }
+00240 
+00241                         if (iterations)
+00242                         {
+00243                                 for (sint i = 0; i < iterations; i++)
+00244                                 {
+00245                                         if (first == last)
+00246                                         {
+00247                                                 nlwarning ("UCS: Invalid UTF-8 character");
+00248                                                 return;
+00249                                         }
+00250 
+00251                                         uint8 ch;
+00252                                         ch = *first ++;
+00253 
+00254                                         if ((ch & 0xC0) != 0x80)
+00255                                         {
+00256                                                 nlwarning ("UCS: Invalid UTF-8 character");
+00257                                                 code = '?';
+00258                                                 break;
+00259                                         }
+00260 
+00261                                         code <<= 6;
+00262                                         code |= (ucchar)(ch & 0x3F);
+00263                                 }
+00264                                 push_back(code);
+00265                         }
+00266                 }
+00267         }
+
+

+ + + + +
+ + + + + + + + + + +
ucstring& ucstring::operator+= const ucstringbase str  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 119 of file ucstring.h. +

+

00120         {
+00121                 ucstringbase::operator +=(str);
+00122                 return *this;
+00123         }
+
+

+ + + + +
+ + + + + + + + + + +
ucstring& ucstring::operator+= const std::string &  str  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 108 of file ucstring.h. +

+References s, sint, and size. +

+

00109         {
+00110                 sint s = size();
+00111                 resize (s + str.size());
+00112                 for (sint i = 0; i < (sint) str.size(); i++)
+00113                 {
+00114                         operator[](s+i) = str[i];
+00115                 }
+00116                 return *this;
+00117         }
+
+

+ + + + +
+ + + + + + + + + + +
ucstring& ucstring::operator+= const char *  str  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 97 of file ucstring.h. +

+References s, sint, and size. +

+

00098         {
+00099                 sint s = size();
+00100                 resize (s + strlen(str));
+00101                 for (sint i = 0; i < (sint) strlen(str); i++)
+00102                 {
+00103                         operator[](s+i) = str[i];
+00104                 }
+00105                 return *this;
+00106         }
+
+

+ + + + +
+ + + + + + + + + + +
ucstring& ucstring::operator+= ucchar  c  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 90 of file ucstring.h. +

+References size, and ucchar. +

+

00091         {
+00092                 resize (size() + 1);
+00093                 operator[](size()-1) = c;
+00094                 return *this;
+00095         }
+
+

+ + + + +
+ + + + + + + + + + +
ucstring& ucstring::operator= const ucstringbase str  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 84 of file ucstring.h. +

+

00085         {
+00086                 ucstringbase::operator =(str);
+00087                 return *this;
+00088         }
+
+

+ + + + +
+ + + + + + + + + + +
ucstring& ucstring::operator= const std::string &  str  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 74 of file ucstring.h. +

+References sint. +

+

00075         {
+00076                 resize (str.size ());
+00077                 for (sint i = 0; i < (sint) str.size (); i++)
+00078                 {
+00079                         operator[](i) = str[i];
+00080                 }
+00081                 return *this;
+00082         }
+
+

+ + + + +
+ + + + + + + + + + +
ucstring& ucstring::operator= const char *  str  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 64 of file ucstring.h. +

+References sint. +

+

00065         {
+00066                 resize (strlen (str));
+00067                 for (sint i = 0; i < (sint) strlen (str); i++)
+00068                 {
+00069                         operator[](i) = str[i];
+00070                 }
+00071                 return *this;
+00072         }
+
+

+ + + + +
+ + + + + + + + + + +
ucstring& ucstring::operator= ucchar  c  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 57 of file ucstring.h. +

+References ucchar. +

+

00058         {
+00059                 resize (1);
+00060                 operator[](0) = c;
+00061                 return *this;
+00062         }
+
+

+ + + + +
+ + + + + + + + + +
std::string ucstring::toString  )  const [inline]
+
+ + + + + +
+   + + +

+Converts the controlled ucstring and returns the resulting string. +

+ +

+Definition at line 143 of file ucstring.h. +

+

00144         {
+00145                 std::string str;
+00146                 toString(str);
+00147                 return str;
+00148         }
+
+

+ + + + +
+ + + + + + + + + + +
void ucstring::toString std::string &  str  )  const [inline]
+
+ + + + + +
+   + + +

+Converts the controlled ucstring to a string str. +

+ +

+Definition at line 133 of file ucstring.h. +

+References sint, and size. +

+Referenced by NLMISC::CEntityIdTranslator::checkEntity(), NLMISC::CEntityIdTranslator::getByEntity(), NLMISC::CEntityIdTranslator::getRegisterableString(), NLMISC::CEntityIdTranslator::isValidEntityName(), NLMISC::NLMISC_COMMAND(), STRING_MANAGER::TGetWorksheetHashValue::operator()(), STRING_MANAGER::TGetWorksheetIdentifier::operator()(), STRING_MANAGER::parseHashFromComment(), STRING_MANAGER::preparePhraseFile(), STRING_MANAGER::prepareStringFile(), STRING_MANAGER::readExcelSheet(), NLMISC::CI18N::readTextFile(), and NLMISC::CEntityIdTranslator::registerEntity(). +

+

00134         {
+00135                 str.resize (size ());
+00136                 for (sint i = 0; i < (sint) str.size (); i++)
+00137                 {
+00138                         str[i] = (char) operator[](i);
+00139                 }
+00140         }
+
+

+ + + + +
+ + + + + + + + + +
std::string ucstring::toUtf8  )  const [inline]
+
+ + + + + +
+   + + +

+Convert this ucstring (16bits char) into a utf8 string. +

+ +

+Definition at line 151 of file ucstring.h. +

+References res, ucchar, and uint. +

+Referenced by NLMISC::CI18N::encodeUTF8(). +

+

00152         {
+00153                 std::string     res;
+00154                 ucstring::const_iterator first(begin()), last(end());
+00155                 for (; first != last; ++first)
+00156                 {
+00157                         //ucchar        c = *first;
+00158                         uint nbLoop = 0;
+00159                         if (*first < 0x80)
+00160                                 res += char(*first);
+00161                         else if (*first < 0x800)
+00162                         {
+00163                                 ucchar c = *first;
+00164                                 c = c >> 6;
+00165                                 c = c & 0x1F;
+00166                                 res += c | 0xC0;
+00167                                 nbLoop = 1;
+00168                         }
+00169                         else /*if (*first < 0x10000)*/
+00170                         {
+00171                                 ucchar c = *first;
+00172                                 c = c >> 12;
+00173                                 c = c & 0x0F;
+00174                                 res += c | 0xE0;
+00175                                 nbLoop = 2;
+00176                         }
+00177 
+00178                         for (uint i=0; i<nbLoop; ++i)
+00179                         {
+00180                                 ucchar  c = *first;
+00181                                 c = c >> ((nbLoop - i - 1) * 6);
+00182                                 c = c & 0x3F;
+00183                                 res += char(c) | 0x80; 
+00184                         }
+00185                 }
+00186                 return res;
+00187         }
+
+


The documentation for this class was generated from the following file: +
Generated on Tue Mar 16 06:43:58 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1