1 //----------------------------------------------------------------------
2 // This software is part of the OpenBeOS distribution and is covered
4 //---------------------------------------------------------------------
6 \file ResourcesContainer.h
7 ResourcesContainer interface declaration.
10 #ifndef _RESOURCES_CONTAINER_H
11 #define _RESOURCES_CONTAINER_H
21 \class ResourcesContainer
22 \brief Represents a collection of resources.
24 This class can be used to manage a collection of resources represented
25 by ResourceItem's. Usually it does never contain two resources with the
26 same type \em and ID, since AddResource() replaces an old item with the
27 new one, unless explicitly told not to do so. This should only be done
28 by ResourceFile, when type and ID of the items are not yet known.
29 Asside from the basic vector features like Add/RemoveResource()/
30 ResourceAt() and MakeEmpty() a bunch of IndexOf() methods are provided
31 and AssimilateResources() which incorporates all resources of another
32 container into this one (replacing old resources, if necessary), emptying
35 The ResourceItem's in a container are deleted on destruction, unless
36 removed before via RemoveResource(). MakeEmpty() deletes the items as
39 \author <a href='mailto:bonefish@users.sf.net'>Ingo Weinhold</a>
43 class ResourcesContainer
{
46 virtual ~ResourcesContainer();
48 bool AddResource(ResourceItem
*item
, int32 index
= -1,
51 ResourceItem
*RemoveResource(int32 index
);
52 bool RemoveResource(ResourceItem
*item
);
56 void AssimilateResources(ResourcesContainer
&container
);
58 int32
IndexOf(ResourceItem
*item
) const;
59 int32
IndexOf(const void *data
) const;
60 int32
IndexOf(type_code type
, int32 id
) const;
61 int32
IndexOf(type_code type
, const char *name
) const;
62 int32
IndexOfType(type_code type
, int32 index
) const;
63 ResourceItem
*ResourceAt(int32 index
) const;
64 int32
CountResources() const;
66 void SetModified(bool modified
);
67 bool IsModified() const;
74 }; // namespace Storage
75 }; // namespace BPrivate
77 #endif // _RESOURCES_CONTAINER_H