doc and brush
This commit is contained in:
@@ -534,18 +534,41 @@ inline uint piHash(const ldouble & v) {
|
|||||||
return piHashData((const uchar *)&v, sizeof(v));
|
return piHashData((const uchar *)&v, sizeof(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \~\brief
|
||||||
|
//! \~english Call \b delete on each "container" element.
|
||||||
|
//! \~russian Вызывает \b delete на каждый элемент "container".
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline void piDeleteAll(const T & container) {
|
inline void piDeleteAll(const T & container) {
|
||||||
for (auto i: container) {
|
for (auto i: container) {
|
||||||
delete i;
|
delete i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \~\brief
|
||||||
|
//! \~english Call \b delete on each element of
|
||||||
|
//! [C++11 initializer list](https://en.cppreference.com/w/cpp/utility/initializer_list).
|
||||||
|
//! \~russian Вызывает \b delete на каждый элемент
|
||||||
|
//! [списка инициализации C++11](https://ru.cppreference.com/w/cpp/utility/initializer_list).
|
||||||
|
template<typename T>
|
||||||
|
inline void piDeleteAll(std::initializer_list<T> container) {
|
||||||
|
for (auto i: container) {
|
||||||
|
delete i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//! \~\brief
|
||||||
|
//! \~english Call \b delete on each "container" element and clear container.
|
||||||
|
//! \~russian Вызывает \b delete на каждый элемент "container" и очищает контейнер.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline void piDeleteAllAndClear(T & container) {
|
inline void piDeleteAllAndClear(T & container) {
|
||||||
piDeleteAll(container);
|
piDeleteAll(container);
|
||||||
container.clear();
|
container.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//! \~\brief
|
||||||
|
//! \~english Call \b delete if "pointer" is not null and set it to null. Returns if deleted.
|
||||||
|
//! \~russian Вызывает \b delete на "pointer" если он не нулевой и устанавливает его в ноль. Возвращает было ли удаление.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline bool piDeleteSafety(T *& pointer) {
|
inline bool piDeleteSafety(T *& pointer) {
|
||||||
if (!pointer) return false;
|
if (!pointer) return false;
|
||||||
@@ -593,12 +616,48 @@ inline bool piDeleteSafety(T *& pointer) {
|
|||||||
#define piLetobef piLetobe<float>
|
#define piLetobef piLetobe<float>
|
||||||
|
|
||||||
|
|
||||||
|
//! \~\brief
|
||||||
|
//! \~english Class for executing a function upon scope exit
|
||||||
|
//! \~russian Класс для выполнения функции при выходе из области видимости
|
||||||
|
//! \~\details
|
||||||
|
//! \~english Example
|
||||||
|
//! \~russian Пример
|
||||||
|
//! \~\code
|
||||||
|
//! bool yourFunc() {
|
||||||
|
//! PIScopeExitCall error_call([]() { piCout << "Error!"; });
|
||||||
|
//! ...
|
||||||
|
//! if (!good0) {
|
||||||
|
//! ...
|
||||||
|
//! return false;
|
||||||
|
//! }
|
||||||
|
//! if (!good1) {
|
||||||
|
//! ...
|
||||||
|
//! return false;
|
||||||
|
//! }
|
||||||
|
//! ...
|
||||||
|
//! error_call.cancel();
|
||||||
|
//! return true;
|
||||||
|
//! }
|
||||||
|
//! \endcode
|
||||||
|
//! \~english In this example "Error!" will be printed on every \b false function return.
|
||||||
|
//! \~russian В данном примере будет выведен "Error!" при каждом \b false возврате из функции.
|
||||||
class PIP_EXPORT PIScopeExitCall {
|
class PIP_EXPORT PIScopeExitCall {
|
||||||
public:
|
public:
|
||||||
|
//! \~\brief
|
||||||
|
//! \~english Constructor that takes a function to execute
|
||||||
|
//! \~russian Конструктор, который принимает функцию для выполнения
|
||||||
explicit PIScopeExitCall(std::function<void()> f): func(f) {}
|
explicit PIScopeExitCall(std::function<void()> f): func(f) {}
|
||||||
|
|
||||||
|
//! \~\brief
|
||||||
|
//! \~english Destructor that executes the function if it exists
|
||||||
|
//! \~russian Деструктор, который выполняет функцию, если она существует
|
||||||
~PIScopeExitCall() {
|
~PIScopeExitCall() {
|
||||||
if (func) func();
|
if (func) func();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \~\brief
|
||||||
|
//! \~english Method for canceling the function
|
||||||
|
//! \~russian Метод для отмены функции
|
||||||
void cancel() { func = nullptr; }
|
void cancel() { func = nullptr; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -54,18 +54,14 @@ extern PIP_EXPORT lconv * currentLocale;
|
|||||||
|
|
||||||
//! \ingroup Core
|
//! \ingroup Core
|
||||||
//! \brief
|
//! \brief
|
||||||
//! \~english
|
//! \~english Return readable error description in format "code <number> - <description>"
|
||||||
//! Return readable error description in format "code <number> - <description>"
|
//! \~russian Возвращает читаемое описание ошибки в формате "code <номер> - <описание>"
|
||||||
//! \~russian
|
|
||||||
//! Возвращает читаемое описание ошибки в формате "code <номер> - <описание>"
|
|
||||||
PIP_EXPORT PIString errorString();
|
PIP_EXPORT PIString errorString();
|
||||||
|
|
||||||
//! \ingroup Core
|
//! \ingroup Core
|
||||||
//! \brief
|
//! \brief
|
||||||
//! \~english
|
//! \~english Reset last error
|
||||||
//! Reset last error
|
//! \~russian Сброс последней ошибки
|
||||||
//! \~russian
|
|
||||||
//! Сброс последней ошибки
|
|
||||||
PIP_EXPORT void errorClear();
|
PIP_EXPORT void errorClear();
|
||||||
|
|
||||||
PIP_EXPORT void randomize();
|
PIP_EXPORT void randomize();
|
||||||
|
|||||||
@@ -92,10 +92,8 @@ void __sighandler__(PISignals::Signal s) {
|
|||||||
|
|
||||||
|
|
||||||
PIInit::PIInit() {
|
PIInit::PIInit() {
|
||||||
file_charset = 0;
|
|
||||||
PISystemInfo * sinfo = PISystemInfo::instance();
|
PISystemInfo * sinfo = PISystemInfo::instance();
|
||||||
sinfo->execDateTime = PIDateTime::current();
|
sinfo->execDateTime = PIDateTime::current();
|
||||||
setFileCharset("UTF-8");
|
|
||||||
# ifndef ANDROID
|
# ifndef ANDROID
|
||||||
PISignals::setSlot(__sighandler__);
|
PISignals::setSlot(__sighandler__);
|
||||||
PISignals::grabSignals(PISignals::UserDefined1);
|
PISignals::grabSignals(PISignals::UserDefined1);
|
||||||
@@ -266,8 +264,6 @@ PIInit::PIInit() {
|
|||||||
|
|
||||||
|
|
||||||
PIInit::~PIInit() {
|
PIInit::~PIInit() {
|
||||||
if (file_charset) delete[] file_charset;
|
|
||||||
file_charset = 0;
|
|
||||||
PIResourcesStorage::instance()->clear();
|
PIResourcesStorage::instance()->clear();
|
||||||
# ifdef WINDOWS
|
# ifdef WINDOWS
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
@@ -365,17 +361,6 @@ PIStringList PIInit::buildOptions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PIInit::setFileCharset(const char * charset) {
|
|
||||||
if (file_charset) delete file_charset;
|
|
||||||
file_charset = 0;
|
|
||||||
if (charset) {
|
|
||||||
file_charset = new char[1024];
|
|
||||||
memset(file_charset, 0, 1024);
|
|
||||||
strcpy(file_charset, charset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool PIInit::fileExists(const PIString & p) {
|
bool PIInit::fileExists(const PIString & p) {
|
||||||
FILE * f = fopen(p.data(), "r");
|
FILE * f = fopen(p.data(), "r");
|
||||||
if (f == 0) return false;
|
if (f == 0) return false;
|
||||||
|
|||||||
@@ -82,10 +82,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
explicit PIInit();
|
explicit PIInit();
|
||||||
void setFileCharset(const char * charset);
|
|
||||||
bool fileExists(const PIString & p);
|
bool fileExists(const PIString & p);
|
||||||
PRIVATE_DECLARATION(PIP_EXPORT)
|
PRIVATE_DECLARATION(PIP_EXPORT)
|
||||||
char * file_charset;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
class PIP_EXPORT PIObject {
|
class PIP_EXPORT PIObject {
|
||||||
#ifndef MICRO_PIP
|
#ifndef MICRO_PIP
|
||||||
friend class PIObjectManager;
|
friend class PIObjectManager;
|
||||||
friend void dumpApplication(bool);
|
friend PIP_EXPORT void dumpApplication(bool);
|
||||||
friend class PIIntrospection;
|
friend class PIIntrospection;
|
||||||
#endif
|
#endif
|
||||||
typedef PIObject __PIObject__;
|
typedef PIObject __PIObject__;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "pistring.h"
|
#include "pistring.h"
|
||||||
|
|
||||||
#include "piincludes_p.h"
|
#include "piincludes_p.h"
|
||||||
|
#include "piliterals.h"
|
||||||
#include "pimathbase.h"
|
#include "pimathbase.h"
|
||||||
#include "pistringlist.h"
|
#include "pistringlist.h"
|
||||||
#ifdef PIP_ICU
|
#ifdef PIP_ICU
|
||||||
@@ -254,7 +255,7 @@ PIString PIString::fromNumberBaseU(const ullong value, int base, bool * ok) {
|
|||||||
|
|
||||||
|
|
||||||
llong PIString::toNumberBase(const PIString & value, int base, bool * ok) {
|
llong PIString::toNumberBase(const PIString & value, int base, bool * ok) {
|
||||||
static const PIString s_0x = PIStringAscii("0x");
|
static const PIString s_0x = "0x"_a;
|
||||||
PIString v = value.trimmed();
|
PIString v = value.trimmed();
|
||||||
if (base < 0) {
|
if (base < 0) {
|
||||||
int ind = v.find(s_0x);
|
int ind = v.find(s_0x);
|
||||||
@@ -430,11 +431,11 @@ PIString PIString::fromCodepage(const char * s, const char * c) {
|
|||||||
//! Пример:
|
//! Пример:
|
||||||
//! \~\code
|
//! \~\code
|
||||||
//! piCout << PIString::readableSize(512); // 512 B
|
//! piCout << PIString::readableSize(512); // 512 B
|
||||||
//! piCout << PIString::readableSize(5120); // 5.0 kB
|
//! piCout << PIString::readableSize(5120); // 5.0 KiB
|
||||||
//! piCout << PIString::readableSize(512000); // 500.0 kB
|
//! piCout << PIString::readableSize(512000); // 500.0 KiB
|
||||||
//! piCout << PIString::readableSize(5120000); // 4.8 MB
|
//! piCout << PIString::readableSize(5120000); // 4.8 MiB
|
||||||
//! piCout << PIString::readableSize(512000000); // 488.2 MB
|
//! piCout << PIString::readableSize(512000000); // 488.2 MiB
|
||||||
//! piCout << PIString::readableSize(51200000000); // 47.6 GB
|
//! piCout << PIString::readableSize(51200000000); // 47.6 GiB
|
||||||
//! \endcode
|
//! \endcode
|
||||||
PIString PIString::readableSize(llong bytes) {
|
PIString PIString::readableSize(llong bytes) {
|
||||||
PIString s;
|
PIString s;
|
||||||
@@ -894,7 +895,7 @@ PIString & PIString::insert(int index, const PIString & str) {
|
|||||||
|
|
||||||
|
|
||||||
PIString & PIString::elide(int size, float pos) {
|
PIString & PIString::elide(int size, float pos) {
|
||||||
static const PIString s_dotdot = PIStringAscii("..");
|
static const PIString s_dotdot = ".."_a;
|
||||||
if (length() <= size) return *this;
|
if (length() <= size) return *this;
|
||||||
if (length() <= 2) {
|
if (length() <= 2) {
|
||||||
fill('.');
|
fill('.');
|
||||||
@@ -1185,10 +1186,10 @@ bool PIString::endsWith(const PIString & str) const {
|
|||||||
//! piCout << PIString("").toBool(); // false
|
//! piCout << PIString("").toBool(); // false
|
||||||
//! \endcode
|
//! \endcode
|
||||||
bool PIString::toBool() const {
|
bool PIString::toBool() const {
|
||||||
static const PIString s_true = PIStringAscii("true");
|
static const PIString s_true = "true"_a;
|
||||||
static const PIString s_yes = PIStringAscii("yes");
|
static const PIString s_yes = "yes"_a;
|
||||||
static const PIString s_on = PIStringAscii("on");
|
static const PIString s_on = "on"_a;
|
||||||
static const PIString s_ok = PIStringAscii("ok");
|
static const PIString s_ok = "ok"_a;
|
||||||
PIString s(*this);
|
PIString s(*this);
|
||||||
s = s.trimmed().toLowerCase();
|
s = s.trimmed().toLowerCase();
|
||||||
if (s == s_true || s == s_yes || s == s_on || s == s_ok) return true;
|
if (s == s_true || s == s_yes || s == s_on || s == s_ok) return true;
|
||||||
@@ -1662,59 +1663,59 @@ ldouble PIString::toLDouble() const {
|
|||||||
//! s.setReadableSize(512);
|
//! s.setReadableSize(512);
|
||||||
//! piCout << s; // 512 B
|
//! piCout << s; // 512 B
|
||||||
//! s.setReadableSize(5120);
|
//! s.setReadableSize(5120);
|
||||||
//! piCout << s; // 5.0 kB
|
//! piCout << s; // 5.0 KiB
|
||||||
//! s.setReadableSize(512000);
|
//! s.setReadableSize(512000);
|
||||||
//! piCout << s; // 500.0 kB
|
//! piCout << s; // 500.0 KiB
|
||||||
//! s.setReadableSize(5120000);
|
//! s.setReadableSize(5120000);
|
||||||
//! piCout << s; // 4.8 MB
|
//! piCout << s; // 4.8 MiB
|
||||||
//! s.setReadableSize(512000000);
|
//! s.setReadableSize(512000000);
|
||||||
//! piCout << s; // 488.2 MB
|
//! piCout << s; // 488.2 MiB
|
||||||
//! s.setReadableSize(51200000000);
|
//! s.setReadableSize(51200000000);
|
||||||
//! piCout << s; // 47.6 GB
|
//! piCout << s; // 47.6 GiB
|
||||||
//! \endcode
|
//! \endcode
|
||||||
PIString & PIString::setReadableSize(llong bytes) {
|
PIString & PIString::setReadableSize(llong bytes) {
|
||||||
clear();
|
clear();
|
||||||
if (bytes < 1024) {
|
if (bytes < 1024) {
|
||||||
*this += (PIString::fromNumber(bytes) + PIStringAscii(" B"));
|
*this += (PIString::fromNumber(bytes) + " B"_a);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
double fres = bytes / 1024.;
|
double fres = bytes / 1024.;
|
||||||
llong res = bytes / 1024;
|
llong res = bytes / 1024;
|
||||||
fres -= res;
|
fres -= res;
|
||||||
if (res < 1024) {
|
if (res < 1024) {
|
||||||
*this += (PIString::fromNumber(res) + PIStringAscii(".") + PIString::fromNumber(llong(fres * 10)).left(1) + PIStringAscii(" kB"));
|
*this += (PIString::fromNumber(res) + "."_a + PIString::fromNumber(llong(fres * 10)).left(1) + " KiB"_a);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
fres = res / 1024.;
|
fres = res / 1024.;
|
||||||
res /= 1024;
|
res /= 1024;
|
||||||
fres -= res;
|
fres -= res;
|
||||||
if (res < 1024) {
|
if (res < 1024) {
|
||||||
*this += (PIString::fromNumber(res) + PIStringAscii(".") + PIString::fromNumber(llong(fres * 10)).left(1) + PIStringAscii(" MB"));
|
*this += (PIString::fromNumber(res) + "."_a + PIString::fromNumber(llong(fres * 10)).left(1) + " MiB"_a);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
fres = res / 1024.;
|
fres = res / 1024.;
|
||||||
res /= 1024;
|
res /= 1024;
|
||||||
fres -= res;
|
fres -= res;
|
||||||
if (res < 1024) {
|
if (res < 1024) {
|
||||||
*this += (PIString::fromNumber(res) + PIStringAscii(".") + PIString::fromNumber(llong(fres * 10)).left(1) + PIStringAscii(" GB"));
|
*this += (PIString::fromNumber(res) + "."_a + PIString::fromNumber(llong(fres * 10)).left(1) + " GiB"_a);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
fres = res / 1024.;
|
fres = res / 1024.;
|
||||||
res /= 1024;
|
res /= 1024;
|
||||||
fres -= res;
|
fres -= res;
|
||||||
if (res < 1024) {
|
if (res < 1024) {
|
||||||
*this += (PIString::fromNumber(res) + PIStringAscii(".") + PIString::fromNumber(llong(fres * 10)).left(1) + PIStringAscii(" TB"));
|
*this += (PIString::fromNumber(res) + "."_a + PIString::fromNumber(llong(fres * 10)).left(1) + " TiB"_a);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
fres = res / 1024.;
|
fres = res / 1024.;
|
||||||
res /= 1024;
|
res /= 1024;
|
||||||
fres -= res;
|
fres -= res;
|
||||||
*this += (PIString::fromNumber(res) + PIStringAscii(".") + PIString::fromNumber(llong(fres * 10)).left(1) + PIStringAscii(" PB"));
|
*this += (PIString::fromNumber(res) + "."_a + PIString::fromNumber(llong(fres * 10)).left(1) + " PiB"_a);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const static PIString _versionDelims_ = PIStringAscii("._-+");
|
const static PIString _versionDelims_ = "._-+"_a;
|
||||||
|
|
||||||
|
|
||||||
void parseVersion(PIString s, PIVector<int> & codes, PIStringList & strs) {
|
void parseVersion(PIString s, PIVector<int> & codes, PIStringList & strs) {
|
||||||
@@ -1731,7 +1732,7 @@ void parseVersion(PIString s, PIVector<int> & codes, PIStringList & strs) {
|
|||||||
if (ind > s.size_s() - 1) break;
|
if (ind > s.size_s() - 1) break;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < mccnt; ++i) {
|
for (int i = 0; i < mccnt; ++i) {
|
||||||
s.insert(ind, PIStringAscii(".0"));
|
s.insert(ind, ".0"_a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIStringList comps;
|
PIStringList comps;
|
||||||
@@ -1762,20 +1763,20 @@ void parseVersion(PIString s, PIVector<int> & codes, PIStringList & strs) {
|
|||||||
int versionLabelValue(PIString s) {
|
int versionLabelValue(PIString s) {
|
||||||
int ret = -10000;
|
int ret = -10000;
|
||||||
if (s.isEmpty()) return 0;
|
if (s.isEmpty()) return 0;
|
||||||
if (s.startsWith(PIStringAscii("pre"))) {
|
if (s.startsWith("pre"_a)) {
|
||||||
s.cutLeft(3);
|
s.cutLeft(3);
|
||||||
ret -= 1;
|
ret -= 1;
|
||||||
}
|
}
|
||||||
if (s.startsWith(PIStringAscii("rc"))) {
|
if (s.startsWith("rc"_a)) {
|
||||||
s.cutLeft(2);
|
s.cutLeft(2);
|
||||||
ret += s.toInt();
|
ret += s.toInt();
|
||||||
}
|
}
|
||||||
if (s.startsWith(PIStringAscii("r"))) {
|
if (s.startsWith("r"_a)) {
|
||||||
s.cutLeft(1);
|
s.cutLeft(1);
|
||||||
ret += 10000 + s.toInt();
|
ret += 10000 + s.toInt();
|
||||||
}
|
}
|
||||||
if (s == PIStringAscii("alpha")) ret -= 4;
|
if (s == "alpha"_a) ret -= 4;
|
||||||
if (s == PIStringAscii("beta")) ret -= 2;
|
if (s == "beta"_a) ret -= 2;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1565,8 +1565,8 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \~english Set string content to human readable size in B/kB/MB/GB/TB/PB.
|
//! \~english Set string content to human readable size in B/KiB/MiB/GiB/TiB/PiB.
|
||||||
//! \~russian Устанавливает содержимое в строку с читаемым размером B/kB/MB/GB/TB/PB.
|
//! \~russian Устанавливает содержимое в строку с читаемым размером B/KiB/MiB/GiB/TiB/PiB.
|
||||||
//! \~\sa PIString::readableSize()
|
//! \~\sa PIString::readableSize()
|
||||||
PIString & setReadableSize(llong bytes);
|
PIString & setReadableSize(llong bytes);
|
||||||
|
|
||||||
@@ -1718,8 +1718,8 @@ public:
|
|||||||
//! \~russian Возвращает строку созданную из кодировки "cp".
|
//! \~russian Возвращает строку созданную из кодировки "cp".
|
||||||
static PIString fromCodepage(const char * s, const char * cp);
|
static PIString fromCodepage(const char * s, const char * cp);
|
||||||
|
|
||||||
//! \~english Returns string contains human readable size in B/kB/MB/GB/TB/PB.
|
//! \~english Returns string contains human readable size in B/KiB/MiB/GiB/TiB/PiB.
|
||||||
//! \~russian Возвращает строку с читаемым размером B/kB/MB/GB/TB/PB.
|
//! \~russian Возвращает строку с читаемым размером B/KiB/MiB/GiB/TiB/PiB.
|
||||||
//! \~\sa PIString::setReadableSize()
|
//! \~\sa PIString::setReadableSize()
|
||||||
static PIString readableSize(llong bytes);
|
static PIString readableSize(llong bytes);
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "piconditionvar.h"
|
#include "piconditionvar.h"
|
||||||
#include "piincludes_p.h"
|
#include "piincludes_p.h"
|
||||||
|
#include "piliterals.h"
|
||||||
#ifdef PIP_TIMER_RT
|
#ifdef PIP_TIMER_RT
|
||||||
# include <csignal>
|
# include <csignal>
|
||||||
#endif
|
#endif
|
||||||
@@ -242,7 +243,7 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
_PITimerImp_Thread::_PITimerImp_Thread() {
|
_PITimerImp_Thread::_PITimerImp_Thread() {
|
||||||
thread_.setName("__S__PITimerImp_Thread::thread");
|
thread_.setName("__S__PITimerImp_Thread::thread"_a);
|
||||||
wait_dt = 1000;
|
wait_dt = 1000;
|
||||||
wait_dd = 2000;
|
wait_dd = 2000;
|
||||||
wait_tick = 1000;
|
wait_tick = 1000;
|
||||||
@@ -259,7 +260,7 @@ void _PITimerImp_Thread::prepareStart(double interval_ms) {
|
|||||||
}
|
}
|
||||||
st_inc = PISystemTime::fromMilliseconds(interval_ms);
|
st_inc = PISystemTime::fromMilliseconds(interval_ms);
|
||||||
st_odt = st_inc * 5;
|
st_odt = st_inc * 5;
|
||||||
if (st_odt.toSeconds() < 1.) st_odt = PISystemTime::fromSeconds(1.);
|
if (st_odt.toSeconds() < 1.) st_odt = 1_s;
|
||||||
if (deferred_) {
|
if (deferred_) {
|
||||||
if (!deferred_mode) st_time = PISystemTime::current(true) + PISystemTime::fromMilliseconds(deferred_delay);
|
if (!deferred_mode) st_time = PISystemTime::current(true) + PISystemTime::fromMilliseconds(deferred_delay);
|
||||||
st_time -= st_inc;
|
st_time -= st_inc;
|
||||||
@@ -452,7 +453,7 @@ _PITimerImp_Pool::_PITimerImp_Pool(): _PITimerImp_Thread() {
|
|||||||
|
|
||||||
|
|
||||||
_PITimerImp_Pool::Pool::Pool(): PIThread() {
|
_PITimerImp_Pool::Pool::Pool(): PIThread() {
|
||||||
setName("__S__PITimerImp_Pool::Pool");
|
setName("__S__PITimerImp_Pool::Pool"_a);
|
||||||
needLockRun(true);
|
needLockRun(true);
|
||||||
#ifndef FREERTOS
|
#ifndef FREERTOS
|
||||||
timers.reserve(64);
|
timers.reserve(64);
|
||||||
|
|||||||
@@ -267,10 +267,10 @@ public:
|
|||||||
//! \~english Stop and start timer with \a interval() loop delay
|
//! \~english Stop and start timer with \a interval() loop delay
|
||||||
//! \~russian Остановить и запустить таймер с интервалом \a interval()
|
//! \~russian Остановить и запустить таймер с интервалом \a interval()
|
||||||
|
|
||||||
//! \fn bool stop(bool wait = true)
|
//! \fn bool stop()
|
||||||
//! \brief
|
//! \brief
|
||||||
//! \~english Stop timer and wait for it finish if "wait"
|
//! \~english Stop timer and wait for it finish
|
||||||
//! \~russian Остановить таймер и если "wait" то дождаться остановки
|
//! \~russian Остановить таймер и дождаться остановки
|
||||||
|
|
||||||
//! \fn void clearDelimiters()
|
//! \fn void clearDelimiters()
|
||||||
//! \brief
|
//! \brief
|
||||||
|
|||||||
5
main.cpp
5
main.cpp
@@ -28,10 +28,6 @@ REGISTER_VARIANT_CAST(PIString, SomeType) {
|
|||||||
#include "piliterals.h"
|
#include "piliterals.h"
|
||||||
|
|
||||||
int main(int argc, char * argv[]) {
|
int main(int argc, char * argv[]) {
|
||||||
// clang-format off
|
|
||||||
piCout << 0.5_s;
|
|
||||||
// clang-format on
|
|
||||||
return 0;
|
|
||||||
/*PIValueTree root;
|
/*PIValueTree root;
|
||||||
root.addChild({"bool", PIVariant(false)});
|
root.addChild({"bool", PIVariant(false)});
|
||||||
root.addChild({"integer", PIVariant(256)});
|
root.addChild({"integer", PIVariant(256)});
|
||||||
@@ -72,6 +68,7 @@ int main(int argc, char * argv[]) {
|
|||||||
// piCout << e.toString();
|
// piCout << e.toString();
|
||||||
// piCout << PIVariantTypes::Enum::fromString(e.toString()).toString();
|
// piCout << PIVariantTypes::Enum::fromString(e.toString()).toString();
|
||||||
// piCout << PIVariantTypes::Enum::fromString("\"MyEnum\"(\"Null\":10105 \"Sec\":20 \"Fir\":100) 20").toString();
|
// piCout << PIVariantTypes::Enum::fromString("\"MyEnum\"(\"Null\":10105 \"Sec\":20 \"Fir\":100) 20").toString();
|
||||||
|
|
||||||
{
|
{
|
||||||
PIScopeExitCall ec([]() { piCout << "exit"; });
|
PIScopeExitCall ec([]() { piCout << "exit"; });
|
||||||
ec.cancel();
|
ec.cancel();
|
||||||
|
|||||||
Reference in New Issue
Block a user