git-svn-id: svn://db.shs.com.ru/pip@367 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -16,20 +16,13 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "pibase.h"
|
||||
#ifdef WINDOWS
|
||||
# include <windef.h>
|
||||
# include <winbase.h>
|
||||
#endif
|
||||
#include "piincludes_p.h"
|
||||
#include "pikbdlistener.h"
|
||||
#ifndef WINDOWS
|
||||
# include <termios.h>
|
||||
#else
|
||||
# include <wincon.h>
|
||||
#endif
|
||||
#ifdef CC_GCC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
/** \class PIKbdListener
|
||||
* \brief Keyboard console input listener
|
||||
|
||||
@@ -16,16 +16,9 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "pibase.h"
|
||||
#ifdef WINDOWS
|
||||
# include <windef.h>
|
||||
# include <winbase.h>
|
||||
#endif
|
||||
#include "piincludes_p.h"
|
||||
#include "piterminal.h"
|
||||
# include "pisharedmemory.h"
|
||||
#ifdef CC_GCC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#ifdef WINDOWS
|
||||
# include <windows.h>
|
||||
# include <wincon.h>
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#define PICONTAINERS_H
|
||||
|
||||
#include "picout.h"
|
||||
#include <list>
|
||||
|
||||
#include <malloc.h>
|
||||
#ifndef PIP_MEMALIGN_BYTES
|
||||
@@ -48,31 +47,6 @@
|
||||
# define afree(p) free(p)
|
||||
#endif
|
||||
|
||||
template<typename Type0, typename Type1>
|
||||
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<typename Type0, typename Type1>
|
||||
inline bool operator <(const PIPair<Type0, Type1> & value0, const PIPair<Type0, Type1> & value1) {return value0.first < value1.first;}
|
||||
template<typename Type0, typename Type1>
|
||||
inline bool operator ==(const PIPair<Type0, Type1> & value0, const PIPair<Type0, Type1> & value1) {return (value0.first == value1.first) && (value0.second == value1.second);}
|
||||
template<typename Type0, typename Type1>
|
||||
inline bool operator !=(const PIPair<Type0, Type1> & value0, const PIPair<Type0, Type1> & value1) {return (value0.first != value1.first) || (value0.second != value1.second);}
|
||||
template<typename Type0, typename Type1>
|
||||
inline std::ostream & operator <<(std::ostream & s, const PIPair<Type0, Type1> & v) {s << "(" << v.first << ", " << v.second << ")"; return s;}
|
||||
template<typename Type0, typename Type1>
|
||||
inline PICout operator <<(PICout s, const PIPair<Type0, Type1> & 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 <typename T> inline _PIForeachC<T> * _PIForeachCastC(_PIForeachBase & c
|
||||
|
||||
#endif // DOXYGEN
|
||||
|
||||
template<typename Type, typename Allocator = std::allocator<Type> >
|
||||
class PIP_EXPORT PIList: public std::list<Type, Allocator> {
|
||||
typedef PIList<Type, Allocator> _CList;
|
||||
typedef std::list<Type, Allocator> _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<int>(_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<Type> toVector() const {PIVector<Type> 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<typename T>
|
||||
inline std::ostream & operator <<(std::ostream & s, const PIDeque<T> & v) {s << "{"; for (size_t i = 0; i < v.size(); ++i) {s << v[i]; if (i < v.size() - 1) s << ", ";} s << "}"; return s;}
|
||||
|
||||
45
src/containers/pilist.h
Normal file
45
src/containers/pilist.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef PILIST_H
|
||||
#define PILIST_H
|
||||
#include "pivector.h"
|
||||
#include <list>
|
||||
|
||||
template<typename Type, typename Allocator = std::allocator<Type> >
|
||||
class PIP_EXPORT PIList: public std::list<Type, Allocator> {
|
||||
typedef PIList<Type, Allocator> _CList;
|
||||
typedef std::list<Type, Allocator> _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<int>(_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<Type> toVector() const {PIVector<Type> v; for (typename _stlc::const_iterator i = _stlc::begin(); i != _stlc::end(); ++i) v << *i; return v;}
|
||||
};
|
||||
|
||||
//! \relatesalso PIByteArray \brief Store operator
|
||||
template<typename T> inline PIByteArray & operator <<(PIByteArray & s, const PIList<T> & v);
|
||||
//! \relatesalso PIByteArray \brief Restore operator
|
||||
template<typename T> inline PIByteArray & operator >>(PIByteArray & s, PIList<T> & v);
|
||||
|
||||
template<typename T>
|
||||
inline PIByteArray & operator <<(PIByteArray & s, const PIList<T> & v) {s << int(v.size_s()); for (uint i = 0; i < v.size(); ++i) s << v[i]; return s;}
|
||||
template<typename T>
|
||||
inline PIByteArray & operator >>(PIByteArray & s, PIList<T> & 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
|
||||
@@ -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)
|
||||
|
||||
|
||||
26
src/containers/pipair.h
Normal file
26
src/containers/pipair.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef PIPAIR_H
|
||||
#define PIPAIR_H
|
||||
|
||||
#include "pibase.h"
|
||||
class PICout;
|
||||
|
||||
template<typename Type0, typename Type1>
|
||||
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<typename Type0, typename Type1>
|
||||
inline bool operator <(const PIPair<Type0, Type1> & value0, const PIPair<Type0, Type1> & value1) {return value0.first < value1.first;}
|
||||
template<typename Type0, typename Type1>
|
||||
inline bool operator ==(const PIPair<Type0, Type1> & value0, const PIPair<Type0, Type1> & value1) {return (value0.first == value1.first) && (value0.second == value1.second);}
|
||||
template<typename Type0, typename Type1>
|
||||
inline bool operator !=(const PIPair<Type0, Type1> & value0, const PIPair<Type0, Type1> & value1) {return (value0.first != value1.first) || (value0.second != value1.second);}
|
||||
template<typename Type0, typename Type1>
|
||||
inline std::ostream & operator <<(std::ostream & s, const PIPair<Type0, Type1> & v) {s << "(" << v.first << ", " << v.second << ")"; return s;}
|
||||
template<typename Type0, typename Type1>
|
||||
inline PICout operator <<(PICout s, const PIPair<Type0, Type1> & v) {s.space(); s.setControl(0, true); s << "(" << v.first << ", " << v.second << ")"; s.restoreControl(); return s;}
|
||||
|
||||
#endif // PIPAIR_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<typename T>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;}
|
||||
|
||||
@@ -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<typename Type0, typename Type1> inline PIByteArray & operator <<(PIByte
|
||||
//! \relatesalso PIByteArray \brief Store operator
|
||||
template<typename T> inline PIByteArray & operator <<(PIByteArray & s, const PIVector<T> & v);
|
||||
//! \relatesalso PIByteArray \brief Store operator
|
||||
template<typename T> inline PIByteArray & operator <<(PIByteArray & s, const PIList<T> & v);
|
||||
//! \relatesalso PIByteArray \brief Store operator
|
||||
template<typename T> inline PIByteArray & operator <<(PIByteArray & s, const PIDeque<T> & v);
|
||||
//! \relatesalso PIByteArray \brief Store operator
|
||||
template <typename Key, typename T> inline PIByteArray & operator <<(PIByteArray & s, const PIMap<Key, T> & 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<typename Type0, typename Type1> inline PIByteArray & operator >>(PIByteArray & s, PIPair<Type0, Type1> & v);
|
||||
//! \relatesalso PIByteArray \brief Restore operator
|
||||
template<typename T> inline PIByteArray & operator >>(PIByteArray & s, PIVector<T> & v);
|
||||
//! \relatesalso PIByteArray \brief Restore operator
|
||||
template<typename T> inline PIByteArray & operator >>(PIByteArray & s, PIList<T> & v);
|
||||
//! \relatesalso PIByteArray \brief Restore operator
|
||||
template<typename T> inline PIByteArray & operator >>(PIByteArray & s, PIDeque<T> & v);
|
||||
//! \relatesalso PIByteArray \brief Restore operator
|
||||
template <typename Key, typename T> inline PIByteArray & operator >>(PIByteArray & s, PIMap<Key, T> & 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<Type0, Type1> & v
|
||||
template<typename T>
|
||||
inline PIByteArray & operator <<(PIByteArray & s, const PIVector<T> & v) {s << int(v.size_s()); for (uint i = 0; i < v.size(); ++i) s << v[i]; return s;}
|
||||
template<typename T>
|
||||
inline PIByteArray & operator <<(PIByteArray & s, const PIList<T> & v) {s << int(v.size_s()); for (uint i = 0; i < v.size(); ++i) s << v[i]; return s;}
|
||||
template<typename T>
|
||||
inline PIByteArray & operator <<(PIByteArray & s, const PIDeque<T> & v) {s << int(v.size_s()); for (uint i = 0; i < v.size(); ++i) s << v[i]; return s;}
|
||||
template <typename Key, typename T>
|
||||
inline PIByteArray & operator <<(PIByteArray & s, const PIMap<Key, T> & v) {
|
||||
@@ -234,6 +238,7 @@ inline PIByteArray & operator <<(PIByteArray & s, const PIMap<Key, T> & 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<typename Type0, typename Type1>
|
||||
@@ -241,8 +246,6 @@ inline PIByteArray & operator >>(PIByteArray & s, PIPair<Type0, Type1> & v) {s >
|
||||
template<typename T>
|
||||
inline PIByteArray & operator >>(PIByteArray & s, PIVector<T> & 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<typename T>
|
||||
inline PIByteArray & operator >>(PIByteArray & s, PIList<T> & 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<typename T>
|
||||
inline PIByteArray & operator >>(PIByteArray & s, PIDeque<T> & 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 <typename Key, typename T>
|
||||
inline PIByteArray & operator >>(PIByteArray & s, PIMap<Key, T> & v) {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "pibytearray.h"
|
||||
#include "pichar.h"
|
||||
#ifdef PIP_ICU
|
||||
# include "unicode/ucnv.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);}
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#endif
|
||||
#include "picout.h"
|
||||
#include "piconsole.h"
|
||||
#include "pibytearray.h"
|
||||
#include "pistack.h"
|
||||
#ifdef WINDOWS
|
||||
# include <windows.h>
|
||||
# include <wincon.h>
|
||||
|
||||
@@ -107,7 +107,6 @@ namespace PICoutManipulators {
|
||||
typedef PIFlags<PICoutControl> PICoutControls;
|
||||
};
|
||||
|
||||
//using namespace PICoutManipulators;
|
||||
|
||||
|
||||
class PIP_EXPORT PICout {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "pibase.h"
|
||||
#include "piflags.h"
|
||||
#include "pimonitor.h"
|
||||
|
||||
#include <iostream>
|
||||
//#include <stdlib.h>
|
||||
@@ -39,16 +40,13 @@
|
||||
|
||||
extern PIMonitor piMonitor;
|
||||
|
||||
#ifndef QNX
|
||||
using std::wstring;
|
||||
#else
|
||||
typedef std::basic_string<wchar_t> wstring;
|
||||
#endif
|
||||
|
||||
class PIObject;
|
||||
class PIMutex;
|
||||
class PIString;
|
||||
class PIByteArray;
|
||||
class PIInit;
|
||||
class PIChar;
|
||||
class PICout;
|
||||
struct lconv;
|
||||
|
||||
extern lconv * currentLocale;
|
||||
|
||||
29
src/core/piincludes_p.h
Normal file
29
src/core/piincludes_p.h
Normal file
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef PIINCLUDES_P_H
|
||||
#define PIINCLUDES_P_H
|
||||
#include "pibase.h"
|
||||
#ifdef WINDOWS
|
||||
# include <windef.h>
|
||||
# include <winbase.h>
|
||||
#endif
|
||||
#ifdef CC_GCC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#endif // PIINCLUDES_P_H
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "piplatform.h"
|
||||
#include "piincludes_p.h"
|
||||
#include "piinit.h"
|
||||
#ifdef WINDOWS
|
||||
# include <windef.h>
|
||||
# include <winbase.h>
|
||||
#endif
|
||||
#include "pitime.h"
|
||||
#include "pisignals.h"
|
||||
#include "piobject.h"
|
||||
@@ -54,9 +50,6 @@
|
||||
# include <unicode/uclean.h>
|
||||
# include <unicode/ucnv.h>
|
||||
#endif
|
||||
#ifdef CC_GCC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
/*
|
||||
#ifdef WINDOWS
|
||||
# include <conio.h>
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "piinit.h"
|
||||
#include "pivariant.h"
|
||||
#include "pimutex.h"
|
||||
#include "piset.h"
|
||||
|
||||
|
||||
#ifdef DOXYGEN
|
||||
|
||||
@@ -26,8 +26,11 @@
|
||||
#define PISTRING_H
|
||||
|
||||
#include "pibytearray.h"
|
||||
#include "pichar.h"
|
||||
|
||||
#ifndef QNX
|
||||
using std::wstring;
|
||||
#else
|
||||
typedef std::basic_string<wchar_t> wstring;
|
||||
#endif
|
||||
#define PIStringAscii PIString::fromAscii
|
||||
|
||||
class PIStringList;
|
||||
|
||||
@@ -16,11 +16,7 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "pibase.h"
|
||||
#ifdef WINDOWS
|
||||
# include <windef.h>
|
||||
# include <winbase.h>
|
||||
#endif
|
||||
#include "piincludes_p.h"
|
||||
#include "pitime.h"
|
||||
#include "pisystemtests.h"
|
||||
#ifdef WINDOWS
|
||||
@@ -38,9 +34,6 @@
|
||||
#ifdef QNX
|
||||
# include <time.h>
|
||||
#endif
|
||||
#ifdef CC_GCC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
/*! \class PISystemTime
|
||||
* \brief System time
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#define PITIME_H
|
||||
#include "pistring.h"
|
||||
#ifdef WINDOWS
|
||||
# include <windef.h>
|
||||
# include <minwindef.h>
|
||||
typedef void(*PINtSetTimerResolution)(ULONG, BOOLEAN, PULONG);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#define PIVARIANT_H
|
||||
|
||||
#include "pivarianttypes.h"
|
||||
#include "pibitarray.h"
|
||||
#include "pitime.h"
|
||||
#include "pimathbase.h"
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#define PIVARIANTYPES_H
|
||||
|
||||
#include "pistring.h"
|
||||
#include "pibytearray.h"
|
||||
|
||||
|
||||
namespace PIVariantTypes {
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#define PIDIAGNOSTICS_H
|
||||
|
||||
#include "pitimer.h"
|
||||
#include "piqueue.h"
|
||||
|
||||
|
||||
class PIP_EXPORT PIDiagnostics: public PITimer
|
||||
|
||||
@@ -16,11 +16,7 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "pibase.h"
|
||||
#ifdef WINDOWS
|
||||
# include <windef.h>
|
||||
# include <winbase.h>
|
||||
#endif
|
||||
#include "piincludes_p.h"
|
||||
#include "pidir.h"
|
||||
|
||||
//#if !defined(ANDROID)
|
||||
@@ -42,9 +38,6 @@ const PIChar PIDir::separator = '/';
|
||||
# endif
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
#ifdef CC_GCC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
/*! \class PIDir
|
||||
* \brief Local directory
|
||||
|
||||
@@ -16,11 +16,7 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "pibase.h"
|
||||
#ifdef WINDOWS
|
||||
# include <windef.h>
|
||||
# include <winbase.h>
|
||||
#endif
|
||||
#include "piincludes_p.h"
|
||||
#include "piethernet.h"
|
||||
#include "piconfig.h"
|
||||
#include "pisysteminfo.h"
|
||||
@@ -67,9 +63,6 @@
|
||||
# endif
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#ifdef CC_GCC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
/** \class PIEthernet
|
||||
|
||||
@@ -16,11 +16,7 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "pibase.h"
|
||||
#ifdef WINDOWS
|
||||
# include <windef.h>
|
||||
# include <winbase.h>
|
||||
#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 <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*! \class PIFile
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -16,18 +16,11 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "pibase.h"
|
||||
#ifdef WINDOWS
|
||||
# include <windef.h>
|
||||
# include <winbase.h>
|
||||
#endif
|
||||
#include "piincludes_p.h"
|
||||
#include "piserial.h"
|
||||
#include "piconfig.h"
|
||||
#include "pidir.h"
|
||||
#include <errno.h>
|
||||
#ifdef CC_GCC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#ifdef WINDOWS
|
||||
# include <winreg.h>
|
||||
# define TIOCM_LE 1
|
||||
|
||||
@@ -16,11 +16,7 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "pibase.h"
|
||||
#ifdef WINDOWS
|
||||
# include <windef.h>
|
||||
# include <winbase.h>
|
||||
#endif
|
||||
#include "piincludes_p.h"
|
||||
#include "pisharedmemory.h"
|
||||
#ifdef WINDOWS
|
||||
|
||||
@@ -36,9 +32,6 @@
|
||||
# include <sys/stat.h>
|
||||
# include <sys/mman.h>
|
||||
#endif
|
||||
#ifdef CC_GCC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*! \class PISharedMemory
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "piinit.h"
|
||||
#include "pibytearray.h"
|
||||
#include <complex>
|
||||
#ifdef QNX
|
||||
# undef PIP_MATH_J0
|
||||
# undef PIP_MATH_J1
|
||||
@@ -33,13 +34,7 @@
|
||||
# undef PIP_MATH_Y1
|
||||
# undef PIP_MATH_YN
|
||||
# include <math.h>
|
||||
# ifdef BLACKBERRY
|
||||
# include <complex>
|
||||
# else
|
||||
# include <complex>
|
||||
# endif
|
||||
#else
|
||||
# include <complex>
|
||||
# include <cmath>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -17,11 +17,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "pibase.h"
|
||||
#ifdef WINDOWS
|
||||
# include <windef.h>
|
||||
# include <winbase.h>
|
||||
#endif
|
||||
#include "piincludes_p.h"
|
||||
#include "piprocess.h"
|
||||
#ifndef WINDOWS
|
||||
# include <sys/wait.h>
|
||||
@@ -30,9 +26,6 @@
|
||||
#ifdef MAC_OS
|
||||
# include <crt_externs.h>
|
||||
#endif
|
||||
#ifdef CC_GCC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
PRIVATE_DEFINITION_START(PIProcess)
|
||||
#ifdef WINDOWS
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#ifndef PISIGNALS_H
|
||||
#define PISIGNALS_H
|
||||
|
||||
#include "picontainers.h"
|
||||
#include "piincludes.h"
|
||||
|
||||
class PIP_EXPORT PISignals
|
||||
{
|
||||
|
||||
@@ -17,19 +17,12 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "pibase.h"
|
||||
#ifdef WINDOWS
|
||||
# include <windef.h>
|
||||
# include <winbase.h>
|
||||
#endif
|
||||
#include "piincludes_p.h"
|
||||
#include "pisystemmonitor.h"
|
||||
#include "pisysteminfo.h"
|
||||
#ifdef WINDOWS
|
||||
# include <tlhelp32.h>
|
||||
#endif
|
||||
#ifdef CC_GCC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
PISystemMonitor::PISystemMonitor(): PIThread() {
|
||||
|
||||
@@ -17,11 +17,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "pibase.h"
|
||||
#ifdef WINDOWS
|
||||
# include <windef.h>
|
||||
# include <winbase.h>
|
||||
#endif
|
||||
#include "piincludes_p.h"
|
||||
#include "pithread.h"
|
||||
#include "pisystemtests.h"
|
||||
#include "piintrospection_proxy.h"
|
||||
@@ -33,9 +29,6 @@
|
||||
#ifdef MAC_OS
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
#ifdef CC_GCC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
/*! \class PIThread
|
||||
* \brief Thread class
|
||||
|
||||
Reference in New Issue
Block a user