From 0b8b417c6d259606e890bcbd8d2f7d81ee16bed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D0=BB=D0=B8=D0=BF=D0=B5=D0=BD=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD?= Date: Sun, 24 Jul 2016 14:04:10 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@206 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- main.cpp | 2 +- src/core/pistring.cpp | 10 ++++++++++ src/core/pistring.h | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 72b68683..691cecdb 100644 --- a/main.cpp +++ b/main.cpp @@ -31,7 +31,7 @@ public: int main (int argc, char * argv[]) { VC<30, double> x(1.5), y(3.3); - double r; + double r = 0.0; PITimeMeasurer tm; for (int i=0; i<10000; i++) r = x.dot(y); diff --git a/src/core/pistring.cpp b/src/core/pistring.cpp index cab4de47..5b507deb 100755 --- a/src/core/pistring.cpp +++ b/src/core/pistring.cpp @@ -271,6 +271,16 @@ const char * PIString::dataAscii() const { } +PIByteArray PIString::toUTF8() const { + buildData( +#ifdef PIP_ICU + "UTF-8" +#endif + ); + return data_.resized(data_.size_s() - 1); +} + + PIString & PIString::operator +=(const char * str) { int l = 0; while (str[l] != '\0') ++l; diff --git a/src/core/pistring.h b/src/core/pistring.h index 8e7019fe..0b6735b3 100755 --- a/src/core/pistring.h +++ b/src/core/pistring.h @@ -502,6 +502,9 @@ public: //! \brief Return \a PIByteArray contains \a data() of this string without terminating null-char PIByteArray toByteArray() const {buildData(); return data_.resized(data_.size_s() - 1);} + //! \brief Return \a PIByteArray contains UTF-8 \a data() of this string without terminating null-char + PIByteArray toUTF8() const; + /*! \brief Split string with delimiter "delim" to \a PIStringList and return it * \details Example: \snippet pistring.cpp PIString::split */ PIStringList split(const PIString & delim) const;