Code: Alles auswählen
typedef std::function<void( Dedupe::Core::DupHandle )> KeyFunction;
class Keys
{
public:
Keys() : StoredKeys(), StringToStore( "" ) { }
std::string & GetInput() { return StringToStore; }
private:
class Proxy
{
public:
Proxy( Keys &CallingClass ) : Instance( CallingClass ) {}
Proxy & operator() ( std::string Key, KeyFunction KeyFunc )
{
std::unique_ptr<Proxy> Next( new Proxy( Instance ));
Instance.StoredKeys[ Key ] = KeyFunc;
return *Next;
}
private:
Keys &Instance;
};
std::map<std::string,KeyFunction> StoredKeys;
std::string StringToStore;
public:
Proxy & AddKeys()
{
std::unique_ptr<Proxy> First( new Proxy( *this ));
return *First;
}
};
Code: Alles auswählen
auto Keep = [] ( Dedupe::Core::DupHandle Handle )
{ Handle.second = Dedupe::Core::Keep; };
auto MarkAsKeep = [] ( Dedupe::Core::DupHandle Handle )
{ Handle.second = Dedupe::Core::MarkAsKeep; };
auto Delete = [] ( Dedupe::Core::DupHandle Handle )
{ Handle.second = Dedupe::Core::Delete; };
Message << Dups.size() << " duplicate Groups are found\n";
Dedupe::CLI::Keys Keys;
Keys.AddKeys() ( "y", Keep )
( "n", Delete )
( "m", MarkAsKeep );
Code: Alles auswählen
Instance.StoredKeys[ Key ] = KeyFunc;