21 extern const char32_t
Null;
22 extern const char32_t
Return;
26 extern const char32_t
Delete;
27 extern const char32_t
Space;
28 extern const char32_t
Escape;
49 bool isInteger(char32_t _val);
55 int32_t
toInt(char32_t _val);
69 #if __CPP_VERSION__ >= 2011 70 std::string convertToUtf8(
const std::u32string& _input);
96 #if __CPP_VERSION__ >= 2011 97 std::u32string convertUnicode(
const std::string& _input);
132 iterator(std::string& _str,
const std::string::iterator& _pos) :
136 if (m_data !=
nullptr) {
137 m_current = std::distance(m_data->begin(), _pos);
149 if (m_data !=
nullptr) {
150 if (_pos > m_data->size()) {
151 m_current = m_data->size();
162 iterator(std::string* _str,
const std::string::iterator& _pos) :
166 if (m_data !=
nullptr) {
167 m_current = std::distance(m_data->begin(), _pos);
179 if (m_data !=
nullptr) {
180 if (_pos > m_data->size()) {
181 m_current = m_data->size();
194 m_current(_obj.m_current) {
203 m_current = _obj.m_current;
204 m_data = _obj.m_data;
220 operator size_t ()
const {
221 if (m_data ==
nullptr) {
227 if (m_current > (int64_t)m_data->size()) {
228 return m_data->size();
230 return (
size_t)m_current;
266 if ( m_current == _obj.m_current
267 && m_data == _obj.m_data) {
278 if ( m_current != _obj.m_current
279 || m_data != _obj.m_data) {
290 if (m_data != _obj.m_data) {
293 if (m_current <= _obj.m_current) {
304 if (m_data != _obj.m_data) {
307 if (m_current >= _obj.m_current) {
318 if (m_data != _obj.m_data) {
321 if (m_current < _obj.m_current) {
332 if (m_data != _obj.m_data) {
335 if (m_current > _obj.m_current) {
344 char32_t operator* ();
350 if (m_data ==
nullptr) {
356 if (m_current >= (int64_t)m_data->size()) {
357 return m_data->size()-1;
359 return (
size_t)m_current;
368 for (int64_t iii=0; iii<_val; ++iii) {
378 for (int64_t iii=0; iii<_val; ++iii) {
388 for (int64_t iii=0; iii<(int64_t)_val; ++iii) {
400 for (int64_t iii=0; iii<_val; ++iii) {
410 for (int64_t iii=0; iii<_val; ++iii) {
420 for (int64_t iii=0; iii<(int64_t)_val; ++iii) {
437 #if (defined(__TARGET_OS__MacOs) || defined(__TARGET_OS__Windows)) 438 using u32string = std::basic_string<char32_t>;
440 #if (defined(__TARGET_OS__Android)) 450 std::string
to_string(
unsigned long _val);
452 std::string
to_string(
unsigned long long _val);
460 double stod(
const std::string& _str,
size_t* _idx = 0);
462 float stof(
const std::string& _str,
size_t* _idx = 0);
464 int stoi(
const std::string& _str,
size_t* _idx = 0,
int _base = 10);
466 long stol(
const std::string& _str,
size_t* _idx = 0,
int _base = 10);
468 long double stold(
const std::string& _str,
size_t* _idx = 0);
470 long long stoll(
const std::string& _str,
size_t* _idx = 0,
int _base = 10);
472 unsigned long stoul(
const std::string& _str,
size_t* _idx = 0,
int _base = 10);
474 unsigned long long stoull(
const std::string& _str,
size_t* _idx = 0,
int _base = 10);
484 template <
class TYPE>
485 std::string
to_string(
const TYPE& _variable);
491 template <
class TYPE>
493 std::string out =
"{";
494 for (
size_t iii=0; iii<_list.size(); ++iii) {
503 #if __CPP_VERSION__ >= 2011 504 template <
class TYPE>
505 std::u32string to_u32string(
const TYPE& _variable);
514 template <
class TYPE>
515 bool from_string(TYPE& _variableRet,
const std::string& _value);
516 #if __CPP_VERSION__ >= 2011 517 template <
class TYPE>
518 bool from_string(TYPE& _variableRet,
const std::u32string& _value);
524 long double string_to_long_double(
const std::string& _str);
525 #if __CPP_VERSION__ >= 2011 526 long double string_to_long_double(
const std::u32string& _str);
528 double string_to_double(
const std::string& _str);
530 #if __CPP_VERSION__ >= 2011 531 double string_to_double(
const std::u32string& _str);
533 float string_to_float(
const std::string& _str);
535 #if __CPP_VERSION__ >= 2011 536 float string_to_float(
const std::u32string& _str);
538 int8_t string_to_int8_t(
const std::string& _str,
int _base = 10);
540 #if __CPP_VERSION__ >= 2011 541 int8_t string_to_int8_t(
const std::u32string& _str,
int _base = 10);
543 int16_t string_to_int16_t(
const std::string& _str,
int _base = 10);
545 #if __CPP_VERSION__ >= 2011 546 int16_t string_to_int16_t(
const std::u32string& _str,
int _base = 10);
548 int32_t string_to_int32_t(
const std::string& _str,
int _base = 10);
550 #if __CPP_VERSION__ >= 2011 551 int32_t string_to_int32_t(
const std::u32string& _str,
int _base = 10);
553 int64_t string_to_int64_t(
const std::string& _str,
int _base = 10);
555 #if __CPP_VERSION__ >= 2011 556 int64_t string_to_int64_t(
const std::u32string& _str,
int _base = 10);
558 uint8_t string_to_uint8_t(
const std::string& _str,
int _base = 10);
560 #if __CPP_VERSION__ >= 2011 561 uint8_t string_to_uint8_t(
const std::u32string& _str,
int _base = 10);
563 uint16_t string_to_uint16_t(
const std::string& _str,
int _base = 10);
565 #if __CPP_VERSION__ >= 2011 566 uint16_t string_to_uint16_t(
const std::u32string& _str,
int _base = 10);
568 uint32_t string_to_uint32_t(
const std::string& _str,
int _base = 10);
570 #if __CPP_VERSION__ >= 2011 571 uint32_t string_to_uint32_t(
const std::u32string& _str,
int _base = 10);
573 uint64_t string_to_uint64_t(
const std::string& _str,
int _base = 10);
575 #if __CPP_VERSION__ >= 2011 576 uint64_t string_to_uint64_t(
const std::u32string& _str,
int _base = 10);
578 bool string_to_bool(
const std::string& _str);
580 #if __CPP_VERSION__ >= 2011 581 bool string_to_bool(
const std::u32string& _str);
583 std::string tolower(std::string _obj);
585 #if __CPP_VERSION__ >= 2011 586 std::u32string tolower(std::u32string _obj);
589 std::string toupper(std::string _obj);
591 #if __CPP_VERSION__ >= 2011 592 std::u32string toupper(std::u32string _obj);
595 bool compare_no_case(
const std::string& _obj,
const std::string& _val);
597 #if __CPP_VERSION__ >= 2011 598 bool compare_no_case(
const std::u32string& _obj,
const std::u32string& _val);
601 bool end_with(
const std::string& _obj,
const std::string& _val,
bool _caseSensitive =
true);
603 #if __CPP_VERSION__ >= 2011 604 bool end_with(
const std::u32string& _obj,
const std::u32string& _val,
bool _caseSensitive =
true);
607 bool start_with(
const std::string& _obj,
const std::string& _val,
bool _caseSensitive =
true);
609 #if __CPP_VERSION__ >= 2011 610 bool start_with(
const std::u32string& _obj,
const std::u32string& _val,
bool _caseSensitive =
true);
613 std::string replace(
const std::string& _obj,
char _val,
char _replace);
615 #if __CPP_VERSION__ >= 2011 616 std::u32string replace(
const std::u32string& _obj, char32_t _val, char32_t _replace);
619 std::string extract_line(
const std::string& _obj, int32_t _pos);
621 #if __CPP_VERSION__ >= 2011 622 std::u32string extract_line(
const std::u32string& _obj, int32_t _pos);
625 std::vector<std::string> split(
const std::string& _input,
char _val);
627 #if __CPP_VERSION__ >= 2011 628 std::vector<std::u32string> split(
const std::u32string& _input, char32_t _val);
631 void sort(std::vector<std::string *>& _list);
633 #if __CPP_VERSION__ >= 2011 634 void sort(std::vector<std::u32string *>& _list);
637 template<
typename T,
typename T2>
639 bool isIn(
const T& _val,
const std::vector<T2>& _list) {
640 for (
size_t iii=0; iii<_list.size(); ++iii) {
641 if (_list[iii] == _val) {
657 template <
class TYPE>
const TYPE&
avg(
const TYPE& _min,
const TYPE& _val,
const TYPE& _max) {
658 return std::min(std::max(_min,_val),_max);
670 template <
class TYPE>
const TYPE&
avg(
const TYPE& _min,
const TYPE& _val,
const TYPE& _max) {
671 return std::min(std::max(_min,_val),_max);
677 std::ostream& operator <<(std::ostream& _os,
const std::string& _obj);
679 std::ostream& operator <<(std::ostream& _os, const std::vector<std::string>& _obj);
680 #if __CPP_VERSION__ >= 2011 681 std::ostream& operator <<(std::ostream& _os,
const std::u32string& _obj);
684 std::ostream& operator <<(std::ostream& _os, const std::vector<std::u32string>& _obj);
686 std::ostream& operator <<(std::ostream& _os, const std::vector<float>& _obj);
689 std::ostream& operator <<(std::ostream& _os, const std::vector<double>& _obj);
691 std::ostream& operator <<(std::ostream& _os, const std::vector<int64_t>& _obj);
693 std::ostream& operator <<(std::ostream& _os, const std::vector<uint64_t>& _obj);
695 std::ostream& operator <<(std::ostream& _os, const std::vector<int32_t>& _obj);
697 std::ostream& operator <<(std::ostream& _os, const std::vector<uint32_t>& _obj);
699 std::ostream& operator <<(std::ostream& _os, const std::vector<int16_t>& _obj);
701 std::ostream& operator <<(std::ostream& _os, const std::vector<uint16_t>& _obj);
703 std::ostream& operator <<(std::ostream& _os, const std::vector<int8_t>& _obj);
705 std::ostream& operator <<(std::ostream& _os, const std::vector<uint8_t>& _obj);
707 std::ostream& operator <<(std::ostream& _os,
const std::chrono::system_clock::time_point& _obj);
709 std::ostream& operator <<(std::ostream& _os,
const std::chrono::steady_clock::time_point& _obj);
717 int32_t
strlen(
const char32_t* _data);
719 #if (defined(__TARGET_OS__Windows)) 720 #define M_PI 3.14159265358979323846 const char32_t Suppress
Value BS (SUPPRESS)
iterator(const iterator &_obj)
Recopy constructor.
Definition: stdTools.hpp:191
iterator()
Basic constructor that is not link on a string.
Definition: stdTools.hpp:111
basic namespace of the etk library. (it might contain all the etk fuctions/class/structures without m...
Definition: Archive.hpp:16
bool theoricFirst(const char _input)
When parsing a string in a reverse mode, we need to know if we get the first char.
char32_t changeOrder(char32_t _val)
Change order of the value to have an order of display with A->Z and after a->z and after 0->9 and aft...
const char32_t CarrierReturn
Value '\r' CR.
bool isSpecialChar(char32_t _val)
check if the current element is NOT [a-zA-Z0-9]
const char32_t Return
Value '\n'.
size_t getPos() const
Get the position in the buffer.
Definition: stdTools.hpp:349
int32_t toInt(char32_t _val)
Convert char32_t in an interfer.
const TYPE & avg(const TYPE &_min, const TYPE &_val, const TYPE &_max)
in std, we have min, max but not avg ==> it is missing... the Defineing avg template.
Definition: stdTools.hpp:670
Unicode simple wrapper interface.
Definition: stdTools.hpp:20
const char32_t Tabulation
Value '\t' TAB.
Iterator on a simple std::string that contain utf8 value.
Definition: stdTools.hpp:102
virtual ~iterator()
Basic destructor.
Definition: stdTools.hpp:211
iterator & operator=(const iterator &_obj)
Asignation operator.
Definition: stdTools.hpp:202
iterator(std::string &_str)
Basic begin constructor link at the start of the string.
Definition: stdTools.hpp:121
char32_t convertChar32(const char *_input)
Convert a char* in a unicode value.
iterator(std::string *_str, size_t _pos)
Basic position constructor link at the _pos position of the string.
Definition: stdTools.hpp:175
UTF-8 simple wrapper interface.
Definition: stdTools.hpp:77
const char32_t Null
Value '\0'.
iterator(std::string &_str, size_t _pos)
Basic position constructor link at the _pos position of the string.
Definition: stdTools.hpp:145
const char32_t Delete
Value DEL.
int8_t theoricLen(const char _input)
Get the size of an utf8 char with his first char.
std::string to_string(const std::vector< TYPE > &_list)
Template to declare convertion from std::vector<anything> in std::string.
Definition: stdTools.hpp:492
bool from_string(TYPE &_variableRet, const std::string &_value)
Template to declare convertion from string to anything.
int8_t convertUtf8(char32_t _val, char _output[5])
Conver unicode in UTF8 value.
iterator(std::string &_str, const std::string::iterator &_pos)
Basic position constructor link at the _pos position of the string.
Definition: stdTools.hpp:132
std::string to_string(const TYPE &_variable)
Template to declare convertion from anything in std::string.
const char32_t Space
Value ' ' SPACE.
bool isWhiteChar(char32_t _val)
check if the current element is white or not : '\t' '\n' '\r' ' '
const char32_t Escape
Value ESC Escape.
iterator(std::string *_str, const std::string::iterator &_pos)
Basic position constructor link at the _pos position of the string.
Definition: stdTools.hpp:162