Commit Graph

74 Commits

Author SHA1 Message Date
Tomasz Sowa 5fe920d591 added: to convert/text.h:
int CompareNoCase(const StringType1 * str1_begin, const StringType1 * str1_end, const StringType2 * str2)



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1130 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-10-24 16:25:47 +00:00
Tomasz Sowa 605f24420e added to convert/text.h:
bool EqualNoCasep(const StringType1 * str1, const StringType2 * str)
int CompareNoCasep(const StringType1 * str1, const StringType2 * str2)




git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1127 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-10-04 13:41:07 +00:00
Tomasz Sowa 8e9f83e377 changed: when parsing date skip 'Z' character if exists (iso format)
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1126 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-09-19 21:24:23 +00:00
Tomasz Sowa 239e1e4674 added: CompareNoCase() to convert/text.h
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1125 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-08-11 17:37:35 +00:00
Tomasz Sowa 040eb12c8b added: to convert/text
wchar_t ToLower(wchar_t c)
       wchar_t ToUpper(wchar_t c)
       void ToLower(std::wstring & s)
       void ToUpper(std::wstring & s)
       
       template<class StringType1, class StringType2>
       bool EqualNoCase(const StringType1 * str1, const StringType2 * str2)

       template<class StringType1, class StringType2>
       bool EqualNoCase(const StringType1 & str1, const StringType2 & str2)

       template<class StringType1, class StringType2>
       bool EqualNoCase(const StringType1 * str1_begin, const StringType1 * str1_end, const StringType2 * str2)

added: to space:
       Value * GetValueNoCase(const wchar_t * name);
       Value * GetValueNoCase(const std::wstring & name);
       const Value * GetValueNoCase(const wchar_t * name) const;
       const Value * GetValueNoCase(const std::wstring & name) const;

       
       



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1111 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-05-25 17:12:28 +00:00
Tomasz Sowa 72a510ce71 fixed: JSONToSpaceParser incorrectly read the last character from an UTF8 string (a last character before terminating zero char)
it caused a syntax error when parsing



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1101 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-04-26 16:36:15 +00:00
Tomasz Sowa dd325bd4f9 added: Logger
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1095 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-04-23 14:28:22 +00: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 38355a2830 added: method Date::SerializeISO(Stream & out)
outputs to the given stream: YYYY-MM-DDTHH:MM:SSZ, eg: 1990-02-12T13:05:39Z
added: parsing date in a format: YYYY-MM-DDTHH:MM:SS ('T' letter given)




git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1089 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-04-20 09:33:53 +00:00
Tomasz Sowa dc0cd13178 some work in Space
- default value returned from TextRef()



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1083 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-04-16 22:55:58 +00:00
Tomasz Sowa c910e22c00 temporarily commented 'current_nested_level' in JSONtoSpaceParser
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1082 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-04-16 22:51:14 +00:00
Tomasz Sowa cb23304885 added: to methods Toull(), Toll(), Toul(), Toui(), Tol(), Toi()
a new parameter: bool allow_skip_whitechars default true
added:   new methods: Toull_b(), Toll_b(), Toul_b(), Toui_b(), Tol_b(), Toi_b()
         automatically detects the base (radix):
           4323 - base 10
           0122 - base 8  (string starts with 0)
           #fff - base 16 (string starts with #)
           &101 - base 2  (string starts with &)
added:   CharType * SkipWhiteFromBack(CharType * str, bool check_additional_chars = true, bool treat_new_line_as_white = true)
         skipping white characters from the end of a string
changed: Toll_b(), Toull_b(), Tol_b() and Toul_b() are used in Space now
         for methods ToInt() etc so we are able to use a different base now
changed: some work in Space (const correctness)
       




git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1070 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-01-05 20:03:11 +00:00
Tomasz Sowa e24112b79b some work in Space API:
added: new GetValue() implementation
       Value * GetValue(const wchar_t * name)
       Value * GetValue(const std::wstring & name)
       const Value * GetValue(const wchar_t * name) const
       const Value * GetValue(const std::wstring & name) const
added: const correctness for Text() and TextA() methods
       std::wstring Text(...) const;
       std::string TextA(...) const;
