Code improvements

Improved LogsFormat constructor
This commit is contained in:
Valentino Orlandi 2024-01-21 20:42:52 +01:00
parent b48703cf3a
commit e7279651d8
Signed by: elB4RTO
GPG Key ID: 1719E976DB2D4E71
2 changed files with 8 additions and 5 deletions

View File

@ -570,7 +570,8 @@ LogsFormat FormatOps::processApacheFormatString( const std::string& f_str ) cons
}
return LogsFormat(
f_str, initial, final, separators, fields,
f_str, std::move(initial), std::move(final),
std::move(separators), std::move(fields),
countNewLines( initial, final, separators ) );
}
@ -672,7 +673,8 @@ LogsFormat FormatOps::processNginxFormatString( const std::string& f_str ) const
}
return LogsFormat(
f_str, initial, final, separators, fields,
f_str, std::move(initial), std::move(final),
std::move(separators), std::move(fields),
countNewLines( initial, final, separators ) );
}
// sample
@ -767,7 +769,8 @@ LogsFormat FormatOps::processIisFormatString( const std::string& f_str, const in
}
return LogsFormat(
f_str, initial, final, separators, fields, 0 );
f_str, std::move(initial), std::move(final),
std::move(separators), std::move(fields), 0 );
}
// sample
QString FormatOps::getIisLogSample( const LogsFormat& log_format ) const noexcept

View File

@ -70,8 +70,8 @@ Q_DECLARE_METATYPE( LogFile )
struct LogsFormat final {
explicit LogsFormat() noexcept = default;
explicit LogsFormat
(const std::string& str,const std::string& itl,const std::string& fnl,const std::vector<std::string>& seps,const std::vector<std::string>& flds,const unsigned nl) noexcept
:string{str},initial{itl},final{fnl},separators{seps},fields{flds},new_lines{nl}{}
(const std::string& str,std::string&& itl,std::string&& fnl,std::vector<std::string>&& seps,std::vector<std::string>&& flds,const unsigned nl) noexcept
:string{str},initial{std::move(itl)},final{std::move(fnl)},separators{std::move(seps)},fields{std::move(flds)},new_lines{nl}{}
std::string string; //!< The logs format string
std::string initial; //!< The initial separator
std::string final; //!< The final separator