# Utilities Tasks

|  |  |  |  | Task Summary | Owner
|  |  |  |  | Misc | Steve Vallee
|  |  |  |  | BString Utility | Steve Vallee
|  |  |  |  | BList | Issac Yonemoto
|  |  |  |  | BString | Steve Vallee
|  |  |  |  | BBlockCache | Graham Gilmore
|  |  |  |  | BStopWatch | Steve Vallee

|  |  |  |  | Task Details
Misc Functions
|  |  |  |  | convert_from_utf8
|  |  |  |  | convert_to_utf8
BString Utility Functions
|  |  |  |  | bool operator<(const char *, const BString &);
|  |  |  |  | bool operator<=(const char *, const BString &);
|  |  |  |  | bool operator==(const char *, const BString &);
|  |  |  |  | bool operator>(const char *, const BString &);
|  |  |  |  | bool operator>=(const char *, const BString &);
|  |  |  |  | bool operator!=(const char *, const BString &);
|  |  |  |  | int Compare(const BString &, const BString &);
|  |  |  |  | int ICompare(const BString &, const BString &);
|  |  |  |  | int Compare(const BString *, const BString *);
|  |  |  |  | int ICompare(const BString *, const BString *);
BList Class
|  |  |  |  | BList(int32 itemsPerBlock = 20);
|  |  |  |  | BList(const BList&);
|  |  |  |  | virtual ~BList();
|  |  |  |  | BList& operator=(const BList &from);
|  |  |  |  | bool AddItem(void *item);
|  |  |  |  | bool AddItem(void *item, int32 atIndex);
|  |  |  |  | bool AddList(BList *newItems);
|  |  |  |  | bool AddList(BList *newItems, int32 atIndex);
|  |  |  |  | bool RemoveItem(void *item);
|  |  |  |  | void* RemoveItem(int32 index);
|  |  |  |  | bool RemoveItems(int32 index, int32 count);
|  |  |  |  | bool ReplaceItem(int32 index, void *newItem);
|  |  |  |  | void MakeEmpty();
|  |  |  |  | void SortItems(int (*cmp)(const void *, const void *));
|  |  |  |  | bool SwapItems(int32 indexA, int32 indexB);
|  |  |  |  | bool MoveItem(int32 fromIndex, int32 toIndex);
|  |  |  |  | void* ItemAt(int32) const;
|  |  |  |  | void* ItemAtFast(int32) const;
|  |  |  |  | void* FirstItem() const;
|  |  |  |  | void* LastItem() const;
|  |  |  |  | void* Items() const;
|  |  |  |  | bool HasItem(void *item) const;
|  |  |  |  | int32 IndexOf(void *item) const;
|  |  |  |  | int32 CountItems() const;
|  |  |  |  | bool IsEmpty() const;
|  |  |  |  | void DoForEach(bool (*func)(void *));
|  |  |  |  | void DoForEach(bool (*func)(void *, void *), void *);
BString Class
|  |  |  |  | BString();
|  |  |  |  | BString(const char *);
|  |  |  |  | BString(const BString &);
|  |  |  |  | BString(const char *, int32 maxLength);
|  |  |  |  | ~BString();
|  |  |  |  | const char* String() const;
|  |  |  |  | int32 Length() const;
|  |  |  |  | int32 CountChars() const;
|  |  |  |  | BString& operator=(const BString &);
|  |  |  |  | BString& operator=(const char *);
|  |  |  |  | BString& operator=(char);
|  |  |  |  | BString& SetTo(const char *);
|  |  |  |  | BString& SetTo(const char *, int32 length);
|  |  |  |  | BString& SetTo(const BString &from);
|  |  |  |  | BString& Adopt(BString &from);
|  |  |  |  | BString& SetTo(const BString &, int32 length);
|  |  |  |  | BString& Adopt(BString &from, int32 length);
|  |  |  |  | BString& SetTo(char, int32 count);
|  |  |  |  | BString& CopyInto(BString &into, int32 fromOffset, int32 length) const;
|  |  |  |  | void CopyInto(char *into, int32 fromOffset, int32 length) const;
|  |  |  |  | BString& operator+=(const BString &);
|  |  |  |  | BString& operator+=(const char *);
|  |  |  |  | BString& operator+=(char);
|  |  |  |  | BString& Append(const BString &);
|  |  |  |  | BString& Append(const char *);
|  |  |  |  | BString& Append(const BString &, int32 length);
|  |  |  |  | BString& Append(const char *, int32 length);
|  |  |  |  | BString& Append(char, int32 count);
|  |  |  |  | BString& Prepend(const char *);
|  |  |  |  | BString& Prepend(const BString &);
|  |  |  |  | BString& Prepend(const char *, int32);
|  |  |  |  | BString& Prepend(const BString &, int32);
|  |  |  |  | BString& Prepend(char, int32 count);
|  |  |  |  | BString& Insert(const char *, int32 pos);
|  |  |  |  | BString& Insert(const char *, int32 length, int32 pos);
|  |  |  |  | BString& Insert(const char *, int32 fromOffset, int32 length, int32 pos);
|  |  |  |  | BString& Insert(const BString &, int32 pos);
|  |  |  |  | BString& Insert(const BString &, int32 length, int32 pos);
|  |  |  |  | BString& Insert(const BString &, int32 fromOffset, int32 length, int32 pos);
|  |  |  |  | BString& Insert(char, int32 count, int32 pos);
|  |  |  |  | BString& Truncate(int32 newLength, bool lazy = true);
|  |  |  |  | BString& Remove(int32 from, int32 length);
|  |  |  |  | BString& RemoveFirst(const BString &);
|  |  |  |  | BString& RemoveLast(const BString &);
|  |  |  |  | BString& RemoveAll(const BString &);
|  |  |  |  | BString& RemoveFirst(const char *);
|  |  |  |  | BString& RemoveLast(const char *);
|  |  |  |  | BString& RemoveAll(const char *);
|  |  |  |  | BString& RemoveSet(const char *setOfCharsToRemove);
|  |  |  |  | BString& MoveInto(BString &into, int32 from, int32 length);
|  |  |  |  | void MoveInto(char *into, int32 from, int32 length);
|  |  |  |  | bool operator<(const BString &) const;
|  |  |  |  | bool operator<=(const BString &) const;
|  |  |  |  | bool operator==(const BString &) const;
|  |  |  |  | bool operator>=(const BString &) const;
|  |  |  |  | bool operator>(const BString &) const;
|  |  |  |  | bool operator!=(const BString &) const;
|  |  |  |  | bool operator<(const char *) const;
|  |  |  |  | bool operator<=(const char *) const;
|  |  |  |  | bool operator==(const char *) const;
|  |  |  |  | bool operator>=(const char *) const;
|  |  |  |  | bool operator>(const char *) const;
|  |  |  |  | bool operator!=(const char *) const;
|  |  |  |  | int Compare(const BString &) const;
|  |  |  |  | int Compare(const char *) const;
|  |  |  |  | int Compare(const BString &, int32 n) const;
|  |  |  |  | int Compare(const char *, int32 n) const;
|  |  |  |  | int ICompare(const BString &) const;
|  |  |  |  | int ICompare(const char *) const;
|  |  |  |  | int ICompare(const BString &, int32 n) const;
|  |  |  |  | int ICompare(const char *, int32 n) const;
|  |  |  |  | int32 FindFirst(const BString &) const;
|  |  |  |  | int32 FindFirst(const char *) const;
|  |  |  |  | int32 FindFirst(const BString &, int32 fromOffset) const;
|  |  |  |  | int32 FindFirst(const char *, int32 fromOffset) const;
|  |  |  |  | int32 FindFirst(char) const;
|  |  |  |  | int32 FindFirst(char, int32 fromOffset) const;
|  |  |  |  | int32 FindLast(const BString &) const;
|  |  |  |  | int32 FindLast(const char *) const;
|  |  |  |  | int32 FindLast(const BString &, int32 beforeOffset) const;
|  |  |  |  | int32 FindLast(const char *, int32 beforeOffset) const;
|  |  |  |  | int32 FindLast(char) const;
|  |  |  |  | int32 FindLast(char, int32 fromOffset) const;
|  |  |  |  | int32 IFindFirst(const BString &) const;
|  |  |  |  | int32 IFindFirst(const char *) const;
|  |  |  |  | int32 IFindFirst(const BString &, int32 fromOffset) const;
|  |  |  |  | int32 IFindFirst(const char *, int32 fromOffset) const;
|  |  |  |  | int32 IFindLast(const BString &) const;
|  |  |  |  | int32 IFindLast(const char *) const;
|  |  |  |  | int32 IFindLast(const BString &, int32 beforeOffset) const;
|  |  |  |  | int32 IFindLast(const char *, int32 beforeOffset) const;
|  |  |  |  | BString& ReplaceFirst(char replaceThis, char withThis);
|  |  |  |  | BString& ReplaceLast(char replaceThis, char withThis);
|  |  |  |  | BString& ReplaceAll(char replaceThis, char withThis, int32 fromOffset = 0);
|  |  |  |  | BString& Replace(char replaceThis, char withThis, int32 maxReplaceCount, int32 fromOffset = 0);
|  |  |  |  | BString& ReplaceFirst(const char *replaceThis, const char *withThis);
|  |  |  |  | BString& ReplaceLast(const char *replaceThis, const char *withThis);
|  |  |  |  | BString& ReplaceAll(const char *replaceThis, const char *withThis, int32 fromOffset = 0);
|  |  |  |  | BString& Replace(const char *replaceThis, const char *withThis, int32 maxReplaceCount, int32 fromOffset = 0);
|  |  |  |  | BString& IReplaceFirst(char replaceThis, char withThis);
|  |  |  |  | BString& IReplaceLast(char replaceThis, char withThis);
|  |  |  |  | BString& IReplaceAll(char replaceThis, char withThis, int32 fromOffset = 0);
|  |  |  |  | BString& IReplace(char replaceThis, char withThis, int32 maxReplaceCount, int32 fromOffset = 0);
|  |  |  |  | BString& IReplaceFirst(const char *replaceThis, const char *withThis);
|  |  |  |  | BString& IReplaceLast(const char *replaceThis, const char *withThis);
|  |  |  |  | BString& IReplaceAll(const char *replaceThis, const char *withThis, int32 fromOffset = 0);
|  |  |  |  | BString& IReplace(const char *replaceThis, const char *withThis, int32 maxReplaceCount, int32 fromOffset = 0);
|  |  |  |  | BString& ReplaceSet(const char *setOfChars, char with);
|  |  |  |  | BString& ReplaceSet(const char *setOfChars, const char *with);
|  |  |  |  | char operator[](int32 index) const;
|  |  |  |  | char& operator[](int32 index);
|  |  |  |  | char ByteAt(int32 index) const;
|  |  |  |  | char* LockBuffer(int32 maxLength);
|  |  |  |  | BString& UnlockBuffer(int32 length = -1);
|  |  |  |  | BString& ToLower();
|  |  |  |  | BString& ToUpper();
|  |  |  |  | BString& Capitalize();
|  |  |  |  | BString& CapitalizeEachWord();
|  |  |  |  | BString& CharacterEscape(const char* original, const char* setOfCharsToEscape, char escapeWith);
|  |  |  |  | BString& CharacterEscape(const char *setOfCharsToEscape, char escapeWith);
|  |  |  |  | BString& CharacterDeescape(const char *original, char escapeChar);
|  |  |  |  | BString& CharacterDeescape(char escapeChar);
|  |  |  |  | BString& operator<<(const char *);
|  |  |  |  | BString& operator<<(const BString &);
|  |  |  |  | BString& operator<<(char);
|  |  |  |  | BString& operator<<(int);
|  |  |  |  | BString& operator<<(unsigned int);
|  |  |  |  | BString& operator<<(uint32);
|  |  |  |  | BString& operator<<(int32);
|  |  |  |  | BString& operator<<(uint64);
|  |  |  |  | BString& operator<<(int64);
|  |  |  |  | BString& operator<<(float);
BBlockCache Class
|  |  |  |  | BBlockCache(size_t cache_size, size_t block_size, uint32 type);
|  |  |  |  | virtual ~BBlockCache();
|  |  |  |  | void* Get(size_t block_size);
|  |  |  |  | void Save(void *pointer, size_t block_size);
BStopWatch Class
|  |  |  |  | BStopWatch(const char *name, bool silent = false);
|  |  |  |  | virtual ~BStopWatch();
|  |  |  |  | void Suspend();
|  |  |  |  | void Resume();
|  |  |  |  | bigtime_t Lap();
|  |  |  |  | bigtime_t ElapsedTime() const;
|  |  |  |  | void Reset();
|  |  |  |  | const char* Name() const;

Legend
| Functional Spec
| Use Cases
| Unit Tests
| Technical Spec
| Implementation
| Completed

The OpenBeOS project is hosted by:

Copyright © 2001-2002 OpenBeOS Project