aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/realisation.hh
blob: c573e1bb486a26e1a248a8a75bed8bfa41003962 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once

#include "path.hh"

namespace nix {

struct DrvOutput {
    StorePath drvPath;
    std::string outputName;

    std::string to_string() const;

    static DrvOutput parse(const std::string &);

    bool operator<(const DrvOutput& other) const { return to_pair() < other.to_pair(); }
    bool operator==(const DrvOutput& other) const { return to_pair() == other.to_pair(); }

private:
    // Just to make comparison operators easier to write
    std::pair<StorePath, std::string> to_pair() const
    { return std::make_pair(drvPath, outputName); }
};

struct Realisation {
    DrvOutput id;
    StorePath outPath;

    std::string to_string() const;
    static Realisation parse(const std::string & s, const std::string & whence);
};

typedef std::map<DrvOutput, Realisation> DrvOutputs;

}