Browse Source

namespace PT renamed to pt

pull/4/head
Tomasz Sowa 1 year ago
parent
commit
b574289054
  1. 2
      src/convert/inttostr.cpp
  2. 2
      src/convert/inttostr.h
  3. 2
      src/convert/misc.cpp
  4. 2
      src/convert/misc.h
  5. 2
      src/convert/patternreplacer.h
  6. 2
      src/convert/strtoint.h
  7. 2
      src/convert/text.cpp
  8. 2
      src/convert/text.h
  9. 4
      src/convert/text_private.h
  10. 8
      src/csv/csvparser.cpp
  11. 2
      src/csv/csvparser.h
  12. 2
      src/date/date.cpp
  13. 2
      src/date/date.h
  14. 10
      src/log/filelog.cpp
  15. 4
      src/log/filelog.h
  16. 16
      src/log/log.cpp
  17. 16
      src/log/log.h
  18. 6
      src/mainoptions/mainoptionsparser.cpp
  19. 2
      src/mainoptions/mainoptionsparser.h
  20. 2
      src/membuffer/membuffer.h
  21. 22
      src/space/space.cpp
  22. 6
      src/space/space.h
  23. 10
      src/space/spaceparser.cpp
  24. 2
      src/space/spaceparser.h
  25. 10
      src/textstream/textstream.h
  26. 2
      src/textstream/types.h
  27. 2
      src/utf8/utf8.cpp
  28. 2
      src/utf8/utf8.h
  29. 4
      src/utf8/utf8_private.cpp
  30. 6
      src/utf8/utf8_private.h
  31. 4
      src/utf8/utf8_templates.h
  32. 1145
      tests/convert.cpp
  33. 4
      tests/convert.h
  34. 5
      tests/csvparser.cpp
  35. 7
      tests/mainoptionsparser.cpp

2
src/convert/inttostr.cpp

