remember history of restrict subdirs in adv search

This commit is contained in:
dockes
2006-09-11 12:05:39 +00:00
parent d2d2c73794
commit a3db7c1937
8 changed files with 126 additions and 45 deletions
+15 -1
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: history.cpp,v 1.6 2006-09-11 09:08:44 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: history.cpp,v 1.7 2006-09-11 12:05:39 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@@ -150,6 +150,20 @@ bool RclHistory::eraseAll(const string &sk)
}
return true;
}
bool RclHistory::truncate(const string &sk, unsigned int n)
{
// Is this doc already in history ? If it is we remove the old entry
list<string> names = m_data.getNames(sk);
if (names.size() <= n)
return true;
unsigned int i = 0;
for (list<string>::const_iterator it = names.begin();
it != names.end(); it++, i++) {
if (i >= n)
m_data.erase(*it, sk);
}
return true;
}
bool RclHistory::enterString(const string sk, const string value)
+2 -1
View File
@@ -16,7 +16,7 @@
*/
#ifndef _HISTORY_H_INCLUDED_
#define _HISTORY_H_INCLUDED_
/* @(#$Id: history.h,v 1.4 2006-09-11 09:08:44 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: history.h,v 1.5 2006-09-11 12:05:39 dockes Exp $ (C) 2004 J.F.Dockes */
/**
* Dynamic configuration storage
@@ -101,6 +101,7 @@ class RclHistory {
bool enterString(const string sk, const string value);
list<string> getStringList(const string sk);
bool eraseAll(const string& sk);
bool truncate(const string& sk, unsigned int n);
private:
unsigned int m_mlen;