namespace PT renamed to pt

This commit is contained in:
2021-05-20 16:25:01 +02:00
parent b12037a7e5
commit 34274ca230
32 changed files with 383 additions and 383 deletions

View File

@@ -67,13 +67,13 @@ DbConnector::~DbConnector()
}
void DbConnector::set_logger(PT::Log * log)
void DbConnector::set_logger(pt::Log * log)
{
this->log = log;
}
void DbConnector::set_logger(PT::Log & log)
void DbConnector::set_logger(pt::Log & log)
{
this->log = &log;
}
@@ -85,7 +85,7 @@ void DbConnector::set_log_queries(bool log_queries)
}
bool DbConnector::query(const PT::TextStream & stream)
bool DbConnector::query(const pt::TextStream & stream)
{
std::unique_ptr<QueryResult> query_result_ptr(create_query_result());
return query(stream, *query_result_ptr);
@@ -107,7 +107,7 @@ bool DbConnector::query(const char * query_str)
bool DbConnector::query(const PT::TextStream & stream, QueryResult & query_result)
bool DbConnector::query(const pt::TextStream & stream, QueryResult & query_result)
{
std::string query_str;
stream.to_string(query_str);
@@ -152,22 +152,22 @@ bool DbConnector::query_remove(const char * query_str, QueryResult & query_resul
bool DbConnector::query_select(const PT::TextStream & stream, QueryResult & query_result)
bool DbConnector::query_select(const pt::TextStream & stream, QueryResult & query_result)
{
return query(stream, query_result);
}
bool DbConnector::query_update(const PT::TextStream & stream, QueryResult & query_result)
bool DbConnector::query_update(const pt::TextStream & stream, QueryResult & query_result)
{
return query(stream, query_result);
}
bool DbConnector::query_insert(const PT::TextStream & stream, QueryResult & query_result)
bool DbConnector::query_insert(const pt::TextStream & stream, QueryResult & query_result)
{
return query(stream, query_result);
}
bool DbConnector::query_remove(const PT::TextStream & stream, QueryResult & query_result)
bool DbConnector::query_remove(const pt::TextStream & stream, QueryResult & query_result)
{
return query(stream, query_result);
}
@@ -181,7 +181,7 @@ DbExpression * DbConnector::get_expression()
}
void DbConnector::generate_select_columns(PT::TextStream & stream, Model & model)
void DbConnector::generate_select_columns(pt::TextStream & stream, Model & model)
{
allocate_default_expression_if_needed();
@@ -196,7 +196,7 @@ void DbConnector::generate_select_columns(PT::TextStream & stream, Model & model
}
void DbConnector::generate_insert_query(PT::TextStream & stream, Model & model)
void DbConnector::generate_insert_query(pt::TextStream & stream, Model & model)
{
allocate_default_expression_if_needed();
@@ -221,7 +221,7 @@ void DbConnector::generate_insert_query(PT::TextStream & stream, Model & model)
}
void DbConnector::generate_update_query(PT::TextStream & stream, Model & model)
void DbConnector::generate_update_query(pt::TextStream & stream, Model & model)
{
allocate_default_expression_if_needed();
@@ -246,7 +246,7 @@ void DbConnector::generate_update_query(PT::TextStream & stream, Model & model)
}
void DbConnector::generate_remove_query(PT::TextStream & stream, Model & model)
void DbConnector::generate_remove_query(pt::TextStream & stream, Model & model)
{
allocate_default_expression_if_needed();
@@ -265,7 +265,7 @@ void DbConnector::generate_remove_query(PT::TextStream & stream, Model & model)
}
}
bool DbConnector::insert(PT::TextStream & stream, Model & model)
bool DbConnector::insert(pt::TextStream & stream, Model & model)
{
std::unique_ptr<QueryResult> query_result_ptr(create_query_result());
@@ -274,7 +274,7 @@ bool DbConnector::insert(PT::TextStream & stream, Model & model)
}
bool DbConnector::update(PT::TextStream & stream, Model & model)
bool DbConnector::update(pt::TextStream & stream, Model & model)
{
std::unique_ptr<QueryResult> query_result_ptr(create_query_result());
@@ -283,7 +283,7 @@ bool DbConnector::update(PT::TextStream & stream, Model & model)
}
bool DbConnector::remove(PT::TextStream & stream, Model & model)
bool DbConnector::remove(pt::TextStream & stream, Model & model)
{
std::unique_ptr<QueryResult> query_result_ptr(create_query_result());
@@ -333,14 +333,14 @@ char DbConnector::unescape_hex_char_part(char hex)
{
if( log )
{
(*log) << PT::Log::log2 << "Morm: incorrect character when reading a hex string, char code: " << (int)(unsigned char)hex;
(*log) << pt::Log::log2 << "Morm: incorrect character when reading a hex string, char code: " << (int)(unsigned char)hex;
if( hex >= 32 )
{
(*log) << " '" << hex << "'";
}
(*log) << PT::Log::logend;
(*log) << pt::Log::logend;
}
}
@@ -443,7 +443,7 @@ size_t DbConnector::unescape_hex_char(const char * value_str, wchar_t & field_va
int value_int;
bool is_correct;
len = PT::UTF8ToInt(utf8_str, utf8_str_len, value_int, is_correct);
len = pt::UTF8ToInt(utf8_str, utf8_str_len, value_int, is_correct);
len = len * 2;
if( is_correct )
@@ -454,7 +454,7 @@ size_t DbConnector::unescape_hex_char(const char * value_str, wchar_t & field_va
{
if( log )
{
(*log) << PT::Log::log2 << "Morm: incorrect utf-8 sequence (ignoring)" << PT::Log::logend;
(*log) << pt::Log::log2 << "Morm: incorrect utf-8 sequence (ignoring)" << pt::Log::logend;
}
}
}
@@ -469,7 +469,7 @@ size_t DbConnector::unescape_hex_char(const char * value_str, wchar_t & field_va
{
if( log )
{
(*log) << PT::Log::log2 << "Morm: unexpected end of string (ignoring)" << PT::Log::logend;
(*log) << pt::Log::log2 << "Morm: unexpected end of string (ignoring)" << pt::Log::logend;
}
}
}
@@ -503,8 +503,8 @@ void DbConnector::get_value(const char * value_str, char & field_value, const FT
{
if( log )
{
(*log) << PT::Log::log2 << "Morm: a character greater than 127 cannot be stored in char type, code point: "
<< (int)c << " '" << c << "'" << PT::Log::logend;
(*log) << pt::Log::log2 << "Morm: a character greater than 127 cannot be stored in char type, code point: "
<< (int)c << " '" << c << "'" << pt::Log::logend;
}
}
}
@@ -548,7 +548,7 @@ void DbConnector::get_value(const char * value_str, wchar_t & field_value, const
int value_int;
bool is_correct;
PT::UTF8ToInt(value_str, value_int, is_correct);
pt::UTF8ToInt(value_str, value_int, is_correct);
if( is_correct )
{
@@ -584,7 +584,7 @@ void DbConnector::get_value(const char * value_str, std::wstring & field_value,
{
if( field_type.use_utf8() )
{
PT::UTF8ToWide(value_str, field_value);
pt::UTF8ToWide(value_str, field_value);
}
else
{
@@ -627,56 +627,56 @@ void DbConnector::get_value(const char * value_str, bool & field_value, const FT
void DbConnector::get_value(const char * value_str, short & field_value, const FT & field_type)
{
// IMPROVE ME give some overflow checking
field_value = (short)PT::Toi(value_str, 10);
field_value = (short)pt::Toi(value_str, 10);
}
void DbConnector::get_value(const char * value_str, unsigned short & field_value, const FT & field_type)
{
// IMPROVE ME give some overflow checking
field_value = (unsigned short)PT::Toui(value_str, 10);
field_value = (unsigned short)pt::Toui(value_str, 10);
}
void DbConnector::get_value(const char * value_str, int & field_value, const FT & field_type)
{
// IMPROVE ME give some overflow checking
field_value = PT::Toi(value_str, 10);
field_value = pt::Toi(value_str, 10);
}
void DbConnector::get_value(const char * value_str, unsigned int & field_value, const FT & field_type)
{
// IMPROVE ME give some overflow checking
field_value = PT::Toui(value_str, 10);
field_value = pt::Toui(value_str, 10);
}
void DbConnector::get_value(const char * value_str, long & field_value, const FT & field_type)
{
// IMPROVE ME give some overflow checking
field_value = PT::Tol(value_str, 10);
field_value = pt::Tol(value_str, 10);
}
void DbConnector::get_value(const char * value_str, unsigned long & field_value, const FT & field_type)
{
// IMPROVE ME give some overflow checking
field_value = PT::Toul(value_str, 10);
field_value = pt::Toul(value_str, 10);
}
void DbConnector::get_value(const char * value_str, long long & field_value, const FT & field_type)
{
// IMPROVE ME give some overflow checking
field_value = PT::Toll(value_str, 10);
field_value = pt::Toll(value_str, 10);
}
void DbConnector::get_value(const char * value_str, unsigned long long & field_value, const FT & field_type)
{
// IMPROVE ME give some overflow checking
field_value = PT::Toull(value_str, 10);
field_value = pt::Toull(value_str, 10);
}
@@ -701,30 +701,30 @@ void DbConnector::get_value(const char * value_str, long double & field_value, c
}
void DbConnector::get_value(const char * value_str, PT::Date & field_value, const FT & field_type)
void DbConnector::get_value(const char * value_str, pt::Date & field_value, const FT & field_type)
{
// IMPROVE ME give some log if parsing failed
field_value.Parse(value_str);
}
void DbConnector::get_value(const char * value_str, PT::Space & field_value, const FT & field_type)
void DbConnector::get_value(const char * value_str, pt::Space & field_value, const FT & field_type)
{
field_value.clear();
if( *value_str != '\0' )
{
PT::SpaceParser space_parser;
pt::SpaceParser space_parser;
space_parser.SetSpace(field_value);
if( space_parser.ParseSpace(value_str) != PT::SpaceParser::ok )
if( space_parser.ParseSpace(value_str) != pt::SpaceParser::ok )
{
field_value.clear();
if( log )
{
(*log) << PT::Log::log2 << "Morm: I cannot correctly parse the Space struct from the datebase"
<< ", the raw string is: " << value_str << PT::Log::logend;
(*log) << pt::Log::log2 << "Morm: I cannot correctly parse the Space struct from the datebase"
<< ", the raw string is: " << value_str << pt::Log::logend;
}
}
}