Commit Graph

6 Commits

Author SHA1 Message Date
Tomasz Sowa f771f12027 renamed: std::wstring Toa(...) -> std::wstring to_str(...)
added: std::string to_str(...)
2021-03-15 19:23:49 +01:00
Tomasz Sowa 448ad42961 added: Toa() methods for converting to a string (new file convert/inttostr.cpp):
template<class StringType> void Toa(unsigned long long value, StringType & res, bool clear_string = true, int base = 10);
template<class StringType> void Toa(long long value, StringType & res, bool clear_string = true, int base = 10);
template<class StringType> void Toa(unsigned long value, StringType & res, bool clear_string = true, int base = 10);
template<class StringType> void Toa(long value, StringType & res, bool clear_string = true, int base = 10);
template<class StringType> void Toa(unsigned int value, StringType & res, bool clear_string = true, int base = 10);
template<class StringType> void Toa(int value, StringType & res, bool clear_string = true, int base = 10);
template<class StringType> void Toa(unsigned short value, StringType & res, bool clear_string = true, int base = 10);
template<class StringType> void Toa(short value, StringType & res, bool clear_string = true, int base = 10);
std::wstring Toa(unsigned long long value, int base);
std::wstring Toa(long long value, int base);
std::wstring Toa(unsigned long value, int base);
std::wstring Toa(long value, int base);
std::wstring Toa(unsigned int value, int base);
std::wstring Toa(int value, int base);
std::wstring Toa(unsigned short value, int base);
std::wstring Toa(short value, int base);
2021-03-03 02:24:30 +01:00
Tomasz Sowa bf4fdf6da7 added: Toa() for long long, int, short and unsigned as well
fixed: when serializing Date the year has at least 4 digits
       e.g. 0001 when the year is equal to one




git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1093 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-04-22 21:22:55 +00:00
Tomasz Sowa 7d51372844 added: functions for dealing with white characters:
bool IsWhite(wchar_t c, bool check_additional_chars, bool treat_new_line_as_white) (checking unicode white characters too)
       CharType * SkipWhite(CharType * str, bool check_additional_chars = true, bool treat_new_line_as_white = true)
       IsDigit(wchar_t c, int base, int * digit)

added: functions to converting from a string to an integer:
       unsigned long long Toull(const CharType * str, int base = 10, const CharType ** after_str = 0, bool * was_overflow = 0)
       long long Toll(const CharType * str, int base = 10, const CharType ** after_str = 0, bool * was_overflow = 0)
       unsigned long Toul(const CharType * str, int base = 10, const CharType ** after_str = 0, bool * was_overflow = 0)
       unsigned int  Toui(const CharType * str, int base = 10, const CharType ** after_str = 0, bool * was_overflow = 0)
       long          Tol(const CharType * str, int base = 10, const CharType ** after_str = 0, bool * was_overflow = 0)
       int           Toi(const CharType * str, int base = 10, const CharType ** after_str = 0, bool * was_overflow = 0)

changed: some work in Space (new Api)       
       now Text() methods returns std::wstring by value (before they were returned by reference)
       added std::wstring & TextRef() methods
       added unsigned int UInt(), unsigned long ULong() and LongLong() and ULongLong()
       GetValue() renamed to GetFirstValue()
       AText() renamed to TextA() and they return std::string by value now
       



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1066 e52654a7-88a9-db11-a3e9-0013d4bc506e
2017-12-05 16:32:21 +00:00
Tomasz Sowa 28ea8f3c3e added: to membuffer:
template<typename in_item_type>
         void append(const in_item_type * item_array, size_t len);
         when adding values from item_array are casted to the type of the internal buffer
changed: some minor optimizations in Space (in Add() methods with WTextStream as an argument)
changed: removed following write() methods from TextStreamBase:
         TextStreamBase & write(const char * buf,    size_t len);
         TextStreamBase & write(const wchar_t * buf, size_t len);
         and added a template instead:
         template<typename in_buffer_type>
         TextStreamBase & write(const in_buffer_type * buf, size_t len);
         this allows to write char* buffer to TextStreamBase<wchar_t...> (and vice versa)
added:   two write() methods to TextStreamBase:
         write(const char * format, double val);
         write(const wchar_t * format, double val);
         converting double value to the text (format is the same as in snprintf)




git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@448 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-11-28 22:21:10 +00:00
Tomasz Sowa d2d30cf640 added: convert (functions for converting) currently only int(long) -> string
added: textstream (an efficient memory stream for creating strings -- it's using MemBuffer)



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@425 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-07-03 14:58:18 +00:00