PIStringAsciixes

git-svn-id: svn://db.shs.com.ru/pip@101 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2015-04-15 13:30:53 +00:00
parent eb99c5752e
commit 85d90729fa
9 changed files with 153 additions and 110 deletions

View File

@@ -28,6 +28,8 @@
#include "pibytearray.h"
#include "pichar.h"
#define PIStringAscii PIString::fromAscii
class PIStringList;
class PIP_EXPORT PIString: public PIDeque<PIChar>
@@ -482,6 +484,13 @@ public:
* execution of this function.\n
* \sa \a data(), \a dataConsole() */
const char * dataUTF8() const;
/*! \brief Return \c char * representation of this string in ASCII
* \details This function fill buffer by sequence
* of chars. Minimum length of this buffer is count
* of symbols. Returned \c char * is valid until next
* execution of this function.\n */
const char * dataAscii() const;
//! \brief Return \c std::string representation of this string
std::string stdString() const {return convertToStd();}
@@ -717,6 +726,9 @@ public:
//! \brief Return string constructed from UTF-8
static PIString fromUTF8(const char * s);
//! \brief Return string constructed from ASCII
static PIString fromAscii(const char * s);
//! \brief Return string contains human readable size in B/kB/MB/GB/TB
//! \details Example: \snippet pistring.cpp PIString::readableSize
static PIString readableSize(llong bytes) {PIString s; s.setReadableSize(bytes); return s;}
@@ -930,7 +942,7 @@ public:
//! \relatesalso PIStringList \relatesalso PIByteArray \brief Output operator to PIByteArray
inline PIByteArray & operator <<(PIByteArray & s, const PIStringList & v) {s << v.size_s(); for (int i = 0; i < v.size_s(); ++i) s << v[i]; return s;}
inline PIByteArray & operator <<(PIByteArray & s, const PIStringList & v) {s << int(v.size_s()); for (int i = 0; i < v.size_s(); ++i) s << v[i]; return s;}
//! \relatesalso PIStringList \relatesalso PIByteArray \brief Input operator from PIByteArray
inline PIByteArray & operator >>(PIByteArray & s, PIStringList & v) {int sz; s >> sz; v.resize(sz); for (int i = 0; i < sz; ++i) s >> v[i]; return s;}