The header is now R5 binary and source compatible
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2170 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+64
-19
@@ -1,40 +1,85 @@
|
|||||||
// List.h
|
//------------------------------------------------------------------------------
|
||||||
// Just here to be able to compile and test BResources.
|
// Copyright (c) 2001-2002, OpenBeOS
|
||||||
// To be replaced by the OpenBeOS version to be provided by the IK Team.
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
|
// to deal in the Software without restriction, including without limitation
|
||||||
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
//
|
||||||
|
// File Name: List.h
|
||||||
|
// Author(s): The Storage kit Team
|
||||||
|
// Description: BList class provides storage for pointers.
|
||||||
|
// Not thread safe..
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef _sk_list_h_
|
#ifndef _BE_LIST_H
|
||||||
#define _sk_list_h_
|
#define _BE_LIST_H
|
||||||
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
/*----- BList class --------------------------------------*/
|
||||||
class BList {
|
class BList {
|
||||||
public:
|
|
||||||
|
public:
|
||||||
BList(int32 count = 20);
|
BList(int32 count = 20);
|
||||||
BList(const BList& anotherList);
|
BList(const BList& anotherList);
|
||||||
virtual ~BList();
|
virtual ~BList();
|
||||||
|
|
||||||
|
BList& operator =(const BList &);
|
||||||
|
|
||||||
|
/* Adding and removing items. */
|
||||||
bool AddItem(void *item, int32 index);
|
bool AddItem(void *item, int32 index);
|
||||||
bool AddItem(void *item);
|
bool AddItem(void *item);
|
||||||
bool AddList(BList *list, int32 index);
|
bool AddList(BList *list, int32 index);
|
||||||
bool AddList(BList *list);
|
bool AddList(BList *list);
|
||||||
int32 CountItems() const;
|
|
||||||
void DoForEach(bool (*func)(void *));
|
|
||||||
void DoForEach(bool (*func)(void *, void *), void *arg2);
|
|
||||||
void *FirstItem() const;
|
|
||||||
bool HasItem(void *item) const;
|
|
||||||
int32 IndexOf(void *item) const;
|
|
||||||
bool IsEmpty() const;
|
|
||||||
void *ItemAt(int32 index) const;
|
|
||||||
void *Items() const;
|
|
||||||
void *LastItem() const;
|
|
||||||
void MakeEmpty();
|
|
||||||
bool RemoveItem(void *item);
|
bool RemoveItem(void *item);
|
||||||
void *RemoveItem(int32 index);
|
void *RemoveItem(int32 index);
|
||||||
bool RemoveItems(int32 index, int32 count);
|
bool RemoveItems(int32 index, int32 count);
|
||||||
|
bool ReplaceItem(int32 index, void *newItem);
|
||||||
|
void MakeEmpty();
|
||||||
|
|
||||||
|
/* Reordering items. */
|
||||||
void SortItems(int (*compareFunc)(const void *, const void *));
|
void SortItems(int (*compareFunc)(const void *, const void *));
|
||||||
|
bool SwapItems(int32 indexA, int32 indexB);
|
||||||
|
bool MoveItem(int32 fromIndex, int32 toIndex);
|
||||||
|
|
||||||
BList& operator =(const BList &);
|
/* Retrieving items. */
|
||||||
|
void *ItemAt(int32 index) const;
|
||||||
|
void *FirstItem() const;
|
||||||
|
|
||||||
|
/* Be careful when using this function, since it doesn't */
|
||||||
|
/* check if the index you pass is valid, and can lead to */
|
||||||
|
/* unexpected results when it isn't. */
|
||||||
|
void *ItemAtFast(int32) const;
|
||||||
|
|
||||||
|
void *LastItem() const;
|
||||||
|
void *Items() const;
|
||||||
|
|
||||||
|
/* Querying the list. */
|
||||||
|
bool HasItem(void *item) const;
|
||||||
|
int32 IndexOf(void *item) const;
|
||||||
|
int32 CountItems() const;
|
||||||
|
bool IsEmpty() const;
|
||||||
|
|
||||||
|
/* Iterating over the list. */
|
||||||
|
void DoForEach(bool (*func)(void *));
|
||||||
|
void DoForEach(bool (*func)(void *, void *), void *arg2);
|
||||||
|
|
||||||
|
/*----- Private or reserved ---------------*/
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void _ReservedList1();
|
virtual void _ReservedList1();
|
||||||
virtual void _ReservedList2();
|
virtual void _ReservedList2();
|
||||||
@@ -50,4 +95,4 @@ private:
|
|||||||
uint32 _reserved[2];
|
uint32 _reserved[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _sk_list_h_
|
#endif // _BE_LIST_H
|
||||||
|
|||||||
Reference in New Issue
Block a user