btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / src / add-ons / kernel / file_systems / exfat / DirectoryIterator.h
blobdaa3ea53a73b7c84291b6bb2dd70801cf9bdb44d
1 /*
2 * Copyright 2011, Jérôme Duval, korli@users.berlios.de.
3 * Copyright 2014 Haiku, Inc. All rights reserved.
5 * Distributed under the terms of the MIT License.
7 * Authors:
8 * Jérôme Duval, korli@users.berlios.de
9 * John Scipione, jscipione@gmail.com
11 #ifndef DIRECTORYITERATOR_H
12 #define DIRECTORYITERATOR_H
15 #include "CachedBlock.h"
16 #include "exfat.h"
18 class Inode;
20 class EntryVisitor {
21 public:
22 EntryVisitor() {};
23 virtual ~EntryVisitor() {};
24 virtual bool VisitBitmap(struct exfat_entry*)
25 { return false; }
26 virtual bool VisitUppercase(struct exfat_entry*)
27 { return false; }
28 virtual bool VisitLabel(struct exfat_entry*)
29 { return false; }
30 virtual bool VisitFilename(struct exfat_entry*)
31 { return false; }
32 virtual bool VisitFile(struct exfat_entry*)
33 { return false; }
34 virtual bool VisitFileInfo(struct exfat_entry*)
35 { return false; }
39 class DirectoryIterator {
40 public:
41 DirectoryIterator(Inode* inode);
42 ~DirectoryIterator();
44 status_t InitCheck();
46 status_t GetNext(char* name, size_t* _nameLength,
47 ino_t* _id, EntryVisitor* visitor = NULL);
48 status_t Lookup(const char* name, size_t nameLength,
49 ino_t* _id);
50 status_t LookupEntry(EntryVisitor* visitor);
51 status_t Rewind();
53 void Iterate(EntryVisitor &visitor);
54 private:
55 status_t _GetNext(uint16* unicodeName,
56 size_t* _codeUnitCount, ino_t* _id,
57 EntryVisitor* visitor = NULL);
58 status_t _NextEntry();
60 int64 fOffset;
61 cluster_t fCluster;
62 Inode* fInode;
63 CachedBlock fBlock;
64 struct exfat_entry* fCurrent;
68 #endif // DIRECTORYITERATOR_H