git-svn-id: svn://db.shs.com.ru/pip@210 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -294,6 +294,17 @@ PIByteArray PIString::toUTF8() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PIByteArray PIString::toCharset(const char * c) const {
|
||||||
|
buildData(
|
||||||
|
#ifdef PIP_ICU
|
||||||
|
c
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
return data_.resized(data_.size_s() - 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PIString & PIString::operator +=(const char * str) {
|
PIString & PIString::operator +=(const char * str) {
|
||||||
int l = 0;
|
int l = 0;
|
||||||
while (str[l] != '\0') ++l;
|
while (str[l] != '\0') ++l;
|
||||||
|
|||||||
@@ -505,6 +505,9 @@ public:
|
|||||||
//! \brief Return \a PIByteArray contains UTF-8 \a data() of this string without terminating null-char
|
//! \brief Return \a PIByteArray contains UTF-8 \a data() of this string without terminating null-char
|
||||||
PIByteArray toUTF8() const;
|
PIByteArray toUTF8() const;
|
||||||
|
|
||||||
|
//! \brief Return \a PIByteArray contains custom charset representation of this string without terminating null-char
|
||||||
|
PIByteArray toCharset(const char * c) const;
|
||||||
|
|
||||||
/*! \brief Split string with delimiter "delim" to \a PIStringList and return it
|
/*! \brief Split string with delimiter "delim" to \a PIStringList and return it
|
||||||
* \details Example: \snippet pistring.cpp PIString::split */
|
* \details Example: \snippet pistring.cpp PIString::split */
|
||||||
PIStringList split(const PIString & delim) const;
|
PIStringList split(const PIString & delim) const;
|
||||||
|
|||||||
@@ -382,6 +382,13 @@ PIFile & PIFile::writeToBinLog(ushort id, const void * data, int size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PIFile &PIFile::operator <<(const PIString & v) {
|
||||||
|
if (canWrite() && fd != 0)
|
||||||
|
*this << v.toCharset(defaultCharset());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PIFile::clear() {
|
void PIFile::clear() {
|
||||||
close();
|
close();
|
||||||
fd = fopen(path().data(), "w");
|
fd = fopen(path().data(), "w");
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ public:
|
|||||||
PIFile & operator <<(const char v) {if (canWrite() && fd != 0) write(&v, 1); return *this;}
|
PIFile & operator <<(const char v) {if (canWrite() && fd != 0) write(&v, 1); return *this;}
|
||||||
//PIFile & operator <<(const string & v) {write(v.c_str(), v.size()); return *this;}
|
//PIFile & operator <<(const string & v) {write(v.c_str(), v.size()); return *this;}
|
||||||
//! Write to file string "v"
|
//! Write to file string "v"
|
||||||
PIFile & operator <<(const PIString & v) {if (canWrite() && fd != 0) *this << v.toByteArray(); return *this;}
|
PIFile & operator <<(const PIString & v);
|
||||||
//! Write to file text representation of "v"
|
//! Write to file text representation of "v"
|
||||||
PIFile & operator <<(const PIByteArray & v) {if (canWrite() && fd != 0) write(v.data(), v.size()); return *this;}
|
PIFile & operator <<(const PIByteArray & v) {if (canWrite() && fd != 0) write(v.data(), v.size()); return *this;}
|
||||||
//! Write to file text representation of "v"
|
//! Write to file text representation of "v"
|
||||||
|
|||||||
Reference in New Issue
Block a user