doc ru
This commit is contained in:
@@ -142,7 +142,7 @@ void PIScreen::SystemConsole::resize(int w, int h) {
|
|||||||
pcells.resize(height);
|
pcells.resize(height);
|
||||||
for (int i = 0; i < height; ++i) {
|
for (int i = 0; i < height; ++i) {
|
||||||
cells[i].resize(width);
|
cells[i].resize(width);
|
||||||
pcells[i].resize(width, Cell(0));
|
pcells[i].resize(width, Cell(PIChar()));
|
||||||
}
|
}
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
PRIVATE->sbi.srWindow = PRIVATE->csbi.srWindow;
|
PRIVATE->sbi.srWindow = PRIVATE->csbi.srWindow;
|
||||||
|
|||||||
@@ -691,7 +691,7 @@ bool TileInput::keyEvent(PIKbdListener::KeyEvent key) {
|
|||||||
default:
|
default:
|
||||||
PIChar tc
|
PIChar tc
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
= PIChar(key.key);
|
= PIChar((ushort)key.key);
|
||||||
#else
|
#else
|
||||||
= PIChar::fromUTF8((char *)&(key.key));
|
= PIChar::fromUTF8((char *)&(key.key));
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -239,9 +239,9 @@ void PITerminal::write(PIKbdListener::KeyEvent ke) {
|
|||||||
else {
|
else {
|
||||||
PIByteArray ba;
|
PIByteArray ba;
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
ba << uchar(PIChar(ke.key).toConsole1Byte());
|
ba << uchar(PIChar((ushort)ke.key).toConsole1Byte());
|
||||||
#else
|
#else
|
||||||
ba = PIString(PIChar(ke.key)).toUTF8();
|
ba = PIString(PIChar((ushort)ke.key)).toUTF8();
|
||||||
#endif
|
#endif
|
||||||
write(ba);
|
write(ba);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ PIAuth::State PIAuth::receive(PIByteArray & ba) {
|
|||||||
passwordRequest(&ps);
|
passwordRequest(&ps);
|
||||||
if (ps.isEmpty()) return disconnect(ba, "Canceled by user");
|
if (ps.isEmpty()) return disconnect(ba, "Canceled by user");
|
||||||
ph = crypt.passwordHash(ps, PIString("PIAuth").toByteArray());
|
ph = crypt.passwordHash(ps, PIString("PIAuth").toByteArray());
|
||||||
ps.fill(PIChar(0));
|
ps.fill(PIChar());
|
||||||
tba.clear();
|
tba.clear();
|
||||||
tba << ph << auth_sign << sign_pk;
|
tba << ph << auth_sign << sign_pk;
|
||||||
tba = crypt.crypt(tba, box_pk, box_sk);
|
tba = crypt.crypt(tba, box_pk, box_sk);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ PIString PICodeParser::Macro::expand(PIString args_, bool * ok) const {
|
|||||||
const PIString & an(args[i]), av(arg_vals[i]);
|
const PIString & an(args[i]), av(arg_vals[i]);
|
||||||
int ind(-1);
|
int ind(-1);
|
||||||
while ((ind = ret.find(an, ind + 1)) >= 0) {
|
while ((ind = ret.find(an, ind + 1)) >= 0) {
|
||||||
PIChar ppc(0), pc(0), nc(0);
|
PIChar ppc, pc, nc;
|
||||||
if (ind > 1) ppc = ret[ind - 2];
|
if (ind > 1) ppc = ret[ind - 2];
|
||||||
if (ind > 0) pc = ret[ind - 1];
|
if (ind > 0) pc = ret[ind - 1];
|
||||||
if (ind + an.size_s() < ret.size_s()) nc = ret.mid(ind + an.size_s(),1)[0];
|
if (ind + an.size_s() < ret.size_s()) nc = ret.mid(ind + an.size_s(),1)[0];
|
||||||
@@ -279,7 +279,7 @@ bool PICodeParser::parseFileContent(PIString & fc, bool main) {
|
|||||||
piForeachC (Define & d, defines) {
|
piForeachC (Define & d, defines) {
|
||||||
int ind(-1);
|
int ind(-1);
|
||||||
while ((ind = pfc.find(d.first, ind + 1)) >= 0) {
|
while ((ind = pfc.find(d.first, ind + 1)) >= 0) {
|
||||||
PIChar pc(0), nc(0);
|
PIChar pc, nc;
|
||||||
if (ind > 0) pc = pfc[ind - 1];
|
if (ind > 0) pc = pfc[ind - 1];
|
||||||
if (ind + d.first.size_s() < pfc.size_s()) nc = pfc.mid(ind + d.first.size_s(),1)[0];
|
if (ind + d.first.size_s() < pfc.size_s()) nc = pfc.mid(ind + d.first.size_s(),1)[0];
|
||||||
if (_isCChar(pc) || _isCChar(nc) || nc.isDigit()) continue;
|
if (_isCChar(pc) || _isCChar(nc) || nc.isDigit()) continue;
|
||||||
@@ -291,7 +291,7 @@ bool PICodeParser::parseFileContent(PIString & fc, bool main) {
|
|||||||
piForeachC (Macro & m, macros) {
|
piForeachC (Macro & m, macros) {
|
||||||
int ind(-1);
|
int ind(-1);
|
||||||
while ((ind = pfc.find(m.name, ind + 1)) >= 0) {
|
while ((ind = pfc.find(m.name, ind + 1)) >= 0) {
|
||||||
PIChar pc(0), nc(0);
|
PIChar pc, nc;
|
||||||
if (ind > 0) pc = pfc[ind - 1];
|
if (ind > 0) pc = pfc[ind - 1];
|
||||||
if (ind + m.name.size_s() < pfc.size_s()) nc = pfc.mid(ind + m.name.size_s(),1)[0];
|
if (ind + m.name.size_s() < pfc.size_s()) nc = pfc.mid(ind + m.name.size_s(),1)[0];
|
||||||
if (_isCChar(pc) || _isCChar(nc) || nc.isDigit()) continue;
|
if (_isCChar(pc) || _isCChar(nc) || nc.isDigit()) continue;
|
||||||
|
|||||||
@@ -20,11 +20,18 @@
|
|||||||
* \~\brief
|
* \~\brief
|
||||||
* \~english This module contains various standart containers realization.
|
* \~english This module contains various standart containers realization.
|
||||||
* \~russian Модуль содержит основные классы контейнеров.
|
* \~russian Модуль содержит основные классы контейнеров.
|
||||||
|
*
|
||||||
* \~\details
|
* \~\details
|
||||||
|
* Scope | Use
|
||||||
|
* ----- | -------
|
||||||
|
* C++ | #include <picontainersmodule.h>
|
||||||
|
* CMake | PIP
|
||||||
|
*
|
||||||
* \~english This includes
|
* \~english This includes
|
||||||
* \~russian В него входят
|
* \~russian В него входят
|
||||||
* \~ \a PIVector, \a PIDeque, \a PIMap, \a PISet,
|
* \~ \a PIVector, \a PIDeque, \a PIMap, \a PISet,
|
||||||
* \a PIStack, \a PIQueue, \a PIPair, \a PIVector2D.
|
* \a PIStack, \a PIQueue, \a PIPair, \a PIVector2D.
|
||||||
|
*
|
||||||
* \authors
|
* \authors
|
||||||
* \~english
|
* \~english
|
||||||
* Ivan Pelipenko peri4ko@yandex.ru;
|
* Ivan Pelipenko peri4ko@yandex.ru;
|
||||||
@@ -33,6 +40,7 @@
|
|||||||
* Иван Пелипенко peri4ko@yandex.ru;
|
* Иван Пелипенко peri4ko@yandex.ru;
|
||||||
* Андрей Бычков work.a.b@yandex.ru;
|
* Андрей Бычков work.a.b@yandex.ru;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PICONTAINERSMODULE_H
|
#ifndef PICONTAINERSMODULE_H
|
||||||
#define PICONTAINERSMODULE_H
|
#define PICONTAINERSMODULE_H
|
||||||
|
|
||||||
|
|||||||
@@ -21,11 +21,14 @@
|
|||||||
#include "pistringlist.h"
|
#include "pistringlist.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
//! \class PIByteArray
|
//! \addtogroup Core
|
||||||
|
//! \{
|
||||||
|
//! \class PIByteArray pibytearray.h
|
||||||
//!
|
//!
|
||||||
//! \~\brief
|
//! \~\brief
|
||||||
//! \~english The PIByteArray class provides an array of bytes
|
//! \~english The %PIByteArray class provides an array of bytes
|
||||||
//! \~russian Класс PIByteArray представляет собой массив байтов
|
//! \~russian Класс %PIByteArray представляет собой массив байтов
|
||||||
|
//! \}
|
||||||
//!
|
//!
|
||||||
//! \~\details
|
//! \~\details
|
||||||
//! \~english
|
//! \~english
|
||||||
|
|||||||
@@ -231,8 +231,8 @@ inline std::ostream & operator <<(std::ostream & s, const PIByteArray & ba);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//! \relatesalso PIByteArray
|
//! \relatesalso PIByteArray
|
||||||
//! \~english Output to PICout operator
|
//! \~english Output operator to \a PICout
|
||||||
//! \~russian Оператор вывода в PICout
|
//! \~russian Оператор вывода в \a PICout
|
||||||
PIP_EXPORT PICout operator <<(PICout s, const PIByteArray & ba);
|
PIP_EXPORT PICout operator <<(PICout s, const PIByteArray & ba);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
/*! \file pichar.h
|
|
||||||
* \brief Unicode char
|
|
||||||
*/
|
|
||||||
/*
|
/*
|
||||||
PIP - Platform Independent Primitives
|
PIP - Platform Independent Primitives
|
||||||
Unicode char
|
Unicode char
|
||||||
@@ -45,11 +42,24 @@ char * __utf8name__ = 0;
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*! \class PIChar
|
//! \addtogroup Core
|
||||||
* \brief Unicode char
|
//! \{
|
||||||
* \details This class is wrapper around \c "uint".
|
//! \class PIChar pichar.h
|
||||||
* There are many contructors and information functions
|
//!
|
||||||
*/
|
//! \~\brief
|
||||||
|
//! \~english %PIChar represents a single character
|
||||||
|
//! \~russian %PIChar представляет собой один символ строки
|
||||||
|
//!
|
||||||
|
//! \~\details
|
||||||
|
//! \~english
|
||||||
|
//! This class is wrapper around UTF16.
|
||||||
|
//! There are many contructors and information functions
|
||||||
|
//!
|
||||||
|
//! \~russian
|
||||||
|
//! %PIChar хранит один сивол в UTF16. Имеет много контрукторов, геттеров в различные
|
||||||
|
//! кодировки (системную, консольную, UTF8) и информационных функций.
|
||||||
|
//!
|
||||||
|
//! \}
|
||||||
|
|
||||||
|
|
||||||
ushort charFromCodepage(const char * c, int size, const char * codepage, int * taken = 0) {
|
ushort charFromCodepage(const char * c, int size, const char * codepage, int * taken = 0) {
|
||||||
@@ -324,7 +334,7 @@ char PIChar::toSystem() const {
|
|||||||
|
|
||||||
|
|
||||||
PIChar PIChar::toUpper() const {
|
PIChar PIChar::toUpper() const {
|
||||||
if (isAscii()) return PIChar(toupper(ch));
|
if (isAscii()) return PIChar((ushort)toupper(ch));
|
||||||
#ifdef PIP_ICU
|
#ifdef PIP_ICU
|
||||||
UChar c(0);
|
UChar c(0);
|
||||||
UErrorCode e((UErrorCode)0);
|
UErrorCode e((UErrorCode)0);
|
||||||
@@ -342,7 +352,7 @@ PIChar PIChar::toUpper() const {
|
|||||||
|
|
||||||
|
|
||||||
PIChar PIChar::toLower() const {
|
PIChar PIChar::toLower() const {
|
||||||
if (isAscii()) return PIChar(tolower(ch));
|
if (isAscii()) return PIChar((ushort)tolower(ch));
|
||||||
#ifdef PIP_ICU
|
#ifdef PIP_ICU
|
||||||
UChar c(0);
|
UChar c(0);
|
||||||
UErrorCode e((UErrorCode)0);
|
UErrorCode e((UErrorCode)0);
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
/*! \file pichar.h
|
/*! \file pichar.h
|
||||||
* \brief Unicode char
|
* \~\brief
|
||||||
|
* \~english Single string character
|
||||||
|
* \~russian Один символ строки
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
PIP - Platform Independent Primitives
|
PIP - Platform Independent Primitives
|
||||||
@@ -34,97 +36,134 @@ class PIP_EXPORT PIChar
|
|||||||
friend class PIString;
|
friend class PIString;
|
||||||
friend PICout PIP_EXPORT operator <<(PICout s, const PIChar & v);
|
friend PICout PIP_EXPORT operator <<(PICout s, const PIChar & v);
|
||||||
public:
|
public:
|
||||||
//! Contructs ascii symbol
|
//! \~english Contructs Ascii symbol
|
||||||
|
//! \~russian Создает символ Ascii
|
||||||
PIChar(const char c) {ch = c; ch &= 0xFF;}
|
PIChar(const char c) {ch = c; ch &= 0xFF;}
|
||||||
|
|
||||||
//! Contructs 2-bytes symbol
|
//! \~english Contructs 2-bytes symbol
|
||||||
|
//! \~russian Создает 2-байтный символ
|
||||||
PIChar(const short c) {ch = c;}
|
PIChar(const short c) {ch = c;}
|
||||||
|
|
||||||
//! Contructs 4-bytes symbol
|
//! \~english Contructs ascii symbol
|
||||||
PIChar(const int c) {ch = c;}
|
//! \~russian Создает символ Ascii
|
||||||
|
PIChar(const uchar c) {ch = c;}
|
||||||
|
|
||||||
//! Contructs ascii symbol
|
//! \~english Contructs 2-bytes symbol
|
||||||
PIChar(const uchar c) {ch = c; ch &= 0xFF;}
|
//! \~russian Создает 2-байтный символ
|
||||||
|
PIChar(const ushort c = 0) {ch = c;}
|
||||||
|
|
||||||
//! Contructs 2-bytes symbol
|
//! \~english Contructs symbol from system locale and no more than 4 bytes of string
|
||||||
PIChar(const ushort c) {ch = c;}
|
//! \~russian Создает символ из системной локали не более 4 байт длины
|
||||||
|
|
||||||
//! Default constructor. Contructs 4-bytes symbol
|
|
||||||
PIChar(const uint c = 0) {ch = c;}
|
|
||||||
|
|
||||||
//! Contructs symbol from no more than 4 bytes of string
|
|
||||||
PIChar(const char * c, int * bytes = 0);
|
PIChar(const char * c, int * bytes = 0);
|
||||||
|
|
||||||
//! Copy operator
|
//! \~english Copy operator
|
||||||
|
//! \~russian Оператор присваивания
|
||||||
PIChar & operator =(const char v) {ch = v; return *this;}
|
PIChar & operator =(const char v) {ch = v; return *this;}
|
||||||
|
|
||||||
//! Compare operator
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
bool operator ==(const PIChar & o) const;
|
bool operator ==(const PIChar & o) const;
|
||||||
|
|
||||||
//! Compare operator
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
bool operator !=(const PIChar & o) const {return !(o == *this);}
|
bool operator !=(const PIChar & o) const {return !(o == *this);}
|
||||||
|
|
||||||
//! Compare operator
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
bool operator >(const PIChar & o) const;
|
bool operator >(const PIChar & o) const;
|
||||||
|
|
||||||
//! Compare operator
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
bool operator <(const PIChar & o) const;
|
bool operator <(const PIChar & o) const;
|
||||||
|
|
||||||
//! Compare operator
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
bool operator >=(const PIChar & o) const;
|
bool operator >=(const PIChar & o) const;
|
||||||
|
|
||||||
//! Compare operator
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
bool operator <=(const PIChar & o) const;
|
bool operator <=(const PIChar & o) const;
|
||||||
|
|
||||||
//! Return \b true if symbol is digit ('0' to '9')
|
//! \~english Returns \b true if symbol is digit ('0' to '9')
|
||||||
|
//! \~russian Возвращает \b true если символ является
|
||||||
bool isDigit() const;
|
bool isDigit() const;
|
||||||
|
|
||||||
//! Return \b true if symbol is HEX digit ('0' to '9', 'a' to 'f', 'A' to 'F')
|
//! \~english Returns \b true if symbol is HEX digit ('0' to '9', 'a' to 'f', 'A' to 'F')
|
||||||
|
//! \~russian Возвращает \b true если символ является HEX цифрой ('0' до '9', 'a' до 'f', 'A' до 'F')
|
||||||
bool isHex() const;
|
bool isHex() const;
|
||||||
|
|
||||||
//! Return \b true if symbol is drawable (without space)
|
//! \~english Returns \b true if symbol is drawable (without space)
|
||||||
|
//! \~russian Возвращает \b true если символ является графическим (исключая пробельные)
|
||||||
bool isGraphical() const;
|
bool isGraphical() const;
|
||||||
|
|
||||||
//! Return \b true if symbol is control byte (< 32 or 127)
|
//! \~english Returns \b true if symbol is control byte (< 32 or 127)
|
||||||
|
//! \~russian Возвращает \b true если символ является контрольным (< 32 or 127)
|
||||||
bool isControl() const;
|
bool isControl() const;
|
||||||
|
|
||||||
//! Return \b true if symbol is in lower case
|
//! \~english Returns \b true if symbol is in lower case
|
||||||
|
//! \~russian Возвращает \b true если символ в нижнем регистре
|
||||||
bool isLower() const;
|
bool isLower() const;
|
||||||
|
|
||||||
//! Return \b true if symbol is in upper case
|
//! \~english Returns \b true if symbol is in upper case
|
||||||
|
//! \~russian Возвращает \b true если символ в верхнем регистре
|
||||||
bool isUpper() const;
|
bool isUpper() const;
|
||||||
|
|
||||||
//! Return \b true if symbol is printable (with space)
|
//! \~english Returns \b true if symbol is printable (with space)
|
||||||
|
//! \~russian Возвращает \b true если символ является печатным (включая пробельные)
|
||||||
bool isPrint() const;
|
bool isPrint() const;
|
||||||
|
|
||||||
//! Return \b true if symbol is space or tab
|
//! \~english Returns \b true if symbol is space or tab
|
||||||
|
//! \~russian Возвращает \b true если символ является пробельным или табуляцией
|
||||||
bool isSpace() const;
|
bool isSpace() const;
|
||||||
|
|
||||||
//! Return \b true if symbol is alphabetical letter
|
//! \~english Returns \b true if symbol is alphabetical letter
|
||||||
|
//! \~russian Возвращает \b true если символ является алфавитной буквой
|
||||||
bool isAlpha() const;
|
bool isAlpha() const;
|
||||||
|
|
||||||
//! Return \b true if symbol is ascii (< 128)
|
//! \~english Returns \b true if symbol is Ascii (< 128)
|
||||||
|
//! \~russian Возвращает \b true если символ является Ascii (< 128)
|
||||||
bool isAscii() const;
|
bool isAscii() const;
|
||||||
|
|
||||||
const wchar_t * toWCharPtr() const;
|
const wchar_t * toWCharPtr() const;
|
||||||
|
|
||||||
//! Return as <tt>"char * "</tt> string
|
//! \~english Returns as <tt>"char * "</tt> string
|
||||||
|
//! \~russian Возвращает символ как указатель на <tt>"char * "</tt>
|
||||||
const char * toCharPtr() const;
|
const char * toCharPtr() const;
|
||||||
|
|
||||||
wchar_t toWChar() const;
|
wchar_t toWChar() const;
|
||||||
|
|
||||||
|
//! \~english Returns symbol as Ascii
|
||||||
|
//! \~russian Возвращает символ в Ascii
|
||||||
char toAscii() const {return ch % 256;}
|
char toAscii() const {return ch % 256;}
|
||||||
|
|
||||||
|
//! \~english Returns symbol as console codepage
|
||||||
|
//! \~russian Возвращает символ в консольной кодировке
|
||||||
char toConsole1Byte() const;
|
char toConsole1Byte() const;
|
||||||
|
|
||||||
|
//! \~english Returns symbol as system codepage
|
||||||
|
//! \~russian Возвращает символ в системной кодировке
|
||||||
char toSystem() const;
|
char toSystem() const;
|
||||||
|
|
||||||
ushort unicode16Code() const {return ch;}
|
ushort unicode16Code() const {return ch;}
|
||||||
|
|
||||||
//! Return symbol in upper case
|
//! \~english Returns symbol in upper case
|
||||||
|
//! \~russian Возвращает символ в нижнем регистре
|
||||||
PIChar toUpper() const;
|
PIChar toUpper() const;
|
||||||
|
|
||||||
//! Return symbol in lower case
|
//! \~english Returns symbol in lower case
|
||||||
|
//! \~russian Возвращает символ в верхнем регистре
|
||||||
PIChar toLower() const;
|
PIChar toLower() const;
|
||||||
|
|
||||||
|
//! \~english Returns symbol from console codepage
|
||||||
|
//! \~russian Возвращает символ из консольной кодировки
|
||||||
static PIChar fromConsole(char c);
|
static PIChar fromConsole(char c);
|
||||||
|
|
||||||
|
//! \~english Returns symbol from system codepage
|
||||||
|
//! \~russian Возвращает символ из системной кодировки
|
||||||
static PIChar fromSystem(char c);
|
static PIChar fromSystem(char c);
|
||||||
|
|
||||||
|
//! \~english Returns symbol from UTF8 codepage
|
||||||
|
//! \~russian Возвращает символ из UTF8 кодировки
|
||||||
static PIChar fromUTF8(const char * c);
|
static PIChar fromUTF8(const char * c);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -132,54 +171,86 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Output operator to \a PICout
|
//! \relatesalso PIChar
|
||||||
|
//! \~english Output operator to \a PICout
|
||||||
|
//! \~russian Оператор вывода в \a PICout
|
||||||
PICout PIP_EXPORT operator <<(PICout s, const PIChar & v);
|
PICout PIP_EXPORT operator <<(PICout s, const PIChar & v);
|
||||||
|
|
||||||
//! Compare operator
|
//! \relatesalso PIChar
|
||||||
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
inline bool operator ==(const char v, const PIChar & c) {return (PIChar(v) == c);}
|
inline bool operator ==(const char v, const PIChar & c) {return (PIChar(v) == c);}
|
||||||
|
|
||||||
//! Compare operator
|
//! \relatesalso PIChar
|
||||||
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
inline bool operator >(const char v, const PIChar & c) {return (PIChar(v) > c);}
|
inline bool operator >(const char v, const PIChar & c) {return (PIChar(v) > c);}
|
||||||
|
|
||||||
//! Compare operator
|
//! \relatesalso PIChar
|
||||||
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
inline bool operator <(const char v, const PIChar & c) {return (PIChar(v) < c);}
|
inline bool operator <(const char v, const PIChar & c) {return (PIChar(v) < c);}
|
||||||
|
|
||||||
//! Compare operator
|
//! \relatesalso PIChar
|
||||||
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
inline bool operator >=(const char v, const PIChar & c) {return (PIChar(v) >= c);}
|
inline bool operator >=(const char v, const PIChar & c) {return (PIChar(v) >= c);}
|
||||||
|
|
||||||
//! Compare operator
|
//! \relatesalso PIChar
|
||||||
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
inline bool operator <=(const char v, const PIChar & c) {return (PIChar(v) <= c);}
|
inline bool operator <=(const char v, const PIChar & c) {return (PIChar(v) <= c);}
|
||||||
|
|
||||||
|
|
||||||
//! Compare operator
|
//! \relatesalso PIChar
|
||||||
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
inline bool operator ==(const char * v, const PIChar & c) {return (PIChar(v) == c);}
|
inline bool operator ==(const char * v, const PIChar & c) {return (PIChar(v) == c);}
|
||||||
|
|
||||||
//! Compare operator
|
//! \relatesalso PIChar
|
||||||
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
inline bool operator >(const char * v, const PIChar & c) {return (PIChar(v) > c);}
|
inline bool operator >(const char * v, const PIChar & c) {return (PIChar(v) > c);}
|
||||||
|
|
||||||
//! Compare operator
|
//! \relatesalso PIChar
|
||||||
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
inline bool operator <(const char * v, const PIChar & c) {return (PIChar(v) < c);}
|
inline bool operator <(const char * v, const PIChar & c) {return (PIChar(v) < c);}
|
||||||
|
|
||||||
//! Compare operator
|
//! \relatesalso PIChar
|
||||||
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
inline bool operator >=(const char * v, const PIChar & c) {return (PIChar(v) >= c);}
|
inline bool operator >=(const char * v, const PIChar & c) {return (PIChar(v) >= c);}
|
||||||
|
|
||||||
//! Compare operator
|
//! \relatesalso PIChar
|
||||||
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
inline bool operator <=(const char * v, const PIChar & c) {return (PIChar(v) <= c);}
|
inline bool operator <=(const char * v, const PIChar & c) {return (PIChar(v) <= c);}
|
||||||
|
|
||||||
|
|
||||||
//! Compare operator
|
//! \relatesalso PIChar
|
||||||
inline bool operator ==(const int v, const PIChar & c) {return (PIChar(v) == c);}
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
|
inline bool operator ==(const int v, const PIChar & c) {return (PIChar((ushort)v) == c);}
|
||||||
|
|
||||||
//! Compare operator
|
//! \relatesalso PIChar
|
||||||
inline bool operator >(const int v, const PIChar & c) {return (PIChar(v) > c);}
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
|
inline bool operator >(const int v, const PIChar & c) {return (PIChar((ushort)v) > c);}
|
||||||
|
|
||||||
//! Compare operator
|
//! \relatesalso PIChar
|
||||||
inline bool operator <(const int v, const PIChar & c) {return (PIChar(v) < c);}
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
|
inline bool operator <(const int v, const PIChar & c) {return (PIChar((ushort)v) < c);}
|
||||||
|
|
||||||
//! Compare operator
|
//! \relatesalso PIChar
|
||||||
inline bool operator >=(const int v, const PIChar & c) {return (PIChar(v) >= c);}
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
|
inline bool operator >=(const int v, const PIChar & c) {return (PIChar((ushort)v) >= c);}
|
||||||
|
|
||||||
//! Compare operator
|
//! \relatesalso PIChar
|
||||||
inline bool operator <=(const int v, const PIChar & c) {return (PIChar(v) <= c);}
|
//! \~english Compare operator
|
||||||
|
//! \~russian Оператор сравнения
|
||||||
|
inline bool operator <=(const int v, const PIChar & c) {return (PIChar((ushort)v) <= c);}
|
||||||
|
|
||||||
#endif // PICHAR_H
|
#endif // PICHAR_H
|
||||||
|
|||||||
@@ -19,45 +19,77 @@
|
|||||||
|
|
||||||
#include "pichunkstream.h"
|
#include "pichunkstream.h"
|
||||||
|
|
||||||
/*! \class PIChunkStream
|
//! \addtogroup Core
|
||||||
* \brief Class for binary serialization
|
//! \{
|
||||||
*
|
//! \class PIChunkStream pichunkstream.h
|
||||||
* \section PIChunkStream_sec0 Synopsis
|
//! \brief
|
||||||
* This class provides very handly mechanism to store and restore values to and from
|
//! \~english Class for binary de/serialization
|
||||||
* \a PIByteArray. The main advantage of using this class is that your binary data
|
//! \~russian Класс для бинарной де/сериализации
|
||||||
* become independent from order and collection of your values.
|
//!
|
||||||
*
|
//! \~english \section PIChunkStream_sec0 Synopsis
|
||||||
* \section PIChunkStream_sec1 Mechanism
|
//! \~russian \section PIChunkStream_sec0 Краткий обзор
|
||||||
* %PIChunkStream works with items called "chunk". Chunk is an ID and any value that
|
//! \~english
|
||||||
* can be stored and restored to \a PIByteArray with stream operators << and >>.
|
//! This class provides very handly mechanism to store and restore values to and from
|
||||||
* You can place chunks to stream and read chunks from stream.
|
//! \a PIByteArray. The main advantage of using this class is that your binary data
|
||||||
*
|
//! become independent from order and collection of your values.
|
||||||
* To construct %PIChunkStream for writing data use any constructor. Empty constructor
|
//!
|
||||||
* creates internal empty buffer that can be accessed by function \a data().
|
//! \~russian
|
||||||
* Non-empty constructor works with given byte array.
|
//! Этот класс предоставляет очень удобный механизм для сохранения и извлечения значений
|
||||||
*
|
//! в/из \a PIByteArray. Главным плюсом является то, что данные не будут зависеть от порядка
|
||||||
* To read chunks from byte array use function \a read() that returns ID of
|
//! и наличия значений.
|
||||||
* next chunk. Then you can get value of this chunk with function \a getData(),
|
//!
|
||||||
* but you should definitely know type of this value. You can read from byte array
|
//! \~english \section PIChunkStream_sec1 Mechanism
|
||||||
* while \a atEnd() if false.
|
//! \~russian \section PIChunkStream_sec1 Механизм
|
||||||
*
|
//! \~english
|
||||||
* \section PIChunkStream_sec2 Examples
|
//! %PIChunkStream works with items called "chunk". Chunk is an ID, size and any value that
|
||||||
*
|
//! can be stored and restored to/from %PIChunkStream with stream operators << and >>.
|
||||||
* Using simple operator and cascade serialization:
|
//!
|
||||||
*
|
//! To construct %PIChunkStream for writing data use any non-default constructor. Empty constructor
|
||||||
* Prepare your structs to work with %PIChunkStream:
|
//! creates internal buffer that can be accessed by function \a data().
|
||||||
* \snippet pichunkstream.cpp struct
|
//! Non-empty constructor works with given byte array.
|
||||||
* Old-style writing to %PIChunkStream:
|
//!
|
||||||
* \snippet pichunkstream.cpp write
|
//! To read chunks from byte array use function \a read() that returns ID of
|
||||||
* Fastest reading from %PIChunkStream:
|
//! readed chunk. Then you can get value of this chunk with functions \a getData() or \a get(),
|
||||||
* \snippet pichunkstream.cpp read
|
//! but you should definitely know type of this value. You can read from byte array
|
||||||
*
|
//! while \a atEnd() if false.
|
||||||
* And next code show how to serialize your struct with %PIChunkStream:
|
//!
|
||||||
* \snippet pichunkstream.cpp write_new
|
//! \~russian
|
||||||
*
|
//! %PIChunkStream работает с элементами под названием "чанк". Чанк имеет ID, размер и значение,
|
||||||
* ... and deserialize:
|
//! и может быть записан или прочитан в/из %PIChunkStream с помощью операторов << и >>.
|
||||||
* \snippet pichunkstream.cpp read_new
|
//!
|
||||||
*/
|
//! Для создания потока на запись используется любой не-умолчальный конструктор. Пустой конструктор
|
||||||
|
//! создает внутренний буфер, который можно получить с помощью метода \a data().
|
||||||
|
//! Непустой конструктор работает с переданным байтовым массивом.
|
||||||
|
//!
|
||||||
|
//! Для чтения чанков из байтового массива используется метод \a read(), который возвращает
|
||||||
|
//! ID прочитанного чанка. Получить значение этого чанка далее можно с помощью методов \a getData() или get(),
|
||||||
|
//! но тип значения должен быть известен. Читать из потока можно пока метод \a atEnd() возвращает ложь.
|
||||||
|
//!
|
||||||
|
//! \~english \section PIChunkStream_sec2 Examples
|
||||||
|
//! \~russian \section PIChunkStream_sec2 Пример
|
||||||
|
//!
|
||||||
|
//! \~english Using simple operator and cascade serialization:
|
||||||
|
//! \~russian Использование простого оператора и каскадная сериализация:
|
||||||
|
//!
|
||||||
|
//! \~english Prepare your structs to work with %PIChunkStream:
|
||||||
|
//! \~russian Подготовка своей структуры для работы с %PIChunkStream:
|
||||||
|
//! \~\snippet pichunkstream.cpp struct
|
||||||
|
//! \~english Old-style writing to %PIChunkStream:
|
||||||
|
//! \~russian Старый стиль использования %PIChunkStream:
|
||||||
|
//! \~\snippet pichunkstream.cpp write
|
||||||
|
//! \~english Fastest reading from %PIChunkStream:
|
||||||
|
//! \~russian Самое быстрое чтение из %PIChunkStream:
|
||||||
|
//! \~\snippet pichunkstream.cpp read
|
||||||
|
//!
|
||||||
|
//! \~english And next code show how to serialize your struct with %PIChunkStream:
|
||||||
|
//! \~russian Следующий код показывает, как сериализовать свою структуру в %PIChunkStream:
|
||||||
|
//! \~\snippet pichunkstream.cpp write_new
|
||||||
|
//!
|
||||||
|
//! \~english ... and deserialize:
|
||||||
|
//! \~russian ... в десериализовать:
|
||||||
|
//! \~\snippet pichunkstream.cpp read_new
|
||||||
|
//!
|
||||||
|
//! \}
|
||||||
|
|
||||||
|
|
||||||
void PIChunkStream::setSource(const PIByteArray & data) {
|
void PIChunkStream::setSource(const PIByteArray & data) {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
/*! \file pichunkstream.h
|
/*! \file pichunkstream.h
|
||||||
* \brief Binary markup serializator
|
* \~\brief
|
||||||
|
* \~english Binary markup de/serializator stream
|
||||||
|
* \~russian Бинарный поток для де/сериализации с разметкой
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
PIP - Platform Independent Primitives
|
PIP - Platform Independent Primitives
|
||||||
@@ -30,20 +32,27 @@ class PIP_EXPORT PIChunkStream
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//! \~english
|
||||||
//! Version of data packing. Read-access %PIChunkStream automatic detect version, but write-access
|
//! Version of data packing. Read-access %PIChunkStream automatic detect version, but write-access
|
||||||
//! %PIChunkStream by default write in new version, be careful!
|
//! %PIChunkStream by default write in new version, be careful!
|
||||||
|
//! \~russian
|
||||||
|
//! Версия хранения данных. %PIChunkStream на чтение автоматически определяет версию, но для записи
|
||||||
|
//! использует по умолчанию новую, осторожно!
|
||||||
enum Version {
|
enum Version {
|
||||||
Version_1 /*! First, old version */,
|
Version_1 /*! \~english First, old version \~russian Первая, старая версия */,
|
||||||
Version_2 /*! Second, more optimized version */ = 2,
|
Version_2 /*! \~english Second, more optimized version \~russian Вторая, более оптимизированная версия */ = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Contructs stream for read from "data"
|
//! \~english Contructs stream for read from "data"
|
||||||
|
//! \~russian Создает поток на чтение из "data"
|
||||||
PIChunkStream(const PIByteArray & data): version_(Version_2) {setSource(data);}
|
PIChunkStream(const PIByteArray & data): version_(Version_2) {setSource(data);}
|
||||||
|
|
||||||
//! Contructs stream for read or write to/from "data", or empty stream for write
|
//! \~english Contructs stream for read or write to/from "data", or empty stream for write if "data" = 0
|
||||||
|
//! \~russian Создает поток на чтение или запись из/в "data", или пустой поток на запись если "data" = 0
|
||||||
PIChunkStream(PIByteArray * data = 0, Version v = Version_2): version_(v) {setSource(data);}
|
PIChunkStream(PIByteArray * data = 0, Version v = Version_2): version_(v) {setSource(data);}
|
||||||
|
|
||||||
//! Contructs empty stream for write with version \"v\"
|
//! \~english Contructs empty stream for write with version \"v\"
|
||||||
|
//! \~russian Создает пустой поток на запись с версией \"v\"
|
||||||
PIChunkStream(Version v): version_(v) {setSource(0);}
|
PIChunkStream(Version v): version_(v) {setSource(0);}
|
||||||
|
|
||||||
~PIChunkStream();
|
~PIChunkStream();
|
||||||
@@ -61,48 +70,64 @@ public:
|
|||||||
const T & data;
|
const T & data;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Returns chunk with ID "id" and value "data" for write to stream
|
//! \~english Returns chunk with ID "id" and value "data" for write to stream
|
||||||
|
//! \~russian Возвращает чанк с ID "id" и значением "data" для записи в поток
|
||||||
template <typename T> static ChunkConst<T> chunk(int id, const T & data) {return ChunkConst<T>(id, data);}
|
template <typename T> static ChunkConst<T> chunk(int id, const T & data) {return ChunkConst<T>(id, data);}
|
||||||
|
|
||||||
//! Add data to this chunk strean with ID "id" and value "data"
|
//! \~english Add to this stream chunk with ID "id" and value "data"
|
||||||
|
//! \~russian Добавляет в этот поток чанк с ID "id" и значением "data"
|
||||||
template <typename T> PIChunkStream & add(int id, const T & data) {*this << ChunkConst<T>(id, data); return *this;}
|
template <typename T> PIChunkStream & add(int id, const T & data) {*this << ChunkConst<T>(id, data); return *this;}
|
||||||
|
|
||||||
|
//! \~english
|
||||||
//! Extract %PIByteArray from "data" and set it current stream.
|
//! Extract %PIByteArray from "data" and set it current stream.
|
||||||
//! If "read_all" then call \a readAll() after extract.
|
//! If "read_all" then call \a readAll() after extract.
|
||||||
//! Returns if has data to read.
|
//! Returns if has data to read.
|
||||||
|
//! \~russian
|
||||||
|
//! Извлекает %PIByteArray из "data" и инициализирует им поток.
|
||||||
|
//! Если указан "read_all", то вызывает \a readAll() после инициализации.
|
||||||
|
//! Возвращает если ли данные для чтения.
|
||||||
bool extract(PIByteArray & data, bool read_all = false);
|
bool extract(PIByteArray & data, bool read_all = false);
|
||||||
|
|
||||||
void setSource(const PIByteArray & data);
|
void setSource(const PIByteArray & data);
|
||||||
void setSource(PIByteArray * data);
|
void setSource(PIByteArray * data);
|
||||||
|
|
||||||
//! Returns internal buffer with written data
|
//! \~english Returns internal buffer with written data
|
||||||
|
//! \~russian Возвращает внутренний буфер с записанными данными
|
||||||
PIByteArray data() const;
|
PIByteArray data() const;
|
||||||
|
|
||||||
//! Returns if there is end of stream
|
//! \~english Returns if there is end of stream
|
||||||
|
//! \~russian Возвращает достигнут ли конец потока
|
||||||
bool atEnd() const {return data_->size_s() <= 1;}
|
bool atEnd() const {return data_->size_s() <= 1;}
|
||||||
|
|
||||||
//! Returns stream version
|
//! \~english Returns stream version
|
||||||
|
//! \~russian Возвращает версию потока
|
||||||
Version version() const {return (Version)version_;}
|
Version version() const {return (Version)version_;}
|
||||||
|
|
||||||
|
|
||||||
//! Read one chunk from stream and returns its ID
|
//! \~english Read one chunk from stream and returns its ID
|
||||||
|
//! \~russian Читает один чанк из потока и возвращает его ID
|
||||||
int read();
|
int read();
|
||||||
|
|
||||||
//! Read all chunks from stream. This function just index input data
|
//! \~english Read all chunks from stream. This function just index input data
|
||||||
|
//! \~russian Читает все чанки из потока. Данный метод лишь индексирует данные
|
||||||
void readAll();
|
void readAll();
|
||||||
|
|
||||||
//! Returns last readed chunk ID
|
//! \~english Returns last readed chunk ID
|
||||||
|
//! \~russian Возвращает ID последнего прочитанного чанка
|
||||||
int getID() {return last_id;}
|
int getID() {return last_id;}
|
||||||
|
|
||||||
//! Returns value of last readed chunk
|
//! \~english Returns value of last readed chunk
|
||||||
|
//! \~russian Возвращает значение последнего прочитанного чанка
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T getData() const {T ret; PIByteArray s(last_data); s >> ret; return ret;}
|
T getData() const {T ret; PIByteArray s(last_data); s >> ret; return ret;}
|
||||||
|
|
||||||
//! Place value of last readed chunk into \"v\"
|
//! \~english Place value of last readed chunk into \"v\"
|
||||||
|
//! \~russian Записывает значение последнего прочитанного чанка в \"v\"
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void get(T & v) const {v = getData<T>();}
|
void get(T & v) const {v = getData<T>();}
|
||||||
|
|
||||||
//! Place value of chunk with id \"id\" into \"v\". You should call \a readAll() before using this function!
|
//! \~english Place value of chunk with ID \"id\" into \"v\". You should call \a readAll() before using this function!
|
||||||
|
//! \~russian Записывает значение чанка с ID \"id\" в \"v\". Необходимо вызвать \a readAll() перед использованием этого метода!
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const PIChunkStream & get(int id, T & v) const {
|
const PIChunkStream & get(int id, T & v) const {
|
||||||
CacheEntry pos = data_map.value(id);
|
CacheEntry pos = data_map.value(id);
|
||||||
@@ -113,7 +138,8 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Replace value of chunk with ID \"id\" to \"v\". You should call \a readAll() before using this function!
|
//! \~english Replace value of chunk with ID \"id\" to \"v\". You should call \a readAll() before using this function!
|
||||||
|
//! \~russian Заменяет значение чанка с ID \"id\" на \"v\". Необходимо вызвать \a readAll() перед использованием этого метода!
|
||||||
template <typename T>
|
template <typename T>
|
||||||
PIChunkStream & set(int id, const T & v) {
|
PIChunkStream & set(int id, const T & v) {
|
||||||
PIByteArray ba;
|
PIByteArray ba;
|
||||||
|
|||||||
@@ -21,16 +21,32 @@
|
|||||||
#include "pisysteminfo.h"
|
#include "pisysteminfo.h"
|
||||||
|
|
||||||
|
|
||||||
/*! \class PICLI
|
//! \addtogroup Core
|
||||||
* \brief Command-line arguments parser
|
//! \{
|
||||||
*
|
//! \class PICLI picli.h
|
||||||
* \section PICLI_sec0 Synopsis
|
//! \~\brief
|
||||||
* This class provide handy parsing of command-line arguments. First you should add
|
//! \~english Command-Line parser
|
||||||
* arguments to PICLI with function \a addArgument(). Then you can check if there
|
//! \~russian Парсер командной строки
|
||||||
* is some argument in application command-line with function \a hasArgument();
|
//!
|
||||||
* \section PICLI_sec1 Example
|
//! \~english \section PICLI_sec0 Synopsis
|
||||||
* \snippet picli.cpp main
|
//! \~russian \section PICLI_sec0 Краткий обзор
|
||||||
*/
|
//! \~english
|
||||||
|
//! This class provide handy parsing of command-line arguments. First you should add
|
||||||
|
//! arguments to %PICLI with function \a addArgument(). Then you can check if there
|
||||||
|
//! is some argument in application command-line with function \a hasArgument(),
|
||||||
|
//! or obtain argument value by \a argumentValue().
|
||||||
|
//!
|
||||||
|
//! \~russian
|
||||||
|
//! Этот класс предоставляет удобный механизм для разбора аргументов командной строки.
|
||||||
|
//! Сперва необходимо добавить аргументы в %PICLI с помощью методов \a addArgument().
|
||||||
|
//! Далее можно проверять аргументы на наличие в командной строке методом \a hasArgument(),
|
||||||
|
//! а также получить их значения при помощи \a argumentValue().
|
||||||
|
//!
|
||||||
|
//! \~english \section PICLI_sec1 Example
|
||||||
|
//! \~russian \section PICLI_sec0 Пример
|
||||||
|
//! \~\snippet picli.cpp main
|
||||||
|
//!
|
||||||
|
//! /}
|
||||||
|
|
||||||
|
|
||||||
PICLI::PICLI(int argc, char * argv[]) {
|
PICLI::PICLI(int argc, char * argv[]) {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
/*! \file picli.h
|
/*! \file picli.h
|
||||||
* \brief Command-Line parser
|
* \~\brief
|
||||||
|
* \~english Command-Line parser
|
||||||
|
* \~russian Парсер командной строки
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
PIP - Platform Independent Primitives
|
PIP - Platform Independent Primitives
|
||||||
@@ -30,39 +32,54 @@ class PIP_EXPORT PICLI: public PIObject
|
|||||||
PIOBJECT_SUBCLASS(PICLI, PIObject)
|
PIOBJECT_SUBCLASS(PICLI, PIObject)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Constructor
|
//! \~english Constructor
|
||||||
|
//! \~russian Конструктор
|
||||||
PICLI(int argc, char * argv[]);
|
PICLI(int argc, char * argv[]);
|
||||||
|
|
||||||
|
|
||||||
//! Add argument with name "name", short key = name first letter, full key = name
|
//! \~english Add argument with name "name", short key = name first letter and full key = name
|
||||||
|
//! \~russian Добавляет аргумент с именем "name", коротким ключом = первой букве имени и полным ключом = имени
|
||||||
void addArgument(const PIString & name, bool value = false) {_args << Argument(name, name[0], name, value); needParse = true;}
|
void addArgument(const PIString & name, bool value = false) {_args << Argument(name, name[0], name, value); needParse = true;}
|
||||||
|
|
||||||
//! Add argument with name "name", short key = "shortKey", full key = name
|
//! \~english Add argument with name "name", short key = "shortKey" and full key = name
|
||||||
|
//! \~russian Добавляет аргумент с именем "name", коротким ключом = "shortKey" и полным ключом = имени
|
||||||
void addArgument(const PIString & name, const PIChar & shortKey, bool value = false) {_args << Argument(name, shortKey, name, value); needParse = true;}
|
void addArgument(const PIString & name, const PIChar & shortKey, bool value = false) {_args << Argument(name, shortKey, name, value); needParse = true;}
|
||||||
|
|
||||||
//! Add argument with name "name", short key = "shortKey", full key = name
|
//! \~english Add argument with name "name", short key = "shortKey" and full key = name
|
||||||
|
//! \~russian Добавляет аргумент с именем "name", коротким ключом = "shortKey" и полным ключом = имени
|
||||||
void addArgument(const PIString & name, const char * shortKey, bool value = false) {_args << Argument(name, PIChar(shortKey), name, value); needParse = true;}
|
void addArgument(const PIString & name, const char * shortKey, bool value = false) {_args << Argument(name, PIChar(shortKey), name, value); needParse = true;}
|
||||||
|
|
||||||
//! Add argument with name "name", short key = "shortKey", full key = "fullKey"
|
//! \~english Add argument with name "name", short key = "shortKey" and full key = "fullKey"
|
||||||
|
//! \~russian Добавляет аргумент с именем "name", коротким ключом = "shortKey" и полным ключом = "fullKey"
|
||||||
void addArgument(const PIString & name, const PIChar & shortKey, const PIString & fullKey, bool value = false) {_args << Argument(name, shortKey, fullKey, value); needParse = true;}
|
void addArgument(const PIString & name, const PIChar & shortKey, const PIString & fullKey, bool value = false) {_args << Argument(name, shortKey, fullKey, value); needParse = true;}
|
||||||
|
|
||||||
//! Add argument with name "name", short key = "shortKey", full key = "fullKey"
|
//! \~english Add argument with name "name", short key = "shortKey" and full key = "fullKey"
|
||||||
|
//! \~russian Добавляет аргумент с именем "name", коротким ключом = "shortKey" и полным ключом = "fullKey"
|
||||||
void addArgument(const PIString & name, const char * shortKey, const PIString & fullKey, bool value = false) {_args << Argument(name, PIChar(shortKey), fullKey, value); needParse = true;}
|
void addArgument(const PIString & name, const char * shortKey, const PIString & fullKey, bool value = false) {_args << Argument(name, PIChar(shortKey), fullKey, value); needParse = true;}
|
||||||
|
|
||||||
|
|
||||||
//! Returns unparsed command-line argument by index "index". Index 0 is program execute command.
|
//! \~english Returns unparsed command-line argument by index "index". Index 0 is program execute command
|
||||||
|
//! \~russian Возвращает исходный аргумент командной строки по индексу "index". Индекс 0 это команда вызова программы
|
||||||
PIString rawArgument(int index) {parse(); return _args_raw[index];}
|
PIString rawArgument(int index) {parse(); return _args_raw[index];}
|
||||||
PIString mandatoryArgument(int index) {parse(); return _args_mand[index];}
|
PIString mandatoryArgument(int index) {parse(); return _args_mand[index];}
|
||||||
PIString optionalArgument(int index) {parse(); return _args_opt[index];}
|
PIString optionalArgument(int index) {parse(); return _args_opt[index];}
|
||||||
|
|
||||||
//! Returns unparsed command-line arguments
|
//! \~english Returns unparsed command-line arguments
|
||||||
|
//! \~russian Возвращает исходные аргументы командной строки
|
||||||
const PIStringList & rawArguments() {parse(); return _args_raw;}
|
const PIStringList & rawArguments() {parse(); return _args_raw;}
|
||||||
const PIStringList & mandatoryArguments() {parse(); return _args_mand;}
|
const PIStringList & mandatoryArguments() {parse(); return _args_mand;}
|
||||||
const PIStringList & optionalArguments() {parse(); return _args_opt;}
|
const PIStringList & optionalArguments() {parse(); return _args_opt;}
|
||||||
|
|
||||||
//! Returns program execute command without arguments
|
//! \~english Returns program execute command without arguments
|
||||||
|
//! \~russian Возвращает команду вызова программы без аргументов
|
||||||
PIString programCommand() {parse(); return _args_raw.size() > 0 ? _args_raw.front() : PIString();}
|
PIString programCommand() {parse(); return _args_raw.size() > 0 ? _args_raw.front() : PIString();}
|
||||||
|
|
||||||
|
//! \~english Returns if argument "name" found
|
||||||
|
//! \~russian Возвращает найден ли аргумент "name"
|
||||||
bool hasArgument(const PIString & name) {parse(); piForeach (Argument & i, _args) if (i.name == name && i.found) return true; return false;}
|
bool hasArgument(const PIString & name) {parse(); piForeach (Argument & i, _args) if (i.name == name && i.found) return true; return false;}
|
||||||
|
|
||||||
|
//! \~english Returns argument "name" value, or empty string if this is no value
|
||||||
|
//! \~russian Возвращает значение аргумента "name" или пустую строку, если значения нет
|
||||||
PIString argumentValue(const PIString & name) {parse(); piForeach (Argument &i, _args) if (i.name == name && i.found) return i.value; return PIString();}
|
PIString argumentValue(const PIString & name) {parse(); piForeach (Argument &i, _args) if (i.name == name && i.found) return i.value; return PIString();}
|
||||||
PIString argumentShortKey(const PIString & name) {piForeach (Argument &i, _args) if (i.name == name) return i.short_key; return PIString();}
|
PIString argumentShortKey(const PIString & name) {piForeach (Argument &i, _args) if (i.name == name) return i.short_key; return PIString();}
|
||||||
PIString argumentFullKey(const PIString & name) {piForeach (Argument &i, _args) if (i.name == name) return i.full_key; return PIString();}
|
PIString argumentFullKey(const PIString & name) {piForeach (Argument &i, _args) if (i.name == name) return i.full_key; return PIString();}
|
||||||
|
|||||||
@@ -16,6 +16,46 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser 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/>.
|
||||||
*/
|
*/
|
||||||
|
/** \defgroup Core
|
||||||
|
* \~\brief
|
||||||
|
* \~english This module contains basic functionality.
|
||||||
|
* \~russian Модуль обеспечивает базовую функциональность.
|
||||||
|
*
|
||||||
|
* \~\details
|
||||||
|
* Scope | Use
|
||||||
|
* ----- | -------
|
||||||
|
* C++ | #include <picoremodule.h>
|
||||||
|
* CMake | PIP
|
||||||
|
*
|
||||||
|
* \~english These files provides platform abstraction, useful macros, methods and classes:
|
||||||
|
* \~russian Эти файлы обеспечивают абстракцию операционной системы, полезные макросы, методы и классы:
|
||||||
|
* \~
|
||||||
|
* * \a PIFlags
|
||||||
|
* * \a PICout
|
||||||
|
* * \a PICLI
|
||||||
|
* * \a PIChar
|
||||||
|
* * \a PIString
|
||||||
|
* * \a PIStringList
|
||||||
|
* * \a PIBitArray
|
||||||
|
* * \a PIByteArray
|
||||||
|
* * \a PIChunkStream
|
||||||
|
* * \a PIPropertyStorage
|
||||||
|
* * \a PITime
|
||||||
|
* * \a PIDate
|
||||||
|
* * \a PIDateTime
|
||||||
|
* * \a PISystemTime
|
||||||
|
* * \a PITimeMeasurer
|
||||||
|
* * \a PIVariant
|
||||||
|
* * \a PIObject
|
||||||
|
*
|
||||||
|
* \~\authors
|
||||||
|
* \~english
|
||||||
|
* Ivan Pelipenko peri4ko@yandex.ru;
|
||||||
|
* Andrey Bychkov work.a.b@yandex.ru;
|
||||||
|
* \~russian
|
||||||
|
* Иван Пелипенко peri4ko@yandex.ru;
|
||||||
|
* Андрей Бычков work.a.b@yandex.ru;
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef PICOREMODULE_H
|
#ifndef PICOREMODULE_H
|
||||||
#define PICOREMODULE_H
|
#define PICOREMODULE_H
|
||||||
|
|||||||
@@ -273,10 +273,10 @@ PICout PICout::operator <<(const PICoutSpecialChar v) {
|
|||||||
switch (v) {
|
switch (v) {
|
||||||
case Null:
|
case Null:
|
||||||
if (buffer_) {
|
if (buffer_) {
|
||||||
(*buffer_) << PIChar(0);
|
(*buffer_) << PIChar();
|
||||||
} else {
|
} else {
|
||||||
if (isOutputDeviceActive(StdOut)) std::cout << char(0);
|
if (isOutputDeviceActive(StdOut)) std::cout << char(0);
|
||||||
if (isOutputDeviceActive(Buffer)) PICout::__string__() << PIChar(0);
|
if (isOutputDeviceActive(Buffer)) PICout::__string__() << PIChar();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NewLine:
|
case NewLine:
|
||||||
|
|||||||
@@ -69,9 +69,11 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
/** \class PIEthernet
|
/** \class PIEthernet piethernet.h
|
||||||
* \brief Ethernet device
|
* \brief
|
||||||
* \details
|
* Ethernet device
|
||||||
|
*
|
||||||
|
* \details
|
||||||
* \section PIEthernet_sec0 Synopsis
|
* \section PIEthernet_sec0 Synopsis
|
||||||
* %PIEthernet designed to work with IPv4 network via two protocols:
|
* %PIEthernet designed to work with IPv4 network via two protocols:
|
||||||
* UDP and TCP. This class allow you send and receive packets to/from
|
* UDP and TCP. This class allow you send and receive packets to/from
|
||||||
|
|||||||
@@ -200,9 +200,9 @@ public:
|
|||||||
ir[j].Event.KeyEvent.dwControlKeyState = KeyModifiers2ControlKeyState(k.modifiers);
|
ir[j].Event.KeyEvent.dwControlKeyState = KeyModifiers2ControlKeyState(k.modifiers);
|
||||||
if (PITerminal::isSpecialKey(k.key)) {
|
if (PITerminal::isSpecialKey(k.key)) {
|
||||||
ir[j].Event.KeyEvent.wVirtualKeyCode = SpecialKey2VirtualKeyCode((PIKbdListener::SpecialKey)k.key);
|
ir[j].Event.KeyEvent.wVirtualKeyCode = SpecialKey2VirtualKeyCode((PIKbdListener::SpecialKey)k.key);
|
||||||
ir[j].Event.KeyEvent.uChar.AsciiChar = PIChar(piMaxi(k.key, 0)).toAscii();
|
ir[j].Event.KeyEvent.uChar.AsciiChar = PIChar((ushort)piMaxi(k.key, 0)).toAscii();
|
||||||
} else
|
} else
|
||||||
ir[j].Event.KeyEvent.uChar.UnicodeChar = PIChar(piMaxi(k.key, 0)).toWChar();
|
ir[j].Event.KeyEvent.uChar.UnicodeChar = PIChar((ushort)piMaxi(k.key, 0)).toWChar();
|
||||||
//piCout << ir[j].Event.KeyEvent.wVirtualKeyCode << int(ir[j].Event.KeyEvent.uChar.AsciiChar);
|
//piCout << ir[j].Event.KeyEvent.wVirtualKeyCode << int(ir[j].Event.KeyEvent.uChar.AsciiChar);
|
||||||
ir[j].Event.KeyEvent.bKeyDown = true;
|
ir[j].Event.KeyEvent.bKeyDown = true;
|
||||||
ir[z] = ir[j];
|
ir[z] = ir[j];
|
||||||
|
|||||||
Reference in New Issue
Block a user