added: TextA() with a wide second argument
       std::string TextA(const wchar_t * name, const wchar_t * def) const;
       std::string TextA(const std::wstring & name, const wchar_t * def) const;
       std::string TextA(const std::wstring & name, const std::wstring & def) const;
       




git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1067 e52654a7-88a9-db11-a3e9-0013d4bc506e
2017-12-07 11:35:12 +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 cde990ba82 start changing the Space API
removed table_single from Space



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1065 e52654a7-88a9-db11-a3e9-0013d4bc506e
2017-06-27 16:51:55 +00:00
Tomasz Sowa 62f16ecb1b changed: using relative paths calculated with relative_path now
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1034 e52654a7-88a9-db11-a3e9-0013d4bc506e
2016-03-18 09:27:40 +00:00
Tomasz Sowa 9deb2ff2f2 some work in MainSpaceParser: added reading long (--longname) parameters
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1025 e52654a7-88a9-db11-a3e9-0013d4bc506e
2016-02-08 18:00:17 +00:00
Tomasz Sowa 7b4b576489 added: MainSpaceParser - starting writing a parser for main(argc, argv) arguments
(a Space object is returned)




git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1019 e52654a7-88a9-db11-a3e9-0013d4bc506e
2016-01-21 18:49:42 +00:00
Tomasz Sowa d9b583df76 instead of directly using 'ar' program we are using the AR macro now
(which defaults to 'ar' if you do not define it)



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@991 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-12 04:11:28 +00:00
Tomasz Sowa d655c7c872 removed: svn:executable attribute from files
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@985 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-01 17:11:00 +00:00
Tomasz Sowa 39717a4dd2 fixed: in static size_t WideToInt(const wchar_t * wide_string, size_t string_len, int & z, bool & correct)
we didn't test UTF8_CheckRange()

added: functions for converting from a wide string into an utf8 c-string:
       bool WideToUTF8(const wchar_t * wide_string, size_t string_len, char * utf8, size_t utf8_len, size_t & utf8_written, int mode = 1);
       bool WideToUTF8(const wchar_t * wide_string,                    char * utf8, size_t utf8_len, size_t & utf8_written, int mode = 1);
       bool WideToUTF8(const std::wstring & wide_string,               char * utf8, size_t utf8_len, size_t & utf8_written, int mode = 1);

       bool WideToUTF8(const wchar_t * wide_string, size_t string_len, char * utf8, size_t utf8_len, int mode = 1);
       bool WideToUTF8(const wchar_t * wide_string,                    char * utf8, size_t utf8_len, int mode = 1);
       bool WideToUTF8(const std::wstring & wide_string,               char * utf8, size_t utf8_len, int mode = 1);




git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@962 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-10-04 11:18:33 +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 3cc5fd5e12 added: -I.. flag for Makefiles when compiling
changed: in SpaceToJSON::PrintToken():
         slash doesn't have to be escaped when serializing to JSON




git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@444 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-10-15 23:53:57 +00:00
Tomasz Sowa aa394b1e4f dummy commit (testing a new repository)
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@439 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-05-07 05:13:08 +00:00
Tomasz Sowa 6e57002a90 fixed: in MemBuffer::MemBuffer(const MemBuffer<> & arg)
we have to initialize some variables before calling the operator=



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@434 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-10-27 07:45:39 +00:00
Tomasz Sowa 1e48455942 added: to Space:
bool HasValue(const wchar_t * name, const wchar_t * value);
       bool HasValue(const wchar_t * name, const std::wstring & value);
       bool HasValue(const std::wstring & name, const wchar_t * value);
       bool HasValue(const std::wstring & name, const std::wstring & value);
       useful when testing whether a value is in a list (or in simple table too)



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@433 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-10-17 19:55:16 +00:00
Tomasz Sowa 02abfe62fa changed: in SpaceParser: now we do not parse special characters when reading commentaries
so we can parse:
         # such a \n string
         beforehand this \n was treated as a new line character
         and the parser was returning syntax error when reading above 'string'



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@432 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-09-25 16:50:01 +00:00
Tomasz Sowa c6c079f8aa some commentaries
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@431 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-09-11 21:41:48 +00:00
Tomasz Sowa 5ad48470b6 added: to Space:
std::wstring & FindAdd(const WTextStream & name);
       std::wstring & Add(const wchar_t * name,        const WTextStream & value);
       std::wstring & Add(const std::wstring & name,   const WTextStream & value);
       std::wstring & Add(const WTextStream & name,    const WTextStream & value);




