1 //----------------------------------------------------------------------
2 // This software is part of the OpenBeOS distribution and is covered
4 //---------------------------------------------------------------------
7 ResourceItem interface declaration.
10 #ifndef _RESOURCE_ITEM_H
11 #define _RESOURCE_ITEM_H
21 \brief Represents a resource loaded into memory.
23 This class represents a resource completely or partially loaded into
24 memory. The minimal information stored in the object should be its
25 type, ID and name and the size of its data. If the data are not loaded
26 then additionally the offset (into a resource file) should be valid.
27 As soon as the data are loaded as well, the offset is more or less
30 Creating a new resource can be done by calling SetIdentity() after the
31 default construction. The object then represents a resource with the
32 specified type, ID and name and with empty data. Data can arbitrarily
33 be read and written using the methods the super class BMallocIO provides.
35 The memory for the resource data is owned by the ResourceItem object and
38 \author <a href='mailto:bonefish@users.sf.net'>Ingo Weinhold</a>
42 class ResourceItem
: public BMallocIO
{
45 virtual ~ResourceItem();
47 virtual ssize_t
WriteAt(off_t pos
, const void *buffer
, size_t size
);
48 virtual status_t
SetSize(off_t size
);
50 void SetLocation(int32 offset
, size_t initialSize
);
51 void SetIdentity(type_code type
, int32 id
, const char *name
);
53 void SetOffset(int32 offset
);
56 size_t InitialSize() const;
57 size_t DataSize() const;
59 void SetType(type_code type
);
60 type_code
Type() const;
65 void SetName(const char *name
);
66 const char *Name() const;
70 void SetLoaded(bool loaded
);
71 bool IsLoaded() const;
73 void SetModified(bool modified
);
74 bool IsModified() const;
86 }; // namespace Storage
87 }; // namespace BPrivate
89 #endif // _RESOURCE_ITEM_H