/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// Callbacks for the string block. This needs to be in the same namespace as // OUString for argument dependent lookup.
MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(OUString, svl::element_type_string, OUString(), svl::string_block)
// Calculate column widths first. for (size_t row = 0; row < ns.row; ++row)
{ for (size_t col = 0; col < ns.column; ++col)
{
OUString aStr = mpImpl->maMatrix.get_string(row, col); if (aColWidths[col] < aStr.getLength())
aColWidths[col] = aStr.getLength();
}
}
// Make the row separator string.
OUStringBuffer aBuf("+"); for (size_t col = 0; col < ns.column; ++col)
{
aBuf.append("-"); for (sal_Int32 i = 0; i < aColWidths[col]; ++i)
aBuf.append(u'-');
aBuf.append("-+");
}
OUString aSep = aBuf.makeStringAndClear();
// Now print to stdout.
std::cout << aSep << std::endl; for (size_t row = 0; row < ns.row; ++row)
{
std::cout << "| "; for (size_t col = 0; col < ns.column; ++col)
{
OUString aStr = mpImpl->maMatrix.get_string(row, col);
size_t nPadding = aColWidths[col] - aStr.getLength();
aBuf.append(aStr); for (size_t i = 0; i < nPadding; ++i)
aBuf.append(u' ');
std::cout << aBuf.makeStringAndClear() << " | ";
}
std::cout << std::endl;
std::cout << aSep << std::endl;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.