1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-27 04:30:59 +01:00
This commit is contained in:
Wouter den Breejen 2007-07-24 12:47:28 +00:00
parent a07ba681cc
commit dc4395b737
16 changed files with 164 additions and 168 deletions

View file

@ -60,7 +60,7 @@ typedef set<Path> PathSet;
//state types
typedef list<int> RevisionNumbers; //the Strings (list) of StateReferences and this list are connected by position
typedef map<Path, RevisionNumbers> RevisionNumbersSet; //We include to the paths to sort on
typedef map<Path, map<Path, unsigned int> > RevisionNumbersSet; //We include to the paths to sort on
typedef map<int, Strings> StateReferences;

View file

@ -918,6 +918,36 @@ Strings unpackStrings(const string & s)
return strings;
}
string packRevisionNumbers(const RevisionNumbers & revs)
{
string seperator = "|";
string d = "";
for (RevisionNumbers::const_iterator i = revs.begin();
i != revs.end(); ++i){
d += int2String(*i) + seperator;
}
return d;
}
RevisionNumbers unpackRevisionNumbers(const string & packed)
{
string seperator = "|";
Strings ss = tokenizeString(packed, seperator);
RevisionNumbers revs;
for (Strings::const_iterator i = ss.begin();
i != ss.end(); ++i){
int rev;
bool succeed = string2Int(*i, rev);
if(!succeed)
throw Error(format("Corrupted revisions db entry: `%1%'") % packed);
revs.push_back(rev);
}
return revs;
}
Strings tokenizeString(const string & s, const string & separators)
{

View file

@ -302,7 +302,7 @@ string time_t2string(const time_t & t);
bool FileExist(const string FileName);
bool IsDirectory(const string FileName);
bool IsDirectory(const string FileName); //TODO replace by pathexists
string getCallingUserName();
@ -312,6 +312,10 @@ PathSet pathSets_union(const PathSet & paths1, const PathSet & paths2);
/* TODO */
void pathSets_difference(const PathSet & oldpaths, const PathSet & newpaths, PathSet & addedpaths, PathSet & removedpaths);
string packRevisionNumbers(const RevisionNumbers & revs);
RevisionNumbers unpackRevisionNumbers(const string & packed);
}
#endif /* !__UTIL_H */