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:
@@ -1464,6 +1464,33 @@ Query::Query(Volume *volume, Expression *expression, uint32 flags)
|
|||||||
fExpression->Root()->CalculateScore(fIndex);
|
fExpression->Root()->CalculateScore(fIndex);
|
||||||
fIndex.Unset();
|
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<Term *> stack;
|
||||||
stack.Push(fExpression->Root());
|
stack.Push(fExpression->Root());
|
||||||
|
|
||||||
@@ -1486,19 +1513,11 @@ Query::Query(Volume *volume, Expression *expression, uint32 flags)
|
|||||||
FATAL(("Unknown term on stack or stack error"));
|
FATAL(("Unknown term on stack or stack error"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fFlags & B_LIVE_QUERY)
|
return B_OK;
|
||||||
volume->AddQuery(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Query::~Query()
|
status_t
|
||||||
{
|
|
||||||
if (fFlags & B_LIVE_QUERY)
|
|
||||||
fVolume->RemoveQuery(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
Query::GetNextEntry(struct dirent *dirent, size_t size)
|
Query::GetNextEntry(struct dirent *dirent, size_t size)
|
||||||
{
|
{
|
||||||
// If we don't have an equation to use yet/anymore, get a new one
|
// 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(Volume *volume, Expression *expression, uint32 flags);
|
||||||
~Query();
|
~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 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 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; }
|
Expression *GetExpression() const { return fExpression; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user