@ -38,7 +38,7 @@
#include "inttostr.h"
namespace PT
namespace pt
{
std::string to_str(unsigned long long value, int base)

2
src/convert/inttostr.h

@ -42,7 +42,7 @@
namespace PT
namespace pt
{

2
src/convert/misc.cpp

@ -38,7 +38,7 @@
#include "misc.h"
namespace PT
namespace pt
{

2
src/convert/misc.h

@ -42,7 +42,7 @@
#include "text.h"
namespace PT
namespace pt
{
void SetOverflow(bool * was_overflow, bool val);

2
src/convert/patternreplacer.h

@ -44,7 +44,7 @@
namespace PT
namespace pt
{
template<typename CharType, typename StrType>

2
src/convert/strtoint.h

@ -43,7 +43,7 @@
#include "misc.h"
namespace PT
namespace pt
{

2
src/convert/text.cpp

@ -40,7 +40,7 @@
#include "text_private.h"
namespace PT
namespace pt
{
// white_chars table should be sorted (a binary search algorithm is used to find a character)

2
src/convert/text.h

@ -41,7 +41,7 @@
#include <string>
namespace PT
namespace pt
{
bool is_white(wchar_t c, bool check_additional_chars = true, bool treat_new_line_as_white = true);

4
src/convert/text_private.h

@ -42,7 +42,7 @@
#include "text.h"
namespace PT
namespace pt
{
namespace pt_private
@ -302,7 +302,7 @@ bool is_substr_nc_generic(const StringType1 * short_str, const StringType2 * lon
} // namespace pt_private
} // namespace PT
} // namespace pt
#endif

8
src/csv/csvparser.cpp

@ -40,7 +40,7 @@
namespace PT
namespace pt
{
@ -81,7 +81,7 @@ CSVParser::Status CSVParser::parse_file(const wchar_t * file_name, Space & out_s
{
std::string file_name_utf8;
PT::WideToUTF8(file_name, file_name_utf8);
WideToUTF8(file_name, file_name_utf8);
return parse_file(file_name_utf8.c_str(), out_space);
}
@ -295,7 +295,7 @@ bool correct;
do
{
PT::UTF8ToInt(file, c, correct);
UTF8ToInt(file, c, correct);
if( !file )
return lastc;
@ -348,7 +348,7 @@ bool correct;
do
{
size_t len = PT::UTF8ToInt(pchar_ascii, c, correct);
size_t len = UTF8ToInt(pchar_ascii, c, correct);
pchar_ascii += len;
}
while( *pchar_ascii && !correct );

2
src/csv/csvparser.h

@ -43,7 +43,7 @@
#include <fstream>
namespace PT
namespace pt
{
/*

2
src/date/date.cpp

@ -41,7 +41,7 @@
#include <string.h>
namespace PT
namespace pt
{

2
src/date/date.h

@ -44,7 +44,7 @@
namespace PT
namespace pt
{

10
src/log/filelog.cpp

@ -39,7 +39,7 @@
namespace PT
namespace pt
{
@ -74,7 +74,7 @@ void FileLog::init(const std::wstring & log_file, bool log_stdout, int log_level
this->log_stdout = log_stdout;
this->log_level = log_level;
this->save_each_line = save_each_line;
PT::WideToUTF8(log_file, this->log_file);
WideToUTF8(log_file, this->log_file);
}
@ -100,7 +100,7 @@ void FileLog::open_file()
}
void FileLog::save_log(PT::WTextStream * buffer)
void FileLog::save_log(WTextStream * buffer)
{
if( buffer->empty() )
return;
@ -111,7 +111,7 @@ void FileLog::save_log(PT::WTextStream * buffer)
{
if( log_stdout )
{
PT::WideStreamToUTF8(*buffer, std::cout);
WideStreamToUTF8(*buffer, std::cout);
}
if( !log_file.empty() )
@ -126,7 +126,7 @@ void FileLog::save_log(PT::WTextStream * buffer)
if( file )
{
PT::WideStreamToUTF8(*buffer, file);
WideStreamToUTF8(*buffer, file);
file.flush();
}
}

4
src/log/filelog.h

@ -42,7 +42,7 @@
#include "textstream/textstream.h"
namespace PT
namespace pt
{
@ -55,7 +55,7 @@ public:
virtual ~FileLog();
virtual void init(const std::wstring & log_file, bool log_stdout, int log_level, bool save_each_line);
virtual void save_log(PT::WTextStream * buffer);
virtual void save_log(WTextStream * buffer);
virtual int get_log_level();
virtual bool should_save_each_line();

16
src/log/log.cpp

@ -45,7 +45,7 @@
#include "morm.h"
#endif
namespace PT
namespace pt
{
@ -73,13 +73,13 @@ Log::~Log()
}
void Log::SetLogBuffer(PT::WTextStream * buffer)
void Log::SetLogBuffer(WTextStream * buffer)
{
this->buffer = buffer;
}
PT::WTextStream * Log::GetLogBuffer()
WTextStream * Log::GetLogBuffer()
{
return buffer;
}
@ -136,7 +136,7 @@ Log & Log::operator<<(const char * s)
{
if( buffer && file_log && s && current_level <= file_log->get_log_level() )
{
PT::UTF8ToWide(s, *buffer, false);
UTF8ToWide(s, *buffer, false);
}
return *this;
@ -148,7 +148,7 @@ Log & Log::operator<<(const std::string & s)
{
if( buffer && file_log && current_level <= file_log->get_log_level() )
{
PT::UTF8ToWide(s, *buffer, false);
UTF8ToWide(s, *buffer, false);
}
return *this;
@ -160,7 +160,7 @@ Log & Log::operator<<(const std::string * s)
{
if( buffer && file_log && current_level <= file_log->get_log_level() )
{
PT::UTF8ToWide(*s, *buffer, false);
UTF8ToWide(*s, *buffer, false);
}
return *this;
@ -290,7 +290,7 @@ Log & Log::operator<<(double s)
Log & Log::operator<<(const PT::Space & s)
Log & Log::operator<<(const Space & s)
{
if( buffer && file_log && current_level <= file_log->get_log_level() )
{
@ -302,7 +302,7 @@ Log & Log::operator<<(const PT::Space & s)
Log & Log::operator<<(const PT::Date & date)
Log & Log::operator<<(const Date & date)
{
if( buffer && file_log && current_level <= file_log->get_log_level() )
{

16
src/log/log.h

@ -51,7 +51,7 @@ namespace morm
}
namespace PT
namespace pt
{
@ -93,8 +93,8 @@ public:
Log();
virtual ~Log();
virtual void SetLogBuffer(PT::WTextStream * buffer);
virtual PT::WTextStream * GetLogBuffer();
virtual void SetLogBuffer(WTextStream * buffer);
virtual WTextStream * GetLogBuffer();
void SetFileLog(FileLog * file_log);
FileLog * GetFileLog();
@ -128,8 +128,8 @@ public:
//virtual Log & operator<<(float s); // added
virtual Log & operator<<(double s);
virtual Log & operator<<(const PT::Space & space);
virtual Log & operator<<(const PT::Date & date);
virtual Log & operator<<(const Space & space);
virtual Log & operator<<(const Date & date);
#ifdef PT_HAS_MORM
virtual Log & operator<<(morm::Model & model);
@ -145,7 +145,7 @@ public:
template<typename char_type, size_t stack_size, size_t heap_block_size>
Log & operator<<(const PT::TextStreamBase<char_type, stack_size, heap_block_size> & buf);
Log & operator<<(const TextStreamBase<char_type, stack_size, heap_block_size> & buf);
@ -157,7 +157,7 @@ public:
protected:
// buffer for the log
PT::WTextStream * buffer;
WTextStream * buffer;
// file logger
FileLog * file_log;
@ -205,7 +205,7 @@ Log & Log::log_string_generic(const StringType & value, size_t max_size)
template<typename char_type, size_t stack_size, size_t heap_block_size>
Log & Log::operator<<(const PT::TextStreamBase<char_type, stack_size, heap_block_size> & buf)
Log & Log::operator<<(const TextStreamBase<char_type, stack_size, heap_block_size> & buf)
{
if( buffer && file_log && current_level <= file_log->get_log_level() )
{

6
src/mainoptions/mainoptionsparser.cpp

@ -42,7 +42,7 @@
namespace PT
namespace pt
{
@ -165,7 +165,7 @@ void MainOptionsParser::convert_str(const char * src, std::wstring & dst)
{
if( should_use_utf8 )
{
PT::UTF8ToWide(src, dst);
UTF8ToWide(src, dst);
}
else
{
@ -181,7 +181,7 @@ void MainOptionsParser::convert_str(const char * src, size_t len, std::wstring &
{
if( should_use_utf8 )
{
PT::UTF8ToWide(src, len, dst);
UTF8ToWide(src, len, dst);
}
else
{

2
src/mainoptions/mainoptionsparser.h

@ -43,7 +43,7 @@
#include <vector>
namespace PT
namespace pt
{

2
src/membuffer/membuffer.h

@ -41,7 +41,7 @@
#include <iostream>
namespace PT
namespace pt
{
/*

22
src/space/space.cpp

@ -42,7 +42,7 @@
#include "convert/convert.h"
namespace PT
namespace pt
{
Space::Space()
@ -922,7 +922,7 @@ std::string Space::to_str() const
if( type == type_wstring )
{
PT::TextStream stream;
TextStream stream;
serialize_string_buffer(value.value_wstring.c_str(), stream, Escape::no_escape);
stream.to_string(str);
return str;
@ -942,7 +942,7 @@ std::wstring Space::to_wstr() const
if( type == type_string )
{
PT::UTF8ToWide(value.value_string, str);
UTF8ToWide(value.value_string, str);
return str;
}
@ -1277,7 +1277,7 @@ std::wstring Space::serialize_to_space_wstr(bool pretty_print) const
void Space::serialize_to_space_to(std::string & str, bool pretty_print) const
{
PT::TextStream stream;
TextStream stream;
serialize_to_space_stream(stream, pretty_print);
stream.to_string(str);
@ -1286,7 +1286,7 @@ void Space::serialize_to_space_to(std::string & str, bool pretty_print) const
void Space::serialize_to_space_to(std::wstring & str, bool pretty_print) const
{
PT::WTextStream stream;
WTextStream stream;
serialize_to_space_stream(stream, pretty_print);
stream.to_string(str);
@ -1312,7 +1312,7 @@ std::wstring Space::serialize_to_json_wstr() const
void Space::serialize_to_json_to(std::string & str) const
{
PT::TextStream stream;
TextStream stream;
serialize_to_json_stream(stream);
stream.to_string(str);
@ -1321,7 +1321,7 @@ void Space::serialize_to_json_to(std::string & str) const
void Space::serialize_to_json_to(std::wstring & str) const
{
PT::WTextStream stream;
WTextStream stream;
serialize_to_json_stream(stream);
stream.to_string(str);
@ -1429,7 +1429,7 @@ bool Space::has_value(const char * val) const
{
for(size_t i=0 ; i < value.value_table.size() ; ++i)
{
PT::Space * table_item = value.value_table[i];
Space * table_item = value.value_table[i];
if( table_item->type == type_string )
{
@ -1459,7 +1459,7 @@ bool Space::has_value(const wchar_t * val) const
{
for(size_t i=0 ; i < value.value_table.size() ; ++i)
{
PT::Space * table_item = value.value_table[i];
Space * table_item = value.value_table[i];
if( table_item->type == type_wstring )
{
@ -1934,7 +1934,7 @@ void Space::remove_child_space(const wchar_t * name)
{
for(size_t i=0 ; i<child_spaces->size() ; )
{
PT::Space * child = (*child_spaces)[i];
Space * child = (*child_spaces)[i];
if( child->name && (*child->name) == name )
{
@ -1960,7 +1960,7 @@ void Space::remove_child_space(size_t index)
{
if( child_spaces && index < child_spaces->size() )
{
PT::Space * child = (*child_spaces)[index];
Space * child = (*child_spaces)[index];
delete child;
child = nullptr;

6
src/space/space.h

@ -50,7 +50,7 @@
namespace PT
namespace pt
{
@ -915,7 +915,7 @@ protected:
wchar_t buffer[50];
size_t buffer_len = sizeof(buffer) / sizeof(wchar_t);
PT::Toa(value.value_long, buffer, buffer_len);
Toa(value.value_long, buffer, buffer_len);
serialize_string_buffer(buffer, str, Escape::escape_space);
}
@ -1095,7 +1095,7 @@ protected:
wchar_t buffer[50];
size_t buffer_len = sizeof(buffer) / sizeof(wchar_t);
PT::Toa(value.value_long, buffer, buffer_len);
Toa(value.value_long, buffer, buffer_len);
serialize_string_buffer(buffer, str, Escape::escape_json);
}

10
src/space/spaceparser.cpp

@ -42,7 +42,7 @@
#include "convert/strtoint.h"
namespace PT
namespace pt
{
@ -145,7 +145,7 @@ SpaceParser::Status SpaceParser::ParseJSONFile(const wchar_t * file_name)
{
std::string file_name_utf8;
PT::WideToUTF8(file_name, file_name_utf8);
WideToUTF8(file_name, file_name_utf8);
return ParseJSONFile(file_name_utf8.c_str());
}
@ -195,7 +195,7 @@ SpaceParser::Status SpaceParser::ParseSpaceFile(const wchar_t * file_name)
{
std::string file_name_utf8;
PT::WideToUTF8(file_name, file_name_utf8);
WideToUTF8(file_name, file_name_utf8);
return ParseSpaceFile(file_name_utf8.c_str());
}
@ -972,7 +972,7 @@ bool correct;
do
{
PT::UTF8ToInt(file, c, correct);
UTF8ToInt(file, c, correct);
if( !file )
return lastc;
@ -1025,7 +1025,7 @@ bool correct;
do
{
size_t len = PT::UTF8ToInt(pchar_ascii, c, correct);
size_t len = UTF8ToInt(pchar_ascii, c, correct);
pchar_ascii += len;
}
while( *pchar_ascii && !correct );

2
src/space/spaceparser.h

@ -43,7 +43,7 @@
namespace PT
namespace pt
{

10
src/textstream/textstream.h

@ -49,7 +49,7 @@
// for snprintf
#include <cstdio>
namespace PT
namespace pt
{
@ -109,8 +109,8 @@ public:
TextStreamBase & operator<<(unsigned long long);
TextStreamBase & operator<<(double);
TextStreamBase & operator<<(const void *); // printing a pointer
TextStreamBase & operator<<(const PT::Space & space);
TextStreamBase & operator<<(const PT::Date & date);
TextStreamBase & operator<<(const Space & space);
TextStreamBase & operator<<(const Date & date);
// min width for integer output
// if the output value has less digits then first zeroes are added
@ -469,7 +469,7 @@ wchar_t buf[100];
template<typename char_type, size_t stack_size, size_t heap_block_size>
TextStreamBase<char_type, stack_size, heap_block_size> &
TextStreamBase<char_type, stack_size, heap_block_size>::operator<<(const PT::Space & space)
TextStreamBase<char_type, stack_size, heap_block_size>::operator<<(const Space & space)
{
space.serialize_to_space_stream(*this, true);
@ -480,7 +480,7 @@ return *this;
template<typename char_type, size_t stack_size, size_t heap_block_size>
TextStreamBase<char_type, stack_size, heap_block_size> &
TextStreamBase<char_type, stack_size, heap_block_size>::operator<<(const PT::Date & date)
TextStreamBase<char_type, stack_size, heap_block_size>::operator<<(const Date & date)
{
date.Serialize(*this);

2
src/textstream/types.h

@ -40,7 +40,7 @@
namespace PT
namespace pt
{

2
src/utf8/utf8.cpp

@ -40,7 +40,7 @@
namespace PT
namespace pt
{

2
src/utf8/utf8.h

@ -42,7 +42,7 @@
#include "textstream/textstream.h"
namespace PT
namespace pt
{
/*!

4
src/utf8/utf8_private.cpp

@ -38,7 +38,7 @@
#include "utf8_private.h"
namespace PT
namespace pt
{
namespace private_namespace
@ -277,7 +277,7 @@ return chars;
} // namespace private_namespace
} // namespace PT
} // namespace pt

6
src/utf8/utf8_private.h

@ -41,7 +41,7 @@
#include "textstream/textstream.h"
namespace PT
namespace pt
{
bool UTF8_CheckRange(int c);
@ -138,7 +138,7 @@ bool correct, was_error = false;
}
else
{
len = PT::UTF8ToInt(utf8, utf8_len, z, correct); // the len will be different from zero
len = pt::UTF8ToInt(utf8, utf8_len, z, correct); // the len will be different from zero
}
if( !correct )
@ -215,6 +215,6 @@ void WideToUTF8Generic(TextStreamBase<char_type, stack_size, heap_block_size> &
} // namespace private_namespace
} // namespace PT
} // namespace pt
#endif

4
src/utf8/utf8_templates.h

@ -43,7 +43,7 @@
#include "utf8_private.h"
namespace PT
namespace pt
{
@ -263,7 +263,7 @@ void WideStreamToUTF8(StreamTypeIn & buffer, StreamTypeOut & utf8, int mode)
} // namespace PT
} // namespace pt
#endif

1145
tests/convert.cpp

File diff suppressed because it is too large Load Diff

4
tests/convert.h

@ -46,14 +46,10 @@ namespace pt_convert_tests
void make_tests();
}
}

5
tests/csvparser.cpp

@ -44,14 +44,11 @@
namespace pt
{
// remove me in the future (when PT will be changed to pt)
using namespace PT;
namespace pt_csvparser_tests
{
void test_csvparser(const char * input_str, const char * expected_json)
{
CSVParser csv_parser;

7
tests/mainoptionsparser.cpp

@ -45,13 +45,10 @@
namespace pt
{
// remove me in the future (when PT will be changed to pt)
using namespace PT;
namespace pt_mainoptions_tests
{
struct MainOptionsParserOutputTest
{
MainOptionsParser::Status status;
@ -83,7 +80,7 @@ bool has_space_in_str(const char * arg)
{
while( *arg )
{
if( PT::is_white((wchar_t)*arg) )
if( is_white((wchar_t)*arg) )
return true;
arg += 1;

Loading…
Cancel
Save