From 9058bdc521e526ed9a7fac8e2479ff828283b1d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=8B=D1=87=D0=BA=D0=BE=D0=B2=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9?= Date: Fri, 14 Apr 2017 17:37:58 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@367 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- src/console/pikbdlistener.cpp | 9 +--- src/console/piterminal.cpp | 9 +--- src/containers/picontainers.h | 78 ----------------------------- src/containers/picontainersmodule.h | 8 ++- src/containers/pideque.h | 17 ++++++- src/containers/pilist.h | 45 +++++++++++++++++ src/containers/pimap.h | 5 +- src/containers/pipair.h | 26 ++++++++++ src/containers/pivector.h | 16 +++++- src/core/pibitarray.h | 2 +- src/core/pibytearray.cpp | 3 ++ src/core/pibytearray.h | 21 ++++---- src/core/pichar.cpp | 1 + src/core/pichar.h | 12 +---- src/core/picout.cpp | 2 + src/core/picout.h | 1 - src/core/piflags.h | 2 +- src/core/piincludes.h | 10 ++-- src/core/piincludes_p.h | 29 +++++++++++ src/core/piinit.cpp | 11 +--- src/core/piobject.h | 1 + src/core/pistring.h | 7 ++- src/core/pitime.cpp | 9 +--- src/core/pitime.h | 2 +- src/core/pivariant.h | 1 - src/core/pivarianttypes.h | 1 - src/io/pidiagnostics.h | 1 + src/io/pidir.cpp | 9 +--- src/io/piethernet.cpp | 9 +--- src/io/pifile.cpp | 9 +--- src/io/piiodevice.h | 1 + src/io/piserial.cpp | 9 +--- src/io/pisharedmemory.cpp | 9 +--- src/math/pimathbase.h | 7 +-- src/system/piprocess.cpp | 9 +--- src/system/pisignals.h | 2 +- src/system/pisystemmonitor.cpp | 9 +--- src/thread/pithread.cpp | 9 +--- 38 files changed, 190 insertions(+), 221 deletions(-) create mode 100644 src/containers/pilist.h create mode 100644 src/containers/pipair.h create mode 100644 src/core/piincludes_p.h diff --git a/src/console/pikbdlistener.cpp b/src/console/pikbdlistener.cpp index 21d100c3..fdc6016c 100644 --- a/src/console/pikbdlistener.cpp +++ b/src/console/pikbdlistener.cpp @@ -16,20 +16,13 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "pibase.h" -#ifdef WINDOWS -# include -# include -#endif +#include "piincludes_p.h" #include "pikbdlistener.h" #ifndef WINDOWS # include #else # include #endif -#ifdef CC_GCC -# include -#endif /** \class PIKbdListener * \brief Keyboard console input listener diff --git a/src/console/piterminal.cpp b/src/console/piterminal.cpp index ccfcb8c5..5933ec02 100644 --- a/src/console/piterminal.cpp +++ b/src/console/piterminal.cpp @@ -16,16 +16,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "pibase.h" -#ifdef WINDOWS -# include -# include -#endif +#include "piincludes_p.h" #include "piterminal.h" # include "pisharedmemory.h" -#ifdef CC_GCC -# include -#endif #ifdef WINDOWS # include # include diff --git a/src/containers/picontainers.h b/src/containers/picontainers.h index 119fe668..d2098077 100755 --- a/src/containers/picontainers.h +++ b/src/containers/picontainers.h @@ -27,7 +27,6 @@ #define PICONTAINERS_H #include "picout.h" -#include #include #ifndef PIP_MEMALIGN_BYTES @@ -48,31 +47,6 @@ # define afree(p) free(p) #endif -template -class PIP_EXPORT PIPair { -public: - PIPair() {first = Type0(); second = Type1();} - PIPair(const Type0 & value0, const Type1 & value1) {first = value0; second = value1;} - Type0 first; - Type1 second; -}; -template -inline bool operator <(const PIPair & value0, const PIPair & value1) {return value0.first < value1.first;} -template -inline bool operator ==(const PIPair & value0, const PIPair & value1) {return (value0.first == value1.first) && (value0.second == value1.second);} -template -inline bool operator !=(const PIPair & value0, const PIPair & value1) {return (value0.first != value1.first) || (value0.second != value1.second);} -template -inline std::ostream & operator <<(std::ostream & s, const PIPair & v) {s << "(" << v.first << ", " << v.second << ")"; return s;} -template -inline PICout operator <<(PICout s, const PIPair & v) {s.space(); s.setControl(0, true); s << "(" << v.first << ", " << v.second << ")"; s.restoreControl(); return s;} - -#include "pivector.h" -#include "pistack.h" -#include "piqueue.h" -#include "pideque.h" -#include "pimap.h" -#include "piset.h" #ifdef DOXYGEN @@ -246,57 +220,5 @@ template inline _PIForeachC * _PIForeachCastC(_PIForeachBase & c #endif // DOXYGEN -template > -class PIP_EXPORT PIList: public std::list { - typedef PIList _CList; - typedef std::list _stlc; -public: - PIList() {piMonitor.containers++;} - PIList(const Type & value) {piMonitor.containers++; _stlc::resize(1, value);} - PIList(const Type & v0, const Type & v1) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1);} - PIList(const Type & v0, const Type & v1, const Type & v2) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2);} - PIList(const Type & v0, const Type & v1, const Type & v2, const Type & v3) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2); _stlc::push_back(v3);} - PIList(uint size, const Type & value = Type()) {piMonitor.containers++; _stlc::resize(size, value);} - ~PIList() {piMonitor.containers--;} - Type & operator [](uint index) {return (*this)[index];} - Type & operator [](uint index) const {return (*this)[index];} - const Type * data(uint index = 0) const {return &(*this)[index];} - Type * data(uint index = 0) {return &(*this)[index];} - int size_s() const {return static_cast(_stlc::size());} - bool isEmpty() const {return _stlc::empty();} - bool has(const Type & t) const {for (typename _stlc::const_iterator i = _stlc::begin(); i != _stlc::end(); ++i) if (t == *i) return true; return false;} - int etries(const Type & t) const {int ec = 0; for (typename _stlc::const_iterator i = _stlc::begin(); i != _stlc::end(); ++i) if (t == *i) ++ec; return ec;} - _CList & fill(const Type & t) {_stlc::assign(_stlc::size(), t); return *this;} - _CList & remove(uint index) {_stlc::erase(_stlc::begin() + index); return *this;} - _CList & remove(uint index, uint count) {_stlc::erase(_stlc::begin() + index, _stlc::begin() + index + count); return *this;} - _CList & insert(uint pos, const Type & t) {_stlc::insert(_stlc::begin() + pos, t); return *this;} - _CList & operator <<(const Type & t) {_stlc::push_back(t); return *this;} - PIVector toVector() const {PIVector v; for (typename _stlc::const_iterator i = _stlc::begin(); i != _stlc::end(); ++i) v << *i; return v;} -}; - - -#ifndef PIP_CONTAINERS_STL - -# define __PICONTAINERS_SIMPLE_TYPE__(T) \ -__PIDEQUE_SIMPLE_TYPE__(T)\ -__PIVECTOR_SIMPLE_TYPE__(T) - -__PICONTAINERS_SIMPLE_TYPE__(bool) -__PICONTAINERS_SIMPLE_TYPE__(char) -__PICONTAINERS_SIMPLE_TYPE__(uchar) -__PICONTAINERS_SIMPLE_TYPE__(short) -__PICONTAINERS_SIMPLE_TYPE__(ushort) -__PICONTAINERS_SIMPLE_TYPE__(int) -__PICONTAINERS_SIMPLE_TYPE__(uint) -__PICONTAINERS_SIMPLE_TYPE__(long) -__PICONTAINERS_SIMPLE_TYPE__(ulong) -__PICONTAINERS_SIMPLE_TYPE__(llong) -__PICONTAINERS_SIMPLE_TYPE__(ullong) -__PICONTAINERS_SIMPLE_TYPE__(float) -__PICONTAINERS_SIMPLE_TYPE__(double) -__PICONTAINERS_SIMPLE_TYPE__(ldouble) - -#endif - #endif // PICONTAINERS_H diff --git a/src/containers/picontainersmodule.h b/src/containers/picontainersmodule.h index 46201035..7eb2e85a 100644 --- a/src/containers/picontainersmodule.h +++ b/src/containers/picontainersmodule.h @@ -20,6 +20,12 @@ #ifndef PICONTAINERSMODULE_H #define PICONTAINERSMODULE_H -#include "picontainers.h" +#include "pivector.h" +#include "pideque.h" +#include "pimap.h" +#include "piqueue.h" +#include "piset.h" +#include "pilist.h" +#include "pistack.h" #endif // PICONTAINERSMODULE_H diff --git a/src/containers/pideque.h b/src/containers/pideque.h index f1945ab2..3a780685 100755 --- a/src/containers/pideque.h +++ b/src/containers/pideque.h @@ -25,7 +25,7 @@ #ifndef PIDEQUE_H #define PIDEQUE_H -#include "piincludes.h" +#include "picontainers.h" #include "piintrospection_proxy.h" @@ -523,7 +523,20 @@ public: #endif - +__PIDEQUE_SIMPLE_TYPE__(bool) +__PIDEQUE_SIMPLE_TYPE__(char) +__PIDEQUE_SIMPLE_TYPE__(uchar) +__PIDEQUE_SIMPLE_TYPE__(short) +__PIDEQUE_SIMPLE_TYPE__(ushort) +__PIDEQUE_SIMPLE_TYPE__(int) +__PIDEQUE_SIMPLE_TYPE__(uint) +__PIDEQUE_SIMPLE_TYPE__(long) +__PIDEQUE_SIMPLE_TYPE__(ulong) +__PIDEQUE_SIMPLE_TYPE__(llong) +__PIDEQUE_SIMPLE_TYPE__(ullong) +__PIDEQUE_SIMPLE_TYPE__(float) +__PIDEQUE_SIMPLE_TYPE__(double) +__PIDEQUE_SIMPLE_TYPE__(ldouble) template inline std::ostream & operator <<(std::ostream & s, const PIDeque & v) {s << "{"; for (size_t i = 0; i < v.size(); ++i) {s << v[i]; if (i < v.size() - 1) s << ", ";} s << "}"; return s;} diff --git a/src/containers/pilist.h b/src/containers/pilist.h new file mode 100644 index 00000000..e18f9678 --- /dev/null +++ b/src/containers/pilist.h @@ -0,0 +1,45 @@ +#ifndef PILIST_H +#define PILIST_H +#include "pivector.h" +#include + +template > +class PIP_EXPORT PIList: public std::list { + typedef PIList _CList; + typedef std::list _stlc; +public: + PIList() {piMonitor.containers++;} + PIList(const Type & value) {piMonitor.containers++; _stlc::resize(1, value);} + PIList(const Type & v0, const Type & v1) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1);} + PIList(const Type & v0, const Type & v1, const Type & v2) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2);} + PIList(const Type & v0, const Type & v1, const Type & v2, const Type & v3) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2); _stlc::push_back(v3);} + PIList(uint size, const Type & value = Type()) {piMonitor.containers++; _stlc::resize(size, value);} + ~PIList() {piMonitor.containers--;} + Type & operator [](uint index) {return (*this)[index];} + Type & operator [](uint index) const {return (*this)[index];} + const Type * data(uint index = 0) const {return &(*this)[index];} + Type * data(uint index = 0) {return &(*this)[index];} + int size_s() const {return static_cast(_stlc::size());} + bool isEmpty() const {return _stlc::empty();} + bool has(const Type & t) const {for (typename _stlc::const_iterator i = _stlc::begin(); i != _stlc::end(); ++i) if (t == *i) return true; return false;} + int etries(const Type & t) const {int ec = 0; for (typename _stlc::const_iterator i = _stlc::begin(); i != _stlc::end(); ++i) if (t == *i) ++ec; return ec;} + _CList & fill(const Type & t) {_stlc::assign(_stlc::size(), t); return *this;} + _CList & remove(uint index) {_stlc::erase(_stlc::begin() + index); return *this;} + _CList & remove(uint index, uint count) {_stlc::erase(_stlc::begin() + index, _stlc::begin() + index + count); return *this;} + _CList & insert(uint pos, const Type & t) {_stlc::insert(_stlc::begin() + pos, t); return *this;} + _CList & operator <<(const Type & t) {_stlc::push_back(t); return *this;} + PIVector toVector() const {PIVector v; for (typename _stlc::const_iterator i = _stlc::begin(); i != _stlc::end(); ++i) v << *i; return v;} +}; + +//! \relatesalso PIByteArray \brief Store operator +template inline PIByteArray & operator <<(PIByteArray & s, const PIList & v); +//! \relatesalso PIByteArray \brief Restore operator +template inline PIByteArray & operator >>(PIByteArray & s, PIList & v); + +template +inline PIByteArray & operator <<(PIByteArray & s, const PIList & v) {s << int(v.size_s()); for (uint i = 0; i < v.size(); ++i) s << v[i]; return s;} +template +inline PIByteArray & operator >>(PIByteArray & s, PIList & v) {assert(s.size_s() >= 4); int sz; s >> sz; v.resize(sz); for (int i = 0; i < sz; ++i) s >> v[i]; return s;} + + +#endif // PILIST_H diff --git a/src/containers/pimap.h b/src/containers/pimap.h index 88b70e9a..44f55977 100644 --- a/src/containers/pimap.h +++ b/src/containers/pimap.h @@ -27,8 +27,11 @@ #include "pivector.h" #include "pideque.h" +#include "pipair.h" +# define __PICONTAINERS_SIMPLE_TYPE__(T) \ +__PIDEQUE_SIMPLE_TYPE__(T)\ +__PIVECTOR_SIMPLE_TYPE__(T) -class PIByteArray; #if !defined(PIP_CONTAINERS_STL) || defined(DOXYGEN) diff --git a/src/containers/pipair.h b/src/containers/pipair.h new file mode 100644 index 00000000..9268e120 --- /dev/null +++ b/src/containers/pipair.h @@ -0,0 +1,26 @@ +#ifndef PIPAIR_H +#define PIPAIR_H + +#include "pibase.h" +class PICout; + +template +class PIP_EXPORT PIPair { +public: + PIPair() {first = Type0(); second = Type1();} + PIPair(const Type0 & value0, const Type1 & value1) {first = value0; second = value1;} + Type0 first; + Type1 second; +}; +template +inline bool operator <(const PIPair & value0, const PIPair & value1) {return value0.first < value1.first;} +template +inline bool operator ==(const PIPair & value0, const PIPair & value1) {return (value0.first == value1.first) && (value0.second == value1.second);} +template +inline bool operator !=(const PIPair & value0, const PIPair & value1) {return (value0.first != value1.first) || (value0.second != value1.second);} +template +inline std::ostream & operator <<(std::ostream & s, const PIPair & v) {s << "(" << v.first << ", " << v.second << ")"; return s;} +template +inline PICout operator <<(PICout s, const PIPair & v) {s.space(); s.setControl(0, true); s << "(" << v.first << ", " << v.second << ")"; s.restoreControl(); return s;} + +#endif // PIPAIR_H diff --git a/src/containers/pivector.h b/src/containers/pivector.h index da2152e6..0a93068f 100755 --- a/src/containers/pivector.h +++ b/src/containers/pivector.h @@ -26,7 +26,7 @@ #define PIVECTOR_H #include "piincludes.h" - +#include "picontainers.h" #if !defined(PIP_CONTAINERS_STL) || defined(DOXYGEN) @@ -522,6 +522,20 @@ public: #endif +__PIVECTOR_SIMPLE_TYPE__(bool) +__PIVECTOR_SIMPLE_TYPE__(char) +__PIVECTOR_SIMPLE_TYPE__(uchar) +__PIVECTOR_SIMPLE_TYPE__(short) +__PIVECTOR_SIMPLE_TYPE__(ushort) +__PIVECTOR_SIMPLE_TYPE__(int) +__PIVECTOR_SIMPLE_TYPE__(uint) +__PIVECTOR_SIMPLE_TYPE__(long) +__PIVECTOR_SIMPLE_TYPE__(ulong) +__PIVECTOR_SIMPLE_TYPE__(llong) +__PIVECTOR_SIMPLE_TYPE__(ullong) +__PIVECTOR_SIMPLE_TYPE__(float) +__PIVECTOR_SIMPLE_TYPE__(double) +__PIVECTOR_SIMPLE_TYPE__(ldouble) template diff --git a/src/core/pibitarray.h b/src/core/pibitarray.h index 86f540cc..52564dcc 100755 --- a/src/core/pibitarray.h +++ b/src/core/pibitarray.h @@ -20,7 +20,7 @@ #ifndef PIBITARRAY_H #define PIBITARRAY_H -#include "picontainers.h" +#include "pivector.h" class PIP_EXPORT PIBitArray { friend PIByteArray & operator <<(PIByteArray & s, const PIBitArray & v); diff --git a/src/core/pibytearray.cpp b/src/core/pibytearray.cpp index f541fbc9..b2b6a2f0 100755 --- a/src/core/pibytearray.cpp +++ b/src/core/pibytearray.cpp @@ -344,3 +344,6 @@ PIByteArray PIByteArray::fromHex(PIString str) { res.remove(0, result - res.data()); return res; } + + +PICout operator <<(PICout s, const PIByteArray & ba) {s.space(); s.setControl(0, true); s << "{"; for (uint i = 0; i < ba.size(); ++i) {s << ba[i]; if (i < ba.size() - 1) s << ", ";} s << "}"; s.restoreControl(); return s;} diff --git a/src/core/pibytearray.h b/src/core/pibytearray.h index 52733d1b..040ba0c0 100755 --- a/src/core/pibytearray.h +++ b/src/core/pibytearray.h @@ -28,7 +28,13 @@ # define PIP_BYTEARRAY_STREAM_ANY_TYPE #endif + +#include "pichar.h" #include "pibitarray.h" +#include "pimap.h" + +__PICONTAINERS_SIMPLE_TYPE__(PIChar) + class PIString; class PIByteArray; @@ -118,7 +124,7 @@ inline bool operator <(const PIByteArray & v0, const PIByteArray & v1) {if (v0.s inline std::ostream & operator <<(std::ostream & s, const PIByteArray & ba) {s << "{"; for (uint i = 0; i < ba.size(); ++i) {s << ba[i]; if (i < ba.size() - 1) s << ", ";} s << "}"; return s;} //! \relatesalso PIByteArray \brief Output to PICout operator -inline PICout operator <<(PICout s, const PIByteArray & ba) {s.space(); s.setControl(0, true); s << "{"; for (uint i = 0; i < ba.size(); ++i) {s << ba[i]; if (i < ba.size() - 1) s << ", ";} s << "}"; s.restoreControl(); return s;} +PICout operator <<(PICout s, const PIByteArray & ba); #define PBA_OPERATOR_TO int os = s.size_s(); s.enlarge(sizeof(v)); memcpy(s.data(os), &v, sizeof(v)); @@ -197,22 +203,22 @@ template inline PIByteArray & operator <<(PIByte //! \relatesalso PIByteArray \brief Store operator template inline PIByteArray & operator <<(PIByteArray & s, const PIVector & v); //! \relatesalso PIByteArray \brief Store operator -template inline PIByteArray & operator <<(PIByteArray & s, const PIList & v); -//! \relatesalso PIByteArray \brief Store operator template inline PIByteArray & operator <<(PIByteArray & s, const PIDeque & v); //! \relatesalso PIByteArray \brief Store operator template inline PIByteArray & operator <<(PIByteArray & s, const PIMap & v); +//! Write operator to \c PIByteArray +inline PIByteArray & operator <<(PIByteArray & s, const PIChar & v) {s << v.ch; return s;} //! \relatesalso PIByteArray \brief Restore operator template inline PIByteArray & operator >>(PIByteArray & s, PIPair & v); //! \relatesalso PIByteArray \brief Restore operator template inline PIByteArray & operator >>(PIByteArray & s, PIVector & v); //! \relatesalso PIByteArray \brief Restore operator -template inline PIByteArray & operator >>(PIByteArray & s, PIList & v); -//! \relatesalso PIByteArray \brief Restore operator template inline PIByteArray & operator >>(PIByteArray & s, PIDeque & v); //! \relatesalso PIByteArray \brief Restore operator template inline PIByteArray & operator >>(PIByteArray & s, PIMap & v); +//! Read operator from \c PIByteArray +inline PIByteArray & operator >>(PIByteArray & s, PIChar & v) {s >> v.ch; return s;} //! \relatesalso PIByteArray \brief Store operator @@ -222,8 +228,6 @@ inline PIByteArray & operator <<(PIByteArray & s, const PIPair & v template inline PIByteArray & operator <<(PIByteArray & s, const PIVector & v) {s << int(v.size_s()); for (uint i = 0; i < v.size(); ++i) s << v[i]; return s;} template -inline PIByteArray & operator <<(PIByteArray & s, const PIList & v) {s << int(v.size_s()); for (uint i = 0; i < v.size(); ++i) s << v[i]; return s;} -template inline PIByteArray & operator <<(PIByteArray & s, const PIDeque & v) {s << int(v.size_s()); for (uint i = 0; i < v.size(); ++i) s << v[i]; return s;} template inline PIByteArray & operator <<(PIByteArray & s, const PIMap & v) { @@ -234,6 +238,7 @@ inline PIByteArray & operator <<(PIByteArray & s, const PIMap & v) { return s; } + //! \relatesalso PIByteArray \brief Restore operator inline PIByteArray & operator >>(PIByteArray & s, PIBitArray & v) {assert(s.size_s() >= 8); s >> v.size_ >> v.data_; return s;} template @@ -241,8 +246,6 @@ inline PIByteArray & operator >>(PIByteArray & s, PIPair & v) {s > template inline PIByteArray & operator >>(PIByteArray & s, PIVector & v) {assert(s.size_s() >= 4); int sz; s >> sz; v.resize(sz); for (int i = 0; i < sz; ++i) s >> v[i]; return s;} template -inline PIByteArray & operator >>(PIByteArray & s, PIList & v) {assert(s.size_s() >= 4); int sz; s >> sz; v.resize(sz); for (int i = 0; i < sz; ++i) s >> v[i]; return s;} -template inline PIByteArray & operator >>(PIByteArray & s, PIDeque & v) {assert(s.size_s() >= 4); int sz; s >> sz; v.resize(sz); for (int i = 0; i < sz; ++i) s >> v[i]; return s;} template inline PIByteArray & operator >>(PIByteArray & s, PIMap & v) { diff --git a/src/core/pichar.cpp b/src/core/pichar.cpp index d7d9e6a4..508f396a 100644 --- a/src/core/pichar.cpp +++ b/src/core/pichar.cpp @@ -20,6 +20,7 @@ along with this program. If not, see . */ +#include "pibytearray.h" #include "pichar.h" #ifdef PIP_ICU # include "unicode/ucnv.h" diff --git a/src/core/pichar.h b/src/core/pichar.h index ef2c80cd..af6d38b0 100755 --- a/src/core/pichar.h +++ b/src/core/pichar.h @@ -23,7 +23,7 @@ #ifndef PICHAR_H #define PICHAR_H -#include "pibytearray.h" +#include "piincludes.h" #ifdef PIP_ICU extern char * __syslocname__; @@ -157,22 +157,12 @@ private: }; -__PICONTAINERS_SIMPLE_TYPE__(PIChar) - //! Output operator to \c std::ostream std::ostream & operator <<(std::ostream & s, const PIChar & v); //! Output operator to \a PICout PICout operator <<(PICout s, const PIChar & v); - -//! Write operator to \c PIByteArray -inline PIByteArray & operator <<(PIByteArray & s, const PIChar & v) {s << v.ch; return s;} - -//! Read operator from \c PIByteArray -inline PIByteArray & operator >>(PIByteArray & s, PIChar & v) {s >> v.ch; return s;} - - //! Compare operator inline bool operator ==(const char v, const PIChar & c) {return (PIChar(v) == c);} diff --git a/src/core/picout.cpp b/src/core/picout.cpp index 6f301433..a678b4fc 100644 --- a/src/core/picout.cpp +++ b/src/core/picout.cpp @@ -23,6 +23,8 @@ #endif #include "picout.h" #include "piconsole.h" +#include "pibytearray.h" +#include "pistack.h" #ifdef WINDOWS # include # include diff --git a/src/core/picout.h b/src/core/picout.h index fdb62838..ff4cddd8 100644 --- a/src/core/picout.h +++ b/src/core/picout.h @@ -107,7 +107,6 @@ namespace PICoutManipulators { typedef PIFlags PICoutControls; }; -//using namespace PICoutManipulators; class PIP_EXPORT PICout { diff --git a/src/core/piflags.h b/src/core/piflags.h index 0ef33ba8..167e88e7 100644 --- a/src/core/piflags.h +++ b/src/core/piflags.h @@ -23,7 +23,7 @@ #ifndef PIFLAGS_H #define PIFLAGS_H -#include "pimonitor.h" +#include "pip_export.h" /*! \brief This class used as container for bit flags * \details PIFlags is wrapper around \c "int". There are many diff --git a/src/core/piincludes.h b/src/core/piincludes.h index 6f2077fa..8748d0cd 100755 --- a/src/core/piincludes.h +++ b/src/core/piincludes.h @@ -22,6 +22,7 @@ #include "pibase.h" #include "piflags.h" +#include "pimonitor.h" #include //#include @@ -39,16 +40,13 @@ extern PIMonitor piMonitor; -#ifndef QNX - using std::wstring; -#else - typedef std::basic_string wstring; -#endif - class PIObject; class PIMutex; class PIString; +class PIByteArray; class PIInit; +class PIChar; +class PICout; struct lconv; extern lconv * currentLocale; diff --git a/src/core/piincludes_p.h b/src/core/piincludes_p.h new file mode 100644 index 00000000..d0a77268 --- /dev/null +++ b/src/core/piincludes_p.h @@ -0,0 +1,29 @@ +/* + PIP - Platform Independent Primitives + Initialization + Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +#ifndef PIINCLUDES_P_H +#define PIINCLUDES_P_H +#include "pibase.h" +#ifdef WINDOWS +# include +# include +#endif +#ifdef CC_GCC +# include +#endif +#endif // PIINCLUDES_P_H diff --git a/src/core/piinit.cpp b/src/core/piinit.cpp index 29ce3657..0de6fed8 100644 --- a/src/core/piinit.cpp +++ b/src/core/piinit.cpp @@ -1,7 +1,7 @@ /* PIP - Platform Independent Primitives Initialization - Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru + Copyright (C) 2016 Ivan Pelipenko peri4ko@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,12 +17,8 @@ along with this program. If not, see . */ -#include "piplatform.h" +#include "piincludes_p.h" #include "piinit.h" -#ifdef WINDOWS -# include -# include -#endif #include "pitime.h" #include "pisignals.h" #include "piobject.h" @@ -54,9 +50,6 @@ # include # include #endif -#ifdef CC_GCC -# include -#endif /* #ifdef WINDOWS # include diff --git a/src/core/piobject.h b/src/core/piobject.h index a90174cc..d5e88408 100755 --- a/src/core/piobject.h +++ b/src/core/piobject.h @@ -28,6 +28,7 @@ #include "piinit.h" #include "pivariant.h" #include "pimutex.h" +#include "piset.h" #ifdef DOXYGEN diff --git a/src/core/pistring.h b/src/core/pistring.h index f812d803..f90b31f8 100755 --- a/src/core/pistring.h +++ b/src/core/pistring.h @@ -26,8 +26,11 @@ #define PISTRING_H #include "pibytearray.h" -#include "pichar.h" - +#ifndef QNX + using std::wstring; +#else + typedef std::basic_string wstring; +#endif #define PIStringAscii PIString::fromAscii class PIStringList; diff --git a/src/core/pitime.cpp b/src/core/pitime.cpp index 42cc035b..14042067 100755 --- a/src/core/pitime.cpp +++ b/src/core/pitime.cpp @@ -16,11 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "pibase.h" -#ifdef WINDOWS -# include -# include -#endif +#include "piincludes_p.h" #include "pitime.h" #include "pisystemtests.h" #ifdef WINDOWS @@ -38,9 +34,6 @@ #ifdef QNX # include #endif -#ifdef CC_GCC -# include -#endif /*! \class PISystemTime * \brief System time diff --git a/src/core/pitime.h b/src/core/pitime.h index ea6eaa7d..92f259c7 100755 --- a/src/core/pitime.h +++ b/src/core/pitime.h @@ -24,7 +24,7 @@ #define PITIME_H #include "pistring.h" #ifdef WINDOWS -# include +# include typedef void(*PINtSetTimerResolution)(ULONG, BOOLEAN, PULONG); #endif diff --git a/src/core/pivariant.h b/src/core/pivariant.h index dcb76187..3cb73709 100755 --- a/src/core/pivariant.h +++ b/src/core/pivariant.h @@ -26,7 +26,6 @@ #define PIVARIANT_H #include "pivarianttypes.h" -#include "pibitarray.h" #include "pitime.h" #include "pimathbase.h" diff --git a/src/core/pivarianttypes.h b/src/core/pivarianttypes.h index d9f4735c..25fd3568 100644 --- a/src/core/pivarianttypes.h +++ b/src/core/pivarianttypes.h @@ -26,7 +26,6 @@ #define PIVARIANTYPES_H #include "pistring.h" -#include "pibytearray.h" namespace PIVariantTypes { diff --git a/src/io/pidiagnostics.h b/src/io/pidiagnostics.h index e7ef773c..f83fe6c6 100755 --- a/src/io/pidiagnostics.h +++ b/src/io/pidiagnostics.h @@ -24,6 +24,7 @@ #define PIDIAGNOSTICS_H #include "pitimer.h" +#include "piqueue.h" class PIP_EXPORT PIDiagnostics: public PITimer diff --git a/src/io/pidir.cpp b/src/io/pidir.cpp index 86eb213f..648ae2a0 100755 --- a/src/io/pidir.cpp +++ b/src/io/pidir.cpp @@ -16,11 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "pibase.h" -#ifdef WINDOWS -# include -# include -#endif +#include "piincludes_p.h" #include "pidir.h" //#if !defined(ANDROID) @@ -42,9 +38,6 @@ const PIChar PIDir::separator = '/'; # endif # include #endif -#ifdef CC_GCC -# include -#endif /*! \class PIDir * \brief Local directory diff --git a/src/io/piethernet.cpp b/src/io/piethernet.cpp index 39c82717..50a7a1ef 100755 --- a/src/io/piethernet.cpp +++ b/src/io/piethernet.cpp @@ -16,11 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "pibase.h" -#ifdef WINDOWS -# include -# include -#endif +#include "piincludes_p.h" #include "piethernet.h" #include "piconfig.h" #include "pisysteminfo.h" @@ -67,9 +63,6 @@ # endif #endif #include -#ifdef CC_GCC -# include -#endif /** \class PIEthernet diff --git a/src/io/pifile.cpp b/src/io/pifile.cpp index c7456c01..01860b2c 100755 --- a/src/io/pifile.cpp +++ b/src/io/pifile.cpp @@ -16,11 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "pibase.h" -#ifdef WINDOWS -# include -# include -#endif +#include "piincludes_p.h" #include "pifile.h" #include "pidir.h" #ifdef WINDOWS @@ -65,9 +61,6 @@ # define _stat_call_ stat64 # define _stat_link_ lstat64 #endif -#ifdef CC_GCC -# include -#endif /*! \class PIFile diff --git a/src/io/piiodevice.h b/src/io/piiodevice.h index a033b826..6f1d9a47 100755 --- a/src/io/piiodevice.h +++ b/src/io/piiodevice.h @@ -26,6 +26,7 @@ #include "piinit.h" #include "picollection.h" #include "pitimer.h" +#include "piqueue.h" // function executed from threaded read, pass ThreadedReadData, readedData, sizeOfData typedef bool (*ReadRetFunc)(void * , uchar * , int ); diff --git a/src/io/piserial.cpp b/src/io/piserial.cpp index dc3daeaa..c4c10f89 100755 --- a/src/io/piserial.cpp +++ b/src/io/piserial.cpp @@ -16,18 +16,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "pibase.h" -#ifdef WINDOWS -# include -# include -#endif +#include "piincludes_p.h" #include "piserial.h" #include "piconfig.h" #include "pidir.h" #include -#ifdef CC_GCC -# include -#endif #ifdef WINDOWS # include # define TIOCM_LE 1 diff --git a/src/io/pisharedmemory.cpp b/src/io/pisharedmemory.cpp index a4e7e667..0903eb82 100644 --- a/src/io/pisharedmemory.cpp +++ b/src/io/pisharedmemory.cpp @@ -16,11 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "pibase.h" -#ifdef WINDOWS -# include -# include -#endif +#include "piincludes_p.h" #include "pisharedmemory.h" #ifdef WINDOWS @@ -36,9 +32,6 @@ # include # include #endif -#ifdef CC_GCC -# include -#endif /*! \class PISharedMemory diff --git a/src/math/pimathbase.h b/src/math/pimathbase.h index 2dd91972..662f4f52 100644 --- a/src/math/pimathbase.h +++ b/src/math/pimathbase.h @@ -25,6 +25,7 @@ #include "piinit.h" #include "pibytearray.h" +#include #ifdef QNX # undef PIP_MATH_J0 # undef PIP_MATH_J1 @@ -33,13 +34,7 @@ # undef PIP_MATH_Y1 # undef PIP_MATH_YN # include -# ifdef BLACKBERRY -# include -# else -# include -# endif #else -# include # include #endif diff --git a/src/system/piprocess.cpp b/src/system/piprocess.cpp index 022823d5..ec028540 100755 --- a/src/system/piprocess.cpp +++ b/src/system/piprocess.cpp @@ -17,11 +17,7 @@ along with this program. If not, see . */ -#include "pibase.h" -#ifdef WINDOWS -# include -# include -#endif +#include "piincludes_p.h" #include "piprocess.h" #ifndef WINDOWS # include @@ -30,9 +26,6 @@ #ifdef MAC_OS # include #endif -#ifdef CC_GCC -# include -#endif PRIVATE_DEFINITION_START(PIProcess) #ifdef WINDOWS diff --git a/src/system/pisignals.h b/src/system/pisignals.h index 249cccae..601fd242 100755 --- a/src/system/pisignals.h +++ b/src/system/pisignals.h @@ -23,7 +23,7 @@ #ifndef PISIGNALS_H #define PISIGNALS_H -#include "picontainers.h" +#include "piincludes.h" class PIP_EXPORT PISignals { diff --git a/src/system/pisystemmonitor.cpp b/src/system/pisystemmonitor.cpp index e3a05e77..061de480 100755 --- a/src/system/pisystemmonitor.cpp +++ b/src/system/pisystemmonitor.cpp @@ -17,19 +17,12 @@ along with this program. If not, see . */ -#include "pibase.h" -#ifdef WINDOWS -# include -# include -#endif +#include "piincludes_p.h" #include "pisystemmonitor.h" #include "pisysteminfo.h" #ifdef WINDOWS # include #endif -#ifdef CC_GCC -# include -#endif PISystemMonitor::PISystemMonitor(): PIThread() { diff --git a/src/thread/pithread.cpp b/src/thread/pithread.cpp index 0a0e4d85..688081ce 100755 --- a/src/thread/pithread.cpp +++ b/src/thread/pithread.cpp @@ -17,11 +17,7 @@ along with this program. If not, see . */ -#include "pibase.h" -#ifdef WINDOWS -# include -# include -#endif +#include "piincludes_p.h" #include "pithread.h" #include "pisystemtests.h" #include "piintrospection_proxy.h" @@ -33,9 +29,6 @@ #ifdef MAC_OS # include #endif -#ifdef CC_GCC -# include -#endif /*! \class PIThread * \brief Thread class