git-svn-id: svn://db.shs.com.ru/pip@368 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -538,8 +538,11 @@ __PIDEQUE_SIMPLE_TYPE__(float)
|
|||||||
__PIDEQUE_SIMPLE_TYPE__(double)
|
__PIDEQUE_SIMPLE_TYPE__(double)
|
||||||
__PIDEQUE_SIMPLE_TYPE__(ldouble)
|
__PIDEQUE_SIMPLE_TYPE__(ldouble)
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef PIP_STD_IOSTREAM
|
||||||
template<typename T>
|
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;}
|
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;}
|
||||||
|
#endif
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline PICout operator <<(PICout s, const PIDeque<T> & v) {s.space(); s.setControl(0, true); s << "{"; for (size_t i = 0; i < v.size(); ++i) {s << v[i]; if (i < v.size() - 1) s << ", ";} s << "}"; s.restoreControl(); return s;}
|
inline PICout operator <<(PICout s, const PIDeque<T> & v) {s.space(); s.setControl(0, true); s << "{"; for (size_t i = 0; i < v.size(); ++i) {s << v[i]; if (i < v.size() - 1) s << ", ";} s << "}"; s.restoreControl(); return s;}
|
||||||
|
|||||||
@@ -428,6 +428,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef PIP_STD_IOSTREAM
|
||||||
template<typename Key, typename Type>
|
template<typename Key, typename Type>
|
||||||
inline std::ostream & operator <<(std::ostream & s, const PIMap<Key, Type> & v) {
|
inline std::ostream & operator <<(std::ostream & s, const PIMap<Key, Type> & v) {
|
||||||
s << "{";
|
s << "{";
|
||||||
@@ -441,6 +442,7 @@ inline std::ostream & operator <<(std::ostream & s, const PIMap<Key, Type> & v)
|
|||||||
s << "}";
|
s << "}";
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template<typename Key, typename Type>
|
template<typename Key, typename Type>
|
||||||
inline PICout operator <<(PICout s, const PIMap<Key, Type> & v) {
|
inline PICout operator <<(PICout s, const PIMap<Key, Type> & v) {
|
||||||
|
|||||||
@@ -18,8 +18,10 @@ 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);}
|
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>
|
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);}
|
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>
|
template<typename Type0, typename Type1>
|
||||||
inline std::ostream & operator <<(std::ostream & s, const PIPair<Type0, Type1> & v) {s << "(" << v.first << ", " << v.second << ")"; return s;}
|
inline std::ostream & operator <<(std::ostream & s, const PIPair<Type0, Type1> & v) {s << "(" << v.first << ", " << v.second << ")"; return s;}
|
||||||
|
|
||||||
template<typename Type0, typename Type1>
|
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;}
|
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;}
|
||||||
|
|
||||||
|
|||||||
@@ -538,8 +538,10 @@ __PIVECTOR_SIMPLE_TYPE__(double)
|
|||||||
__PIVECTOR_SIMPLE_TYPE__(ldouble)
|
__PIVECTOR_SIMPLE_TYPE__(ldouble)
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef PIP_STD_IOSTREAM
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline std::ostream & operator <<(std::ostream & s, const PIVector<T> & v) {s << "{"; for (size_t i = 0; i < v.size(); ++i) {s << v[i]; if (i < v.size() - 1) s << ", ";} s << "}"; return s;}
|
inline std::ostream & operator <<(std::ostream & s, const PIVector<T> & v) {s << "{"; for (size_t i = 0; i < v.size(); ++i) {s << v[i]; if (i < v.size() - 1) s << ", ";} s << "}"; return s;}
|
||||||
|
#endif
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline PICout operator <<(PICout s, const PIVector<T> & v) {s.space(); s.setControl(0, true); s << "{"; for (size_t i = 0; i < v.size(); ++i) {s << v[i]; if (i < v.size() - 1) s << ", ";} s << "}"; s.restoreControl(); return s;}
|
inline PICout operator <<(PICout s, const PIVector<T> & v) {s.space(); s.setControl(0, true); s << "{"; for (size_t i = 0; i < v.size(); ++i) {s << v[i]; if (i < v.size() - 1) s << ", ";} s << "}"; s.restoreControl(); return s;}
|
||||||
|
|||||||
24
src/core/pibitarray.cpp
Normal file
24
src/core/pibitarray.cpp
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#include "pibitarray.h"
|
||||||
|
#include "picout.h"
|
||||||
|
|
||||||
|
|
||||||
|
PICout operator <<(PICout s, const PIBitArray & ba) {
|
||||||
|
s.space();
|
||||||
|
s.setControl(0, true);
|
||||||
|
for (uint i = 0; i < ba.bitSize(); ++i) {
|
||||||
|
s << int(ba[i]);
|
||||||
|
if (i % 8 == 7) s << ' ';
|
||||||
|
}
|
||||||
|
s.restoreControl();
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::ostream &operator <<(std::ostream & s, const PIBitArray & ba) {
|
||||||
|
for (uint i = 0; i < ba.bitSize(); ++i) {
|
||||||
|
s << ba[i];
|
||||||
|
if (i % 8 == 7) s << ' ';
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -100,7 +100,8 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::ostream & operator <<(std::ostream & s, const PIBitArray & ba) {for (uint i = 0; i < ba.bitSize(); ++i) {s << ba[i]; if (i % 8 == 7) s << ' ';} return s;}
|
std::ostream & operator <<(std::ostream & s, const PIBitArray & ba);
|
||||||
inline PICout operator <<(PICout s, const PIBitArray & ba) {s.space(); s.setControl(0, true); for (uint i = 0; i < ba.bitSize(); ++i) {s << int(ba[i]); if (i % 8 == 7) s << ' ';} s.restoreControl(); return s;}
|
|
||||||
|
inline PICout operator <<(PICout s, const PIBitArray & ba);
|
||||||
|
|
||||||
#endif // PIBITARRAY_H
|
#endif // PIBITARRAY_H
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "pibytearray.h"
|
#include "pibytearray.h"
|
||||||
#include "pistring.h"
|
#include "pistring.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
/*! \class PIByteArray
|
/*! \class PIByteArray
|
||||||
* \brief Byte array
|
* \brief Byte array
|
||||||
@@ -346,4 +347,26 @@ PIByteArray PIByteArray::fromHex(PIString str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -120,8 +120,9 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator <(const PIByteArray & v0, const PIByteArray & v1) {if (v0.size() == v1.size()) {for (uint i = 0; i < v0.size(); ++i) if (v0[i] != v1[i]) return v0[i] < v1[i]; return false;} return v0.size() < v1.size();}
|
inline bool operator <(const PIByteArray & v0, const PIByteArray & v1) {if (v0.size() == v1.size()) {for (uint i = 0; i < v0.size(); ++i) if (v0[i] != v1[i]) return v0[i] < v1[i]; return false;} return v0.size() < v1.size();}
|
||||||
|
|
||||||
//! \relatesalso PIByteArray \brief Output to std::ostream operator
|
//! \relatesalso PIByteArray \brief Output to std::ostream operator
|
||||||
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;}
|
inline std::ostream & operator <<(std::ostream & s, const PIByteArray & ba);
|
||||||
|
|
||||||
//! \relatesalso PIByteArray \brief Output to PICout operator
|
//! \relatesalso PIByteArray \brief Output to PICout operator
|
||||||
PICout operator <<(PICout s, const PIByteArray & ba);
|
PICout operator <<(PICout s, const PIByteArray & ba);
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include "pibytearray.h"
|
#include "pibytearray.h"
|
||||||
#include "pichar.h"
|
|
||||||
#ifdef PIP_ICU
|
#ifdef PIP_ICU
|
||||||
# include "unicode/ucnv.h"
|
# include "unicode/ucnv.h"
|
||||||
# include "unicode/ustring.h"
|
# include "unicode/ustring.h"
|
||||||
|
|||||||
@@ -16,11 +16,7 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "pibase.h"
|
#include "piincludes_p.h"
|
||||||
#ifdef WINDOWS
|
|
||||||
# include <windef.h>
|
|
||||||
# include <winbase.h>
|
|
||||||
#endif
|
|
||||||
#include "picout.h"
|
#include "picout.h"
|
||||||
#include "piconsole.h"
|
#include "piconsole.h"
|
||||||
#include "pibytearray.h"
|
#include "pibytearray.h"
|
||||||
@@ -30,6 +26,7 @@
|
|||||||
# include <wincon.h>
|
# include <wincon.h>
|
||||||
# define COMMON_LVB_UNDERSCORE 0x8000
|
# define COMMON_LVB_UNDERSCORE 0x8000
|
||||||
#endif
|
#endif
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
/*! \class PICout
|
/*! \class PICout
|
||||||
* \brief Class for formatted output similar std::cout
|
* \brief Class for formatted output similar std::cout
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include "piflags.h"
|
#include "piflags.h"
|
||||||
#include "pimonitor.h"
|
#include "pimonitor.h"
|
||||||
|
|
||||||
#include <iostream>
|
//#include <iostream>
|
||||||
//#include <stdlib.h>
|
//#include <stdlib.h>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -47,6 +47,8 @@ class PIByteArray;
|
|||||||
class PIInit;
|
class PIInit;
|
||||||
class PIChar;
|
class PIChar;
|
||||||
class PICout;
|
class PICout;
|
||||||
|
#include <iosfwd>
|
||||||
|
|
||||||
struct lconv;
|
struct lconv;
|
||||||
|
|
||||||
extern lconv * currentLocale;
|
extern lconv * currentLocale;
|
||||||
|
|||||||
@@ -26,4 +26,6 @@
|
|||||||
#ifdef CC_GCC
|
#ifdef CC_GCC
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
#endif // PIINCLUDES_P_H
|
#endif // PIINCLUDES_P_H
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pistring.h"
|
#include "pistring.h"
|
||||||
|
#include <iostream>
|
||||||
#ifdef PIP_ICU
|
#ifdef PIP_ICU
|
||||||
# include "unicode/ucnv.h"
|
# include "unicode/ucnv.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -429,6 +430,12 @@ bool PIString::operator >(const PIString & str) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PIString &PIString::operator +=(const std::string & str) {
|
||||||
|
appendFromChars(str.c_str(), str.length());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PIString PIString::mid(const int start, const int len) const {
|
PIString PIString::mid(const int start, const int len) const {
|
||||||
//PIString str;
|
//PIString str;
|
||||||
int s = start, l = len;
|
int s = start, l = len;
|
||||||
@@ -861,6 +868,16 @@ std::string PIString::convertToStd() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAS_LOCALE
|
||||||
|
std::wstring PIString::convertToWString() const {
|
||||||
|
std::wstring s;
|
||||||
|
for (int i = 0; i < length(); ++i)
|
||||||
|
s.push_back(at(i).toWChar());
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
char PIString::toChar() const {
|
char PIString::toChar() const {
|
||||||
PIString s(toNativeDecimalPoints());
|
PIString s(toNativeDecimalPoints());
|
||||||
char v;
|
char v;
|
||||||
@@ -985,3 +1002,14 @@ PIStringList& PIStringList::removeDuplicates() {
|
|||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::ostream &operator <<(std::ostream & s, const PIStringList & v) {
|
||||||
|
s << "{";
|
||||||
|
for (uint i = 0; i < v.size(); ++i) {
|
||||||
|
s << "\"" << v[i] << "\"";
|
||||||
|
if (i < v.size() - 1) s << ", ";
|
||||||
|
}
|
||||||
|
s << "}";
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|||||||
@@ -26,12 +26,11 @@
|
|||||||
#define PISTRING_H
|
#define PISTRING_H
|
||||||
|
|
||||||
#include "pibytearray.h"
|
#include "pibytearray.h"
|
||||||
#ifndef QNX
|
#define PIStringAscii PIString::fromAscii
|
||||||
using std::wstring;
|
#include <string>
|
||||||
#else
|
#ifdef QNX
|
||||||
typedef std::basic_string<wchar_t> wstring;
|
typedef std::basic_string<wchar_t> wstring;
|
||||||
#endif
|
#endif
|
||||||
#define PIStringAscii PIString::fromAscii
|
|
||||||
|
|
||||||
class PIStringList;
|
class PIStringList;
|
||||||
|
|
||||||
@@ -46,11 +45,11 @@ public:
|
|||||||
PIString & operator +=(const PIChar & c) {push_back(c); return *this;}
|
PIString & operator +=(const PIChar & c) {push_back(c); return *this;}
|
||||||
PIString & operator +=(const char * str);
|
PIString & operator +=(const char * str);
|
||||||
PIString & operator +=(const wchar_t * str);
|
PIString & operator +=(const wchar_t * str);
|
||||||
PIString & operator +=(const std::string & str) {appendFromChars(str.c_str(), str.length()); return *this;}
|
PIString & operator +=(const std::string & str);
|
||||||
PIString & operator +=(const PIByteArray & ba) {appendFromChars((const char * )ba.data(), ba.size_s()); return *this;}
|
PIString & operator +=(const PIByteArray & ba) {appendFromChars((const char * )ba.data(), ba.size_s()); return *this;}
|
||||||
PIString & operator +=(const PIString & str);
|
PIString & operator +=(const PIString & str);
|
||||||
#ifdef HAS_LOCALE
|
#ifdef HAS_LOCALE
|
||||||
PIString & operator +=(const wstring & str);
|
PIString & operator +=(const std::wstring & str);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//PIString(const char c) {*this += c;}
|
//PIString(const char c) {*this += c;}
|
||||||
@@ -86,7 +85,7 @@ public:
|
|||||||
|
|
||||||
/*! \brief Contructs string from "len" characters of buffer "str"
|
/*! \brief Contructs string from "len" characters of buffer "str"
|
||||||
* \details Example: \snippet pistring.cpp PIString(char * , int) */
|
* \details Example: \snippet pistring.cpp PIString(char * , int) */
|
||||||
PIString(const char * str, const int len): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this += std::string(str, len);}
|
PIString(const char * str, const int len): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; appendFromChars(str, len);}
|
||||||
|
|
||||||
/*! \brief Contructs string as sequence of characters "c" of buffer with length "len"
|
/*! \brief Contructs string as sequence of characters "c" of buffer with length "len"
|
||||||
* \details Example: \snippet pistring.cpp PIString(int, char) */
|
* \details Example: \snippet pistring.cpp PIString(int, char) */
|
||||||
@@ -500,7 +499,7 @@ public:
|
|||||||
|
|
||||||
//! \brief Return \c std::string representation of this string
|
//! \brief Return \c std::string representation of this string
|
||||||
std::string stdString() const {return convertToStd();}
|
std::string stdString() const {return convertToStd();}
|
||||||
|
|
||||||
#ifdef HAS_LOCALE
|
#ifdef HAS_LOCALE
|
||||||
wstring stdWString() const {return convertToWString();}
|
wstring stdWString() const {return convertToWString();}
|
||||||
#endif
|
#endif
|
||||||
@@ -841,7 +840,7 @@ private:
|
|||||||
void trimsubstr(int &st, int &fn) const;
|
void trimsubstr(int &st, int &fn) const;
|
||||||
std::string convertToStd() const;
|
std::string convertToStd() const;
|
||||||
#ifdef HAS_LOCALE
|
#ifdef HAS_LOCALE
|
||||||
wstring convertToWString() const {wstring s; for (int i = 0; i < length(); ++i) s.push_back(at(i).toWChar()); return s;}
|
std::wstring convertToWString() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mutable PIByteArray data_;
|
mutable PIByteArray data_;
|
||||||
@@ -970,7 +969,7 @@ inline PIByteArray & operator >>(PIByteArray & s, PIStringList & v) {int sz; s >
|
|||||||
|
|
||||||
|
|
||||||
//! \relatesalso PIStringList \brief Output operator to std::ostream (cout)
|
//! \relatesalso PIStringList \brief Output operator to std::ostream (cout)
|
||||||
inline std::ostream & operator <<(std::ostream & s, const PIStringList & v) {s << "{"; for (uint i = 0; i < v.size(); ++i) {s << "\"" << v[i] << "\""; if (i < v.size() - 1) s << ", ";} s << "}"; return s;}
|
std::ostream & operator <<(std::ostream & s, const PIStringList & v);
|
||||||
|
|
||||||
//! \relatesalso PIStringList \relatesalso PICout \brief Output operator to PICout
|
//! \relatesalso PIStringList \relatesalso PICout \brief Output operator to PICout
|
||||||
inline PICout operator <<(PICout s, const PIStringList & v) {s.space(); s.setControl(0, true); s << "{"; for (uint i = 0; i < v.size(); ++i) {s << "\"" << v[i] << "\""; if (i < v.size() - 1) s << ", ";} s << "}"; s.restoreControl(); return s;}
|
inline PICout operator <<(PICout s, const PIStringList & v) {s.space(); s.setControl(0, true); s << "{"; for (uint i = 0; i < v.size(); ++i) {s << "\"" << v[i] << "\""; if (i < v.size() - 1) s << ", ";} s << "}"; s.restoreControl(); return s;}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "piconfig.h"
|
#include "piconfig.h"
|
||||||
#include "pifile.h"
|
#include "pifile.h"
|
||||||
#include "piiostring.h"
|
#include "piiostring.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
/*! \class PIConfig
|
/*! \class PIConfig
|
||||||
* \brief Configuration file
|
* \brief Configuration file
|
||||||
@@ -222,7 +223,7 @@ PIConfig::Branch PIConfig::Entry::getValues(const PIString & vname) {
|
|||||||
if (i->_name.find(vname) >= 0)
|
if (i->_name.find(vname) >= 0)
|
||||||
b << i;
|
b << i;
|
||||||
return b;
|
return b;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PIConfig::Entry::entryExists(const Entry * e, const PIString & name) const {
|
bool PIConfig::Entry::entryExists(const Entry * e, const PIString & name) const {
|
||||||
@@ -235,6 +236,22 @@ bool PIConfig::Entry::entryExists(const Entry * e, const PIString & name) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PIConfig::Entry::coutt(std::ostream & s, const PIString & p) const {
|
||||||
|
PIString nl = p + " ";
|
||||||
|
if (!_value.isEmpty()) s << p << _name << " = " << _value << std::endl;
|
||||||
|
else std::cout << p << _name << std::endl;
|
||||||
|
piForeachC (Entry * i, _children) i->coutt(s, nl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PIConfig::Entry::piCoutt(PICout s, const PIString & p) const {
|
||||||
|
PIString nl = p + " ";
|
||||||
|
if (!_value.isEmpty()) s << p << _name << " = " << _value << PICoutManipulators::NewLine;
|
||||||
|
else std::cout << p << _name << std::endl;
|
||||||
|
piForeachC (Entry * i, _children) i->piCoutt(s, nl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PIConfig::PIConfig(const PIString & path, PIIODevice::DeviceMode mode) {
|
PIConfig::PIConfig(const PIString & path, PIIODevice::DeviceMode mode) {
|
||||||
_init();
|
_init();
|
||||||
own_dev = true;
|
own_dev = true;
|
||||||
|
|||||||
@@ -303,8 +303,8 @@ public:
|
|||||||
bool entryExists(const Entry * e, const PIString & name) const;
|
bool entryExists(const Entry * e, const PIString & name) const;
|
||||||
void buildLine() {_all = _tab + _full_name + " = " + _value + " #" + _type + " " + _comment;}
|
void buildLine() {_all = _tab + _full_name + " = " + _value + " #" + _type + " " + _comment;}
|
||||||
void clear() {_children.clear(); _name = _value = _type = _comment = _all = PIString(); _line = 0; _parent = 0;}
|
void clear() {_children.clear(); _name = _value = _type = _comment = _all = PIString(); _line = 0; _parent = 0;}
|
||||||
void coutt(std::ostream & s, const PIString & p) const {PIString nl = p + " "; if (!_value.isEmpty()) s << p << _name << " = " << _value << std::endl; else std::cout << p << _name << std::endl; piForeachC (Entry * i, _children) i->coutt(s, nl);}
|
void coutt(std::ostream & s, const PIString & p) const;
|
||||||
void piCoutt(PICout s, const PIString & p) const {PIString nl = p + " "; if (!_value.isEmpty()) s << p << _name << " = " << _value << PICoutManipulators::NewLine; else std::cout << p << _name << std::endl; piForeachC (Entry * i, _children) i->piCoutt(s, nl);}
|
void piCoutt(PICout s, const PIString & p) const;
|
||||||
void deleteBranch() {piForeach (Entry * i, _children) {i->deleteBranch(); delete i;}}
|
void deleteBranch() {piForeach (Entry * i, _children) {i->deleteBranch(); delete i;}}
|
||||||
|
|
||||||
static Entry _empty;
|
static Entry _empty;
|
||||||
|
|||||||
@@ -159,8 +159,8 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <uint L>
|
//template <uint L>
|
||||||
inline std::ostream & operator <<(std::ostream & s, const uint_cl<L> & v) {std::ios::fmtflags f = s.flags(); s << std::hex; for (uint i = 0; i < v.length(); ++i) {s << int(v.data()[i]); if (v.data()[i] < 0x10) s << '0'; s << ' ';} s.flags(f); return s;}
|
//inline std::ostream & operator <<(std::ostream & s, const uint_cl<L> & v) {std::ios::fmtflags f = s.flags(); s << std::hex; for (uint i = 0; i < v.length(); ++i) {s << int(v.data()[i]); if (v.data()[i] < 0x10) s << '0'; s << ' ';} s.flags(f); return s;}
|
||||||
|
|
||||||
inline uchar reverseByte(uchar b) {
|
inline uchar reverseByte(uchar b) {
|
||||||
uchar ret = 0;
|
uchar ret = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user