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

View file

@ -77,20 +77,20 @@ class ExternalValueBase
public: public:
/* Return a simple string describing the type */ /* 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 */ /* 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 /* 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, /* Compare to another value of the same type. Defaults to uncomparable,
* i.e. always false. * 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 */ /* Print the value as JSON. Defaults to unconvertable, i.e. throws an error */
virtual void printValueAsJSON(EvalState & state, bool strict, virtual void printValueAsJSON(EvalState & state, bool strict,

View file

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

View file

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

View file

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