[partition] Drop "convenience" functions
- the functions are used just once - thin wrappers for named-enum methods that are just as convenient
This commit is contained in:
parent
824dac62d8
commit
fec8361ed5
@ -64,7 +64,7 @@ getSwapChoices( const QVariantMap& configurationMap )
|
||||
for ( const auto& item : l )
|
||||
{
|
||||
bool ok = false;
|
||||
auto v = PartitionActions::Choices::nameToChoice( item, ok );
|
||||
auto v = PartitionActions::Choices::swapChoiceNames().find( item, ok );
|
||||
if ( ok )
|
||||
{
|
||||
choices.insert( v );
|
||||
@ -105,7 +105,8 @@ getSwapChoices( const QVariantMap& configurationMap )
|
||||
#define COMPLAIN_UNSUPPORTED( x ) \
|
||||
if ( choices.contains( x ) ) \
|
||||
{ \
|
||||
cWarning() << unsupportedSetting << PartitionActions::Choices::choiceToName( x ); \
|
||||
bool bogus = false; \
|
||||
cWarning() << unsupportedSetting << PartitionActions::Choices::swapChoiceNames().find( x, bogus ); \
|
||||
choices.remove( x ); \
|
||||
}
|
||||
|
||||
|
@ -257,8 +257,8 @@ doReplacePartition( PartitionCoreModule* core, Device* dev, Partition* partition
|
||||
|
||||
namespace Choices
|
||||
{
|
||||
static const NamedEnumTable< SwapChoice >&
|
||||
nameTable()
|
||||
const NamedEnumTable< SwapChoice >&
|
||||
swapChoiceNames()
|
||||
{
|
||||
static const NamedEnumTable< SwapChoice > names { { QStringLiteral( "none" ), SwapChoice::NoSwap },
|
||||
{ QStringLiteral( "small" ), SwapChoice::SmallSwap },
|
||||
@ -269,19 +269,6 @@ nameTable()
|
||||
return names;
|
||||
}
|
||||
|
||||
SwapChoice
|
||||
nameToChoice( QString name, bool& ok )
|
||||
{
|
||||
return nameTable().find( name, ok );
|
||||
}
|
||||
|
||||
QString
|
||||
choiceToName( SwapChoice c )
|
||||
{
|
||||
bool ok = false;
|
||||
return nameTable().find( c, ok );
|
||||
}
|
||||
|
||||
SwapChoice
|
||||
pickOne( const SwapChoiceSet& s )
|
||||
{
|
||||
|
@ -19,6 +19,8 @@
|
||||
#ifndef PARTITIONACTIONS_H
|
||||
#define PARTITIONACTIONS_H
|
||||
|
||||
#include "utils/NamedEnum.h"
|
||||
|
||||
#include <QSet>
|
||||
#include <QString>
|
||||
|
||||
@ -34,7 +36,7 @@ namespace PartitionActions
|
||||
*/
|
||||
namespace Choices
|
||||
{
|
||||
/** @brief Ccchoice of swap (size and type) */
|
||||
/** @brief Choice of swap (size and type) */
|
||||
enum SwapChoice
|
||||
{
|
||||
NoSwap, // don't create any swap, don't use any
|
||||
@ -45,8 +47,7 @@ enum SwapChoice
|
||||
};
|
||||
using SwapChoiceSet = QSet< SwapChoice >;
|
||||
|
||||
SwapChoice nameToChoice( QString name, bool& ok );
|
||||
QString choiceToName( SwapChoice );
|
||||
const NamedEnumTable< SwapChoice >& swapChoiceNames();
|
||||
|
||||
/** @brief Given a set of swap choices, return a sensible value from it.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user