2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
5 #ifndef ARRAY_INDEX_PATH_H
6 #define ARRAY_INDEX_PATH_H
17 class ArrayIndexPath
{
20 ArrayIndexPath(const ArrayIndexPath
& other
);
23 status_t
SetTo(const char* path
);
26 bool GetPathString(BString
& path
) const;
28 inline int32
CountIndices() const;
29 inline int64
IndexAt(int32 index
) const;
30 inline bool AddIndex(int64 index
);
31 inline void SetIndexAt(int32 at
, int64 newIndex
);
33 ArrayIndexPath
& operator=(const ArrayIndexPath
& other
);
36 typedef Array
<int64
> IndexArray
;
44 ArrayIndexPath::CountIndices() const
46 return fIndices
.Count();
51 ArrayIndexPath::IndexAt(int32 index
) const
53 return index
>= 0 && index
< fIndices
.Count()
54 ? fIndices
.ElementAt(index
) : -1;
59 ArrayIndexPath::AddIndex(int64 index
)
61 return fIndices
.Add(index
);
66 ArrayIndexPath::SetIndexAt(int32 at
, int64 newIndex
)
68 if (at
>= 0 && at
< fIndices
.Count())
69 fIndices
[at
] = newIndex
;
73 #endif // ARRAY_INDEX_PATH_H