11#include <rtl/ustrbuf.hxx>
13#include <mdds/multi_type_vector/types.hpp>
14#include <mdds/multi_type_vector/macro.hpp>
15#include <mdds/multi_type_matrix.hpp>
24typedef mdds::mtv::default_element_block<element_type_string, OUString>
string_block;
31 typedef mdds::mtv::uint16_element_block integer_element_block;
55 Impl(
size_t nRows,
size_t nCols,
bool bPrint ) :
60 mpImpl(new
Impl(nRows, nCols, bPrint)) {}
68 mpImpl->maMatrix.set(nRow, nCol, rStr);
77 std::cout << pHeader << std::endl;
79 MatrixImplType::size_pair_type
ns =
mpImpl->maMatrix.size();
80 std::vector<sal_Int32> aColWidths(
ns.column, 0);
83 for (
size_t row = 0; row <
ns.row; ++row)
88 if (aColWidths[
col] <
aStr.getLength())
89 aColWidths[
col] =
aStr.getLength();
94 OUStringBuffer
aBuf(
"+");
98 for (sal_Int32
i = 0;
i < aColWidths[
col]; ++
i)
103 OUString aSep =
aBuf.makeStringAndClear();
106 std::cout << aSep << std::endl;
107 for (
size_t row = 0; row <
ns.row; ++row)
113 size_t nPadding = aColWidths[
col] -
aStr.getLength();
115 for (
size_t i = 0;
i < nPadding; ++
i)
117 std::cout <<
aBuf.makeStringAndClear() <<
" | ";
119 std::cout << std::endl;
120 std::cout << aSep << std::endl;
void set(size_t nRow, size_t nCol, const OUString &rStr)
std::unique_ptr< Impl > mpImpl
void print(const char *pHeader) const
GridPrinter(size_t nRows, size_t nCols, bool bPrint)
RttiCompleteObjectLocator col
const mdds::mtv::element_t element_type_string
mdds::mtv::default_element_block< element_type_string, OUString > string_block
mdds::multi_type_matrix< matrix_traits > MatrixImplType
Impl(size_t nRows, size_t nCols, bool bPrint)