1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 16:51:15 +02:00

programName as static member var

This commit is contained in:
Ben Burdette 2020-03-25 10:52:03 -06:00
parent fc310eda3a
commit 3582dc3c88
3 changed files with 18 additions and 5 deletions

View file

@ -80,11 +80,12 @@ class ErrorInfo {
ErrLevel level;
string name;
string description;
string program;
optional<NixCode> nixCode;
string hint;
ErrorInfo& GetEI() { return *this; }
static optional<string> programName;
// give these access to the private constructor,
// when they are direct descendants.
friend AddName<ErrorInfo>;
@ -109,18 +110,21 @@ class ErrorInfo {
};
// Init as error
class EIError : public ErrorInfo
{
protected:
EIError() : ErrorInfo(elError) {}
};
// Init as warning
class EIWarning : public ErrorInfo
{
protected:
EIWarning() : ErrorInfo(elWarning) {}
};
// Builder class definitions.
template <class T>
class AddName : private T
{