git-svn-id: svn://db.shs.com.ru/pip@334 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "piterminal.h"
|
||||
#ifdef WINDOWS
|
||||
# include "pisharedmemory.h"
|
||||
# include <windows.h>
|
||||
# include <wincon.h>
|
||||
# include <winuser.h>
|
||||
#else
|
||||
|
||||
@@ -336,7 +336,12 @@ private:
|
||||
if (pid_rsize + pid_rsize >= size_t(s) && pid_rsize < size_t(s))
|
||||
return pid_rsize + pid_rsize;
|
||||
ssize_t t = 0, s_ = s - 1;
|
||||
while (s_ >> t) ++t;
|
||||
//printf("asize .. %p rs=%d ns=%d s_=%d t=%d \n", this, pid_rsize, s, s_, t);
|
||||
while (s_ >> t) {
|
||||
++t;
|
||||
//printf("asize ++ %p rs=%d ns=%d s_=%d t=%d \n", this, pid_rsize, s, s_, t);
|
||||
}
|
||||
//printf("asize ok %p rs=%d ns=%d s_=%d t=%d \n", this, pid_rsize, s, s_, t);
|
||||
return (1 << t);
|
||||
}
|
||||
inline void newT(T * dst, const T * src, size_t s) {
|
||||
|
||||
@@ -37,7 +37,7 @@ class PIP_EXPORT PIString: public PIDeque<PIChar>
|
||||
friend PIByteArray & operator >>(PIByteArray & s, PIString & v);
|
||||
public:
|
||||
//! Contructs an empty string
|
||||
PIString(): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--;}
|
||||
PIString(): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--;}
|
||||
|
||||
//inline PIString & operator +=(const char c) {push_back(c); return *this;}
|
||||
PIString & operator +=(const PIChar & c) {push_back(c); return *this;}
|
||||
@@ -51,47 +51,47 @@ public:
|
||||
#endif
|
||||
|
||||
//PIString(const char c) {*this += c;}
|
||||
PIString(const PIString & o): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this += o;}
|
||||
PIString(const PIString & o): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this += o;}
|
||||
|
||||
|
||||
//! Contructs string with single symbol "c"
|
||||
PIString(const PIChar & c): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this += c;}
|
||||
PIString(const char c): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this += PIChar(c);}
|
||||
PIString(const PIChar & c): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this += c;}
|
||||
PIString(const char c): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this += PIChar(c);}
|
||||
|
||||
/*! \brief Contructs string from c-string "str"
|
||||
* \details "str" should be null-terminated\n
|
||||
* Example: \snippet pistring.cpp PIString(char * ) */
|
||||
PIString(const char * str): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this += str;}
|
||||
PIString(const char * str): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this += str;}
|
||||
|
||||
/*! \brief Contructs string from \c wchar_t c-string "str"
|
||||
* \details "str" should be null-terminated\n
|
||||
* Example: \snippet pistring.cpp PIString(wchar_t * ) */
|
||||
PIString(const wchar_t * str): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this += str;}
|
||||
PIString(const wchar_t * str): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this += str;}
|
||||
|
||||
//! Contructs string from std::string "str"
|
||||
PIString(const std::string & str): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this += str;}
|
||||
PIString(const std::string & str): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this += str;}
|
||||
|
||||
#ifdef HAS_LOCALE
|
||||
PIString(const wstring & str): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this += str;}
|
||||
PIString(const wstring & str): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this += str;}
|
||||
#endif
|
||||
|
||||
//! Contructs string from byte array "ba"
|
||||
PIString(const PIByteArray & ba): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this += ba;}
|
||||
PIString(const PIByteArray & ba): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this += ba;}
|
||||
|
||||
//! \brief Contructs string from "len" characters of buffer "str"
|
||||
PIString(const PIChar * str, const int len): PIDeque<PIChar>(str, size_t(len)) {/*reserve(256); */piMonitor.strings++; piMonitor.containers--;}
|
||||
PIString(const PIChar * str, const int len): PIDeque<PIChar>(str, size_t(len)) {/*reserve(4); */piMonitor.strings++; piMonitor.containers--;}
|
||||
|
||||
/*! \brief Contructs string from "len" characters of buffer "str"
|
||||
* \details Example: \snippet pistring.cpp PIString(char * , int) */
|
||||
PIString(const char * str, const int len): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this += std::string(str, len);}
|
||||
PIString(const char * str, const int len): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this += std::string(str, len);}
|
||||
|
||||
/*! \brief Contructs string as sequence of characters "c" of buffer with length "len"
|
||||
* \details Example: \snippet pistring.cpp PIString(int, char) */
|
||||
PIString(const int len, const char c): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; for (int i = 0; i < len; ++i) push_back(c);}
|
||||
PIString(const int len, const char c): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; for (int i = 0; i < len; ++i) push_back(c);}
|
||||
|
||||
/*! \brief Contructs string as sequence of symbols "c" of buffer with length "len"
|
||||
* \details Example: \snippet pistring.cpp PIString(int, PIChar) */
|
||||
PIString(const int len, const PIChar & c): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; for (int i = 0; i < len; ++i) push_back(c);}
|
||||
PIString(const int len, const PIChar & c): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; for (int i = 0; i < len; ++i) push_back(c);}
|
||||
/*
|
||||
#ifdef WINDOWS
|
||||
PIString(const WCHAR * str): PIDeque<PIChar>() {piMonitor.strings++; piMonitor.containers--; *this += str;}
|
||||
@@ -100,16 +100,16 @@ public:
|
||||
#endif
|
||||
*/
|
||||
|
||||
PIString(const short & value): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const ushort & value): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const int & value): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const uint & value): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const long & value): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const ulong & value): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const llong & value): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const ullong & value): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const float & value): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const double & value): PIDeque<PIChar>() {/*reserve(256); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const short & value): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const ushort & value): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const int & value): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const uint & value): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const long & value): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const ulong & value): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const llong & value): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const ullong & value): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const float & value): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
PIString(const double & value): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
|
||||
|
||||
|
||||
//~PIString() {piMonitor.strings--; piMonitor.containers++;}
|
||||
|
||||
Reference in New Issue
Block a user