btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / package / hpkg / v1 / PackageReaderImpl.h
blob3628d88a09d03e11ee11cda10636866869047c2c
1 /*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Copyright 2011, Oliver Tappe <zooey@hirschkaefer.de>
4 * Distributed under the terms of the MIT License.
5 */
6 #ifndef _PACKAGE__HPKG__V1__PRIVATE__PACKAGE_READER_IMPL_H_
7 #define _PACKAGE__HPKG__V1__PRIVATE__PACKAGE_READER_IMPL_H_
10 #include <package/hpkg/v1/ReaderImplBase.h>
13 namespace BPackageKit {
15 namespace BHPKG {
17 namespace V1 {
20 class BPackageEntry;
21 class BPackageEntryAttribute;
24 namespace BPrivate {
27 class PackageReaderImpl : public ReaderImplBase {
28 typedef ReaderImplBase inherited;
29 public:
30 PackageReaderImpl(
31 BErrorOutput* errorOutput);
32 ~PackageReaderImpl();
34 status_t Init(const char* fileName);
35 status_t Init(int fd, bool keepFD);
36 status_t ParseContent(
37 BPackageContentHandler* contentHandler);
38 status_t ParseContent(BLowLevelPackageContentHandler*
39 contentHandler);
41 int PackageFileFD() const;
43 uint64 HeapOffset() const;
44 uint64 HeapSize() const;
46 protected:
47 // from ReaderImplBase
48 virtual status_t ReadAttributeValue(uint8 type, uint8 encoding,
49 AttributeValue& _value);
51 private:
52 struct DataAttributeHandler;
53 struct AttributeAttributeHandler;
54 struct EntryAttributeHandler;
55 struct RootAttributeHandler;
57 private:
58 status_t _ParseTOC(AttributeHandlerContext* context,
59 AttributeHandler* rootAttributeHandler);
61 status_t _GetTOCBuffer(size_t size,
62 const void*& _buffer);
63 private:
64 uint64 fTotalSize;
65 uint64 fHeapOffset;
66 uint64 fHeapSize;
68 SectionInfo fTOCSection;
72 inline int
73 PackageReaderImpl::PackageFileFD() const
75 return FD();
79 inline uint64
80 PackageReaderImpl::HeapOffset() const
82 return fHeapOffset;
86 inline uint64
87 PackageReaderImpl::HeapSize() const
89 return fHeapSize;
93 } // namespace BPrivate
95 } // namespace V1
97 } // namespace BHPKG
99 } // namespace BPackageKit
102 #endif // _PACKAGE__HPKG__V1__PRIVATE__PACKAGE_READER_IMPL_H_