vfs: check userland buffers before reading them.
[haiku.git] / headers / private / shared / QueryFile.h
blob5558e63fda5e2ac73568bcf38ac087af268deae3
1 /*
2 * Copyright 2010, Axel Dörfler, axeld@pinc-software.de.
3 * This file may be used under the terms of the MIT License.
4 */
5 #ifndef _QUERY_FILE_H
6 #define _QUERY_FILE_H
9 #include <EntryList.h>
10 #include <Query.h>
11 #include <List.h>
12 #include <String.h>
15 class BQueryFile : public BEntryList {
16 public:
17 BQueryFile(const entry_ref& ref);
18 BQueryFile(const BEntry& entry);
19 BQueryFile(const char* path);
20 BQueryFile(BQuery& query);
21 virtual ~BQueryFile();
23 status_t InitCheck() const;
25 status_t SetTo(const entry_ref& ref);
26 status_t SetTo(const BEntry& entry);
27 status_t SetTo(const char* path);
28 status_t SetTo(BQuery& query);
29 void Unset();
31 status_t SetPredicate(const char* predicate);
32 status_t AddVolume(const BVolume& volume);
33 status_t AddVolume(dev_t device);
35 const char* Predicate() const;
36 int32 CountVolumes() const;
37 dev_t VolumeAt(int32 index) const;
39 status_t WriteTo(const entry_ref& ref);
40 status_t WriteTo(const char* path);
42 // BEntryList implementation
44 virtual status_t GetNextEntry(BEntry* entry,
45 bool traverse = false);
46 virtual status_t GetNextRef(entry_ref* ref);
47 virtual int32 GetNextDirents(struct dirent* buffer,
48 size_t length, int32 count = INT_MAX);
49 virtual status_t Rewind();
50 virtual int32 CountEntries();
52 static const char* MimeType();
54 private:
55 status_t _SetQuery(int32 index);
57 private:
58 status_t fStatus;
59 BString fPredicate;
60 BQuery fQuery;
61 BList fVolumes;
62 int32 fCurrentVolumeIndex;
66 #endif // _QUERY_FILE_H