BPicture: Fix archive constructor.
[haiku.git] / src / add-ons / kernel / file_systems / ramfs / Attribute.h
blobe13b26a267444e6bf69242725b420e8c514aa1cc
1 // Attribute.h
3 #ifndef ATTRIBUTE_H
4 #define ATTRIBUTE_H
6 #include <util/DoublyLinkedList.h>
8 #include "AttributeIndex.h"
9 #include "AttributeIterator.h"
10 #include "DataContainer.h"
11 #include "String.h"
13 class AllocationInfo;
14 class Node;
15 class Volume;
17 class Attribute : public DataContainer,
18 public DoublyLinkedListLinkImpl<Attribute> {
19 public:
20 Attribute(Volume *volume, Node *node, const char *name, uint32 type = 0);
21 ~Attribute();
23 status_t InitCheck() const;
25 void SetNode(Node *node) { fNode = node; }
26 Node *GetNode() const { return fNode; }
28 const char *GetName() { return fName.GetString(); }
30 void SetType(uint32 type);
31 uint32 GetType() const { return fType; }
33 status_t SetSize(off_t newSize);
34 off_t GetSize() const { return DataContainer::GetSize(); }
36 virtual status_t WriteAt(off_t offset, const void *buffer, size_t size,
37 size_t *bytesWritten);
39 // index support
40 void SetIndex(AttributeIndex *index, bool inIndex);
41 AttributeIndex *GetIndex() const { return fIndex; }
42 bool IsInIndex() const { return fInIndex; }
43 void GetKey(const uint8 **key, size_t *length);
44 void GetKey(uint8 *key, size_t *length);
46 // iterator management
47 void AttachAttributeIterator(AttributeIterator *iterator);
48 void DetachAttributeIterator(AttributeIterator *iterator);
49 inline DoublyLinkedList<AttributeIterator> *GetAttributeIteratorList()
50 { return &fIterators; }
52 // debugging
53 void GetAllocationInfo(AllocationInfo &info);
55 private:
56 Node *fNode;
57 String fName;
58 uint32 fType;
59 AttributeIndex *fIndex;
60 bool fInIndex;
62 // iterator management
63 DoublyLinkedList<AttributeIterator> fIterators;
66 #endif // ATTRIBUTE_H