1#ifndef OPENXLSX_XLROWDATA_HPP
2#define OPENXLSX_XLROWDATA_HPP
6# pragma warning(disable : 4251)
7# pragma warning(disable : 4275)
18#include "OpenXLSX-Exports.hpp"
122 std::unique_ptr<XLRowDataRange> m_dataRange;
172 uint16_t size()
const;
194 typename = std::enable_if_t<
195 std::is_integral_v<T> or std::is_floating_point_v<T> or std::is_same_v<std::decay_t<T>, std::string> ||
196 std::is_same_v<std::decay_t<T>, std::string_view> or std::is_same_v<std::decay_t<T>,
const char*> ||
197 std::is_same_v<std::decay_t<T>,
char*> or std::is_same_v<T, XLDateTime>>>
201 for (
auto it = begin(); it != end(); ++it) it->value() = value;
220 std::unique_ptr<XMLNode> m_rowNode;
221 uint16_t m_firstCol{1};
222 uint16_t m_lastCol{1};
252 XLRowDataProxy& operator=(
const std::vector<XLCellValue>& values);
269 typename = std::enable_if_t<!std::is_same_v<T, XLRowDataProxy> &&
270 std::is_base_of_v<std::bidirectional_iterator_tag,
271 typename std::iterator_traits<typename T::iterator>::iterator_category>,
276 if (values.size() == 0)
return *
this;
279 if constexpr (std::is_same_v<typename T::value_type, XLCellValue>) {
281 deleteCellValues(
static_cast<uint16_t
>(values.size()));
284 auto colNo = values.size();
285 for (
auto value = values.rbegin(); value != values.rend(); ++value) {
286 prependCellValue(*value,
287 static_cast<uint16_t
>(colNo));
295 auto range =
XLRowDataRange(*m_rowNode, 1,
static_cast<uint16_t
>(values.size()), getSharedStrings());
296 auto dst = range.begin();
298 auto src = values.begin();
303 if (src == values.end())
break;
333 operator std::vector<XLCellValue>()
const;
339 operator std::deque<XLCellValue>()
const;
345 operator std::list<XLCellValue>()
const;
355 template<
typename Container,
357 std::enable_if_t<!std::is_same_v<Container, XLRowDataProxy> &&
358 std::is_base_of_v<std::bidirectional_iterator_tag,
359 typename std::iterator_traits<typename Container::iterator>::iterator_category>,
361 explicit operator Container()
const
362 {
return convertContainer<Container>(); }
405 std::vector<XLCellValue> getValues()
const;
418 void deleteCellValues(uint16_t count);
425 void prependCellValue(
const XLCellValue& value, uint16_t col);
436 template<
typename Container,
438 std::enable_if_t<!std::is_same_v<Container, XLRowDataProxy> &&
439 std::is_base_of_v<std::bidirectional_iterator_tag,
440 typename std::iterator_traits<typename Container::iterator>::iterator_category>,
442 Container convertContainer() const
445 auto it = std::inserter(c, c.end());
446 for (
const auto& v : getValues()) {
448 if constexpr (std::is_same_v<typename Container::value_type, XLCellValue>) *it++ = v;
454 *it++ = v.get<
typename Container::value_type>();
461 XLRow* m_row{
nullptr};
Definition XLXmlParser.hpp:84
Class encapsulating a cell value.
Definition XLCellValue.hpp:79
An implementation class encapsulating the properties and behaviours of a spreadsheet cell.
Definition XLCell.hpp:41
Definition XLException.hpp:32
This class encapsulates a (non-const) iterator, for iterating over the cells in a row.
Definition XLRowData.hpp:35
std::forward_iterator_tag iterator_category
Definition XLRowData.hpp:39
~XLRowDataIterator()
Destructor.
int64_t difference_type
Definition XLRowData.hpp:41
XLRowDataIterator(XLRowDataIterator &&other) noexcept
Move constructor.
XLRowDataIterator & operator=(XLRowDataIterator &&other) noexcept
Move assignment operator.
The XLRowDataProxy is used as a proxy object when getting or setting row data. The class facilitates ...
Definition XLRowData.hpp:231
~XLRowDataProxy()
Destructor.
XLRowDataProxy & operator=(const T &values)
Templated assignment operator taking any container supporting bidirectional iterators.
Definition XLRowData.hpp:273
This class encapsulates the concept of a contiguous range of cells in a row.
Definition XLRowData.hpp:131
XLRowDataRange(XLRowDataRange &&other) noexcept
Move constructor.
~XLRowDataRange()
Destructor.
XLRowDataRange & operator=(T value)
Templated assignment operator - assign value to all existing cells in the row.
Definition XLRowData.hpp:198
XLRowDataRange & operator=(XLRowDataRange &&other) noexcept
Move assignment operator.
The XLRow class represent a row in an Excel spreadsheet. Using XLRow objects, various row formatting ...
Definition XLRow.hpp:23
This class encapsulate the Excel concept of Shared Strings. In Excel, instead of havig individual str...
Definition XLSharedStrings.hpp:67
Definition IZipArchive.hpp:18
XLIteratorLocation
Definition XLIterator.hpp:7
bool operator==(const XLCell &lhs, const XLCell &rhs)
Definition XLCell.hpp:304
bool operator!=(const XLCell &lhs, const XLCell &rhs)
Definition XLCell.hpp:311
OpenXLSX_xml_node XMLNode
Definition XLXmlParser.hpp:63
constexpr uint16_t MAX_COLS
Definition XLConstants.hpp:8
std::reference_wrapper< const XLSharedStrings > XLSharedStringsRef
Definition XLSharedStrings.hpp:56