Move TextTable from pkgman to libshared

This commit is contained in:
Ingo Weinhold
2013-11-30 17:02:49 +01:00
parent aea2cb917e
commit 5df58b522b
5 changed files with 19 additions and 4 deletions
+51
View File
@@ -0,0 +1,51 @@
/*
* Copyright 2013, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TEXT_TABLE_H
#define TEXT_TABLE_H
#include <InterfaceDefs.h>
#include <ObjectList.h>
#include <StringList.h>
namespace BPrivate {
class TextTable {
public:
TextTable();
~TextTable();
int32 CountColumns() const;
void AddColumn(const BString& title,
enum alignment align = B_ALIGN_LEFT,
bool canTruncate = false);
int32 CountRows() const;
BString TextAt(int32 rowIndex, int32 columnIndex) const;
void SetTextAt(int32 rowIndex, int32 columnIndex,
const BString& text);
void Print(int32 maxWidth);
private:
struct Column;
typedef BObjectList<Column> ColumnList;
typedef BObjectList<BStringList> RowList;
private:
ColumnList fColumns;
RowList fRows;
};
} // namespace BPrivate
using ::BPrivate::TextTable;
#endif // TEXT_TABLE_H