about summary refs log blame commit diff
path: root/src/nix/legacy.hh
blob: f503b0da3e1ae7b6f2adc85688ece7ea9697962c (plain) (tree)
1
2
3
4
5



                     
                 

















                                                                     
#pragma once

#include <functional>
#include <map>
#include <string>

namespace nix {

typedef std::function<void(int, char * *)> MainFunction;

struct RegisterLegacyCommand
{
    typedef std::map<std::string, MainFunction> Commands;
    static Commands * commands;

    RegisterLegacyCommand(const std::string & name, MainFunction fun)
    {
        if (!commands) commands = new Commands;
        (*commands)[name] = fun;
    }
};

}