зеркало из https://github.com/microsoft/pict.git
Enum1 (#68)
* Fix warning about the array delete * Fix ErrorCode enum * Fixing unintalized vars
This commit is contained in:
Родитель
d3efe9d64f
Коммит
baaae8f613
|
@ -376,7 +376,8 @@ class Parameter
|
|||
public:
|
||||
Parameter( int order, int sequence, int valueCount, std::wstring name, bool expectedResultParam ) :
|
||||
m_order( order ), m_sequence( sequence ), m_valueCount( valueCount ),
|
||||
m_name( name ), m_expResultParam( expectedResultParam ), m_valueWeights( 0 )
|
||||
m_name( name ), m_expResultParam( expectedResultParam ), m_valueWeights( 0 ),
|
||||
m_bound( false ), m_pending( false ), m_avgExclusionSize( 0 )
|
||||
{
|
||||
// result params must have order = 1
|
||||
if ( m_expResultParam ) m_order = 1;
|
||||
|
|
|
@ -97,8 +97,8 @@ const LogicalOperPriority LogicalOperPriority_OR = 1;
|
|||
class CValue
|
||||
{
|
||||
public:
|
||||
CValue( IN std::wstring text ) : DataType( DataType_String ), Text( text ) {}
|
||||
CValue( IN double number ) : DataType( DataType_Number ), Number( number ) {}
|
||||
CValue( IN std::wstring text ) : DataType( DataType_String ), Text( text ), Number( 0 ) {}
|
||||
CValue( IN double number ) : DataType( DataType_Number ), Text( L"" ), Number( number ) {}
|
||||
|
||||
pictcli_constraints::DataType DataType;
|
||||
std::wstring Text;
|
||||
|
|
14
cli/gcd.cpp
14
cli/gcd.cpp
|
@ -1,7 +1,7 @@
|
|||
#include "gcd.h"
|
||||
using namespace std;
|
||||
|
||||
#define FAILED(err) (ErrorCode_Success != (err))
|
||||
#define FAILED(err) (ErrorCode::ErrorCode_Success != (err))
|
||||
|
||||
namespace pictcli_gcd
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ ErrorCode GcdRunner::generateResults( IN CModelData& modelData, IN bool justNega
|
|||
// check if we excluded all values of any parameter; generation will return nothing if that's the case
|
||||
if( gcdData.CheckEntireParameterExcluded() )
|
||||
{
|
||||
return( ErrorCode_BadConstraints );
|
||||
return( ErrorCode::ErrorCode_BadConstraints );
|
||||
}
|
||||
|
||||
// save all one-element exclusions, they'll be used for warnings later
|
||||
|
@ -41,7 +41,7 @@ ErrorCode GcdRunner::generateResults( IN CModelData& modelData, IN bool justNega
|
|||
// each submodel may assign different order to parameters
|
||||
if( !gcdData.FixParamOrder( submodel ))
|
||||
{
|
||||
return( ErrorCode_BadModel );
|
||||
return( ErrorCode::ErrorCode_BadModel );
|
||||
}
|
||||
|
||||
if( modelData.Verbose )
|
||||
|
@ -57,7 +57,7 @@ ErrorCode GcdRunner::generateResults( IN CModelData& modelData, IN bool justNega
|
|||
|
||||
if( !gcdData.FixParamOrder( model ))
|
||||
{
|
||||
return( ErrorCode_BadModel );
|
||||
return( ErrorCode::ErrorCode_BadModel );
|
||||
}
|
||||
|
||||
if( modelData.Verbose )
|
||||
|
@ -96,12 +96,12 @@ ErrorCode GcdRunner::generateResults( IN CModelData& modelData, IN bool justNega
|
|||
assert( false );
|
||||
throw;
|
||||
#endif
|
||||
return( ErrorCode_GenerationError );
|
||||
return( ErrorCode::ErrorCode_GenerationError );
|
||||
}
|
||||
|
||||
translateResults( modelData, model->GetResults(), justNegative );
|
||||
|
||||
return( ErrorCode_Success );
|
||||
return( ErrorCode::ErrorCode_Success );
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -180,7 +180,7 @@ ErrorCode GcdRunner::Generate()
|
|||
if( FAILED( err )) return( err );
|
||||
}
|
||||
|
||||
return( ErrorCode_Success );
|
||||
return( ErrorCode::ErrorCode_Success );
|
||||
}
|
||||
|
||||
}
|
|
@ -266,7 +266,7 @@ ErrorCode CGcdData::TranslateToGCD()
|
|||
// make sure all order fields in models are set appropriately
|
||||
if( !fixModelAndSubmodelOrder() )
|
||||
{
|
||||
return( ErrorCode_BadModel );
|
||||
return( ErrorCode::ErrorCode_BadModel );
|
||||
}
|
||||
|
||||
// add exclusions for negative values
|
||||
|
@ -278,7 +278,7 @@ ErrorCode CGcdData::TranslateToGCD()
|
|||
ConstraintsInterpreter interpreter( _modelData, Parameters );
|
||||
if( !interpreter.ConvertToExclusions( Exclusions ) )
|
||||
{
|
||||
return( ErrorCode_BadConstraints );
|
||||
return( ErrorCode::ErrorCode_BadConstraints );
|
||||
}
|
||||
_constraintWarnings.assign( interpreter.GetWarnings().begin(), interpreter.GetWarnings().end() );
|
||||
|
||||
|
@ -308,7 +308,7 @@ ErrorCode CGcdData::TranslateToGCD()
|
|||
PrintGcdExclusions();
|
||||
}
|
||||
|
||||
return( ErrorCode_Success );
|
||||
return( ErrorCode::ErrorCode_Success );
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace pictcli_gcd
|
|||
//
|
||||
//
|
||||
//
|
||||
enum ErrorCode
|
||||
enum class ErrorCode
|
||||
{
|
||||
ErrorCode_Success = 0x00,
|
||||
ErrorCode_OutOfMemory = 0x01,
|
||||
|
|
|
@ -58,8 +58,10 @@ public:
|
|||
Parameter* GcdPointer;
|
||||
|
||||
CModelParameter() :
|
||||
IsResultParameter( false ),
|
||||
GcdPointer( nullptr ) {}
|
||||
Name(nullptr),
|
||||
IsResultParameter(false),
|
||||
Order(UNDEFINED_ORDER),
|
||||
GcdPointer(nullptr){}
|
||||
|
||||
int GetValueOrdinal( IN std::wstring& name, IN bool caseSensitive );
|
||||
bool ValueNamesUnique( IN bool CaseSensitive );
|
||||
|
|
14
cli/pict.cpp
14
cli/pict.cpp
|
@ -52,25 +52,25 @@ int __cdecl execute
|
|||
|
||||
if( !ParseArgs( argc, args, modelData ) )
|
||||
{
|
||||
return( ErrorCode_BadOption );
|
||||
return( (int)ErrorCode::ErrorCode_BadOption );
|
||||
}
|
||||
|
||||
if( !modelData.ReadModel( wstring( args[ 1 ] )))
|
||||
{
|
||||
return( ErrorCode_BadModel );
|
||||
return( (int)ErrorCode::ErrorCode_BadModel );
|
||||
}
|
||||
|
||||
if( !modelData.ReadRowSeedFile( modelData.RowSeedsFile ))
|
||||
{
|
||||
return( ErrorCode_BadRowSeedFile );
|
||||
return( (int)ErrorCode::ErrorCode_BadRowSeedFile );
|
||||
}
|
||||
|
||||
GcdRunner gcdRunner( modelData );
|
||||
|
||||
ErrorCode err = gcdRunner.Generate();
|
||||
if( err != ErrorCode_Success )
|
||||
if( err != ErrorCode::ErrorCode_Success )
|
||||
{
|
||||
return err;
|
||||
return (int)err;
|
||||
}
|
||||
|
||||
time_t end = time( nullptr );
|
||||
|
@ -100,7 +100,7 @@ int __cdecl execute
|
|||
output.append( outputStream.str() );
|
||||
}
|
||||
|
||||
return( ErrorCode_Success );
|
||||
return( (int)ErrorCode::ErrorCode_Success );
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -165,7 +165,7 @@ int main
|
|||
{
|
||||
delete wargs[ ii ];
|
||||
}
|
||||
delete wargs;
|
||||
delete[] wargs;
|
||||
|
||||
return( ret );
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче