Remove std::string alias

This commit is contained in:
Eelco Dolstra 2022-02-21 16:37:25 +01:00
parent 1ac2664472
commit 36c7b12f33
5 changed files with 24 additions and 27 deletions

View file

@ -17,8 +17,8 @@ namespace nix {
class Symbol
{
private:
const string * s; // pointer into SymbolTable
Symbol(const string * s) : s(s) { };
const std::string * s; // pointer into SymbolTable
Symbol(const std::string * s) : s(s) { };
friend class SymbolTable;
public:
@ -72,7 +72,7 @@ class SymbolTable
{
private:
std::unordered_map<std::string_view, Symbol> symbols;
std::list<string> store;
std::list<std::string> store;
public:
Symbol create(std::string_view s)
@ -84,7 +84,7 @@ public:
auto it = symbols.find(s);
if (it != symbols.end()) return it->second;
const string & rawSym = store.emplace_back(s);
auto & rawSym = store.emplace_back(s);
return symbols.emplace(rawSym, Symbol(&rawSym)).first->second;
}

View file

@ -77,20 +77,20 @@ class ExternalValueBase
public:
/* Return a simple string describing the type */
virtual string showType() const = 0;
virtual std::string showType() const = 0;
/* Return a string to be used in builtins.typeOf */
virtual string typeOf() const = 0;
virtual std::string typeOf() const = 0;
/* Coerce the value to a string. Defaults to uncoercable, i.e. throws an
* error
* error.
*/
virtual string coerceToString(const Pos & pos, PathSet & context, bool copyMore, bool copyToStore) const;
virtual std::string coerceToString(const Pos & pos, PathSet & context, bool copyMore, bool copyToStore) const;
/* Compare to another value of the same type. Defaults to uncomparable,
* i.e. always false.
*/
virtual bool operator==(const ExternalValueBase & b) const;
virtual bool operator ==(const ExternalValueBase & b) const;
/* Print the value as JSON. Defaults to unconvertable, i.e. throws an error */
virtual void printValueAsJSON(EvalState & state, bool strict,

View file

@ -8,19 +8,19 @@ class Store;
struct Machine {
const string storeUri;
const std::vector<string> systemTypes;
const string sshKey;
const std::string storeUri;
const std::vector<std::string> systemTypes;
const std::string sshKey;
const unsigned int maxJobs;
const unsigned int speedFactor;
const std::set<string> supportedFeatures;
const std::set<string> mandatoryFeatures;
const std::set<std::string> supportedFeatures;
const std::set<std::string> mandatoryFeatures;
const std::string sshPublicHostKey;
bool enabled = true;
bool allSupported(const std::set<string> & features) const;
bool allSupported(const std::set<std::string> & features) const;
bool mandatoryMet(const std::set<string> & features) const;
bool mandatoryMet(const std::set<std::string> & features) const;
Machine(decltype(storeUri) storeUri,
decltype(systemTypes) systemTypes,

View file

@ -10,9 +10,9 @@ struct Regex;
struct DrvName
{
string fullName;
string name;
string version;
std::string fullName;
std::string name;
std::string version;
unsigned int hits;
DrvName();

View file

@ -11,20 +11,17 @@
namespace nix {
using std::string;
typedef std::list<string> Strings;
typedef std::set<string> StringSet;
typedef std::map<string, string> StringMap;
typedef std::list<std::string> Strings;
typedef std::set<std::string> StringSet;
typedef std::map<std::string, std::string> StringMap;
/* Paths are just strings. */
typedef string Path;
typedef std::string Path;
typedef std::string_view PathView;
typedef std::list<Path> Paths;
typedef std::set<Path> PathSet;
typedef std::vector<std::pair<string, string>> Headers;
typedef std::vector<std::pair<std::string, std::string>> Headers;
/* Helper class to run code at startup. */
template<typename T>