Added Query::Rewind() method - not yet tested.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10404 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0ddccfdc7a
commit
467954408f
@ -1464,6 +1464,33 @@ Query::Query(Volume *volume, Expression *expression, uint32 flags)
|
||||
fExpression->Root()->CalculateScore(fIndex);
|
||||
fIndex.Unset();
|
||||
|
||||
Rewind();
|
||||
|
||||
if (fFlags & B_LIVE_QUERY)
|
||||
volume->AddQuery(this);
|
||||
}
|
||||
|
||||
|
||||
Query::~Query()
|
||||
{
|
||||
if (fFlags & B_LIVE_QUERY)
|
||||
fVolume->RemoveQuery(this);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Query::Rewind()
|
||||
{
|
||||
// free previous stuff
|
||||
|
||||
fStack.MakeEmpty();
|
||||
|
||||
delete fIterator;
|
||||
fIterator = NULL;
|
||||
fCurrent = NULL;
|
||||
|
||||
// put the whole expression on the stack
|
||||
|
||||
Stack<Term *> stack;
|
||||
stack.Push(fExpression->Root());
|
||||
|
||||
@ -1486,19 +1513,11 @@ Query::Query(Volume *volume, Expression *expression, uint32 flags)
|
||||
FATAL(("Unknown term on stack or stack error"));
|
||||
}
|
||||
|
||||
if (fFlags & B_LIVE_QUERY)
|
||||
volume->AddQuery(this);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
Query::~Query()
|
||||
{
|
||||
if (fFlags & B_LIVE_QUERY)
|
||||
fVolume->RemoveQuery(this);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
status_t
|
||||
Query::GetNextEntry(struct dirent *dirent, size_t size)
|
||||
{
|
||||
// If we don't have an equation to use yet/anymore, get a new one
|
||||
|
@ -50,10 +50,12 @@ class Query {
|
||||
Query(Volume *volume, Expression *expression, uint32 flags);
|
||||
~Query();
|
||||
|
||||
status_t GetNextEntry(struct dirent *,size_t size);
|
||||
status_t Rewind();
|
||||
status_t GetNextEntry(struct dirent *, size_t size);
|
||||
|
||||
void SetLiveMode(port_id port,int32 token);
|
||||
void LiveUpdate(Inode *inode,const char *attribute,int32 type,const uint8 *oldKey,size_t oldLength,const uint8 *newKey,size_t newLength);
|
||||
void SetLiveMode(port_id port, int32 token);
|
||||
void LiveUpdate(Inode *inode, const char *attribute, int32 type,
|
||||
const uint8 *oldKey, size_t oldLength, const uint8 *newKey, size_t newLength);
|
||||
|
||||
Expression *GetExpression() const { return fExpression; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user