mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-16 18:32:10 -05:00
Convert to enum class
This commit is contained in:
1 parent
e85c36b4a4
commit
95fc63fe7c
76 files changed
+363
-333
No files matched your search
@@ -36,7 +36,7 @@ class RiaCurveDataTools
|
||||
public:
|
||||
typedef std::vector<std::pair<size_t, size_t>> CurveIntervals;
|
||||
|
||||
enum ErrorAxis
|
||||
enum class ErrorAxis
|
||||
{
|
||||
ERROR_ALONG_X_AXIS,
|
||||
ERROR_ALONG_Y_AXIS
|
||||
|
||||
@@ -28,11 +28,11 @@ namespace caf
|
||||
template <>
|
||||
void RiaEclipseUnitTools::UnitSystemType::setUp()
|
||||
{
|
||||
addItem( RiaEclipseUnitTools::UNITS_METRIC, "UNITS_METRIC", "Metric" );
|
||||
addItem( RiaEclipseUnitTools::UNITS_FIELD, "UNITS_FIELD", "Field" );
|
||||
addItem( RiaEclipseUnitTools::UNITS_UNKNOWN, "UNITS_UNKNOWN", "Unknown" );
|
||||
addItem( RiaEclipseUnitTools::UnitSystem::UNITS_METRIC, "UNITS_METRIC", "Metric" );
|
||||
addItem( RiaEclipseUnitTools::UnitSystem::UNITS_FIELD, "UNITS_FIELD", "Field" );
|
||||
addItem( RiaEclipseUnitTools::UnitSystem::UNITS_UNKNOWN, "UNITS_UNKNOWN", "Unknown" );
|
||||
|
||||
setDefault( RiaEclipseUnitTools::UNITS_METRIC );
|
||||
setDefault( RiaEclipseUnitTools::UnitSystem::UNITS_METRIC );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
@@ -49,9 +49,9 @@ double RiaEclipseUnitTools::darcysConstant( UnitSystem unitSystem )
|
||||
// = 0.00864 (PVT - M)
|
||||
switch ( unitSystem )
|
||||
{
|
||||
case UNITS_FIELD:
|
||||
case UnitSystem::UNITS_FIELD:
|
||||
return 0.001127;
|
||||
case UNITS_METRIC:
|
||||
case UnitSystem::UNITS_METRIC:
|
||||
return 0.008527;
|
||||
default:
|
||||
CVF_ASSERT( false );
|
||||
@@ -66,16 +66,16 @@ RiaDefines::DepthUnitType RiaEclipseUnitTools::depthUnit( UnitSystem unit )
|
||||
{
|
||||
switch ( unit )
|
||||
{
|
||||
case RiaEclipseUnitTools::UNITS_METRIC:
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_METRIC:
|
||||
return RiaDefines::DepthUnitType::UNIT_METER;
|
||||
break;
|
||||
case RiaEclipseUnitTools::UNITS_FIELD:
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_FIELD:
|
||||
return RiaDefines::DepthUnitType::UNIT_FEET;
|
||||
break;
|
||||
case RiaEclipseUnitTools::UNITS_LAB:
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_LAB:
|
||||
return RiaDefines::DepthUnitType::UNIT_NONE;
|
||||
break;
|
||||
case RiaEclipseUnitTools::UNITS_UNKNOWN:
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_UNKNOWN:
|
||||
return RiaDefines::DepthUnitType::UNIT_NONE;
|
||||
break;
|
||||
default:
|
||||
@@ -102,9 +102,9 @@ double RiaEclipseUnitTools::convertSurfaceGasFlowRateToOilEquivalents( UnitSyste
|
||||
|
||||
double oilEquivalentGasRate = HUGE_VAL;
|
||||
|
||||
if ( caseUnitSystem == RiaEclipseUnitTools::UNITS_FIELD )
|
||||
if ( caseUnitSystem == RiaEclipseUnitTools::UnitSystem::UNITS_FIELD )
|
||||
oilEquivalentGasRate = fieldGasToOilEquivalent * eclGasFlowRate;
|
||||
if ( caseUnitSystem == RiaEclipseUnitTools::UNITS_METRIC )
|
||||
if ( caseUnitSystem == RiaEclipseUnitTools::UnitSystem::UNITS_METRIC )
|
||||
oilEquivalentGasRate = metricGasToOilEquivalent * eclGasFlowRate;
|
||||
|
||||
return oilEquivalentGasRate;
|
||||
@@ -117,13 +117,13 @@ QString RiaEclipseUnitTools::unitStringPressure( UnitSystem unitSystem )
|
||||
{
|
||||
switch ( unitSystem )
|
||||
{
|
||||
case RiaEclipseUnitTools::UNITS_METRIC:
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_METRIC:
|
||||
return "barsa";
|
||||
case RiaEclipseUnitTools::UNITS_FIELD:
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_FIELD:
|
||||
return "psia";
|
||||
case RiaEclipseUnitTools::UNITS_LAB:
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_LAB:
|
||||
return "atma";
|
||||
case RiaEclipseUnitTools::UNITS_UNKNOWN:
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_UNKNOWN:
|
||||
return "";
|
||||
default:
|
||||
return "";
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
class RiaEclipseUnitTools
|
||||
{
|
||||
public:
|
||||
enum UnitSystem
|
||||
enum class UnitSystem
|
||||
{
|
||||
UNITS_METRIC,
|
||||
UNITS_FIELD,
|
||||
|
||||
@@ -44,7 +44,7 @@ RiaGitDiff::~RiaGitDiff()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaGitDiff::reset()
|
||||
{
|
||||
m_lastError = IC_NO_ERROR;
|
||||
m_lastError = ErrorType::IC_NO_ERROR;
|
||||
m_errorMsg.clear();
|
||||
m_errorDetails.clear();
|
||||
m_diffOutput.clear();
|
||||
@@ -80,7 +80,7 @@ bool RiaGitDiff::executeDiff( const QString& baseFolder )
|
||||
QProcess::ProcessError procError = proc.error();
|
||||
if ( procError != QProcess::UnknownError )
|
||||
{
|
||||
m_lastError = SEVERE_ERROR;
|
||||
m_lastError = ErrorType::SEVERE_ERROR;
|
||||
m_errorMsg = "Error running 'git' tool process";
|
||||
m_errorDetails = completeCommand;
|
||||
return false;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
class RiaGitDiff
|
||||
{
|
||||
public:
|
||||
enum ErrorType
|
||||
enum class ErrorType
|
||||
{
|
||||
IC_NO_ERROR, // No error occurred
|
||||
IC_ERROR, // An error occurred
|
||||
|
||||
@@ -47,7 +47,7 @@ RiaImageFileCompare::~RiaImageFileCompare()
|
||||
void RiaImageFileCompare::reset()
|
||||
{
|
||||
m_imagesEqual = false;
|
||||
m_lastError = IC_NO_ERROR;
|
||||
m_lastError = ErrorType::IC_NO_ERROR;
|
||||
m_errorMsg = "";
|
||||
m_errorDetails = "";
|
||||
}
|
||||
@@ -61,7 +61,7 @@ bool RiaImageFileCompare::runComparison( const QString& imgFileName, const QStri
|
||||
|
||||
if ( m_compareExecutable.isEmpty() )
|
||||
{
|
||||
m_lastError = SEVERE_ERROR;
|
||||
m_lastError = ErrorType::SEVERE_ERROR;
|
||||
m_errorMsg = "Cannot compare images, no compare executable set";
|
||||
return false;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ bool RiaImageFileCompare::runComparison( const QString& imgFileName, const QStri
|
||||
QProcess::ProcessError procError = proc.error();
|
||||
if ( procError != QProcess::UnknownError )
|
||||
{
|
||||
m_lastError = SEVERE_ERROR;
|
||||
m_lastError = ErrorType::SEVERE_ERROR;
|
||||
m_errorMsg = "Error running compare tool process";
|
||||
m_errorDetails = completeCommand;
|
||||
return false;
|
||||
@@ -111,7 +111,7 @@ bool RiaImageFileCompare::runComparison( const QString& imgFileName, const QStri
|
||||
else
|
||||
{
|
||||
// Report non-severe error
|
||||
m_lastError = IC_ERROR;
|
||||
m_lastError = ErrorType::IC_ERROR;
|
||||
m_errorMsg = "Error running compare tool process";
|
||||
m_errorDetails = stdErr;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
class RiaImageFileCompare
|
||||
{
|
||||
public:
|
||||
enum ErrorType
|
||||
enum class ErrorType
|
||||
{
|
||||
IC_NO_ERROR, // No error occurred
|
||||
IC_ERROR, // An error occurred
|
||||
|
||||
@@ -66,7 +66,7 @@ private:
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefaultConsoleLogger::RiaDefaultConsoleLogger()
|
||||
: m_logLevel( RI_LL_WARNING )
|
||||
: m_logLevel( int( RILogLevel::RI_LL_WARNING ) )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ void RiaLogging::deleteLoggerInstance()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaLogging::error( const QString& message )
|
||||
{
|
||||
if ( sm_logger && sm_logger->level() >= RI_LL_ERROR )
|
||||
if ( sm_logger && sm_logger->level() >= int( RILogLevel::RI_LL_ERROR ) )
|
||||
{
|
||||
#pragma omp critical( critical_section_logging )
|
||||
sm_logger->error( message.toLatin1().constData() );
|
||||
@@ -216,7 +216,7 @@ void RiaLogging::error( const QString& message )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaLogging::warning( const QString& message )
|
||||
{
|
||||
if ( sm_logger && sm_logger->level() >= RI_LL_WARNING )
|
||||
if ( sm_logger && sm_logger->level() >= int( RILogLevel::RI_LL_WARNING ) )
|
||||
{
|
||||
#pragma omp critical( critical_section_logging )
|
||||
sm_logger->warning( message.toLatin1().constData() );
|
||||
@@ -228,7 +228,7 @@ void RiaLogging::warning( const QString& message )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaLogging::info( const QString& message )
|
||||
{
|
||||
if ( sm_logger && sm_logger->level() >= RI_LL_INFO )
|
||||
if ( sm_logger && sm_logger->level() >= int( RILogLevel::RI_LL_INFO ) )
|
||||
{
|
||||
#pragma omp critical( critical_section_logging )
|
||||
sm_logger->info( message.toLatin1().constData() );
|
||||
@@ -240,7 +240,7 @@ void RiaLogging::info( const QString& message )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaLogging::debug( const QString& message )
|
||||
{
|
||||
if ( sm_logger && sm_logger->level() >= RI_LL_DEBUG )
|
||||
if ( sm_logger && sm_logger->level() >= int( RILogLevel::RI_LL_DEBUG ) )
|
||||
{
|
||||
#pragma omp critical( critical_section_logging )
|
||||
sm_logger->debug( message.toLatin1().constData() );
|
||||
@@ -251,7 +251,7 @@ void RiaLogging::debug( const QString& message )
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuMessageLoggerBase::RiuMessageLoggerBase()
|
||||
: m_logLevel( RI_LL_WARNING )
|
||||
: m_logLevel( (int)RILogLevel::RI_LL_WARNING )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
class QString;
|
||||
|
||||
enum RILogLevel
|
||||
enum class RILogLevel
|
||||
{
|
||||
RI_LL_ERROR = 1,
|
||||
RI_LL_WARNING = 2,
|
||||
|
||||
@@ -58,11 +58,11 @@ void caf::AppEnum<RiaQDateTimeTools::DateFormatComponents>::setUp()
|
||||
template <>
|
||||
void caf::AppEnum<RiaQDateTimeTools::TimeFormatComponents>::setUp()
|
||||
{
|
||||
addItem( RiaQDateTimeTools::TIME_FORMAT_NONE, "NO_TIME", "No Time of Day" );
|
||||
addItem( RiaQDateTimeTools::TIME_FORMAT_HOUR, "HOUR", "Hour Only" );
|
||||
addItem( RiaQDateTimeTools::TIME_FORMAT_HOUR_MINUTE, "HOUR_MINUTE", "Hour and Minute" );
|
||||
addItem( RiaQDateTimeTools::TIME_FORMAT_HOUR_MINUTE_SECOND, "HOUR_MINUTE_SECONDS", "Hour, Minutes and Seconds" );
|
||||
setDefault( RiaQDateTimeTools::TIME_FORMAT_NONE );
|
||||
addItem( RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_NONE, "NO_TIME", "No Time of Day" );
|
||||
addItem( RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR, "HOUR", "Hour Only" );
|
||||
addItem( RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE, "HOUR_MINUTE", "Hour and Minute" );
|
||||
addItem( RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND, "HOUR_MINUTE_SECONDS", "Hour, Minutes and Seconds" );
|
||||
setDefault( RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_NONE );
|
||||
}
|
||||
|
||||
template <>
|
||||
@@ -489,12 +489,12 @@ QString RiaQDateTimeTools::dateFormatString( const QString& fullDateFormat, Date
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaQDateTimeTools::timeFormatString( const QString& fullTimeFormat, TimeFormatComponents timeComponents )
|
||||
{
|
||||
if ( timeComponents == TIME_FORMAT_NONE ) return "";
|
||||
if ( timeComponents == TimeFormatComponents::TIME_FORMAT_NONE ) return "";
|
||||
|
||||
QStringList allVariants = fullTimeFormat.split( ";" );
|
||||
if ( static_cast<int>( timeComponents ) < allVariants.size() )
|
||||
{
|
||||
return allVariants[timeComponents];
|
||||
return allVariants[static_cast<int>( timeComponents )];
|
||||
}
|
||||
CVF_ASSERT( false && "Time format string is malformed" );
|
||||
return "";
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
DATE_FORMAT_SIZE
|
||||
};
|
||||
|
||||
enum TimeFormatComponents
|
||||
enum class TimeFormatComponents
|
||||
{
|
||||
TIME_FORMAT_UNSPECIFIED = -2,
|
||||
TIME_FORMAT_NONE = -1,
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
static QDateTime truncateTime( const QDateTime& dt, RiaQDateTimeTools::DateTimePeriod period );
|
||||
|
||||
static std::vector<RiaQDateTimeTools::DateTimePeriod> dateTimePeriods();
|
||||
static QString dateTimePeriodName( RiaQDateTimeTools::DateTimePeriod period );
|
||||
static QString dateTimePeriodName( RiaQDateTimeTools::DateTimePeriod period );
|
||||
|
||||
// This function uses C locale to make sure the text representation of a date is stable, independent of the locale
|
||||
// settings on local machine. Required for stable regression testing.
|
||||
|
||||
Reference in new issue
Block a user