Основная часть рефакторинга закончена

This commit is contained in:
Andrei Astafev 2020-04-22 20:59:39 +03:00
parent d6143953f6
commit f550594b85
33 changed files with 144 additions and 41 deletions

View File

@ -1 +1,5 @@
#ifndef MYXLIB_BUILD_LIBRARIES
#error Define MYXLIB_BUILD_LIBRARIES to compile this file.
#endif
#include "config.hpp"

View File

@ -5,8 +5,10 @@
#ifdef MYXLIB_BUILD_LIBRARIES
#undef MYXLIB_HEADER_ONLY
#define MYXLIB_INLINE inline
#else
#define MYXLIB_HEADER_ONLY
#define MYXLIB_INLINE inline
#endif
#ifdef MYXLIB_HEADER_ONLY

View File

@ -1,7 +1,6 @@
#ifndef MYX_BASE_ENUM_BITWISE_OPERATIONS_HPP_
#define MYX_BASE_ENUM_BITWISE_OPERATIONS_HPP_
#pragma once
#include <type_traits>

View File

@ -22,14 +22,14 @@ namespace filesystem {
error "Class CurrentExecutable is supported only in Linux"
#endif
CurrentExecutable::CurrentExecutable() :
MYXLIB_INLINE CurrentExecutable::CurrentExecutable() :
m_procFilePath( QStringLiteral( "/proc/self/exe" ) )
{
m_canonicalFilePath = m_procFilePath.canonicalFilePath();
}
const QFileInfo& CurrentExecutable::canonicalFilePath() const
MYXLIB_INLINE const QFileInfo& CurrentExecutable::canonicalFilePath() const
{
return( m_canonicalFilePath );
}

View File

@ -1 +1,5 @@
#ifndef MYXLIB_BUILD_LIBRARIES
#error Define MYXLIB_BUILD_LIBRARIES to compile this file.
#endif
#include <myx/filesystem/current_executable-inl.hpp>

View File

@ -19,9 +19,9 @@ namespace myx {
namespace filesystem {
Paths::Paths() = default;
MYXLIB_INLINE Paths::Paths() = default;
Paths::HierarchyType Paths::getHierarchyType()
MYXLIB_INLINE Paths::HierarchyType Paths::getHierarchyType()
{
QRegExp binUnityRegexp( "/s*bin/unity$" );
QRegExp binRegexp( "/s*bin$" );
@ -170,7 +170,7 @@ Paths::HierarchyType Paths::getHierarchyType()
} // Paths::getHierarchyType
bool Paths::init( const QString& projectDir, const QString& configFileExtension )
MYXLIB_INLINE bool Paths::init( const QString& projectDir, const QString& configFileExtension )
{
m_projectName = projectDir.isEmpty() ? m_currentExecutable.m_canonicalFilePath.fileName()
: projectDir;
@ -214,7 +214,7 @@ bool Paths::init( const QString& projectDir, const QString& configFileExtension
} // Paths::updatePaths
bool Paths::makeDefaultDirectories()
MYXLIB_INLINE bool Paths::makeDefaultDirectories()
{
bool status = true;
@ -226,7 +226,7 @@ bool Paths::makeDefaultDirectories()
}
QString Paths::findConfigFile( const QString& defaultConfigFile )
MYXLIB_INLINE QString Paths::findConfigFile( const QString& defaultConfigFile )
{
if ( !defaultConfigFile.isEmpty() && QFileInfo( defaultConfigFile ).isReadable() )
{
@ -251,103 +251,103 @@ QString Paths::findConfigFile( const QString& defaultConfigFile )
} // Paths::findConfigFile
QDir Paths::executableFileDirectory() const
MYXLIB_INLINE QDir Paths::executableFileDirectory() const
{
return( m_currentExecutable.m_canonicalFilePath.dir() );
}
const QDir& Paths::userConfigDirectory() const
MYXLIB_INLINE const QDir& Paths::userConfigDirectory() const
{
return( m_userConfigDirectory );
}
const QDir& Paths::systemConfigDirectory() const
MYXLIB_INLINE const QDir& Paths::systemConfigDirectory() const
{
return( m_systemConfigDirectory );
}
const QFileInfo& Paths::configFilePath() const
MYXLIB_INLINE const QFileInfo& Paths::configFilePath() const
{
return( m_configFilePath );
}
const QString& Paths::configFileName() const
MYXLIB_INLINE const QString& Paths::configFileName() const
{
return( m_configFileName );
}
const QString& Paths::configFileExtension() const
MYXLIB_INLINE const QString& Paths::configFileExtension() const
{
return( m_configFileExtension );
}
const QDir& Paths::userVarDataDirectory() const
MYXLIB_INLINE const QDir& Paths::userVarDataDirectory() const
{
return( m_userVarDataDirectory );
}
const QDir& Paths::systemVarDataDirectory() const
MYXLIB_INLINE const QDir& Paths::systemVarDataDirectory() const
{
return( m_systemVarDataDirectory );
}
const QDir& Paths::userConstDataDirectory() const
MYXLIB_INLINE const QDir& Paths::userConstDataDirectory() const
{
return( m_userConstDataDirectory );
}
const QDir& Paths::systemConstDataDirectory() const
MYXLIB_INLINE const QDir& Paths::systemConstDataDirectory() const
{
return( m_systemConstDataDirectory );
}
const QDir& Paths::userLogDirectory() const
MYXLIB_INLINE const QDir& Paths::userLogDirectory() const
{
return( m_userLogDirectory );
}
const QDir& Paths::systemLogDirectory() const
MYXLIB_INLINE const QDir& Paths::systemLogDirectory() const
{
return( m_systemLogDirectory );
}
const QDir& Paths::tempDirectory() const
MYXLIB_INLINE const QDir& Paths::tempDirectory() const
{
return( m_tempDirectory );
}
const QDir& Paths::homeDirectory() const
MYXLIB_INLINE const QDir& Paths::homeDirectory() const
{
return( m_homeDirectory );
}
const QString& Paths::projectName() const
MYXLIB_INLINE const QString& Paths::projectName() const
{
return( m_projectName );
}
QString Paths::executableFileName() const
MYXLIB_INLINE QString Paths::executableFileName() const
{
return( m_currentExecutable.m_canonicalFilePath.fileName() );
}
const QFileInfo& Paths::executableFilePath() const
MYXLIB_INLINE const QFileInfo& Paths::executableFilePath() const
{
return( m_currentExecutable.m_canonicalFilePath );
}

View File

@ -1 +1,5 @@
#ifndef MYXLIB_BUILD_LIBRARIES
#error Define MYXLIB_BUILD_LIBRARIES to compile this file.
#endif
#include <myx/filesystem/paths-inl.hpp>

View File

@ -19,9 +19,9 @@ namespace myx {
namespace filesystem {
PathsMT::PathsMT() = default;
MYXLIB_INLINE PathsMT::PathsMT() = default;
PathsMT& PathsMT::instance()
MYXLIB_INLINE PathsMT& PathsMT::instance()
{
volatile PathsMT* localInstance = mInstance.load( std::memory_order_acquire );
if ( localInstance == nullptr )

View File

@ -1 +1,5 @@
#ifndef MYXLIB_BUILD_LIBRARIES
#error Define MYXLIB_BUILD_LIBRARIES to compile this file.
#endif
#include <myx/filesystem/paths_mt-inl.hpp>

View File

@ -1,3 +1,8 @@
#ifndef MYX_MATH_ALL_HPP_
#define MYX_MATH_ALL_HPP_
#pragma once
#include <myx/math/almost_equal_relative.hpp>
#include <myx/math/almost_equal_relative_and_abs.hpp>
#include <myx/math/almost_equal_ulps.hpp>
@ -6,3 +11,5 @@
#include <myx/math/functions.hpp>
#include <myx/math/radar.hpp>
#include <myx/math/units.hpp>
#endif

View File

@ -1,3 +1,8 @@
#ifndef MYX_MATH_ALMOST_EQUAL_RELATIVE_INL_HPP_
#define MYX_MATH_ALMOST_EQUAL_RELATIVE_INL_HPP_
#pragma once
#ifndef MYXLIB_HEADER_ONLY
#include <myx/math/almost_equal_relative.hpp>
#endif
@ -8,7 +13,7 @@ namespace myx {
namespace math {
bool almost_equal_relative( const float a, const float b,
MYXLIB_INLINE bool almost_equal_relative( const float a, const float b,
const float maxRelDiff )
{
float diff = fabsf( a - b );
@ -24,7 +29,7 @@ bool almost_equal_relative( const float a, const float b,
}
bool almost_equal_relative( const double a, const double b,
MYXLIB_INLINE bool almost_equal_relative( const double a, const double b,
const double maxRelDiff )
{
double diff = fabs( a - b );
@ -42,3 +47,5 @@ bool almost_equal_relative( const double a, const double b,
} // namespace math
} // namespace myx
#endif

View File

@ -1 +1,5 @@
#ifndef MYXLIB_BUILD_LIBRARIES
#error Define MYXLIB_BUILD_LIBRARIES to compile this file.
#endif
#include <myx/math/almost_equal_relative-inl.hpp>

View File

@ -1,6 +1,8 @@
#ifndef MYX_MATH_ALMOST_EQUAL_RELATIVE_HPP_
#define MYX_MATH_ALMOST_EQUAL_RELATIVE_HPP_
#pragma once
#include <myx/base/config.hpp>
#include <cfloat>

View File

@ -1,3 +1,8 @@
#ifndef MYX_MATH_ALMOST_EQUAL_RELATIVE_AND_ABS_INL_HPP_
#define MYX_MATH_ALMOST_EQUAL_RELATIVE_AND_ABS_INL_HPP_
#pragma once
#ifndef MYXLIB_HEADER_ONLY
#include <myx/math/almost_equal_relative_and_abs.hpp>
#endif
@ -8,7 +13,7 @@ namespace myx {
namespace math {
bool almost_equal_relative_and_abs( const float a, const float b,
MYXLIB_INLINE bool almost_equal_relative_and_abs( const float a, const float b,
const float maxAbsDiff, const float maxRelDiff )
{
// Check if the numbers are really close -- needed
@ -31,7 +36,7 @@ bool almost_equal_relative_and_abs( const float a, const float b,
}
bool almost_equal_relative_and_abs( const double a, const double b,
MYXLIB_INLINE bool almost_equal_relative_and_abs( const double a, const double b,
const double maxAbsDiff, const double maxRelDiff )
{
// Check if the numbers are really close -- needed
@ -56,3 +61,5 @@ bool almost_equal_relative_and_abs( const double a, const double b,
} // namespace math
} // namespace myx
#endif

View File

@ -1 +1,5 @@
#ifndef MYXLIB_BUILD_LIBRARIES
#error Define MYXLIB_BUILD_LIBRARIES to compile this file.
#endif
#include <myx/math/almost_equal_relative_and_abs-inl.hpp>

View File

@ -1,6 +1,8 @@
#ifndef MYX_MATH_ALMOST_EQUAL_RELATIVE_AND_ABS_HPP_
#define MYX_MATH_ALMOST_EQUAL_RELATIVE_AND_ABS_HPP_
#pragma once
#include <myx/base/config.hpp>
#include <cfloat>

View File

@ -1,3 +1,8 @@
#ifndef MYX_MATH_ALMOST_EQUAL_ULPS_INL_HPP_
#define MYX_MATH_ALMOST_EQUAL_ULPS_INL_HPP_
#pragma once
#ifndef MYXLIB_HEADER_ONLY
#include <myx/math/almost_equal_ulps.hpp>
#endif
@ -10,7 +15,7 @@ namespace myx {
namespace math {
bool almost_equal_ulps( const float a, const float b,
MYXLIB_INLINE bool almost_equal_ulps( const float a, const float b,
const int maxUlpsDiff )
{
FloatCmp uA( a );
@ -46,7 +51,7 @@ bool almost_equal_ulps( const float a, const float b,
} // almost_equal_ulps
bool almost_equal_ulps( const double a, const double b,
MYXLIB_INLINE bool almost_equal_ulps( const double a, const double b,
const int maxUlpsDiff )
{
DoubleCmp uA( a );
@ -84,3 +89,5 @@ bool almost_equal_ulps( const double a, const double b,
} // namespace math
} // namespace myx
#endif

View File

@ -1 +1,5 @@
#ifndef MYXLIB_BUILD_LIBRARIES
#error Define MYXLIB_BUILD_LIBRARIES to compile this file.
#endif
#include <myx/math/almost_equal_ulps-inl.hpp>

View File

@ -1,6 +1,8 @@
#ifndef MYX_MATH_ALMOST_EQUAL_ULPS_HPP_
#define MYX_MATH_ALMOST_EQUAL_ULPS_HPP_
#pragma once
#include <myx/base/config.hpp>
#include <myx/math/float_cmp_types.hpp>

View File

@ -1,3 +1,8 @@
#ifndef MYX_MATH_ALMOST_EQUAL_ULPS_INL_HPP_
#define MYX_MATH_ALMOST_EQUAL_ULPS_INL_HPP_
#pragma once
#ifndef MYXLIB_HEADER_ONLY
#include <myx/math/almost_equal_ulps_and_abs.hpp>
#endif
@ -10,7 +15,7 @@ namespace myx {
namespace math {
bool almost_equal_ulps_and_abs( const float a, const float b,
MYXLIB_INLINE bool almost_equal_ulps_and_abs( const float a, const float b,
const float maxAbsDiff, const int maxUlpsDiff )
{
// Check if the numbers are really close -- needed
@ -43,7 +48,7 @@ bool almost_equal_ulps_and_abs( const float a, const float b,
} // almost_equal_ulps_and_abs
bool almost_equal_ulps_and_abs( const double a, const double b,
MYXLIB_INLINE bool almost_equal_ulps_and_abs( const double a, const double b,
const double maxAbsDiff, const int maxUlpsDiff )
{
// Check if the numbers are really close -- needed
@ -78,3 +83,5 @@ bool almost_equal_ulps_and_abs( const double a, const double b,
} // namespace math
} // namespace myx
#endif

View File

@ -1 +1,5 @@
#ifndef MYXLIB_BUILD_LIBRARIES
#error Define MYXLIB_BUILD_LIBRARIES to compile this file.
#endif
#include <myx/math/almost_equal_ulps_and_abs-inl.hpp>

View File

@ -1,6 +1,8 @@
#ifndef MYX_MATH_ALMOST_EQUAL_ULPS_HPP_
#define MYX_MATH_ALMOST_EQUAL_ULPS_HPP_
#pragma once
#include <myx/base/config.hpp>
namespace myx {

View File

@ -1,3 +1,8 @@
#ifndef MYX_MATH_CONSTANTS_INL_HPP_
#define MYX_MATH_CONSTANTS_INL_HPP_
#pragma once
#ifndef MYXLIB_HEADER_ONLY
#include <myx/math/constants.hpp>
#endif
@ -9,3 +14,5 @@ namespace math {
} // namespace math
} // namespace myx
#endif

View File

@ -1 +1,5 @@
#ifndef MYXLIB_BUILD_LIBRARIES
#error Define MYXLIB_BUILD_LIBRARIES to compile this file.
#endif
#include <myx/math/constants-inl.hpp>

View File

@ -1,6 +1,8 @@
#ifndef MYX_MATH_CONSTANTS_HPP_
#define MYX_MATH_CONSTANTS_HPP_
#pragma once
#include <myx/base/config.hpp>
#include <cmath>

View File

@ -1,6 +1,8 @@
#ifndef MYX_MATH_FLOAT_CMP_TYPES_HPP_
#define MYX_MATH_FLOAT_CMP_TYPES_HPP_
#pragma once
#include <cstdint>
/**

View File

@ -1,6 +1,8 @@
#ifndef MYX_MATH_FUNCTIONS_HPP_
#define MYX_MATH_FUNCTIONS_HPP_
#pragma once
#include <boost/math/special_functions/pow.hpp>
#include <cmath>
#include <type_traits>

View File

@ -1,6 +1,8 @@
#ifndef MYX_MATH_RADAR_HPP_
#define MYX_MATH_RADAR_HPP_
#pragma once
#include <cmath>
#include <type_traits>

View File

@ -1,6 +1,8 @@
#ifndef MYX_MATH_UNITS_HPP_
#define MYX_MATH_UNITS_HPP_
#pragma once
#include <cmath>
#include <type_traits>
@ -88,5 +90,4 @@ T magnitude_to_decibel( T const& magnitude )
} // namespace myx
#endif // MYX_MATH_UNITS_HPP_

View File

@ -1,6 +1,8 @@
#ifndef MYX_QT_BACKPORTS_HPP_
#define MYX_QT_BACKPORTS_HPP_
#pragma once
#if ( defined ( TARGET_LSB_ID_AstraLinuxSE ) && defined ( TARGET_LSB_CODENAME_smolensk ) )
#define override

View File

@ -17,7 +17,7 @@ namespace myx {
namespace qt {
void append_translators( QTranslatorsList& translators, const QString& appName )
MYXLIB_INLINE void append_translators( QTranslatorsList& translators, const QString& appName )
{
auto* translator = new QTranslator( qApp );

View File

@ -1,2 +1,5 @@
#ifndef MYXLIB_BUILD_LIBRARIES
#error Define MYXLIB_BUILD_LIBRARIES to compile this file.
#endif
#include <myx/qt/translators.hpp>
#include <myx/qt/translators-inl.hpp>

View File

@ -1,5 +1,7 @@
#ifndef MYX_LOG_QT_TRANSLATORS_HPP_
#define MYX_LOG_QT_TRANSLATORS_HPP_
#ifndef MYX_QT_TRANSLATORS_HPP_
#define MYX_QT_TRANSLATORS_HPP_
#pragma once
#include <myx/base/config.hpp>
#include <myx/qt/backports.hpp>
@ -22,4 +24,4 @@ void append_translators( QTranslatorsList& translators, const QString& appName )
#include "translators-inl.hpp"
#endif
#endif // ifndef MYX_LOG_QT_TRANSLATORS_HPP_
#endif // ifndef MYX_QT_TRANSLATORS_HPP_