git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@430 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-07-25 10:27:20 +00:00
Tomasz Sowa f8d5a962ed changed: rewritten the Serialize method in SpaceToJSON class
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@429 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-07-15 22:53:24 +00:00
Tomasz Sowa 2b88d011f6 updated: SpaceToJSON (not finished yet)
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@428 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-07-13 12:26:09 +00:00
Tomasz Sowa 2af6c28a54 added: JSONToSpaceParser -- a parser for JSON format to Space structure
added: SpaceToJSON -- a serializer from Space structure to JSON (not finished yet)



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@427 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-07-12 15:01:15 +00:00
Tomasz Sowa 600d0fc34a added: some work in membuffer and textstreambase
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@426 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-07-10 16:53:26 +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
Tomasz Sowa 64b05fe8d1 added: some work in MemBuffer (copy cctor and assignment operator)
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@424 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-07-02 20:27:31 +00:00
Tomasz Sowa 862dd01ea9 fixed: friend keyword should be used with a type name like 'class'
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@423 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-07-01 22:49:08 +00:00
Tomasz Sowa 4d968f5a85 added: some work in MemBuffer
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@422 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-07-01 22:38:27 +00:00
Tomasz Sowa 62f0624539 added: start working on MemBuffer (an efficient memory buffer)
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@421 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-07-01 00:39:41 +00:00
Tomasz Sowa be8e0d005c changed: Makefile
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@419 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-06-30 23:22:31 +00:00
Tomasz Sowa bff2ecb147 added: to Space:
const std::wstring * GetValue(const std::wstring & name) const;
       std::wstring & Add(const wchar_t * name,        size_t value);
       std::wstring & Add(const std::wstring & name,   size_t value);




git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@418 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-06-26 23:20:59 +00:00
Tomasz Sowa 39a1ea1007 added: to Date:
template<class Stream> void SerializeMonthDay(Stream & out) const;
       template<class Stream> void SerializeHourMin(Stream & out) const;




git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@417 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-06-22 23:35:16 +00:00
Tomasz Sowa d77db196ee added: to Date:
bool ParseMonthDayTime(const CStringType * str, const CStringType ** str_after = 0);
       parsing: MM:DD HH[:MM[:SS]]



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@416 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-05-30 21:48:44 +00:00
Tomasz Sowa e775728f6b added: Date::ToTm() now sets tm_wday too
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@415 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-05-27 23:50:10 +00:00
Tomasz Sowa 03bac5721d added:
Date(const char * str);
       Date(const wchar_t * str);
       Date(const std::string & str);
       Date(const std::wstring & str);
 
       Date & operator=(const char * str);
       Date & operator=(const wchar_t * str);
       Date & operator=(const std::string & str);
       Date & operator=(const std::wstring & str);

       void Swap(Date&);
removed:
       templates cctors and operators=
       it is better to have directly char*, wchar_t and string, wstring



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@414 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-05-26 22:38:18 +00:00
Tomasz Sowa 27cde22774 fixed: two operators: Date::operator=(const CStringType)
need 'return' statement


git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@413 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-05-24 19:24:37 +00:00
Tomasz Sowa 0ffb2b155f added: some methods for parsing from a string
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@412 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-05-22 23:47:41 +00:00
Tomasz Sowa e25bc826e7 changed: Date::SerializeDay outputs the date in a form of YYYY-MM-DD (before was: YYYY.MM.DD)
git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@411 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-05-13 21:49:06 +00:00
Tomasz Sowa 5d9ce6e093 changed: in SpaceParser:
white characters can be escaped by '\ ' and in such a case this is not a delimiter
         (when reading single token)


git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@410 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-05-12 18:20:39 +00:00
Tomasz Sowa 11ddf0f6d9 fixed: in Space serializer: we have to escape more characters
fixed: in SpaceParser::ReadTokenSingle
       the delimiter can be only if the character was not escaped


git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@409 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-05-12 15:54:20 +00:00
Tomasz Sowa e195145394 changed: now in SpaceParser 'split_single' and utf8 are default
removed: some errors checking at the end of a line
         now we can have in the same line: value="option" value2="option2"



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@408 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-05-12 14:54:19 +00:00