|
a/src/query/history.cpp |
|
b/src/query/history.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: history.cpp,v 1.6 2006-09-11 09:08:44 dockes Exp $ (C) 2005 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: history.cpp,v 1.7 2006-09-11 12:05:39 dockes Exp $ (C) 2005 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
148 |
for (it = names.begin(); it != names.end(); it++) {
|
148 |
for (it = names.begin(); it != names.end(); it++) {
|
149 |
m_data.erase(*it, sk);
|
149 |
m_data.erase(*it, sk);
|
150 |
}
|
150 |
}
|
151 |
return true;
|
151 |
return true;
|
152 |
}
|
152 |
}
|
|
|
153 |
bool RclHistory::truncate(const string &sk, unsigned int n)
|
|
|
154 |
{
|
|
|
155 |
// Is this doc already in history ? If it is we remove the old entry
|
|
|
156 |
list<string> names = m_data.getNames(sk);
|
|
|
157 |
if (names.size() <= n)
|
|
|
158 |
return true;
|
|
|
159 |
unsigned int i = 0;
|
|
|
160 |
for (list<string>::const_iterator it = names.begin();
|
|
|
161 |
it != names.end(); it++, i++) {
|
|
|
162 |
if (i >= n)
|
|
|
163 |
m_data.erase(*it, sk);
|
|
|
164 |
}
|
|
|
165 |
return true;
|
|
|
166 |
}
|
153 |
|
167 |
|
154 |
|
168 |
|
155 |
bool RclHistory::enterString(const string sk, const string value)
|
169 |
bool RclHistory::enterString(const string sk, const string value)
|
156 |
{
|
170 |
{
|
157 |
RclSListEntry ne(value);
|
171 |
RclSListEntry ne(value);
|