nix-super/src/libutil/types.hh

51 lines
870 B
C++
Raw Normal View History

#pragma once
2016-02-23 14:53:31 +02:00
#include "ref.hh"
#include <list>
#include <set>
#include <string>
#include <map>
2020-05-14 21:28:18 +03:00
#include <vector>
2014-10-20 19:15:50 +03:00
namespace nix {
using std::list;
using std::set;
using std::vector;
2020-05-12 00:52:15 +03:00
using std::string;
2017-05-11 18:06:07 +03:00
2020-05-14 00:56:39 +03:00
typedef list<string> Strings;
typedef set<string> StringSet;
typedef std::map<string, string> StringMap;
/* Paths are just strings. */
2020-04-24 23:57:51 +03:00
2020-05-14 00:56:39 +03:00
typedef string Path;
typedef std::string_view PathView;
typedef list<Path> Paths;
typedef set<Path> PathSet;
typedef vector<std::pair<string, string>> Headers;
/* Helper class to run code at startup. */
template<typename T>
struct OnStartup
{
OnStartup(T && t) { t(); }
};
2020-10-26 17:58:58 +02:00
/* Wrap bools to prevent string literals (i.e. 'char *') from being
cast to a bool in Attr. */
template<typename T>
struct Explicit {
T t;
bool operator ==(const Explicit<T> & other) const
{
return t == other.t;
}
};
}