mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-poco.git
synced 2025-11-08 06:23:21 +00:00
* remove leftover progen files * remove Data sources and turn headers into forwards * add SQL files #2059 * Data2sql: adjust Travis, AppVeyor & Makefiles (#2069) * Replace Data by SQL * Replace Data by SQL * Replace Data by SQL * Replace Data by SQL * fix header forwarding * Data2sql: Fixes for complete Travis CI success (#2071) * Replace Data by SQL * Replace Data by SQL * Replace Data by SQL * Replace Data by SQL * Replace Data by SQL * Restore DataFormatException * Replace Data by SQL * Replace Data by SQL * Replace Data by SQL * Replace Data by SQL * construct RowFilter from RecordSet reference instead of pointer * pass Container ref instead of ptr to Column * elimitate g++ warnings * SQL: remove raw pointers from interfaces #2094; add constness and move ops where appropriate * tidy up Postgres * ODBC fixes
120 lines
2.4 KiB
C++
120 lines
2.4 KiB
C++
//
|
|
// RowFormatter.h
|
|
//
|
|
// Library: Data
|
|
// Package: DataCore
|
|
// Module: SimpleRowFormatter
|
|
//
|
|
// Definition of the RowFormatter class.
|
|
//
|
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
|
// and Contributors.
|
|
//
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
//
|
|
|
|
|
|
#ifndef SQL_SimpleRowFormatter_INCLUDED
|
|
#define SQL_SimpleRowFormatter_INCLUDED
|
|
|
|
|
|
#include "Poco/SQL/SQL.h"
|
|
#include "Poco/SQL/RowFormatter.h"
|
|
|
|
|
|
namespace Poco {
|
|
namespace SQL {
|
|
|
|
|
|
class Poco_SQL_API SimpleRowFormatter: public RowFormatter
|
|
/// A simple row formatting class.
|
|
{
|
|
public:
|
|
|
|
static const int DEFAULT_COLUMN_WIDTH = 16;
|
|
static const int DEFAULT_SPACING = 1;
|
|
|
|
SimpleRowFormatter(std::streamsize columnWidth = DEFAULT_COLUMN_WIDTH, std::streamsize spacing = DEFAULT_SPACING);
|
|
/// Creates the SimpleRowFormatter and sets the column width to specified value.
|
|
|
|
SimpleRowFormatter(const SimpleRowFormatter& other);
|
|
/// Creates the copy of the supplied SimpleRowFormatter.
|
|
|
|
SimpleRowFormatter& operator = (const SimpleRowFormatter& row);
|
|
/// Assignment operator.
|
|
|
|
~SimpleRowFormatter();
|
|
/// Destroys the SimpleRowFormatter.
|
|
|
|
void swap(SimpleRowFormatter& other);
|
|
/// Swaps the row formatter with another one.
|
|
|
|
std::string& formatNames(const NameVecPtr pNames, std::string& formattedNames);
|
|
/// Formats the row field names.
|
|
|
|
std::string& formatValues(const ValueVec& vals, std::string& formattedValues);
|
|
/// Formats the row values.
|
|
|
|
int rowCount() const;
|
|
/// Returns row count.
|
|
|
|
void setColumnWidth(std::streamsize width);
|
|
/// Sets the column width.
|
|
|
|
std::streamsize getColumnWidth() const;
|
|
/// Returns the column width.
|
|
|
|
std::streamsize getSpacing() const;
|
|
/// Returns the spacing.
|
|
|
|
private:
|
|
std::streamsize _colWidth;
|
|
std::streamsize _spacing;
|
|
int _rowCount;
|
|
};
|
|
|
|
|
|
///
|
|
/// inlines
|
|
///
|
|
inline int SimpleRowFormatter::rowCount() const
|
|
{
|
|
return _rowCount;
|
|
}
|
|
|
|
|
|
inline void SimpleRowFormatter::setColumnWidth(std::streamsize columnWidth)
|
|
{
|
|
_colWidth = columnWidth;
|
|
}
|
|
|
|
|
|
inline std::streamsize SimpleRowFormatter::getColumnWidth() const
|
|
{
|
|
return _colWidth;
|
|
}
|
|
|
|
|
|
inline std::streamsize SimpleRowFormatter::getSpacing() const
|
|
{
|
|
return _spacing;
|
|
}
|
|
|
|
|
|
} } // namespace Poco::SQL
|
|
|
|
|
|
namespace std
|
|
{
|
|
template<>
|
|
inline void swap<Poco::SQL::SimpleRowFormatter>(Poco::SQL::SimpleRowFormatter& s1,
|
|
Poco::SQL::SimpleRowFormatter& s2)
|
|
/// Full template specialization of std:::swap for SimpleRowFormatter
|
|
{
|
|
s1.swap(s2);
|
|
}
|
|
}
|
|
|
|
|
|
#endif // Data_SimpleRowFormatter_INCLUDED
|