mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
实现excel报表文件生成功能
This commit is contained in:
345
thirdparty/OpenXLSX/include/headers/IZipArchive.hpp
vendored
Normal file
345
thirdparty/OpenXLSX/include/headers/IZipArchive.hpp
vendored
Normal file
@@ -0,0 +1,345 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2022, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_IZIPARCHIVE_HPP
|
||||
#define OPENXLSX_IZIPARCHIVE_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief This class functions as a wrapper around any class that provides the necessary functionality for
|
||||
* a zip archive.
|
||||
* @details This class works by applying 'type erasure'. This enables the use of objects of any class, the only
|
||||
* requirement being that it provides the right interface. No inheritance from a base class is needed.
|
||||
*/
|
||||
class OPENXLSX_EXPORT IZipArchive
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Default constructor
|
||||
*/
|
||||
IZipArchive() : m_zipArchive() {} // NOLINT
|
||||
|
||||
/**
|
||||
* @brief Constructor, taking the target object as an argument.
|
||||
* @tparam T The type of the target object (will be auto deducted)
|
||||
* @param x The target object
|
||||
* @note This method is deliberately not marked 'explicit', because as a templated constructor, it should be able
|
||||
* to take any type as an argument. However, only objects that satisfy the required interface can be used.
|
||||
*/
|
||||
template<typename T>
|
||||
IZipArchive(const T& zipArchive) : m_zipArchive { std::make_unique<Model<T>>(zipArchive) } {} // NOLINT
|
||||
|
||||
/**
|
||||
* @brief Copy constructor
|
||||
* @param other
|
||||
*/
|
||||
IZipArchive(const IZipArchive& other) : m_zipArchive(other.m_zipArchive ? other.m_zipArchive->clone() : nullptr) {}
|
||||
|
||||
/**
|
||||
* @brief Move constructor
|
||||
* @param other
|
||||
*/
|
||||
IZipArchive(IZipArchive&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
~IZipArchive() = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @tparam T
|
||||
* @param x
|
||||
* @return
|
||||
*/
|
||||
template<typename T>
|
||||
inline IZipArchive& operator=(const T& zipArchive)
|
||||
{
|
||||
m_zipArchive = std::make_unique<Model<T>>(zipArchive);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
inline IZipArchive& operator=(const IZipArchive& other)
|
||||
{
|
||||
IZipArchive copy(other);
|
||||
*this = std::move(copy);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
inline IZipArchive& operator=(IZipArchive&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
inline explicit operator bool() const
|
||||
{
|
||||
return isValid();
|
||||
}
|
||||
|
||||
inline bool isValid() const {
|
||||
return m_zipArchive->isValid();
|
||||
|
||||
}
|
||||
|
||||
inline bool isOpen() const {
|
||||
return m_zipArchive->isOpen();
|
||||
}
|
||||
|
||||
inline void open(const std::string& fileName) {
|
||||
m_zipArchive->open(fileName);
|
||||
}
|
||||
|
||||
inline void close() const {
|
||||
m_zipArchive->close();
|
||||
}
|
||||
|
||||
inline void save(const std::string& path) {
|
||||
m_zipArchive->save(path);
|
||||
}
|
||||
|
||||
inline void addEntry(const std::string& name, const std::string& data) {
|
||||
m_zipArchive->addEntry(name, data);
|
||||
}
|
||||
|
||||
inline void deleteEntry(const std::string& entryName) {
|
||||
m_zipArchive->deleteEntry(entryName);
|
||||
}
|
||||
|
||||
inline std::string getEntry(const std::string& name) {
|
||||
return m_zipArchive->getEntry(name);
|
||||
}
|
||||
|
||||
inline bool hasEntry(const std::string& entryName) {
|
||||
return m_zipArchive->hasEntry(entryName);
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
struct Concept
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
Concept() = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
Concept(const Concept&) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
Concept(Concept&&) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
virtual ~Concept() = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
inline Concept& operator=(const Concept&) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
inline Concept& operator=(Concept&&) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
inline virtual std::unique_ptr<Concept> clone() const = 0;
|
||||
|
||||
inline virtual bool isValid() const = 0;
|
||||
|
||||
inline virtual bool isOpen() const = 0;
|
||||
|
||||
inline virtual void open(const std::string& fileName) = 0;
|
||||
|
||||
inline virtual void close() = 0;
|
||||
|
||||
inline virtual void save (const std::string& path) = 0;
|
||||
|
||||
inline virtual void addEntry(const std::string& name, const std::string& data) = 0;
|
||||
|
||||
inline virtual void deleteEntry(const std::string& entryName) = 0;
|
||||
|
||||
inline virtual std::string getEntry(const std::string& name) = 0;
|
||||
|
||||
inline virtual bool hasEntry(const std::string& entryName) = 0;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @tparam T
|
||||
*/
|
||||
template<typename T>
|
||||
struct Model : Concept
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief
|
||||
* @param x
|
||||
*/
|
||||
explicit Model(const T& x) : ZipType(x) {}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
Model(const Model& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
Model(Model&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
~Model() override = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
inline Model& operator=(const Model& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
inline Model& operator=(Model&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
inline std::unique_ptr<Concept> clone() const override
|
||||
{
|
||||
return std::make_unique<Model<T>>(ZipType);
|
||||
}
|
||||
|
||||
inline bool isValid() const override {
|
||||
return ZipType.isValid();
|
||||
}
|
||||
|
||||
inline bool isOpen() const override {
|
||||
return ZipType.isOpen();
|
||||
}
|
||||
|
||||
inline void open(const std::string& fileName) override {
|
||||
ZipType.open(fileName);
|
||||
}
|
||||
|
||||
inline void close() override {
|
||||
ZipType.close();
|
||||
}
|
||||
|
||||
inline void save(const std::string& path) override {
|
||||
ZipType.save(path);
|
||||
}
|
||||
|
||||
inline void addEntry(const std::string& name, const std::string& data) override {
|
||||
ZipType.addEntry(name, data);
|
||||
}
|
||||
|
||||
inline void deleteEntry(const std::string& entryName) override {
|
||||
ZipType.deleteEntry(entryName);
|
||||
}
|
||||
|
||||
inline std::string getEntry(const std::string& name) override {
|
||||
return ZipType.getEntry(name);
|
||||
}
|
||||
|
||||
inline bool hasEntry(const std::string& entryName) override {
|
||||
return ZipType.hasEntry(entryName);
|
||||
}
|
||||
|
||||
private:
|
||||
T ZipType;
|
||||
};
|
||||
|
||||
std::unique_ptr<Concept> m_zipArchive;
|
||||
};
|
||||
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_IZIPARCHIVE_HPP
|
||||
43
thirdparty/OpenXLSX/include/headers/OpenXLSX-Exports.hpp
vendored
Normal file
43
thirdparty/OpenXLSX/include/headers/OpenXLSX-Exports.hpp
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
#ifndef OPENXLSX_EXPORT_H
|
||||
#define OPENXLSX_EXPORT_H
|
||||
|
||||
#ifdef OPENXLSX_STATIC_DEFINE
|
||||
# define OPENXLSX_EXPORT
|
||||
# define OPENXLSX_HIDDEN
|
||||
#else
|
||||
# ifndef OPENXLSX_EXPORT
|
||||
# ifdef OpenXLSX_EXPORTS
|
||||
/* We are building this library */
|
||||
# define OPENXLSX_EXPORT
|
||||
# else
|
||||
/* We are using this library */
|
||||
# define OPENXLSX_EXPORT
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef OPENXLSX_HIDDEN
|
||||
# define OPENXLSX_HIDDEN
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef OPENXLSX_DEPRECATED
|
||||
# define OPENXLSX_DEPRECATED __declspec(deprecated)
|
||||
#endif
|
||||
|
||||
#ifndef OPENXLSX_DEPRECATED_EXPORT
|
||||
# define OPENXLSX_DEPRECATED_EXPORT OPENXLSX_EXPORT OPENXLSX_DEPRECATED
|
||||
#endif
|
||||
|
||||
#ifndef OPENXLSX_DEPRECATED_NO_EXPORT
|
||||
# define OPENXLSX_DEPRECATED_NO_EXPORT OPENXLSX_HIDDEN OPENXLSX_DEPRECATED
|
||||
#endif
|
||||
|
||||
/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
|
||||
#if 0 /* DEFINE_NO_DEPRECATED */
|
||||
# ifndef OPENXLSX_NO_DEPRECATED
|
||||
# define OPENXLSX_NO_DEPRECATED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* OPENXLSX_EXPORT_H */
|
||||
231
thirdparty/OpenXLSX/include/headers/XLCell.hpp
vendored
Normal file
231
thirdparty/OpenXLSX/include/headers/XLCell.hpp
vendored
Normal file
@@ -0,0 +1,231 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLCELL_HPP
|
||||
#define OPENXLSX_XLCELL_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
#include <memory>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
#include "XLCellReference.hpp"
|
||||
#include "XLCellValue.hpp"
|
||||
#include "XLFormula.hpp"
|
||||
#include "XLSharedStrings.hpp"
|
||||
|
||||
// ========== CLASS AND ENUM TYPE DEFINITIONS ========== //
|
||||
namespace OpenXLSX
|
||||
{
|
||||
class XLCellRange;
|
||||
class XLSharedStrings;
|
||||
|
||||
/**
|
||||
* @brief An implementation class encapsulating the properties and behaviours of a spreadsheet cell.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLCell
|
||||
{
|
||||
friend class XLCellIterator;
|
||||
friend class XLCellValueProxy;
|
||||
friend class XLRowDataIterator;
|
||||
friend bool operator==(const XLCell& lhs, const XLCell& rhs);
|
||||
friend bool operator!=(const XLCell& lhs, const XLCell& rhs);
|
||||
|
||||
public:
|
||||
//---------- Public Member Functions ----------//
|
||||
|
||||
/**
|
||||
* @brief Default constructor. Constructs a null object.
|
||||
*/
|
||||
XLCell();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param cellNode
|
||||
* @param sharedStrings
|
||||
*/
|
||||
XLCell(const XMLNode& cellNode, const XLSharedStrings& sharedStrings);
|
||||
|
||||
/**
|
||||
* @brief Copy constructor
|
||||
* @param other The XLCell object to be copied.
|
||||
* @note The copy constructor has been deleted, as it makes no sense to copy a cell. If the objective is to
|
||||
* copy the getValue, create the the target object and then use the copy assignment operator.
|
||||
*/
|
||||
XLCell(const XLCell& other);
|
||||
|
||||
/**
|
||||
* @brief Move constructor
|
||||
* @param other The XLCell object to be moved
|
||||
* @note The move constructor has been deleted, as it makes no sense to move a cell.
|
||||
*/
|
||||
XLCell(XLCell&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
* @note Using the default destructor
|
||||
*/
|
||||
~XLCell();
|
||||
|
||||
/**
|
||||
* @brief Copy assignment operator
|
||||
* @param other The XLCell object to be copy assigned
|
||||
* @return A reference to the new object
|
||||
* @note Copies only the cell contents, not the pointer to parent worksheet etc.
|
||||
*/
|
||||
XLCell& operator=(const XLCell& other);
|
||||
|
||||
/**
|
||||
* @brief Move assignment operator [deleted]
|
||||
* @param other The XLCell object to be move assigned
|
||||
* @return A reference to the new object
|
||||
* @note The move assignment constructor has been deleted, as it makes no sense to move a cell.
|
||||
*/
|
||||
XLCell& operator=(XLCell&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
explicit operator bool() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLCellValueProxy& value();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
const XLCellValueProxy& value() const;
|
||||
|
||||
/**
|
||||
* @brief get the XLCellReference object for the cell.
|
||||
* @return A reference to the cells' XLCellReference object.
|
||||
*/
|
||||
XLCellReference cellReference() const;
|
||||
|
||||
/**
|
||||
* @brief get the XLCell object from the current cell offset
|
||||
* @return A reference to the XLCell object.
|
||||
*/
|
||||
XLCell offset(uint16_t rowOffset, uint16_t colOffset) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
bool hasFormula() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLFormulaProxy& formula();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
const XLFormulaProxy& formula() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param newFormula
|
||||
*/
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
static bool isEqual(const XLCell& lhs, const XLCell& rhs);
|
||||
|
||||
//---------- Private Member Variables ---------- //
|
||||
std::unique_ptr<XMLNode> m_cellNode; /**< A pointer to the root XMLNode for the cell. */
|
||||
XLSharedStrings m_sharedStrings; /**< */
|
||||
XLCellValueProxy m_valueProxy; /**< */
|
||||
XLFormulaProxy m_formulaProxy; /**< */
|
||||
};
|
||||
|
||||
} // namespace OpenXLSX
|
||||
|
||||
// ========== FRIEND FUNCTION IMPLEMENTATIONS ========== //
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
inline bool operator==(const XLCell& lhs, const XLCell& rhs)
|
||||
{
|
||||
return XLCell::isEqual(lhs, rhs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
inline bool operator!=(const XLCell& lhs, const XLCell& rhs)
|
||||
{
|
||||
return !XLCell::isEqual(lhs, rhs);
|
||||
}
|
||||
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLCELL_HPP
|
||||
179
thirdparty/OpenXLSX/include/headers/XLCellIterator.hpp
vendored
Normal file
179
thirdparty/OpenXLSX/include/headers/XLCellIterator.hpp
vendored
Normal file
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLCELLITERATOR_HPP
|
||||
#define OPENXLSX_XLCELLITERATOR_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
#include "XLCell.hpp"
|
||||
#include "XLCellReference.hpp"
|
||||
#include "XLIterator.hpp"
|
||||
#include "XLXmlParser.hpp"
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
class OPENXLSX_EXPORT XLCellIterator
|
||||
{
|
||||
public:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using value_type = XLCell;
|
||||
using difference_type = int64_t;
|
||||
using pointer = XLCell*;
|
||||
using reference = XLCell&;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param cellRange
|
||||
* @param loc
|
||||
*/
|
||||
explicit XLCellIterator(const XLCellRange& cellRange, XLIteratorLocation loc);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
~XLCellIterator();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLCellIterator(const XLCellIterator& other);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
[[maybe_unused]] XLCellIterator(XLCellIterator&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLCellIterator& operator=(const XLCellIterator& other);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLCellIterator& operator=(XLCellIterator&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLCellIterator& operator++();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLCellIterator operator++(int); // NOLINT
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
reference operator*();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
pointer operator->();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
bool operator==(const XLCellIterator& rhs) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
bool operator!=(const XLCellIterator& rhs) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param last
|
||||
* @return
|
||||
*/
|
||||
uint64_t distance(const XLCellIterator& last);
|
||||
|
||||
private:
|
||||
std::unique_ptr<XMLNode> m_dataNode; /**< */
|
||||
XLCellReference m_topLeft; /**< The cell reference of the first cell in the range */
|
||||
XLCellReference m_bottomRight; /**< The cell reference of the last cell in the range */
|
||||
XLCell m_currentCell; /**< */
|
||||
XLSharedStrings m_sharedStrings; /**< */
|
||||
bool m_endReached { false }; /**< */
|
||||
};
|
||||
|
||||
} // namespace OpenXLSX
|
||||
|
||||
// ===== Template specialization for std::distance.
|
||||
namespace std // NOLINT
|
||||
{
|
||||
using OpenXLSX::XLCellIterator;
|
||||
template<>
|
||||
inline typename std::iterator_traits<XLCellIterator>::difference_type distance<XLCellIterator>(XLCellIterator first,
|
||||
XLCellIterator last)
|
||||
{
|
||||
return static_cast<typename std::iterator_traits<XLCellIterator>::difference_type>(first.distance(last));
|
||||
}
|
||||
} // namespace std
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLCELLITERATOR_HPP
|
||||
169
thirdparty/OpenXLSX/include/headers/XLCellRange.hpp
vendored
Normal file
169
thirdparty/OpenXLSX/include/headers/XLCellRange.hpp
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLCELLRANGE_HPP
|
||||
#define OPENXLSX_XLCELLRANGE_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== External Includes ===== //
|
||||
#include <memory>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
#include "XLCell.hpp"
|
||||
#include "XLCellIterator.hpp"
|
||||
#include "XLCellReference.hpp"
|
||||
#include "XLXmlParser.hpp"
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief This class encapsulates the concept of a cell range, i.e. a square area
|
||||
* (or subset) of cells in a spreadsheet.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLCellRange
|
||||
{
|
||||
friend class XLCellIterator;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// Public Member Functions
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief
|
||||
* @param dataNode
|
||||
* @param topLeft
|
||||
* @param bottomRight
|
||||
* @param sharedStrings
|
||||
*/
|
||||
explicit XLCellRange(const XMLNode& dataNode,
|
||||
const XLCellReference& topLeft,
|
||||
const XLCellReference& bottomRight,
|
||||
const XLSharedStrings& sharedStrings);
|
||||
|
||||
/**
|
||||
* @brief Copy constructor [default].
|
||||
* @param other The range object to be copied.
|
||||
* @note This implements the default copy constructor, i.e. memberwise copying.
|
||||
*/
|
||||
XLCellRange(const XLCellRange& other);
|
||||
|
||||
/**
|
||||
* @brief Move constructor [default].
|
||||
* @param other The range object to be moved.
|
||||
* @note This implements the default move constructor, i.e. memberwise move.
|
||||
*/
|
||||
XLCellRange(XLCellRange&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Destructor [default]
|
||||
* @note This implements the default destructor.
|
||||
*/
|
||||
~XLCellRange();
|
||||
|
||||
/**
|
||||
* @brief The copy assignment operator [default]
|
||||
* @param other The range object to be copied and assigned.
|
||||
* @return A reference to the new object.
|
||||
* @throws A std::range_error if the source range and destination range are of different size and shape.
|
||||
* @note This implements the default copy assignment operator.
|
||||
*/
|
||||
XLCellRange& operator=(const XLCellRange& other);
|
||||
|
||||
/**
|
||||
* @brief The move assignment operator [default].
|
||||
* @param other The range object to be moved and assigned.
|
||||
* @return A reference to the new object.
|
||||
* @note This implements the default move assignment operator.
|
||||
*/
|
||||
XLCellRange& operator=(XLCellRange&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Get the number of rows in the range.
|
||||
* @return The number of rows.
|
||||
*/
|
||||
uint32_t numRows() const;
|
||||
|
||||
/**
|
||||
* @brief Get the number of columns in the range.
|
||||
* @return The number of columns.
|
||||
*/
|
||||
uint16_t numColumns() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLCellIterator begin() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLCellIterator end() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void clear();
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// Private Member Variables
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
private:
|
||||
std::unique_ptr<XMLNode> m_dataNode; /**< */
|
||||
XLCellReference m_topLeft; /**< The cell reference of the first cell in the range */
|
||||
XLCellReference m_bottomRight; /**< The cell reference of the last cell in the range */
|
||||
XLSharedStrings m_sharedStrings;
|
||||
};
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLCELLRANGE_HPP
|
||||
323
thirdparty/OpenXLSX/include/headers/XLCellReference.hpp
vendored
Normal file
323
thirdparty/OpenXLSX/include/headers/XLCellReference.hpp
vendored
Normal file
@@ -0,0 +1,323 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLCELLREFERENCE_HPP
|
||||
#define OPENXLSX_XLCELLREFERENCE_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== External Includes ===== //
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
using XLCoordinates = std::pair<uint32_t, uint16_t>;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLCellReference final
|
||||
{
|
||||
friend bool operator==(const XLCellReference& lhs, const XLCellReference& rhs);
|
||||
friend bool operator!=(const XLCellReference& lhs, const XLCellReference& rhs);
|
||||
friend bool operator<(const XLCellReference& lhs, const XLCellReference& rhs);
|
||||
friend bool operator>(const XLCellReference& lhs, const XLCellReference& rhs);
|
||||
friend bool operator<=(const XLCellReference& lhs, const XLCellReference& rhs);
|
||||
friend bool operator>=(const XLCellReference& lhs, const XLCellReference& rhs);
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// Public Member Functions
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor taking a cell address as argument.
|
||||
* @param cellAddress The address of the cell, e.g. 'A1'.
|
||||
* @details The constructor creates a new XLCellReference from a string, e.g. 'A1'. If there's no input,
|
||||
* the default reference will be cell A1.
|
||||
*/
|
||||
XLCellReference(const std::string& cellAddress = ""); // NOLINT
|
||||
|
||||
/**
|
||||
* @brief Constructor taking the cell coordinates as arguments.
|
||||
* @param row The row number of the cell.
|
||||
* @param column The column number of the cell.
|
||||
*/
|
||||
XLCellReference(uint32_t row, uint16_t column);
|
||||
|
||||
/**
|
||||
* @brief Constructor taking the row number and the column letter as arguments.
|
||||
* @param row The row number of the cell.
|
||||
* @param column The column letter of the cell.
|
||||
*/
|
||||
XLCellReference(uint32_t row, const std::string& column);
|
||||
|
||||
/**
|
||||
* @brief Copy constructor
|
||||
* @param other The object to be copied.
|
||||
*/
|
||||
XLCellReference(const XLCellReference& other);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLCellReference(XLCellReference&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Destructor. Default implementation used.
|
||||
*/
|
||||
~XLCellReference();
|
||||
|
||||
/**
|
||||
* @brief Assignment operator.
|
||||
* @param other The object to be copied/assigned.
|
||||
* @return A reference to the new object.
|
||||
*/
|
||||
XLCellReference& operator=(const XLCellReference& other);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLCellReference& operator=(XLCellReference&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLCellReference& operator++();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLCellReference operator++(int); // NOLINT
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLCellReference& operator--();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLCellReference operator--(int); // NOLINT
|
||||
|
||||
/**
|
||||
* @brief Get the row number of the XLCellReference.
|
||||
* @return The row.
|
||||
*/
|
||||
uint32_t row() const;
|
||||
|
||||
/**
|
||||
* @brief Set the row number for the XLCellReference.
|
||||
* @param row The row number.
|
||||
*/
|
||||
void setRow(uint32_t row);
|
||||
|
||||
/**
|
||||
* @brief Get the column number of the XLCellReference.
|
||||
* @return The column number.
|
||||
*/
|
||||
uint16_t column() const;
|
||||
|
||||
/**
|
||||
* @brief Set the column number of the XLCellReference.
|
||||
* @param column The column number.
|
||||
*/
|
||||
void setColumn(uint16_t column);
|
||||
|
||||
/**
|
||||
* @brief Set both row and column number of the XLCellReference.
|
||||
* @param row The row number.
|
||||
* @param column The column number.
|
||||
*/
|
||||
void setRowAndColumn(uint32_t row, uint16_t column);
|
||||
|
||||
/**
|
||||
* @brief Get the address of the XLCellReference
|
||||
* @return The address, e.g. 'A1'
|
||||
*/
|
||||
std::string address() const;
|
||||
|
||||
/**
|
||||
* @brief Set the address of the XLCellReference
|
||||
* @param address The address, e.g. 'A1'
|
||||
* @pre The address input string must be a valid Excel cell reference. Otherwise the behaviour is undefined.
|
||||
*/
|
||||
void setAddress(const std::string& address);
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// Private Member Functions
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// private:
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param row
|
||||
* @return
|
||||
*/
|
||||
static std::string rowAsString(uint32_t row);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param row
|
||||
* @return
|
||||
*/
|
||||
static uint32_t rowAsNumber(const std::string& row);
|
||||
|
||||
/**
|
||||
* @brief Static helper function to convert column number to column letter (e.g. column 1 becomes 'A')
|
||||
* @param column The column number.
|
||||
* @return The column letter
|
||||
*/
|
||||
static std::string columnAsString(uint16_t column);
|
||||
|
||||
/**
|
||||
* @brief Static helper function to convert column letter to column number (e.g. column 'A' becomes 1)
|
||||
* @param column The column letter, e.g. 'A'
|
||||
* @return The column number.
|
||||
*/
|
||||
static uint16_t columnAsNumber(const std::string& column);
|
||||
|
||||
/**
|
||||
* @brief Static helper function to convert cell address to coordinates.
|
||||
* @param address The address to be converted, e.g. 'A1'
|
||||
* @return A std::pair<row, column>
|
||||
*/
|
||||
static XLCoordinates coordinatesFromAddress(const std::string& address);
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// Private Member Variables
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
private:
|
||||
uint32_t m_row { 1 }; /**< The row */
|
||||
uint16_t m_column { 1 }; /**< The column */
|
||||
std::string m_cellAddress {"A1"}; /**< The address, e.g. 'A1' */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Helper function to check equality between two XLCellReferences.
|
||||
* @param lhs The first XLCellReference
|
||||
* @param rhs The second XLCellReference
|
||||
* @return true if equal; otherwise false.
|
||||
*/
|
||||
inline bool operator==(const XLCellReference& lhs, const XLCellReference& rhs)
|
||||
{
|
||||
return lhs.row() == rhs.row() && lhs.column() == rhs.column();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Helper function to check for in-equality between two XLCellReferences
|
||||
* @param lhs The first XLCellReference
|
||||
* @param rhs The second XLCellReference
|
||||
* @return false if equal; otherwise true.
|
||||
*/
|
||||
inline bool operator!=(const XLCellReference& lhs, const XLCellReference& rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Helper function to check if one XLCellReference is smaller than another.
|
||||
* @param lhs The first XLCellReference
|
||||
* @param rhs The second XLCellReference
|
||||
* @return true if lhs < rhs; otherwise false.
|
||||
*/
|
||||
inline bool operator<(const XLCellReference& lhs, const XLCellReference& rhs)
|
||||
{
|
||||
return lhs.row() < rhs.row() || (lhs.row() <= rhs.row() && lhs.column() < rhs.column());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Helper function to check if one XLCellReference is larger than another.
|
||||
* @param lhs The first XLCellReference
|
||||
* @param rhs The second XLCellReference
|
||||
* @return true if lhs > rhs; otherwise false.
|
||||
*/
|
||||
inline bool operator>(const XLCellReference& lhs, const XLCellReference& rhs)
|
||||
{
|
||||
return (rhs < lhs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Helper function to check if one XLCellReference is smaller than or equal to another.
|
||||
* @param lhs The first XLCellReference
|
||||
* @param rhs The second XLCellReference
|
||||
* @return true if lhs <= rhs; otherwise false
|
||||
*/
|
||||
inline bool operator<=(const XLCellReference& lhs, const XLCellReference& rhs)
|
||||
{
|
||||
return !(lhs > rhs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Helper function to check if one XLCellReference is larger than or equal to another.
|
||||
* @param lhs The first XLCellReference
|
||||
* @param rhs The second XLCellReference
|
||||
* @return true if lhs >= rhs; otherwise false.
|
||||
*/
|
||||
inline bool operator>=(const XLCellReference& lhs, const XLCellReference& rhs)
|
||||
{
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLCELLREFERENCE_HPP
|
||||
672
thirdparty/OpenXLSX/include/headers/XLCellValue.hpp
vendored
Normal file
672
thirdparty/OpenXLSX/include/headers/XLCellValue.hpp
vendored
Normal file
@@ -0,0 +1,672 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLCELLVALUE_HPP
|
||||
#define OPENXLSX_XLCELLVALUE_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== External Includes ===== //
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <variant>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
#include "XLDateTime.hpp"
|
||||
#include "XLException.hpp"
|
||||
#include "XLXmlParser.hpp"
|
||||
|
||||
// ========== CLASS AND ENUM TYPE DEFINITIONS ========== //
|
||||
namespace OpenXLSX
|
||||
{
|
||||
//---------- Forward Declarations ----------//
|
||||
class XLCellValueProxy;
|
||||
class XLCell;
|
||||
|
||||
/**
|
||||
* @brief Enum defining the valid value types for a an Excel spreadsheet cell.
|
||||
*/
|
||||
enum class XLValueType { Empty, Boolean, Integer, Float, Error, String };
|
||||
|
||||
/**
|
||||
* @brief Class encapsulating a cell value.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLCellValue
|
||||
{
|
||||
//---------- Friend Declarations ----------//
|
||||
|
||||
// TODO: Consider template functions to compare to ints, floats etc.
|
||||
friend bool operator==(const XLCellValue& lhs, const XLCellValue& rhs);
|
||||
friend bool operator!=(const XLCellValue& lhs, const XLCellValue& rhs);
|
||||
friend bool operator<(const XLCellValue& lhs, const XLCellValue& rhs);
|
||||
friend bool operator>(const XLCellValue& lhs, const XLCellValue& rhs);
|
||||
friend bool operator<=(const XLCellValue& lhs, const XLCellValue& rhs);
|
||||
friend bool operator>=(const XLCellValue& lhs, const XLCellValue& rhs);
|
||||
friend std::ostream& operator<<(std::ostream& os, const XLCellValue& value);
|
||||
friend std::hash<OpenXLSX::XLCellValue>;
|
||||
|
||||
public:
|
||||
//---------- Public Member Functions ----------//
|
||||
|
||||
/**
|
||||
* @brief Default constructor
|
||||
*/
|
||||
XLCellValue();
|
||||
|
||||
/**
|
||||
* @brief A templated constructor. Any value convertible to a valid cell value can be used as argument.
|
||||
* @tparam T The type of the argument (will be automatically deduced).
|
||||
* @param value The value.
|
||||
* @todo Consider changing the enable_if statement to check for objects with a .c_str() member function.
|
||||
*/
|
||||
template<
|
||||
typename T,
|
||||
typename std::enable_if<std::is_integral_v<T> || std::is_floating_point_v<T> || std::is_same_v<std::decay_t<T>, std::string> ||
|
||||
std::is_same_v<std::decay_t<T>, std::string_view> || std::is_same_v<std::decay_t<T>, const char*> ||
|
||||
std::is_same_v<std::decay_t<T>, char*> || std::is_same_v<T, XLDateTime>>::type* = nullptr>
|
||||
XLCellValue(T value) // NOLINT
|
||||
{
|
||||
// ===== If the argument is a bool, set the m_type attribute to Boolean.
|
||||
if constexpr (std::is_integral_v<T> && std::is_same_v<T, bool>) {
|
||||
m_type = XLValueType::Boolean;
|
||||
m_value = value;
|
||||
}
|
||||
|
||||
// ===== If the argument is an integral type, set the m_type attribute to Integer.
|
||||
else if constexpr (std::is_integral_v<T> && !std::is_same_v<T, bool>) {
|
||||
m_type = XLValueType::Integer;
|
||||
m_value = int64_t(value);
|
||||
}
|
||||
|
||||
// ===== If the argument is a string type (i.e. is constructable from *char),
|
||||
// ===== set the m_type attribute to String.
|
||||
else if constexpr (std::is_same_v<std::decay_t<T>, std::string> || std::is_same_v<std::decay_t<T>, std::string_view> ||
|
||||
std::is_same_v<std::decay_t<T>, const char*> ||
|
||||
(std::is_same_v<std::decay_t<T>, char*> && !std::is_same_v<T, bool>))
|
||||
{
|
||||
m_type = XLValueType::String;
|
||||
m_value = std::string(value);
|
||||
}
|
||||
|
||||
// ===== If the argument is an XLDateTime, set the value to the date/time serial number.
|
||||
else if constexpr (std::is_same_v<T, XLDateTime>) {
|
||||
m_type = XLValueType::Float;
|
||||
m_value = value.serial();
|
||||
}
|
||||
|
||||
// ===== If the argument is a floating point type, set the m_type attribute to Float.
|
||||
// ===== If not, a static_assert will result in compilation error.
|
||||
else {
|
||||
static_assert(std::is_floating_point_v<T>, "Invalid argument for constructing XLCellValue object");
|
||||
if (std::isfinite(value)) {
|
||||
m_type = XLValueType::Float;
|
||||
m_value = double(value);
|
||||
}
|
||||
else {
|
||||
m_type = XLValueType::Error;
|
||||
m_value = std::string("#NUM!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Copy constructor.
|
||||
* @param other The object to be copied.
|
||||
*/
|
||||
XLCellValue(const XLCellValue& other);
|
||||
|
||||
/**
|
||||
* @brief Move constructor.
|
||||
* @param other The object to be moved.
|
||||
*/
|
||||
XLCellValue(XLCellValue&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
~XLCellValue();
|
||||
|
||||
/**
|
||||
* @brief Copy assignment operator.
|
||||
* @param other Object to be copied.
|
||||
* @return Reference to the copied-to object.
|
||||
*/
|
||||
XLCellValue& operator=(const XLCellValue& other);
|
||||
|
||||
/**
|
||||
* @brief Move assignment operator.
|
||||
* @param other Object to be moved.
|
||||
* @return Reference to the moved-to object.
|
||||
*/
|
||||
XLCellValue& operator=(XLCellValue&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Templated copy assignment operator.
|
||||
* @tparam T The type of the value argument.
|
||||
* @param value The value.
|
||||
* @return A reference to the assigned-to object.
|
||||
*/
|
||||
template<
|
||||
typename T,
|
||||
typename std::enable_if<std::is_integral_v<T> || std::is_floating_point_v<T> || std::is_same_v<std::decay_t<T>, std::string> ||
|
||||
std::is_same_v<std::decay_t<T>, std::string_view> || std::is_same_v<std::decay_t<T>, const char*> ||
|
||||
std::is_same_v<std::decay_t<T>, char*> || std::is_same_v<T, XLDateTime>>::type* = nullptr>
|
||||
XLCellValue& operator=(T value)
|
||||
{
|
||||
// ===== Implemented using copy-and-swap.
|
||||
XLCellValue temp(value);
|
||||
std::swap(*this, temp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Templated setter for integral and bool types.
|
||||
* @tparam T The type of the value argument.
|
||||
* @param numberValue The value
|
||||
*/
|
||||
template<
|
||||
typename T,
|
||||
typename std::enable_if<std::is_same_v<T, XLCellValue> || std::is_integral_v<T> || std::is_floating_point_v<T> ||
|
||||
std::is_same_v<std::decay_t<T>, std::string> || std::is_same_v<std::decay_t<T>, std::string_view> ||
|
||||
std::is_same_v<std::decay_t<T>, const char*> || std::is_same_v<std::decay_t<T>, char*> ||
|
||||
std::is_same_v<T, XLDateTime>>::type* = nullptr>
|
||||
void set(T numberValue)
|
||||
{
|
||||
// ===== Implemented using the assignment operator.
|
||||
*this = numberValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Templated getter.
|
||||
* @tparam T The type of the value to be returned.
|
||||
* @return The value as a type T object.
|
||||
* @throws XLValueTypeError if the XLCellValue object does not contain a compatible type.
|
||||
*/
|
||||
template<
|
||||
typename T,
|
||||
typename std::enable_if<std::is_integral_v<T> || std::is_floating_point_v<T> || std::is_same_v<std::decay_t<T>, std::string> ||
|
||||
std::is_same_v<std::decay_t<T>, std::string_view> || std::is_same_v<std::decay_t<T>, const char*> ||
|
||||
std::is_same_v<std::decay_t<T>, char*> || std::is_same_v<T, XLDateTime>>::type* = nullptr>
|
||||
T get() const
|
||||
{
|
||||
try {
|
||||
if constexpr (std::is_integral_v<T> && std::is_same_v<T, bool>) return std::get<bool>(m_value);
|
||||
|
||||
if constexpr (std::is_integral_v<T> && !std::is_same_v<T, bool>) return static_cast<T>(std::get<int64_t>(m_value));
|
||||
|
||||
if constexpr (std::is_floating_point_v<T>) {
|
||||
if (m_type == XLValueType::Error) return std::nan("1");
|
||||
return static_cast<T>(std::get<double>(m_value));
|
||||
}
|
||||
|
||||
if constexpr (std::is_same_v<std::decay_t<T>, std::string> || std::is_same_v<std::decay_t<T>, std::string_view> ||
|
||||
std::is_same_v<std::decay_t<T>, const char*> ||
|
||||
(std::is_same_v<std::decay_t<T>, char*> && !std::is_same_v<T, bool>))
|
||||
return std::get<std::string>(m_value).c_str();
|
||||
|
||||
if constexpr (std::is_same_v<T, XLDateTime>) return XLDateTime(std::get<double>(m_value));
|
||||
}
|
||||
|
||||
catch (const std::bad_variant_access& ) {
|
||||
throw XLValueTypeError("XLCellValue object does not contain the requested type.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Explicit conversion operator for easy conversion to supported types.
|
||||
* @tparam T The type to cast to.
|
||||
* @return The XLCellValue object cast to requested type.
|
||||
* @throws XLValueTypeError if the XLCellValue object does not contain a compatible type.
|
||||
*/
|
||||
template<
|
||||
typename T,
|
||||
typename std::enable_if<std::is_integral_v<T> || std::is_floating_point_v<T> || std::is_same_v<std::decay_t<T>, std::string> ||
|
||||
std::is_same_v<std::decay_t<T>, std::string_view> || std::is_same_v<std::decay_t<T>, const char*> ||
|
||||
std::is_same_v<std::decay_t<T>, char*> || std::is_same_v<T, XLDateTime>>::type* = nullptr>
|
||||
operator T() const
|
||||
{
|
||||
return this->get<T>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clears the contents of the XLCellValue object.
|
||||
* @return Returns a reference to the current object.
|
||||
*/
|
||||
XLCellValue& clear();
|
||||
|
||||
/**
|
||||
* @brief Sets the value type to XLValueType::Error.
|
||||
* @return Returns a reference to the current object.
|
||||
*/
|
||||
XLCellValue& setError(const std::string &error);
|
||||
|
||||
/**
|
||||
* @brief Get the value type of the current object.
|
||||
* @return An XLValueType for the current object.
|
||||
*/
|
||||
XLValueType type() const;
|
||||
|
||||
/**
|
||||
* @brief Get the value type of the current object, as a string representation
|
||||
* @return A std::string representation of the value type.
|
||||
*/
|
||||
std::string typeAsString() const;
|
||||
|
||||
private:
|
||||
//---------- Private Member Variables ---------- //
|
||||
|
||||
std::variant<std::string, int64_t, double, bool> m_value { std::string("") }; /**< The value contained in the cell. */
|
||||
XLValueType m_type { XLValueType::Empty }; /**< The value type of the cell. */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The XLCellValueProxy class is used for proxy (or placeholder) objects for XLCellValue objects.
|
||||
* @details The XLCellValueProxy class is used for proxy (or placeholder) objects for XLCellValue objects.
|
||||
* The purpose is to enable implicit conversion during assignment operations. XLCellValueProxy objects
|
||||
* can not be constructed manually by the user, only through XLCell objects.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLCellValueProxy
|
||||
{
|
||||
friend class XLCell;
|
||||
friend class XLCellValue;
|
||||
|
||||
public:
|
||||
//---------- Public Member Functions ----------//
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
~XLCellValueProxy();
|
||||
|
||||
/**
|
||||
* @brief Copy assignment operator.
|
||||
* @param other XLCellValueProxy object to be copied.
|
||||
* @return A reference to the current object.
|
||||
*/
|
||||
XLCellValueProxy& operator=(const XLCellValueProxy& other);
|
||||
|
||||
/**
|
||||
* @brief Templated assignment operator
|
||||
* @tparam T The type of numberValue assigned to the object.
|
||||
* @param value The value.
|
||||
* @return A reference to the current object.
|
||||
*/
|
||||
template<
|
||||
typename T,
|
||||
typename std::enable_if<std::is_integral_v<T> || std::is_floating_point_v<T> || std::is_same_v<std::decay_t<T>, std::string> ||
|
||||
std::is_same_v<std::decay_t<T>, std::string_view> || std::is_same_v<std::decay_t<T>, const char*> ||
|
||||
std::is_same_v<std::decay_t<T>, char*> || std::is_same_v<T, XLCellValue> ||
|
||||
std::is_same_v<T, XLDateTime>>::type* = nullptr>
|
||||
XLCellValueProxy& operator=(T value)
|
||||
{ // NOLINT
|
||||
|
||||
if constexpr (std::is_integral_v<T> && std::is_same_v<T, bool>) // if bool
|
||||
setBoolean(value);
|
||||
|
||||
else if constexpr (std::is_integral_v<T> && !std::is_same_v<T, bool>) // if integer
|
||||
setInteger(value);
|
||||
|
||||
else if constexpr (std::is_floating_point_v<T>) // if floating point
|
||||
setFloat(value);
|
||||
|
||||
else if constexpr (std::is_same_v<T, XLDateTime>)
|
||||
setFloat(value.serial());
|
||||
|
||||
else if constexpr (std::is_same_v<std::decay_t<T>, std::string> || std::is_same_v<std::decay_t<T>, std::string_view> ||
|
||||
std::is_same_v<std::decay_t<T>, const char*> ||
|
||||
(std::is_same_v<std::decay_t<T>, char*> && !std::is_same_v<T, bool> && !std::is_same_v<T, XLCellValue>))
|
||||
{
|
||||
if constexpr (std::is_same_v<std::decay_t<T>, const char*> || std::is_same_v<std::decay_t<T>, char*>)
|
||||
setString(value);
|
||||
else if constexpr (std::is_same_v<std::decay_t<T>, std::string_view>)
|
||||
setString(std::string(value).c_str());
|
||||
else
|
||||
setString(value.c_str());
|
||||
}
|
||||
|
||||
if constexpr (std::is_same_v<T, XLCellValue>) {
|
||||
switch (value.type()) {
|
||||
case XLValueType::Boolean:
|
||||
setBoolean(value.template get<bool>());
|
||||
break;
|
||||
case XLValueType::Integer:
|
||||
setInteger(value.template get<int64_t>());
|
||||
break;
|
||||
case XLValueType::Float:
|
||||
setFloat(value.template get<double>());
|
||||
break;
|
||||
case XLValueType::String:
|
||||
setString(value.template get<const char*>());
|
||||
break;
|
||||
case XLValueType::Empty:
|
||||
clear();
|
||||
break;
|
||||
default:
|
||||
setError("#N/A");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @tparam T
|
||||
* @param value
|
||||
*/
|
||||
template<
|
||||
typename T,
|
||||
typename std::enable_if<std::is_integral_v<T> || std::is_floating_point_v<T> || std::is_same_v<std::decay_t<T>, std::string> ||
|
||||
std::is_same_v<std::decay_t<T>, std::string_view> || std::is_same_v<std::decay_t<T>, const char*> ||
|
||||
std::is_same_v<std::decay_t<T>, char*> || std::is_same_v<T, XLCellValue> ||
|
||||
std::is_same_v<T, XLDateTime>>::type* = nullptr>
|
||||
void set(T value)
|
||||
{
|
||||
*this = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @tparam T
|
||||
* @return
|
||||
* @todo Is an explicit conversion operator needed as well?
|
||||
*/
|
||||
template<
|
||||
typename T,
|
||||
typename std::enable_if<std::is_integral_v<T> || std::is_floating_point_v<T> || std::is_same_v<std::decay_t<T>, std::string> ||
|
||||
std::is_same_v<std::decay_t<T>, std::string_view> || std::is_same_v<std::decay_t<T>, const char*> ||
|
||||
std::is_same_v<std::decay_t<T>, char*> || std::is_same_v<T, XLDateTime>>::type* = nullptr>
|
||||
T get() const
|
||||
{
|
||||
return getValue().get<T>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear the contents of the cell.
|
||||
* @return A reference to the current object.
|
||||
*/
|
||||
XLCellValueProxy& clear();
|
||||
|
||||
/**
|
||||
* @brief Set the cell value to a error state.
|
||||
* @return A reference to the current object.
|
||||
*/
|
||||
XLCellValueProxy& setError(const std::string & error);
|
||||
|
||||
/**
|
||||
* @brief Get the value type for the cell.
|
||||
* @return An XLCellValue corresponding to the cell value.
|
||||
*/
|
||||
XLValueType type() const;
|
||||
|
||||
/**
|
||||
* @brief Get the value type of the current object, as a string representation
|
||||
* @return A std::string representation of the value type.
|
||||
*/
|
||||
std::string typeAsString() const;
|
||||
|
||||
/**
|
||||
* @brief Implicitly convert the XLCellValueProxy object to a XLCellValue object.
|
||||
* @return An XLCellValue object, corresponding to the cell value.
|
||||
*/
|
||||
operator XLCellValue(); // NOLINT
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @tparam T
|
||||
* @return
|
||||
*/
|
||||
template<
|
||||
typename T,
|
||||
typename std::enable_if<std::is_integral_v<T> || std::is_floating_point_v<T> || std::is_same_v<std::decay_t<T>, std::string> ||
|
||||
std::is_same_v<std::decay_t<T>, std::string_view> || std::is_same_v<std::decay_t<T>, const char*> ||
|
||||
std::is_same_v<std::decay_t<T>, char*> || std::is_same_v<T, XLDateTime>>::type* = nullptr>
|
||||
operator T() const
|
||||
{
|
||||
return getValue().get<T>();
|
||||
}
|
||||
|
||||
private:
|
||||
//---------- Private Member Functions ---------- //
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
* @param cell Pointer to the parent XLCell object.
|
||||
* @param cellNode Pointer to the corresponding XMLNode object.
|
||||
*/
|
||||
XLCellValueProxy(XLCell* cell, XMLNode* cellNode);
|
||||
|
||||
/**
|
||||
* @brief Copy constructor
|
||||
* @param other Object to be copied.
|
||||
*/
|
||||
XLCellValueProxy(const XLCellValueProxy& other);
|
||||
|
||||
/**
|
||||
* @brief Move constructor
|
||||
* @param other Object to be moved.
|
||||
*/
|
||||
XLCellValueProxy(XLCellValueProxy&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Move assignment operator
|
||||
* @param other Object to be moved
|
||||
* @return Reference to moved-to pbject.
|
||||
*/
|
||||
XLCellValueProxy& operator=(XLCellValueProxy&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Set cell to an integer value.
|
||||
* @param numberValue The value to be set.
|
||||
*/
|
||||
void setInteger(int64_t numberValue);
|
||||
|
||||
/**
|
||||
* @brief Set the cell to a bool value.
|
||||
* @param numberValue The value to be set.
|
||||
*/
|
||||
void setBoolean(bool numberValue);
|
||||
|
||||
/**
|
||||
* @brief Set the cell to a floating point value.
|
||||
* @param numberValue The value to be set.
|
||||
*/
|
||||
void setFloat(double numberValue);
|
||||
|
||||
/**
|
||||
* @brief Set the cell to a string value.
|
||||
* @param stringValue The value to be set.
|
||||
*/
|
||||
void setString(const char* stringValue);
|
||||
|
||||
/**
|
||||
* @brief Get a copy of the XLCellValue object for the cell.
|
||||
* @return An XLCellValue object.
|
||||
*/
|
||||
XLCellValue getValue() const;
|
||||
|
||||
//---------- Private Member Variables ---------- //
|
||||
|
||||
XLCell* m_cell; /**< Pointer to the owning XLCell object. */
|
||||
XMLNode* m_cellNode; /**< Pointer to corresponding XML cell node. */
|
||||
};
|
||||
|
||||
} // namespace OpenXLSX
|
||||
|
||||
// TODO: Consider comparison operators on fundamental datatypes
|
||||
// ========== FRIEND FUNCTION IMPLEMENTATIONS ========== //
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
inline bool operator==(const XLCellValue& lhs, const XLCellValue& rhs)
|
||||
{
|
||||
return lhs.m_value == rhs.m_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
inline bool operator!=(const XLCellValue& lhs, const XLCellValue& rhs)
|
||||
{
|
||||
return lhs.m_value != rhs.m_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
inline bool operator<(const XLCellValue& lhs, const XLCellValue& rhs)
|
||||
{
|
||||
return lhs.m_value < rhs.m_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
inline bool operator>(const XLCellValue& lhs, const XLCellValue& rhs)
|
||||
{
|
||||
return lhs.m_value > rhs.m_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
inline bool operator<=(const XLCellValue& lhs, const XLCellValue& rhs)
|
||||
{
|
||||
return lhs.m_value <= rhs.m_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
inline bool operator>=(const XLCellValue& lhs, const XLCellValue& rhs)
|
||||
{
|
||||
return lhs.m_value >= rhs.m_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param os
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
inline std::ostream& operator<<(std::ostream& os, const XLCellValue& value)
|
||||
{
|
||||
switch (value.type()) {
|
||||
case XLValueType::Empty:
|
||||
return os << "";
|
||||
case XLValueType::Boolean:
|
||||
return os << value.get<bool>();
|
||||
case XLValueType::Integer:
|
||||
return os << value.get<int64_t>();
|
||||
case XLValueType::Float:
|
||||
return os << value.get<double>();
|
||||
case XLValueType::String:
|
||||
return os << value.get<std::string_view>();
|
||||
default:
|
||||
return os << "";
|
||||
}
|
||||
}
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& os, const XLCellValueProxy& value)
|
||||
{
|
||||
switch (value.type()) {
|
||||
case XLValueType::Empty:
|
||||
return os << "";
|
||||
case XLValueType::Boolean:
|
||||
return os << value.get<bool>();
|
||||
case XLValueType::Integer:
|
||||
return os << value.get<int64_t>();
|
||||
case XLValueType::Float:
|
||||
return os << value.get<double>();
|
||||
case XLValueType::String:
|
||||
return os << value.get<std::string_view>();
|
||||
default:
|
||||
return os << "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace OpenXLSX
|
||||
|
||||
namespace std
|
||||
{
|
||||
template<>
|
||||
struct hash<OpenXLSX::XLCellValue> // NOLINT
|
||||
{
|
||||
std::size_t operator()(const OpenXLSX::XLCellValue& value) const noexcept
|
||||
{
|
||||
return std::hash<std::variant<std::string, int64_t, double, bool>> {}(value.m_value);
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLCELLVALUE_HPP
|
||||
229
thirdparty/OpenXLSX/include/headers/XLColor.hpp
vendored
Normal file
229
thirdparty/OpenXLSX/include/headers/XLColor.hpp
vendored
Normal file
@@ -0,0 +1,229 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLCOLOR_HPP
|
||||
#define OPENXLSX_XLCOLOR_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== External Includes ===== //
|
||||
#include <string>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLColor
|
||||
{
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// Public Member Functions
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
friend bool operator==(const XLColor& lhs, const XLColor& rhs);
|
||||
friend bool operator!=(const XLColor& lhs, const XLColor& rhs);
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
XLColor();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param alpha
|
||||
* @param red
|
||||
* @param green
|
||||
* @param blue
|
||||
*/
|
||||
XLColor(uint8_t alpha, uint8_t red, uint8_t green, uint8_t blue);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param red
|
||||
* @param green
|
||||
* @param blue
|
||||
*/
|
||||
XLColor(uint8_t red, uint8_t green, uint8_t blue);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param hexCode
|
||||
*/
|
||||
explicit XLColor(const std::string& hexCode);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLColor(const XLColor& other);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLColor(XLColor&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
~XLColor();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLColor& operator=(const XLColor& other);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLColor& operator=(XLColor&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param alpha
|
||||
* @param red
|
||||
* @param green
|
||||
* @param blue
|
||||
*/
|
||||
void set(uint8_t alpha, uint8_t red, uint8_t green, uint8_t blue);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param red
|
||||
* @param green
|
||||
* @param blue
|
||||
*/
|
||||
void set(uint8_t red = 0, uint8_t green = 0, uint8_t blue = 0);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param hexCode
|
||||
*/
|
||||
void set(const std::string& hexCode);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
uint8_t alpha() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
uint8_t red() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
uint8_t green() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
uint8_t blue() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
std::string hex() const;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// Private Member Variables
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
private:
|
||||
uint8_t m_alpha { 255 };
|
||||
|
||||
uint8_t m_red { 0 };
|
||||
|
||||
uint8_t m_green { 0 };
|
||||
|
||||
uint8_t m_blue { 0 };
|
||||
};
|
||||
|
||||
} // namespace OpenXLSX
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
inline bool operator==(const XLColor& lhs, const XLColor& rhs)
|
||||
{
|
||||
return lhs.alpha() == rhs.alpha() && lhs.red() == rhs.red() && lhs.green() == rhs.green() && lhs.blue() == rhs.blue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
inline bool operator!=(const XLColor& lhs, const XLColor& rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLCOLOR_HPP
|
||||
139
thirdparty/OpenXLSX/include/headers/XLColumn.hpp
vendored
Normal file
139
thirdparty/OpenXLSX/include/headers/XLColumn.hpp
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLCOLUMN_HPP
|
||||
#define OPENXLSX_XLCOLUMN_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== External Includes ===== //
|
||||
#include <memory>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
#include "XLXmlParser.hpp"
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLColumn
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
* @param columnNode A pointer to the XMLNode for the column.
|
||||
*/
|
||||
explicit XLColumn(const XMLNode& columnNode);
|
||||
|
||||
/**
|
||||
* @brief Copy Constructor [deleted]
|
||||
*/
|
||||
XLColumn(const XLColumn& other);
|
||||
|
||||
/**
|
||||
* @brief Move Constructor
|
||||
* @note The move constructor has been explicitly deleted.
|
||||
*/
|
||||
XLColumn(XLColumn&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
~XLColumn();
|
||||
|
||||
/**
|
||||
* @brief Copy assignment operator [deleted]
|
||||
*/
|
||||
XLColumn& operator=(const XLColumn& other);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLColumn& operator=(XLColumn&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief Get the width of the column.
|
||||
* @return The width of the column.
|
||||
*/
|
||||
float width() const;
|
||||
|
||||
/**
|
||||
* @brief Set the width of the column
|
||||
* @param width The width of the column
|
||||
*/
|
||||
void setWidth(float width);
|
||||
|
||||
/**
|
||||
* @brief Is the column hidden?
|
||||
* @return The state of the column.
|
||||
*/
|
||||
bool isHidden() const;
|
||||
|
||||
/**
|
||||
* @brief Set the column to be shown or hidden.
|
||||
* @param state The state of the column.
|
||||
*/
|
||||
void setHidden(bool state);
|
||||
|
||||
/**
|
||||
* @brief Get the XMLNode object for the column.
|
||||
* @return The XMLNode for the column
|
||||
*/
|
||||
XMLNode& columnNode() const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<XMLNode> m_columnNode; /**< A pointer to the XMLNode object for the column. */
|
||||
};
|
||||
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLCOLUMN_HPP
|
||||
224
thirdparty/OpenXLSX/include/headers/XLCommandQuery.hpp
vendored
Normal file
224
thirdparty/OpenXLSX/include/headers/XLCommandQuery.hpp
vendored
Normal file
@@ -0,0 +1,224 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLCOMMANDQUERY_HPP
|
||||
#define OPENXLSX_XLCOMMANDQUERY_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== External Includes ===== //
|
||||
#include <any>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <variant>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "XLXmlData.hpp"
|
||||
#include "XLSharedStrings.hpp"
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
enum class XLCommandType {
|
||||
SetSheetName,
|
||||
SetSheetColor,
|
||||
SetSheetVisibility,
|
||||
SetSheetIndex,
|
||||
SetSheetActive,
|
||||
ResetCalcChain,
|
||||
AddSharedStrings,
|
||||
AddWorksheet,
|
||||
AddChartsheet,
|
||||
DeleteSheet,
|
||||
CloneSheet,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class XLCommand
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param type
|
||||
*/
|
||||
explicit XLCommand(XLCommandType type) : m_type(type) {}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @tparam T
|
||||
* @param param
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
template<typename T>
|
||||
XLCommand& setParam(const std::string& param, T value) {
|
||||
m_params[param] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @tparam T
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
template<typename T>
|
||||
T getParam(const std::string& param) const {
|
||||
return std::any_cast<T>(m_params.at(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLCommandType type() const {
|
||||
return m_type;
|
||||
}
|
||||
|
||||
private:
|
||||
XLCommandType m_type; /*< */
|
||||
std::map<std::string, std::any> m_params; /*< */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
enum class XLQueryType {
|
||||
QuerySheetName,
|
||||
QuerySheetIndex,
|
||||
QuerySheetVisibility,
|
||||
QuerySheetIsActive,
|
||||
QuerySheetType,
|
||||
QuerySheetID,
|
||||
QuerySheetRelsID,
|
||||
QuerySheetRelsTarget,
|
||||
QuerySharedStrings,
|
||||
QueryXmlData
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class XLQuery
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param type
|
||||
*/
|
||||
explicit XLQuery(XLQueryType type) : m_type(type) {}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @tparam T
|
||||
* @param param
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
template<typename T>
|
||||
XLQuery& setParam(const std::string& param, T value) {
|
||||
m_params[param] = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @tparam T
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
template<typename T>
|
||||
T getParam(const std::string& param) const {
|
||||
return std::any_cast<T>(m_params.at(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @tparam T
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
template<typename T>
|
||||
XLQuery& setResult(T value) {
|
||||
m_result = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @tparam T
|
||||
* @return
|
||||
*/
|
||||
template<typename T>
|
||||
T result() const {
|
||||
return std::any_cast<T>(m_result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLQueryType type() const {
|
||||
return m_type;
|
||||
}
|
||||
|
||||
private:
|
||||
XLQueryType m_type; /*< */
|
||||
std::any m_result; /*< */
|
||||
std::map<std::string, std::any> m_params; /*< */
|
||||
};
|
||||
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLCOMMANDQUERY_HPP
|
||||
14
thirdparty/OpenXLSX/include/headers/XLConstants.hpp
vendored
Normal file
14
thirdparty/OpenXLSX/include/headers/XLConstants.hpp
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// Created by Kenneth Balslev on 15/08/2021.
|
||||
//
|
||||
|
||||
#ifndef OPENXLSX_XLCONSTANTS_HPP
|
||||
#define OPENXLSX_XLCONSTANTS_HPP
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
inline const uint16_t MAX_COLS = 16'384;
|
||||
inline const uint32_t MAX_ROWS = 1'048'576;
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#endif // OPENXLSX_XLCONSTANTS_HPP
|
||||
251
thirdparty/OpenXLSX/include/headers/XLContentTypes.hpp
vendored
Normal file
251
thirdparty/OpenXLSX/include/headers/XLContentTypes.hpp
vendored
Normal file
@@ -0,0 +1,251 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLCONTENTTYPES_HPP
|
||||
#define OPENXLSX_XLCONTENTTYPES_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== External Includes ===== //
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
#include "XLXmlFile.hpp"
|
||||
#include "XLXmlParser.hpp"
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
enum class XLContentType {
|
||||
Workbook,
|
||||
WorkbookMacroEnabled,
|
||||
Worksheet,
|
||||
Chartsheet,
|
||||
ExternalLink,
|
||||
Theme,
|
||||
Styles,
|
||||
SharedStrings,
|
||||
Drawing,
|
||||
Chart,
|
||||
ChartStyle,
|
||||
ChartColorStyle,
|
||||
ControlProperties,
|
||||
CalculationChain,
|
||||
VBAProject,
|
||||
CoreProperties,
|
||||
ExtendedProperties,
|
||||
CustomProperties,
|
||||
Comments,
|
||||
Table,
|
||||
VMLDrawing,
|
||||
Unknown
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLContentItem
|
||||
{
|
||||
friend class XLContentTypes;
|
||||
|
||||
public: // ---------- Public Member Functions ---------- //
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
XLContentItem();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param node
|
||||
*/
|
||||
explicit XLContentItem(const XMLNode& node);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
~XLContentItem();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLContentItem(const XLContentItem& other);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLContentItem(XLContentItem&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLContentItem& operator=(const XLContentItem& other);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLContentItem& operator=(XLContentItem&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLContentType type() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
std::string path() const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<XMLNode> m_contentNode; /**< */
|
||||
};
|
||||
|
||||
// ================================================================================
|
||||
// XLContentTypes Class
|
||||
// ================================================================================
|
||||
|
||||
/**
|
||||
* @brief The purpose of this class is to load, store add and save item in the [Content_Types].xml file.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLContentTypes : public XLXmlFile
|
||||
{
|
||||
public: // ---------- Public Member Functions ---------- //
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
XLContentTypes();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param xmlData
|
||||
*/
|
||||
explicit XLContentTypes(XLXmlData* xmlData);
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
~XLContentTypes();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLContentTypes(const XLContentTypes& other);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLContentTypes(XLContentTypes&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLContentTypes& operator=(const XLContentTypes& other);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLContentTypes& operator=(XLContentTypes&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Add a new override key/getValue pair to the data store.
|
||||
* @param path The key
|
||||
* @param type The getValue
|
||||
*/
|
||||
void addOverride(const std::string& path, XLContentType type);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param path
|
||||
*/
|
||||
void deleteOverride(const std::string& path);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param item
|
||||
*/
|
||||
void deleteOverride(XLContentItem& item);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
XLContentItem contentItem(const std::string& path);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
std::vector<XLContentItem> getContentItems();
|
||||
|
||||
// ---------- Protected Member Functions ---------- //
|
||||
};
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLCONTENTTYPES_HPP
|
||||
173
thirdparty/OpenXLSX/include/headers/XLDateTime.hpp
vendored
Normal file
173
thirdparty/OpenXLSX/include/headers/XLDateTime.hpp
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef OPENXLSX_XLDATETIME_HPP
|
||||
#define OPENXLSX_XLDATETIME_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== External Includes ===== //
|
||||
#include <ctime>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
#include "XLException.hpp"
|
||||
|
||||
// ========== CLASS AND ENUM TYPE DEFINITIONS ========== //
|
||||
namespace OpenXLSX
|
||||
{
|
||||
class OPENXLSX_EXPORT XLDateTime
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Constructor.
|
||||
*/
|
||||
XLDateTime();
|
||||
|
||||
/**
|
||||
* @brief Constructor taking an Excel time point serial number as an argument.
|
||||
* @param serial Excel time point serial number.
|
||||
*/
|
||||
explicit XLDateTime(double serial);
|
||||
|
||||
/**
|
||||
* @brief Constructor taking a std::tm struct as an argument.
|
||||
* @param timepoint A std::tm struct.
|
||||
*/
|
||||
explicit XLDateTime(const std::tm& timepoint);
|
||||
|
||||
/**
|
||||
* @brief Constructor taking a unixtime format (seconds since 1/1/1970) as an argument.
|
||||
* @param unixtime A time_t number.
|
||||
*/
|
||||
explicit XLDateTime(time_t unixtime);
|
||||
|
||||
/**
|
||||
* @brief Copy constructor.
|
||||
* @param other Object to be copied.
|
||||
*/
|
||||
XLDateTime(const XLDateTime& other);
|
||||
|
||||
/**
|
||||
* @brief Move constructor.
|
||||
* @param other Object to be moved.
|
||||
*/
|
||||
XLDateTime(XLDateTime&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
~XLDateTime();
|
||||
|
||||
/**
|
||||
* @brief Copy assignment operator.
|
||||
* @param other Object to be copied.
|
||||
* @return Reference to the copied-to object.
|
||||
*/
|
||||
XLDateTime& operator=(const XLDateTime& other);
|
||||
|
||||
/**
|
||||
* @brief Move assignment operator.
|
||||
* @param other Object to be moved.
|
||||
* @return Reference to the moved-to object.
|
||||
*/
|
||||
XLDateTime& operator=(XLDateTime&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Assignment operator taking an Excel date/time serial number as an argument.
|
||||
* @param serial A floating point value with the serial number.
|
||||
* @return Reference to the copied-to object.
|
||||
*/
|
||||
XLDateTime& operator=(double serial);
|
||||
|
||||
/**
|
||||
* @brief Assignment operator taking a std::tm object as an argument.
|
||||
* @param timepoint std::tm object with the time point
|
||||
* @return Reference to the copied-to object.
|
||||
*/
|
||||
XLDateTime& operator=(const std::tm& timepoint);
|
||||
|
||||
/**
|
||||
* @brief Implicit conversion to Excel date/time serial number (any floating point type).
|
||||
* @tparam T Type to convert to (any floating point type).
|
||||
* @return Excel date/time serial number.
|
||||
*/
|
||||
template<typename T,
|
||||
typename std::enable_if<std::is_floating_point_v<T> >::type* = nullptr>
|
||||
operator T() const // NOLINT
|
||||
{
|
||||
return serial();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Implicit conversion to std::tm object.
|
||||
* @return std::tm object.
|
||||
*/
|
||||
operator std::tm() const; // NOLINT
|
||||
|
||||
/**
|
||||
* @brief Get the date/time in the form of an Excel date/time serial number.
|
||||
* @return A double with the serial number.
|
||||
*/
|
||||
double serial() const;
|
||||
|
||||
/**
|
||||
* @brief Get the date/time in the form of a std::tm struct.
|
||||
* @return A std::tm struct with the time point.
|
||||
*/
|
||||
std::tm tm() const;
|
||||
|
||||
private:
|
||||
double m_serial {1.0}; /**< */
|
||||
|
||||
|
||||
};
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#endif // OPENXLSX_XLDATETIME_HPP
|
||||
320
thirdparty/OpenXLSX/include/headers/XLDocument.hpp
vendored
Normal file
320
thirdparty/OpenXLSX/include/headers/XLDocument.hpp
vendored
Normal file
@@ -0,0 +1,320 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLDOCUMENT_HPP
|
||||
#define OPENXLSX_XLDOCUMENT_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== External Includes ===== //
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "IZipArchive.hpp"
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
#include "XLCommandQuery.hpp"
|
||||
#include "XLContentTypes.hpp"
|
||||
#include "XLException.hpp"
|
||||
#include "XLProperties.hpp"
|
||||
#include "XLRelationships.hpp"
|
||||
#include "XLSharedStrings.hpp"
|
||||
#include "XLWorkbook.hpp"
|
||||
#include "XLXmlData.hpp"
|
||||
#include "XLZipArchive.hpp"
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief The XLDocumentProperties class is an enumeration of the possible properties (metadata) that can be set
|
||||
* for a XLDocument object (and .xlsx file)
|
||||
*/
|
||||
enum class XLProperty {
|
||||
Title,
|
||||
Subject,
|
||||
Creator,
|
||||
Keywords,
|
||||
Description,
|
||||
LastModifiedBy,
|
||||
LastPrinted,
|
||||
CreationDate,
|
||||
ModificationDate,
|
||||
Category,
|
||||
Application,
|
||||
DocSecurity,
|
||||
ScaleCrop,
|
||||
Manager,
|
||||
Company,
|
||||
LinksUpToDate,
|
||||
SharedDoc,
|
||||
HyperlinkBase,
|
||||
HyperlinksChanged,
|
||||
AppVersion
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class encapsulates the concept of an excel file. It is different from the XLWorkbook, in that an
|
||||
* XLDocument holds an XLWorkbook together with its metadata, as well as methods for opening,
|
||||
* closing and saving the document.\n<b><em>The XLDocument is the entrypoint for clients
|
||||
* using the RapidXLSX library.</em></b>
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLDocument final
|
||||
{
|
||||
//----- Friends
|
||||
friend class XLXmlFile;
|
||||
friend class XLWorkbook;
|
||||
friend class XLSheet;
|
||||
friend class XLXmlData;
|
||||
|
||||
//---------- Public Member Functions
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor. The default constructor with no arguments.
|
||||
*/
|
||||
explicit XLDocument(const IZipArchive& zipArchive = XLZipArchive());
|
||||
|
||||
/**
|
||||
* @brief Constructor. An alternative constructor, taking the path to the .xlsx file as an argument.
|
||||
* @param docPath A std::string with the path to the .xlsx file.
|
||||
*/
|
||||
explicit XLDocument(const std::string& docPath, const IZipArchive& zipArchive = XLZipArchive());
|
||||
|
||||
/**
|
||||
* @brief Copy constructor
|
||||
* @param other The object to copy
|
||||
* @note Copy constructor explicitly deleted.
|
||||
*/
|
||||
XLDocument(const XLDocument& other) = delete;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLDocument(XLDocument&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
~XLDocument();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLDocument& operator=(const XLDocument& other) = delete;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLDocument& operator=(XLDocument&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief Open the .xlsx file with the given path
|
||||
* @param fileName The path of the .xlsx file to open
|
||||
*/
|
||||
void open(const std::string& fileName);
|
||||
|
||||
/**
|
||||
* @brief Create a new .xlsx file with the given name.
|
||||
* @param fileName The path of the new .xlsx file.
|
||||
*/
|
||||
void create(const std::string& fileName);
|
||||
|
||||
/**
|
||||
* @brief Close the current document
|
||||
*/
|
||||
void close();
|
||||
|
||||
/**
|
||||
* @brief Save the current document using the current filename, overwriting the existing file.
|
||||
* @return true if successful; otherwise false.
|
||||
*/
|
||||
void save();
|
||||
|
||||
/**
|
||||
* @brief Save the document with a new name. If a file exists with that name, it will be overwritten.
|
||||
* @param fileName The path of the file
|
||||
* @return true if successful; otherwise false.
|
||||
*/
|
||||
void saveAs(const std::string& fileName);
|
||||
|
||||
/**
|
||||
* @brief Get the filename of the current document, e.g. "spreadsheet.xlsx".
|
||||
* @return A std::string with the filename.
|
||||
*/
|
||||
const std::string& name() const;
|
||||
|
||||
/**
|
||||
* @brief Get the full path of the current document, e.g. "drive/blah/spreadsheet.xlsx"
|
||||
* @return A std::string with the path.
|
||||
*/
|
||||
const std::string& path() const;
|
||||
|
||||
/**
|
||||
* @brief Get the underlying workbook object, as a const object.
|
||||
* @return A const pointer to the XLWorkbook object.
|
||||
*/
|
||||
XLWorkbook workbook() const;
|
||||
|
||||
/**
|
||||
* @brief Get the requested document property.
|
||||
* @param prop The name of the property to get.
|
||||
* @return The property as a string
|
||||
*/
|
||||
std::string property(XLProperty prop) const;
|
||||
|
||||
/**
|
||||
* @brief Set a property
|
||||
* @param prop The property to set.
|
||||
* @param value The getValue of the property, as a string
|
||||
*/
|
||||
void setProperty(XLProperty prop, const std::string& value);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
explicit operator bool() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
bool isOpen() const;
|
||||
|
||||
/**
|
||||
* @brief Delete the property from the document
|
||||
* @param theProperty The property to delete from the document
|
||||
*/
|
||||
void deleteProperty(XLProperty theProperty);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param command
|
||||
*/
|
||||
void execCommand(const XLCommand& command);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
XLQuery execQuery(const XLQuery& query) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
XLQuery execQuery(const XLQuery& query);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// Protected Member Functions
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Get an XML file from the .xlsx archive.
|
||||
* @param path The relative path of the file.
|
||||
* @return A std::string with the content of the file
|
||||
*/
|
||||
std::string extractXmlFromArchive(const std::string& path);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
XLXmlData* getXmlData(const std::string& path);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
const XLXmlData* getXmlData(const std::string& path) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
bool hasXmlData(const std::string& path) const;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// Private Member Variables
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
private:
|
||||
std::string m_filePath {}; /**< The path to the original file*/
|
||||
std::string m_realPath {}; /**< */
|
||||
|
||||
mutable std::list<XLXmlData> m_data {}; /**< */
|
||||
mutable std::deque<std::string> m_sharedStringCache {}; /**< */
|
||||
mutable XLSharedStrings m_sharedStrings {}; /**< */
|
||||
|
||||
XLRelationships m_docRelationships {}; /**< A pointer to the document relationships object*/
|
||||
XLRelationships m_wbkRelationships {}; /**< A pointer to the document relationships object*/
|
||||
XLContentTypes m_contentTypes {}; /**< A pointer to the content types object*/
|
||||
XLAppProperties m_appProperties {}; /**< A pointer to the App properties object */
|
||||
XLProperties m_coreProperties {}; /**< A pointer to the Core properties object*/
|
||||
XLWorkbook m_workbook {}; /**< A pointer to the workbook object */
|
||||
IZipArchive m_archive {}; /**< */
|
||||
};
|
||||
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLDOCUMENT_HPP
|
||||
155
thirdparty/OpenXLSX/include/headers/XLException.hpp
vendored
Normal file
155
thirdparty/OpenXLSX/include/headers/XLException.hpp
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLEXCEPTION_HPP
|
||||
#define OPENXLSX_XLEXCEPTION_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== External Includes ===== //
|
||||
#include <stdexcept>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLException : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
inline explicit XLException(const std::string& err) : runtime_error(err) {};
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLOverflowError : public XLException
|
||||
{
|
||||
public:
|
||||
inline explicit XLOverflowError(const std::string& err) : XLException(err) {};
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLValueTypeError : public XLException
|
||||
{
|
||||
public:
|
||||
inline explicit XLValueTypeError(const std::string& err) : XLException(err) {};
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLCellAddressError : public XLException
|
||||
{
|
||||
public:
|
||||
inline explicit XLCellAddressError(const std::string& err) : XLException(err) {};
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLInputError : public XLException
|
||||
{
|
||||
public:
|
||||
inline explicit XLInputError(const std::string& err) : XLException(err) {};
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLInternalError : public XLException
|
||||
{
|
||||
public:
|
||||
inline explicit XLInternalError(const std::string& err) : XLException(err) {};
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLPropertyError : public XLException
|
||||
{
|
||||
public:
|
||||
inline explicit XLPropertyError(const std::string& err) : XLException(err) {};
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLSheetError : public XLException
|
||||
{
|
||||
public:
|
||||
inline explicit XLSheetError(const std::string& err) : XLException(err) {};
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLDateTimeError : public XLException
|
||||
{
|
||||
public:
|
||||
inline explicit XLDateTimeError(const std::string& err) : XLException(err) {};
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLFormulaError : public XLException
|
||||
{
|
||||
public:
|
||||
inline explicit XLFormulaError(const std::string& err) : XLException(err) {};
|
||||
};
|
||||
|
||||
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLEXCEPTION_HPP
|
||||
365
thirdparty/OpenXLSX/include/headers/XLFormula.hpp
vendored
Normal file
365
thirdparty/OpenXLSX/include/headers/XLFormula.hpp
vendored
Normal file
@@ -0,0 +1,365 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLFORMULA_HPP
|
||||
#define OPENXLSX_XLFORMULA_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== External Includes ===== //
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <variant>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
#include "XLException.hpp"
|
||||
#include "XLXmlParser.hpp"
|
||||
|
||||
// ========== CLASS AND ENUM TYPE DEFINITIONS ========== //
|
||||
namespace OpenXLSX
|
||||
{
|
||||
//---------- Forward Declarations ----------//
|
||||
class XLFormulaProxy;
|
||||
class XLCell;
|
||||
|
||||
/**
|
||||
* @brief The XLFormula class encapsulates the concept of an Excel formula. The class is essentially
|
||||
* a wrapper around a std::string.
|
||||
* @warning This class currently only supports simple formulas. Array formulas and shared formulas are
|
||||
* not supported. Unfortunately, many spreadsheets have shared formulas, so this class is probably
|
||||
* best used for adding formulas, not reading them from an existing spreadsheet.
|
||||
* @todo Enable handling of shared and array formulas.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLFormula
|
||||
{
|
||||
//---------- Friend Declarations ----------//
|
||||
|
||||
friend bool operator==(const XLFormula& lhs, const XLFormula& rhs);
|
||||
friend bool operator!=(const XLFormula& lhs, const XLFormula& rhs);
|
||||
friend std::ostream& operator<<(std::ostream& os, const XLFormula& value);
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
XLFormula();
|
||||
|
||||
/**
|
||||
* @brief Constructor, taking a string-type argument
|
||||
* @tparam T Type of argument used. Must be string-type.
|
||||
* @param formula The formula to initialize the object with.
|
||||
*/
|
||||
template<typename T,
|
||||
typename std::enable_if<
|
||||
std::is_same_v<std::decay_t<T>, std::string> || std::is_same_v<std::decay_t<T>, std::string_view> ||
|
||||
std::is_same_v<std::decay_t<T>, const char*> || std::is_same_v<std::decay_t<T>, char*>>::type* = nullptr>
|
||||
explicit XLFormula(T formula)
|
||||
{
|
||||
// ===== If the argument is a const char *, use the argument directly; otherwise, assume it has a .c_str() function.
|
||||
if constexpr (std::is_same_v<std::decay_t<T>, const char*> || std::is_same_v<std::decay_t<T>, char*>)
|
||||
m_formulaString = formula;
|
||||
else if constexpr (std::is_same_v<std::decay_t<T>, std::string_view>)
|
||||
m_formulaString = std::string(formula);
|
||||
else
|
||||
m_formulaString = formula.c_str();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Copy constructor.
|
||||
* @param other Object to be copied.
|
||||
*/
|
||||
XLFormula(const XLFormula& other);
|
||||
|
||||
/**
|
||||
* @brief Move constructor.
|
||||
* @param other Object to be moved.
|
||||
*/
|
||||
XLFormula(XLFormula&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Destructor.
|
||||
*/
|
||||
~XLFormula();
|
||||
|
||||
/**
|
||||
* @brief Copy assignment operator.
|
||||
* @param other Object to be copied.
|
||||
* @return Reference to copied-to object.
|
||||
*/
|
||||
XLFormula& operator=(const XLFormula& other);
|
||||
|
||||
/**
|
||||
* @brief Move assignment operator.
|
||||
* @param other Object to be moved.
|
||||
* @return Reference to moved-to object.
|
||||
*/
|
||||
XLFormula& operator=(XLFormula&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Templated assignment operator, taking a string-type object as an argument.
|
||||
* @tparam T Type of argument (only string-types are allowed).
|
||||
* @param formula String containing the formula.
|
||||
* @return Reference to the assigned-to object.
|
||||
*/
|
||||
template<typename T,
|
||||
typename std::enable_if<
|
||||
std::is_same_v<std::decay_t<T>, std::string> || std::is_same_v<std::decay_t<T>, std::string_view> ||
|
||||
std::is_same_v<std::decay_t<T>, const char*> || std::is_same_v<std::decay_t<T>, char*>>::type* = nullptr>
|
||||
XLFormula& operator=(T formula)
|
||||
{
|
||||
XLFormula temp(formula);
|
||||
std::swap(*this, temp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Templated setter function, taking a string-type object as an argument.
|
||||
* @tparam T Type of argument (only string-types are allowed).
|
||||
* @param formula String containing the formula.
|
||||
*/
|
||||
template<typename T,
|
||||
typename std::enable_if<
|
||||
std::is_same_v<std::decay_t<T>, std::string> || std::is_same_v<std::decay_t<T>, std::string_view> ||
|
||||
std::is_same_v<std::decay_t<T>, const char*> || std::is_same_v<std::decay_t<T>, char*>>::type* = nullptr>
|
||||
void set(T formula)
|
||||
{
|
||||
*this = formula;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the forumla as a std::string.
|
||||
* @return A std::string with the formula.
|
||||
*/
|
||||
std::string get() const;
|
||||
|
||||
/**
|
||||
* @brief Conversion operator, for converting object to a std::string.
|
||||
* @return The formula as a std::string.
|
||||
*/
|
||||
operator std::string() const; // NOLINT
|
||||
|
||||
/**
|
||||
* @brief Clear the formula.
|
||||
* @return Return a reference to the cleared object.
|
||||
*/
|
||||
XLFormula& clear();
|
||||
|
||||
private:
|
||||
std::string m_formulaString; /**< A std::string, holding the formula string.*/
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The XLFormulaProxy serves as a placeholder for XLFormula objects. This enable
|
||||
* getting and setting formulas through the same interface.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLFormulaProxy
|
||||
{
|
||||
friend class XLCell;
|
||||
friend class XLFormula;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
~XLFormulaProxy();
|
||||
|
||||
/**
|
||||
* @brief Copy assignment operator.
|
||||
* @param other Object to be copied.
|
||||
* @return A reference to the copied-to object.
|
||||
*/
|
||||
XLFormulaProxy& operator=(const XLFormulaProxy& other);
|
||||
|
||||
/**
|
||||
* @brief Templated assignment operator, taking a string-type argument.
|
||||
* @tparam T Type of argument.
|
||||
* @param formula The formula string to be assigned.
|
||||
* @return A reference to the copied-to object.
|
||||
*/
|
||||
template<
|
||||
typename T,
|
||||
typename std::enable_if<std::is_same_v<std::decay_t<T>, XLFormula> || std::is_same_v<std::decay_t<T>, std::string> ||
|
||||
std::is_same_v<std::decay_t<T>, std::string_view> || std::is_same_v<std::decay_t<T>, const char*> ||
|
||||
std::is_same_v<std::decay_t<T>, char*>>::type* = nullptr>
|
||||
XLFormulaProxy& operator=(T formula)
|
||||
{
|
||||
if constexpr (std::is_same_v<std::decay_t<T>, XLFormula>)
|
||||
setFormulaString(formula.get().c_str());
|
||||
else if constexpr (std::is_same_v<std::decay_t<T>, std::string>)
|
||||
setFormulaString(formula.c_str());
|
||||
else if constexpr (std::is_same_v<std::decay_t<T>, std::string_view>)
|
||||
setFormulaString(std::string(formula).c_str());
|
||||
else
|
||||
setFormulaString(formula);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Templated setter, taking a string-type argument.
|
||||
* @tparam T Type of argument.
|
||||
* @param formula The formula string to be assigned.
|
||||
*/
|
||||
template<typename T,
|
||||
typename std::enable_if<
|
||||
std::is_same_v<std::decay_t<T>, std::string> || std::is_same_v<std::decay_t<T>, std::string_view> ||
|
||||
std::is_same_v<std::decay_t<T>, const char*> || std::is_same_v<std::decay_t<T>, char*>>::type* = nullptr>
|
||||
void set(T formula)
|
||||
{
|
||||
*this = formula;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the forumla as a std::string.
|
||||
* @return A std::string with the formula.
|
||||
*/
|
||||
std::string get() const;
|
||||
|
||||
/**
|
||||
* @brief Clear the formula.
|
||||
* @return Return a reference to the cleared object.
|
||||
*/
|
||||
XLFormulaProxy& clear();
|
||||
|
||||
/**
|
||||
* @brief Conversion operator, for converting the object to a std::string.
|
||||
* @return The formula as a std::string.
|
||||
*/
|
||||
operator std::string() const; // NOLINT
|
||||
|
||||
/**
|
||||
* @brief Implicit conversion to XLFormula object.
|
||||
* @return Returns the corresponding XLFormula object.
|
||||
*/
|
||||
operator XLFormula() const; // NOLINT
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Constructor, taking pointers to the cell and cell node objects.
|
||||
* @param cell Pointer to the associated cell object.
|
||||
* @param cellNode Pointer to the associated cell node object.
|
||||
*/
|
||||
XLFormulaProxy(XLCell* cell, XMLNode* cellNode);
|
||||
|
||||
/**
|
||||
* @brief Copy constructor.
|
||||
* @param other Object to be copied.
|
||||
*/
|
||||
XLFormulaProxy(const XLFormulaProxy& other);
|
||||
|
||||
/**
|
||||
* @brief Move constructor.
|
||||
* @param other Object to be moved.
|
||||
*/
|
||||
XLFormulaProxy(XLFormulaProxy&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Move assignment operator.
|
||||
* @param other Object to be moved.
|
||||
* @return A reference to the moved-to object.
|
||||
*/
|
||||
XLFormulaProxy& operator=(XLFormulaProxy&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Set the formula to the given string.
|
||||
* @param formulaString String holding the formula.
|
||||
*/
|
||||
void setFormulaString(const char* formulaString);
|
||||
|
||||
/**
|
||||
* @brief Get the underlying XLFormula object.
|
||||
* @return A XLFormula object.
|
||||
* @throw XLFormulaError if the formula is of 'shared' or 'array' types.
|
||||
*/
|
||||
XLFormula getFormula() const;
|
||||
|
||||
//---------- Private Member Variables ---------- //
|
||||
XLCell* m_cell; /**< Pointer to the owning XLCell object. */
|
||||
XMLNode* m_cellNode; /**< Pointer to corresponding XML cell node. */
|
||||
};
|
||||
} // namespace OpenXLSX
|
||||
|
||||
// ========== FRIEND FUNCTION IMPLEMENTATIONS ========== //
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
inline bool operator==(const XLFormula& lhs, const XLFormula& rhs)
|
||||
{
|
||||
return lhs.m_formulaString == rhs.m_formulaString;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
inline bool operator!=(const XLFormula& lhs, const XLFormula& rhs)
|
||||
{
|
||||
return lhs.m_formulaString != rhs.m_formulaString;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param os
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
inline std::ostream& operator<<(std::ostream& os, const XLFormula& value)
|
||||
{
|
||||
return os << value.m_formulaString;
|
||||
}
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#endif // OPENXLSX_XLFORMULA_HPP
|
||||
15
thirdparty/OpenXLSX/include/headers/XLIterator.hpp
vendored
Normal file
15
thirdparty/OpenXLSX/include/headers/XLIterator.hpp
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// Created by Kenneth Balslev on 22/08/2020.
|
||||
//
|
||||
|
||||
#ifndef OPENXLSX_XLITERATOR_HPP
|
||||
#define OPENXLSX_XLITERATOR_HPP
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
enum class XLIteratorDirection { Forward, Reverse };
|
||||
enum class XLIteratorLocation { Begin, End };
|
||||
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#endif // OPENXLSX_XLITERATOR_HPP
|
||||
298
thirdparty/OpenXLSX/include/headers/XLProperties.hpp
vendored
Normal file
298
thirdparty/OpenXLSX/include/headers/XLProperties.hpp
vendored
Normal file
@@ -0,0 +1,298 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLPROPERTIES_HPP
|
||||
#define OPENXLSX_XLPROPERTIES_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== External Includes ===== //
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
#include "XLXmlFile.hpp"
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLProperties : public XLXmlFile
|
||||
{
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// Public Member Functions
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
XLProperties() = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param xmlData
|
||||
*/
|
||||
explicit XLProperties(XLXmlData* xmlData);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLProperties(const XLProperties& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLProperties(XLProperties&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
~XLProperties();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLProperties& operator=(const XLProperties& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLProperties& operator=(XLProperties&& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param name
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
void setProperty(const std::string& name, const std::string& value);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param name
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
void setProperty(const std::string& name, int value);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param name
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
void setProperty(const std::string& name, double value);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
std::string property(const std::string& name) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param name
|
||||
*/
|
||||
void deleteProperty(const std::string& name);
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// Protected Member Functions
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class is a specialization of the XLAbstractXMLFile, with the purpose of the representing the
|
||||
* document app properties in the app.xml file (docProps folder) in the .xlsx package.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLAppProperties : public XLXmlFile
|
||||
{
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
// Public Member Functions
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
XLAppProperties() = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param xmlData
|
||||
*/
|
||||
explicit XLAppProperties(XLXmlData* xmlData);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLAppProperties(const XLAppProperties& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLAppProperties(XLAppProperties&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
~XLAppProperties();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLAppProperties& operator=(const XLAppProperties& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLAppProperties& operator=(XLAppProperties&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param title
|
||||
* @return
|
||||
*/
|
||||
void addSheetName(const std::string& title);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param title
|
||||
*/
|
||||
void deleteSheetName(const std::string& title);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param oldTitle
|
||||
* @param newTitle
|
||||
*/
|
||||
void setSheetName(const std::string& oldTitle, const std::string& newTitle);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param name
|
||||
* @param value
|
||||
*/
|
||||
void addHeadingPair(const std::string& name, int value);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param name
|
||||
*/
|
||||
void deleteHeadingPair(const std::string& name);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param name
|
||||
* @param newValue
|
||||
*/
|
||||
void setHeadingPair(const std::string& name, int newValue);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param name
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
void setProperty(const std::string& name, const std::string& value);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
std::string property(const std::string& name) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param name
|
||||
*/
|
||||
void deleteProperty(const std::string& name);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetName
|
||||
* @return
|
||||
*/
|
||||
void appendSheetName(const std::string& sheetName);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetName
|
||||
* @return
|
||||
*/
|
||||
void prependSheetName(const std::string& sheetName);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetName
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
void insertSheetName(const std::string& sheetName, unsigned int index);
|
||||
};
|
||||
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLPROPERTIES_HPP
|
||||
278
thirdparty/OpenXLSX/include/headers/XLRelationships.hpp
vendored
Normal file
278
thirdparty/OpenXLSX/include/headers/XLRelationships.hpp
vendored
Normal file
@@ -0,0 +1,278 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLRELATIONSHIPS_HPP
|
||||
#define OPENXLSX_XLRELATIONSHIPS_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== External Includes ===== //
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
#include "XLXmlFile.hpp"
|
||||
#include "XLXmlParser.hpp"
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
class XLRelationships;
|
||||
|
||||
class XLRelationshipItem;
|
||||
|
||||
/**
|
||||
* @brief An enum of the possible relationship (or XML document) types used in relationship (.rels) XML files.
|
||||
*/
|
||||
enum class XLRelationshipType {
|
||||
CoreProperties,
|
||||
ExtendedProperties,
|
||||
CustomProperties,
|
||||
Workbook,
|
||||
Worksheet,
|
||||
Chartsheet,
|
||||
Dialogsheet,
|
||||
Macrosheet,
|
||||
CalculationChain,
|
||||
ExternalLink,
|
||||
ExternalLinkPath,
|
||||
Theme,
|
||||
Styles,
|
||||
Chart,
|
||||
ChartStyle,
|
||||
ChartColorStyle,
|
||||
Image,
|
||||
Drawing,
|
||||
VMLDrawing,
|
||||
SharedStrings,
|
||||
PrinterSettings,
|
||||
VBAProject,
|
||||
ControlProperties,
|
||||
Unknown
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief An encapsulation of a relationship item, i.e. an XML file in the document, its type and an ID number.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLRelationshipItem
|
||||
{
|
||||
public: // ---------- Public Member Functions ---------- //
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
XLRelationshipItem();
|
||||
|
||||
/**
|
||||
* @brief Constructor. New items should only be created through an XLRelationship object.
|
||||
* @param node An XMLNode object with the relationship item. If no input is provided, a null node is used.
|
||||
*/
|
||||
explicit XLRelationshipItem(const XMLNode& node);
|
||||
|
||||
/**
|
||||
* @brief Copy Constructor.
|
||||
* @param other Object to be copied.
|
||||
*/
|
||||
XLRelationshipItem(const XLRelationshipItem& other);
|
||||
|
||||
/**
|
||||
* @brief Move Constructor.
|
||||
* @param other Object to be moved.
|
||||
*/
|
||||
XLRelationshipItem(XLRelationshipItem&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
~XLRelationshipItem();
|
||||
|
||||
/**
|
||||
* @brief Copy assignment operator.
|
||||
* @param other Right hand side of assignment operation.
|
||||
* @return A reference to the lhs object.
|
||||
*/
|
||||
XLRelationshipItem& operator=(const XLRelationshipItem& other);
|
||||
|
||||
/**
|
||||
* @brief Move assignment operator.
|
||||
* @param other Right hand side of assignment operation.
|
||||
* @return A reference to lhs object.
|
||||
*/
|
||||
XLRelationshipItem& operator=(XLRelationshipItem&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief Get the type of the current relationship item.
|
||||
* @return An XLRelationshipType enum object, corresponding to the type.
|
||||
*/
|
||||
XLRelationshipType type() const;
|
||||
|
||||
/**
|
||||
* @brief Get the target, i.e. the path to the XML file the relationship item refers to.
|
||||
* @return An XMLAttribute object containing the Target getValue.
|
||||
*/
|
||||
std::string target() const;
|
||||
|
||||
/**
|
||||
* @brief Get the id of the relationship item.
|
||||
* @return An XMLAttribute object containing the Id getValue.
|
||||
*/
|
||||
std::string id() const;
|
||||
|
||||
private: // ---------- Private Member Variables ---------- //
|
||||
std::unique_ptr<XMLNode> m_relationshipNode; /**< An XMLNode object with the relationship item */
|
||||
};
|
||||
|
||||
// ================================================================================
|
||||
// XLRelationships Class
|
||||
// ================================================================================
|
||||
|
||||
/**
|
||||
* @brief An encapsulation of relationship files (.rels files) in an Excel document package.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLRelationships : public XLXmlFile
|
||||
{
|
||||
public: // ---------- Public Member Functions ---------- //
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
XLRelationships() = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param xmlData
|
||||
*/
|
||||
explicit XLRelationships(XLXmlData* xmlData);
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
~XLRelationships();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLRelationships(const XLRelationships& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLRelationships(XLRelationships&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLRelationships& operator=(const XLRelationships& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLRelationships& operator=(XLRelationships&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief Look up a relationship item by ID.
|
||||
* @param id The ID string of the relationship item to retrieve.
|
||||
* @return An XLRelationshipItem object.
|
||||
*/
|
||||
XLRelationshipItem relationshipById(const std::string& id) const;
|
||||
|
||||
/**
|
||||
* @brief Look up a relationship item by Target.
|
||||
* @param target The Target string of the relationship item to retrieve.
|
||||
* @return An XLRelationshipItem object.
|
||||
*/
|
||||
XLRelationshipItem relationshipByTarget(const std::string& target) const;
|
||||
|
||||
/**
|
||||
* @brief Get the std::map with the relationship items, ordered by ID.
|
||||
* @return A const reference to the std::map with relationship items.
|
||||
*/
|
||||
std::vector<XLRelationshipItem> relationships() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param relID
|
||||
*/
|
||||
void deleteRelationship(const std::string& relID);
|
||||
|
||||
/**
|
||||
* @brief Delete an item from the Relationships register
|
||||
* @param item The XLRelationshipItem object to delete.
|
||||
*/
|
||||
void deleteRelationship(const XLRelationshipItem& item);
|
||||
|
||||
/**
|
||||
* @brief Add a new relationship item to the XLRelationships object.
|
||||
* @param type The type of the new relationship item.
|
||||
* @param target The target (or path) of the XML file for the relationship item.
|
||||
*/
|
||||
XLRelationshipItem addRelationship(XLRelationshipType type, const std::string& target);
|
||||
|
||||
/**
|
||||
* @brief Check if a XLRelationshipItem with the given Target string exists.
|
||||
* @param target The Target string to look up.
|
||||
* @return true if the XLRelationshipItem exists; otherwise false.
|
||||
*/
|
||||
bool targetExists(const std::string& target) const;
|
||||
|
||||
/**
|
||||
* @brief Check if a XLRelationshipItem with the given Id string exists.
|
||||
* @param id The Id string to look up.
|
||||
* @return true if the XLRelationshipItem exists; otherwise false.
|
||||
*/
|
||||
bool idExists(const std::string& id) const;
|
||||
|
||||
// ---------- Protected Member Functions ---------- //
|
||||
};
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLRELATIONSHIPS_HPP
|
||||
496
thirdparty/OpenXLSX/include/headers/XLRow.hpp
vendored
Normal file
496
thirdparty/OpenXLSX/include/headers/XLRow.hpp
vendored
Normal file
@@ -0,0 +1,496 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLROW_HPP
|
||||
#define OPENXLSX_XLROW_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
#include "XLRowData.hpp"
|
||||
|
||||
// ========== CLASS AND ENUM TYPE DEFINITIONS ========== //
|
||||
namespace OpenXLSX
|
||||
{
|
||||
class XLRowRange;
|
||||
|
||||
/**
|
||||
* @brief The XLRow class represent a row in an Excel spreadsheet. Using XLRow objects, various row formatting
|
||||
* options can be set and modified.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLRow
|
||||
{
|
||||
friend class XLRowIterator;
|
||||
friend class XLRowDataProxy;
|
||||
friend bool operator==(const XLRow& lhs, const XLRow& rhs);
|
||||
friend bool operator!=(const XLRow& lhs, const XLRow& rhs);
|
||||
friend bool operator<(const XLRow& lhs, const XLRow& rhs);
|
||||
friend bool operator>(const XLRow& lhs, const XLRow& rhs);
|
||||
friend bool operator<=(const XLRow& lhs, const XLRow& rhs);
|
||||
friend bool operator>=(const XLRow& lhs, const XLRow& rhs);
|
||||
|
||||
//---------- PUBLIC MEMBER FUNCTIONS ----------//
|
||||
public:
|
||||
/**
|
||||
* @brief Default constructor
|
||||
*/
|
||||
XLRow();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param rowNode
|
||||
* @param sharedStrings
|
||||
*/
|
||||
XLRow(const XMLNode& rowNode, const XLSharedStrings& sharedStrings);
|
||||
|
||||
/**
|
||||
* @brief Copy Constructor
|
||||
* @note The copy constructor is explicitly deleted
|
||||
*/
|
||||
XLRow(const XLRow& other);
|
||||
|
||||
/**
|
||||
* @brief Move Constructor
|
||||
* @note The move constructor has been explicitly deleted.
|
||||
*/
|
||||
XLRow(XLRow&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
* @note The destructor has a default implementation.
|
||||
*/
|
||||
~XLRow();
|
||||
|
||||
/**
|
||||
* @brief Copy assignment operator.
|
||||
* @note The copy assignment operator is explicitly deleted.
|
||||
*/
|
||||
XLRow& operator=(const XLRow& other);
|
||||
|
||||
/**
|
||||
* @brief Move assignment operator.
|
||||
* @note The move assignment operator has been explicitly deleted.
|
||||
*/
|
||||
XLRow& operator=(XLRow&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Get the height of the row.
|
||||
* @return the row height.
|
||||
*/
|
||||
double height() const;
|
||||
|
||||
/**
|
||||
* @brief Set the height of the row.
|
||||
* @param height The height of the row.
|
||||
*/
|
||||
void setHeight(float height);
|
||||
|
||||
/**
|
||||
* @brief Get the descent of the row, which is the vertical distance in pixels from the bottom of the cells
|
||||
* in the current row to the typographical baseline of the cell content.
|
||||
* @return The row descent.
|
||||
*/
|
||||
float descent() const;
|
||||
|
||||
/**
|
||||
* @brief Set the descent of the row, which is he vertical distance in pixels from the bottom of the cells
|
||||
* in the current row to the typographical baseline of the cell content.
|
||||
* @param descent The row descent.
|
||||
*/
|
||||
void setDescent(float descent);
|
||||
|
||||
/**
|
||||
* @brief Is the row hidden?
|
||||
* @return The state of the row.
|
||||
*/
|
||||
bool isHidden() const;
|
||||
|
||||
/**
|
||||
* @brief Set the row to be hidden or visible.
|
||||
* @param state The state of the row.
|
||||
*/
|
||||
void setHidden(bool state);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
uint64_t rowNumber() const;
|
||||
|
||||
/**
|
||||
* @brief Get the number of cells in the row.
|
||||
* @return The number of cells in the row.
|
||||
*/
|
||||
unsigned int cellCount() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLRowDataProxy& values();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
const XLRowDataProxy& values() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @tparam T
|
||||
* @return
|
||||
*/
|
||||
template<typename T>
|
||||
T values() const
|
||||
{
|
||||
return static_cast<T>(values());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLRowDataRange cells() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param cellCount
|
||||
* @return
|
||||
*/
|
||||
XLRowDataRange cells(uint16_t cellCount) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param firstCell
|
||||
* @param lastCell
|
||||
* @return
|
||||
*/
|
||||
XLRowDataRange cells(uint16_t firstCell, uint16_t lastCell) const;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
static bool isEqual(const XLRow& lhs, const XLRow& rhs);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
static bool isLessThan(const XLRow& lhs, const XLRow& rhs);
|
||||
|
||||
//---------- PRIVATE MEMBER VARIABLES ----------//
|
||||
std::unique_ptr<XMLNode> m_rowNode; /**< The XMLNode object for the row. */
|
||||
XLSharedStrings m_sharedStrings; /**< */
|
||||
XLRowDataProxy m_rowDataProxy; /**< */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLRowIterator
|
||||
{
|
||||
public:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using value_type = XLRow;
|
||||
using difference_type = int64_t;
|
||||
using pointer = XLRow*;
|
||||
using reference = XLRow&;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param rowRange
|
||||
* @param loc
|
||||
*/
|
||||
explicit XLRowIterator(const XLRowRange& rowRange, XLIteratorLocation loc);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
~XLRowIterator();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLRowIterator(const XLRowIterator& other);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLRowIterator(XLRowIterator&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLRowIterator& operator=(const XLRowIterator& other);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLRowIterator& operator=(XLRowIterator&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLRowIterator& operator++();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLRowIterator operator++(int); // NOLINT
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
reference operator*();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
pointer operator->();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
bool operator==(const XLRowIterator& rhs) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
bool operator!=(const XLRowIterator& rhs) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
explicit operator bool() const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<XMLNode> m_dataNode; /**< */
|
||||
uint32_t m_firstRow { 1 }; /**< The cell reference of the first cell in the range */
|
||||
uint32_t m_lastRow { 1 }; /**< The cell reference of the last cell in the range */
|
||||
XLRow m_currentRow; /**< */
|
||||
XLSharedStrings m_sharedStrings; /**< */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLRowRange
|
||||
{
|
||||
friend class XLRowIterator;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// Public Member Functions
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief
|
||||
* @param dataNode
|
||||
* @param first
|
||||
* @param last
|
||||
* @param sharedStrings
|
||||
*/
|
||||
explicit XLRowRange(const XMLNode& dataNode, uint32_t first, uint32_t last, const XLSharedStrings& sharedStrings);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLRowRange(const XLRowRange& other);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLRowRange(XLRowRange&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
~XLRowRange();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLRowRange& operator=(const XLRowRange& other);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLRowRange& operator=(XLRowRange&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
uint32_t rowCount() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLRowIterator begin();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLRowIterator end();
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// Private Member Variables
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
private:
|
||||
std::unique_ptr<XMLNode> m_dataNode; /**< */
|
||||
uint32_t m_firstRow; /**< The cell reference of the first cell in the range */
|
||||
uint32_t m_lastRow; /**< The cell reference of the last cell in the range */
|
||||
XLSharedStrings m_sharedStrings; /**< */
|
||||
};
|
||||
|
||||
} // namespace OpenXLSX
|
||||
|
||||
// ========== FRIEND FUNCTION IMPLEMENTATIONS ========== //
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
inline bool operator==(const XLRow& lhs, const XLRow& rhs)
|
||||
{
|
||||
return XLRow::isEqual(lhs, rhs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
inline bool operator!=(const XLRow& lhs, const XLRow& rhs)
|
||||
{
|
||||
return !(lhs.m_rowNode == rhs.m_rowNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
inline bool operator<(const XLRow& lhs, const XLRow& rhs)
|
||||
{
|
||||
return XLRow::isLessThan(lhs, rhs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
inline bool operator>(const XLRow& lhs, const XLRow& rhs)
|
||||
{
|
||||
return (rhs < lhs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
inline bool operator<=(const XLRow& lhs, const XLRow& rhs)
|
||||
{
|
||||
return !(lhs > rhs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param lhs
|
||||
* @param rhs
|
||||
* @return
|
||||
*/
|
||||
inline bool operator>=(const XLRow& lhs, const XLRow& rhs)
|
||||
{
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLROW_HPP
|
||||
427
thirdparty/OpenXLSX/include/headers/XLRowData.hpp
vendored
Normal file
427
thirdparty/OpenXLSX/include/headers/XLRowData.hpp
vendored
Normal file
@@ -0,0 +1,427 @@
|
||||
//
|
||||
// Created by Kenneth Balslev on 24/08/2020.
|
||||
//
|
||||
|
||||
#ifndef OPENXLSX_XLROWDATA_HPP
|
||||
#define OPENXLSX_XLROWDATA_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== External Includes ===== //
|
||||
#include <deque>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
#include "XLCell.hpp"
|
||||
#include "XLConstants.hpp"
|
||||
#include "XLException.hpp"
|
||||
#include "XLIterator.hpp"
|
||||
#include "XLXmlParser.hpp"
|
||||
|
||||
// ========== CLASS AND ENUM TYPE DEFINITIONS ========== //
|
||||
namespace OpenXLSX
|
||||
{
|
||||
class XLRow;
|
||||
class XLRowDataRange;
|
||||
|
||||
/**
|
||||
* @brief This class encapsulates a (non-const) iterator, for iterating over the cells in a row.
|
||||
* @todo Consider implementing a const iterator also
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLRowDataIterator
|
||||
{
|
||||
friend class XLRowDataRange;
|
||||
|
||||
public:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using value_type = XLCell;
|
||||
using difference_type = int64_t;
|
||||
using pointer = XLCell*;
|
||||
using reference = XLCell&;
|
||||
|
||||
/**
|
||||
* @brief Destructor.
|
||||
*/
|
||||
~XLRowDataIterator();
|
||||
|
||||
/**
|
||||
* @brief Copy constructor.
|
||||
* @param other Object to be copied.
|
||||
*/
|
||||
XLRowDataIterator(const XLRowDataIterator& other);
|
||||
|
||||
/**
|
||||
* @brief Move constructor.
|
||||
* @param other Object to be moved.
|
||||
*/
|
||||
XLRowDataIterator(XLRowDataIterator&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Copy assignment operator.
|
||||
* @param other Object to be copied.
|
||||
* @return Reference to the copied-to object.
|
||||
*/
|
||||
XLRowDataIterator& operator=(const XLRowDataIterator& other);
|
||||
|
||||
/**
|
||||
* @brief Move assignment operator.
|
||||
* @param other Object to be moved.
|
||||
* @return Reference to the moved-to object.
|
||||
*/
|
||||
XLRowDataIterator& operator=(XLRowDataIterator&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Pre-increment of the iterator.
|
||||
* @return Reference to the iterator object.
|
||||
*/
|
||||
XLRowDataIterator& operator++();
|
||||
|
||||
/**
|
||||
* @brief Post-increment of the iterator.
|
||||
* @return Reference to the iterator object.
|
||||
*/
|
||||
XLRowDataIterator operator++(int); // NOLINT
|
||||
|
||||
/**
|
||||
* @brief Dereferencing operator.
|
||||
* @return Reference to the object pointed to by the iterator.
|
||||
*/
|
||||
reference operator*();
|
||||
|
||||
/**
|
||||
* @brief Arrow operator.
|
||||
* @return Pointer to the object pointed to by the iterator.
|
||||
*/
|
||||
pointer operator->();
|
||||
|
||||
/**
|
||||
* @brief Equality operator.
|
||||
* @param rhs XLRowDataIterator to compare to.
|
||||
* @return true if equal, otherwise false.
|
||||
*/
|
||||
bool operator==(const XLRowDataIterator& rhs) const;
|
||||
|
||||
/**
|
||||
* @brief Non-equality operator.
|
||||
* @param rhs XLRowDataIterator to compare to.
|
||||
* @return false if equal, otherwise true.
|
||||
*/
|
||||
bool operator!=(const XLRowDataIterator& rhs) const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Constructor.
|
||||
* @param rowDataRange The range to iterate over.
|
||||
* @param loc The location of the iterator (begin or end).
|
||||
*/
|
||||
XLRowDataIterator(const XLRowDataRange& rowDataRange, XLIteratorLocation loc);
|
||||
|
||||
std::unique_ptr<XLRowDataRange> m_dataRange; /**< A pointer to the range to iterate over. */
|
||||
std::unique_ptr<XMLNode> m_cellNode; /**< The XML node representing the cell currently pointed at. */
|
||||
XLCell m_currentCell; /**< The XLCell currently pointed at. */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class encapsulates the concept of a contiguous range of cells in a row.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLRowDataRange
|
||||
{
|
||||
friend class XLRowDataIterator;
|
||||
friend class XLRowDataProxy;
|
||||
friend class XLRow;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Copy constructor.
|
||||
* @param other Object to be copied.
|
||||
*/
|
||||
XLRowDataRange(const XLRowDataRange& other);
|
||||
|
||||
/**
|
||||
* @brief Move constructor.
|
||||
* @param other Object to be moved.
|
||||
*/
|
||||
XLRowDataRange(XLRowDataRange&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Destructor.
|
||||
*/
|
||||
~XLRowDataRange();
|
||||
|
||||
/**
|
||||
* @brief Copy assignment operator.
|
||||
* @param other Object to be copied.
|
||||
* @return A reference to the copied-to object.
|
||||
*/
|
||||
XLRowDataRange& operator=(const XLRowDataRange& other);
|
||||
|
||||
/**
|
||||
* @brief Move assignment operator.
|
||||
* @param other Object to be moved.
|
||||
* @return A reference to the moved-to object.
|
||||
*/
|
||||
XLRowDataRange& operator=(XLRowDataRange&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Get the size (length) of the range.
|
||||
* @return The size of the range.
|
||||
*/
|
||||
uint16_t size() const;
|
||||
|
||||
/**
|
||||
* @brief Get an iterator to the first element.
|
||||
* @return An XLRowDataIterator pointing to the first element.
|
||||
*/
|
||||
XLRowDataIterator begin();
|
||||
|
||||
/**
|
||||
* @brief Get an iterator to (one-past) the last element.
|
||||
* @return An XLRowDataIterator pointing to (one past) the last element.
|
||||
*/
|
||||
XLRowDataIterator end();
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Constructor.
|
||||
* @param rowNode XMLNode representing the row of the range.
|
||||
* @param firstColumn The index of the first column.
|
||||
* @param lastColumn The index of the last column.
|
||||
* @param sharedStrings A pointer to the shared strings repository.
|
||||
*/
|
||||
explicit XLRowDataRange(const XMLNode& rowNode, uint16_t firstColumn, uint16_t lastColumn, const XLSharedStrings& sharedStrings);
|
||||
|
||||
std::unique_ptr<XMLNode> m_rowNode; /**< */
|
||||
uint16_t m_firstCol { 1 }; /**< The cell reference of the first cell in the range */
|
||||
uint16_t m_lastCol { 1 }; /**< The cell reference of the last cell in the range */
|
||||
XLSharedStrings m_sharedStrings; /**< */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The XLRowDataProxy is used as a proxy object when getting or setting row data. The class facilitates easy conversion
|
||||
* to/from containers.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLRowDataProxy
|
||||
{
|
||||
friend class XLRow;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
~XLRowDataProxy();
|
||||
|
||||
/**
|
||||
* @brief Copy assignment operator.
|
||||
* @param other Object to be copied.
|
||||
* @return A reference to the copied-to object.
|
||||
*/
|
||||
XLRowDataProxy& operator=(const XLRowDataProxy& other);
|
||||
|
||||
/**
|
||||
* @brief Assignment operator taking a std::vector of XLCellValues as an argument.
|
||||
* @param values A std::vector of XLCellValues representing the values to be assigned.
|
||||
* @return A reference to the copied-to object.
|
||||
*/
|
||||
XLRowDataProxy& operator=(const std::vector<XLCellValue>& values);
|
||||
|
||||
/**
|
||||
* @brief Assignment operator taking a std::vector of bool values as an argument.
|
||||
* @param values A std::vector of bool values representing the values to be assigned.
|
||||
* @return A reference to the copied-to object.
|
||||
*/
|
||||
XLRowDataProxy& operator=(const std::vector<bool>& values);
|
||||
|
||||
/**
|
||||
* @brief Templated assignment operator taking any container supporting bidirectional iterators.
|
||||
* @tparam T The container and value type (will be auto deducted by the compiler).
|
||||
* @param values The container of the values to be assigned.
|
||||
* @return A reference to the copied-to object.
|
||||
* @throws XLOverflowError if size of container exceeds maximum number of columns.
|
||||
*/
|
||||
template<typename T,
|
||||
typename std::enable_if<!std::is_same_v<T, XLRowDataProxy> &&
|
||||
std::is_base_of_v<typename std::bidirectional_iterator_tag,
|
||||
typename std::iterator_traits<typename T::iterator>::iterator_category>,
|
||||
T>::type* = nullptr>
|
||||
XLRowDataProxy& operator=(const T& values)
|
||||
{
|
||||
if (values.size() > MAX_COLS) throw XLOverflowError("Container size exceeds maximum number of columns.");
|
||||
if (values.size() == 0) return *this;
|
||||
|
||||
// ===== If the container value_type is XLCellValue, the values can be copied directly.
|
||||
if constexpr (std::is_same_v<typename T::value_type, XLCellValue>) {
|
||||
// ===== First, delete the values in the first N columns.
|
||||
deleteCellValues(values.size());
|
||||
|
||||
// ===== Then, prepend new cell nodes to current row node
|
||||
auto colNo = values.size();
|
||||
for (auto value = values.rbegin(); value != values.rend(); ++value) { // NOLINT
|
||||
prependCellValue(*value, colNo);
|
||||
--colNo;
|
||||
}
|
||||
}
|
||||
|
||||
// ===== If the container value_type is a POD type, use the overloaded operator= on each cell.
|
||||
else {
|
||||
auto range = XLRowDataRange(*m_rowNode, 1, values.size(), getSharedStrings());
|
||||
auto dst = range.begin();
|
||||
auto src = values.begin();
|
||||
|
||||
while (true) {
|
||||
dst->value() = *src;
|
||||
++src;
|
||||
if (src == values.end()) break;
|
||||
++dst;
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Implicit conversion to std::vector of XLCellValues.
|
||||
* @return A std::vector of XLCellValues.
|
||||
*/
|
||||
operator std::vector<XLCellValue>() const; // NOLINT
|
||||
|
||||
/**
|
||||
* @brief Implicit conversion to std::deque of XLCellValues.
|
||||
* @return A std::deque of XLCellValues.
|
||||
*/
|
||||
operator std::deque<XLCellValue>() const; // NOLINT
|
||||
|
||||
/**
|
||||
* @brief Implicit conversion to std::list of XLCellValues.
|
||||
* @return A std::list of XLCellValues.
|
||||
*/
|
||||
operator std::list<XLCellValue>() const; // NOLINT
|
||||
|
||||
/**
|
||||
* @brief Explicit conversion operator.
|
||||
* @details This function calls the convertContainer template function to convert the row data to the container
|
||||
* stipulated by the client. The reason that this function is marked explicit is that the implicit conversion operators
|
||||
* above will be ambiguous.
|
||||
* @tparam Container The container (and value) type to convert the row data to.
|
||||
* @return The required container with the row data.
|
||||
*/
|
||||
template<
|
||||
typename Container,
|
||||
typename std::enable_if<!std::is_same_v<Container, XLRowDataProxy> &&
|
||||
std::is_base_of_v<typename std::bidirectional_iterator_tag,
|
||||
typename std::iterator_traits<typename Container::iterator>::iterator_category>,
|
||||
Container>::type* = nullptr>
|
||||
explicit operator Container() const
|
||||
{
|
||||
return convertContainer<Container>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clears all values for the current row.
|
||||
*/
|
||||
void clear();
|
||||
|
||||
private:
|
||||
//---------- Private Member Functions ---------- //
|
||||
|
||||
/**
|
||||
* @brief Constructor.
|
||||
* @param row Pointer to the parent XLRow object.
|
||||
* @param rowNode Pointer to the underlying XML node representing the row.
|
||||
*/
|
||||
XLRowDataProxy(XLRow* row, XMLNode* rowNode);
|
||||
|
||||
/**
|
||||
* @brief Copy constructor.
|
||||
* @param other Object to be copied.
|
||||
* @note The copy constructor is private in order to prevent use of the auto keyword in client code.
|
||||
*/
|
||||
XLRowDataProxy(const XLRowDataProxy& other);
|
||||
|
||||
/**
|
||||
* @brief Move constructor.
|
||||
* @param other Object to be moved.
|
||||
* @note Made private, as move construction should only be allowed when the parent object is moved. Disallowed for client code.
|
||||
*/
|
||||
XLRowDataProxy(XLRowDataProxy&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Move assignment operator.
|
||||
* @param other Object to be moved.
|
||||
* @return Reference to the moved-to object.
|
||||
* @note Made private, as move assignment is disallowed for client code.
|
||||
*/
|
||||
XLRowDataProxy& operator=(XLRowDataProxy&& other) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Get the cell values for the row.
|
||||
* @return A std::vector of XLCellValues.
|
||||
*/
|
||||
std::vector<XLCellValue> getValues() const;
|
||||
|
||||
/**
|
||||
* @brief Helper function for getting a pointer to the shared strings repository.
|
||||
* @return A pointer to an XLSharedStrings object.
|
||||
*/
|
||||
XLSharedStrings getSharedStrings() const;
|
||||
|
||||
/**
|
||||
* @brief Convenience function for erasing the first 'count' numbers of values in the row.
|
||||
* @param count The number of values to erase.
|
||||
*/
|
||||
void deleteCellValues(uint16_t count);
|
||||
|
||||
/**
|
||||
* @brief Convenience function for prepending a row value with a given column number.
|
||||
* @param value The XLCellValue object.
|
||||
* @param col The column of the value.
|
||||
*/
|
||||
void prependCellValue(const XLCellValue& value, uint16_t col);
|
||||
|
||||
/**
|
||||
* @brief Convenience function for converting the row data to a user-supplied container.
|
||||
* @details This function can convert row data to any user-supplied container that adheres to the design
|
||||
* of STL containers and supports bidirectional iterators. This could be std::vector, std::deque, or
|
||||
* std::list, but any container with the same interface should work.
|
||||
* @tparam Container The container (and value) type to be returned.
|
||||
* @return The row data in the required format.
|
||||
* @throws bad_variant_access if Container::value type is not XLCellValue and does not match the type contained.
|
||||
*/
|
||||
template<
|
||||
typename Container,
|
||||
typename std::enable_if<!std::is_same_v<Container, XLRowDataProxy> &&
|
||||
std::is_base_of_v<typename std::bidirectional_iterator_tag,
|
||||
typename std::iterator_traits<typename Container::iterator>::iterator_category>,
|
||||
Container>::type* = nullptr>
|
||||
Container convertContainer() const
|
||||
{
|
||||
Container c;
|
||||
auto it = std::inserter(c, c.end());
|
||||
for (const auto& v : getValues()) {
|
||||
// ===== If the value_type of the container is XLCellValue, the value can be assigned directly.
|
||||
if constexpr (std::is_same_v<typename Container::value_type, XLCellValue>) *it++ = v;
|
||||
|
||||
// ===== If the value_type is something else, the underlying value has to be extracted from the XLCellValue object.
|
||||
// ===== Note that if the type contained in the XLCellValue object does not match the value_type, a bad_variant_access
|
||||
// ===== exception will be thrown.
|
||||
else
|
||||
*it++ = v.get<typename Container::value_type>();
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
//---------- Private Member Variables ---------- //
|
||||
|
||||
XLRow* m_row { nullptr }; /**< Pointer to the parent XLRow object. */
|
||||
XMLNode* m_rowNode { nullptr }; /**< Pointer the the XML node representing the row. */
|
||||
};
|
||||
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLROWDATA_HPP
|
||||
159
thirdparty/OpenXLSX/include/headers/XLSharedStrings.hpp
vendored
Normal file
159
thirdparty/OpenXLSX/include/headers/XLSharedStrings.hpp
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLSHAREDSTRINGS_HPP
|
||||
#define OPENXLSX_XLSHAREDSTRINGS_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
#include <deque>
|
||||
#include <string>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
#include "XLXmlFile.hpp"
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief This class encapsulate the Excel concept of Shared Strings. In Excel, instead of havig individual strings
|
||||
* in each cell, cells have a reference to an entry in the SharedStrings register. This results in smalle file
|
||||
* sizes, as repeated strings are referenced easily.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLSharedStrings : public XLXmlFile
|
||||
{
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// Public Member Functions
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
XLSharedStrings() = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param xmlData
|
||||
*/
|
||||
explicit XLSharedStrings(XLXmlData* xmlData, std::deque<std::string> *stringCache);
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
~XLSharedStrings();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLSharedStrings(const XLSharedStrings& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLSharedStrings(XLSharedStrings&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLSharedStrings& operator=(const XLSharedStrings& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLSharedStrings& operator=(XLSharedStrings&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
int32_t getStringIndex(const std::string& str) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
bool stringExists(const std::string& str) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
const char* getString(uint32_t index) const;
|
||||
|
||||
/**
|
||||
* @brief Append a new string to the list of shared strings.
|
||||
* @param str The string to append.
|
||||
* @return A long int with the index of the appended string
|
||||
*/
|
||||
int32_t appendString(const std::string& str);
|
||||
|
||||
/**
|
||||
* @brief Clear the string at the given index.
|
||||
* @param index The index to clear.
|
||||
* @note There is no 'deleteString' member function, as deleting a shared string node will invalidate the
|
||||
* shared string indices for the cells in the spreadsheet. Instead use this member functions, which clears
|
||||
* the contents of the string, but keeps the XMLNode holding the string.
|
||||
*/
|
||||
void clearString(uint64_t index);
|
||||
|
||||
private:
|
||||
std::deque<std::string> *m_stringCache {}; /** < Each string must have an unchanging memory address; hence the use of std::deque */
|
||||
};
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLSHAREDSTRINGS_HPP
|
||||
737
thirdparty/OpenXLSX/include/headers/XLSheet.hpp
vendored
Normal file
737
thirdparty/OpenXLSX/include/headers/XLSheet.hpp
vendored
Normal file
@@ -0,0 +1,737 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLSHEET_HPP
|
||||
#define OPENXLSX_XLSHEET_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== External Includes ===== //
|
||||
#include <type_traits>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
#include "XLCell.hpp"
|
||||
#include "XLCellReference.hpp"
|
||||
#include "XLColor.hpp"
|
||||
#include "XLColumn.hpp"
|
||||
#include "XLCommandQuery.hpp"
|
||||
#include "XLDocument.hpp"
|
||||
#include "XLException.hpp"
|
||||
#include "XLRow.hpp"
|
||||
#include "XLXmlFile.hpp"
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief The XLSheetState is an enumeration of the possible (visibility) states, e.g. Visible or Hidden.
|
||||
*/
|
||||
enum class XLSheetState { Visible, Hidden, VeryHidden };
|
||||
|
||||
/**
|
||||
* @brief The XLSheetBase class is the base class for the XLWorksheet and XLChartsheet classes. However,
|
||||
* it is not a base class in the traditional sense. Rather, it provides common functionality that is
|
||||
* inherited via the CRTP (Curiously Recurring Template Pattern) pattern.
|
||||
* @tparam T Type that will inherit functionality. Restricted to types XLWorksheet and XLChartsheet.
|
||||
*/
|
||||
template<typename T, typename std::enable_if<std::is_same_v<T, XLWorksheet> || std::is_same_v<T, XLChartsheet>>::type* = nullptr>
|
||||
class OPENXLSX_EXPORT XLSheetBase : public XLXmlFile
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
XLSheetBase() : XLXmlFile(nullptr) {};
|
||||
|
||||
/**
|
||||
* @brief The constructor. There are no default constructor, so all parameters must be provided for
|
||||
* constructing an XLAbstractSheet object. Since this is a pure abstract class, instantiation is only
|
||||
* possible via one of the derived classes.
|
||||
* @param xmlData
|
||||
*/
|
||||
explicit XLSheetBase(XLXmlData* xmlData) : XLXmlFile(xmlData) {};
|
||||
|
||||
/**
|
||||
* @brief The copy constructor.
|
||||
* @param other The object to be copied.
|
||||
* @note The default copy constructor is used, i.e. only shallow copying of pointer data members.
|
||||
*/
|
||||
XLSheetBase(const XLSheetBase& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLSheetBase(XLSheetBase&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief The destructor
|
||||
* @note The default destructor is used, since cleanup of pointer data members is not required.
|
||||
*/
|
||||
~XLSheetBase() = default;
|
||||
|
||||
/**
|
||||
* @brief Assignment operator
|
||||
* @return A reference to the new object.
|
||||
* @note The default assignment operator is used, i.e. only shallow copying of pointer data members.
|
||||
*/
|
||||
XLSheetBase& operator=(const XLSheetBase&) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLSheetBase& operator=(XLSheetBase&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLSheetState visibility() const
|
||||
{
|
||||
XLQuery query(XLQueryType::QuerySheetVisibility);
|
||||
query.setParam("sheetID", relationshipID());
|
||||
auto state = parentDoc().execQuery(query).template result<std::string>();
|
||||
auto result = XLSheetState::Visible;
|
||||
|
||||
if (state == "visible" || state.empty()) {
|
||||
result = XLSheetState::Visible;
|
||||
}
|
||||
else if (state == "hidden") {
|
||||
result = XLSheetState::Hidden;
|
||||
}
|
||||
else if (state == "veryHidden") {
|
||||
result = XLSheetState::VeryHidden;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param state
|
||||
*/
|
||||
void setVisibility(XLSheetState state)
|
||||
{
|
||||
auto stateString = std::string();
|
||||
switch (state) {
|
||||
case XLSheetState::Visible:
|
||||
stateString = "visible";
|
||||
break;
|
||||
|
||||
case XLSheetState::Hidden:
|
||||
stateString = "hidden";
|
||||
break;
|
||||
|
||||
case XLSheetState::VeryHidden:
|
||||
stateString = "veryHidden";
|
||||
break;
|
||||
}
|
||||
|
||||
parentDoc().execCommand(XLCommand(XLCommandType::SetSheetVisibility)
|
||||
.setParam("sheetID", relationshipID())
|
||||
.setParam("sheetVisibility", stateString));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
* @todo To be implemented.
|
||||
*/
|
||||
XLColor color() const
|
||||
{
|
||||
return static_cast<const T&>(*this).getColor_impl();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param color
|
||||
*/
|
||||
void setColor(const XLColor& color)
|
||||
{
|
||||
static_cast<T&>(*this).setColor_impl(color);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
uint16_t index() const
|
||||
{
|
||||
// return uint16_t(std::stoi(parentDoc().execQuery(R"({ "query": "QuerySheetIndex", "sheetID": ")" + relationshipID() + "\"}")));
|
||||
|
||||
XLQuery query(XLQueryType::QuerySheetIndex);
|
||||
query.setParam("sheetID", relationshipID());
|
||||
return uint16_t(std::stoi(parentDoc().execQuery(query).template result<std::string>()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param index
|
||||
*/
|
||||
void setIndex(uint16_t index)
|
||||
{
|
||||
parentDoc().execCommand(XLCommand(XLCommandType::SetSheetIndex)
|
||||
.setParam("sheetID", relationshipID())
|
||||
.setParam("sheetIndex", index));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Method to retrieve the name of the sheet.
|
||||
* @return A std::string with the sheet name.
|
||||
*/
|
||||
std::string name() const
|
||||
{
|
||||
XLQuery query(XLQueryType::QuerySheetName);
|
||||
query.setParam("sheetID", relationshipID());
|
||||
return parentDoc().execQuery(query).template result<std::string>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Method for renaming the sheet.
|
||||
* @param sheetName A std::string with the new name.
|
||||
*/
|
||||
void setName(const std::string& sheetName)
|
||||
{
|
||||
parentDoc().execCommand(XLCommand(XLCommandType::SetSheetName)
|
||||
.setParam("sheetID", relationshipID())
|
||||
.setParam("sheetName", name())
|
||||
.setParam("newName", sheetName));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
bool isSelected() const
|
||||
{
|
||||
return static_cast<const T&>(*this).isSelected_impl();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param selected
|
||||
*/
|
||||
void setSelected(bool selected)
|
||||
{
|
||||
static_cast<T&>(*this).setSelected_impl(selected);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
bool isActive() const
|
||||
{
|
||||
return static_cast<const T&>(*this).isActive_impl();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param active
|
||||
*/
|
||||
void setActive()
|
||||
{
|
||||
static_cast<T&>(*this).setActive_impl();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Method for cloning the sheet.
|
||||
* @param newName A std::string with the name of the clone
|
||||
* @return A pointer to the cloned object.
|
||||
* @note This is a pure abstract method. I.e. it is implemented in subclasses.
|
||||
*/
|
||||
void clone(const std::string& newName)
|
||||
{
|
||||
parentDoc().execCommand(XLCommand(XLCommandType::CloneSheet)
|
||||
.setParam("sheetID", relationshipID())
|
||||
.setParam("cloneName", newName));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A class encapsulating an Excel worksheet. Access to XLWorksheet objects should be via the workbook object.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLWorksheet final : public XLSheetBase<XLWorksheet>
|
||||
{
|
||||
friend class XLCell;
|
||||
friend class XLRow;
|
||||
friend class XLWorkbook;
|
||||
friend class XLSheetBase<XLWorksheet>;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// Public Member Functions
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Default constructor
|
||||
*/
|
||||
XLWorksheet() : XLSheetBase(nullptr) {};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param xmlData
|
||||
*/
|
||||
explicit XLWorksheet(XLXmlData* xmlData);
|
||||
|
||||
/**
|
||||
* @brief Copy Constructor.
|
||||
* @note The copy constructor has been explicitly deleted.
|
||||
*/
|
||||
XLWorksheet(const XLWorksheet& other) = default;
|
||||
|
||||
/**
|
||||
* @brief Move Constructor.
|
||||
* @note The move constructor has been explicitly deleted.
|
||||
*/
|
||||
XLWorksheet(XLWorksheet&& other) = default;
|
||||
|
||||
/**
|
||||
* @brief Destructor.
|
||||
*/
|
||||
~XLWorksheet();
|
||||
|
||||
/**
|
||||
* @brief Copy assignment operator.
|
||||
* @note The copy assignment operator has been explicitly deleted.
|
||||
*/
|
||||
XLWorksheet& operator=(const XLWorksheet& other) = default;
|
||||
|
||||
/**
|
||||
* @brief Move assignment operator.
|
||||
* @note The move assignment operator has been explicitly deleted.
|
||||
*/
|
||||
XLWorksheet& operator=(XLWorksheet&& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param ref
|
||||
* @return
|
||||
*/
|
||||
XLCell cell(const std::string& ref) const;
|
||||
|
||||
/**
|
||||
* @brief Get a pointer to the XLCell object for the given cell reference.
|
||||
* @param ref An XLCellReference object with the address of the cell to get.
|
||||
* @return A const reference to the requested XLCell object.
|
||||
*/
|
||||
XLCell cell(const XLCellReference& ref) const;
|
||||
|
||||
/**
|
||||
* @brief Get the cell at the given coordinates.
|
||||
* @param rowNumber The row number (index base 1).
|
||||
* @param columnNumber The column number (index base 1).
|
||||
* @return A reference to the XLCell object at the given coordinates.
|
||||
*/
|
||||
XLCell cell(uint32_t rowNumber, uint16_t columnNumber) const;
|
||||
|
||||
/**
|
||||
* @brief Get a range for the area currently in use (i.e. from cell A1 to the last cell being in use).
|
||||
* @return A const XLCellRange object with the entire range.
|
||||
*/
|
||||
XLCellRange range() const;
|
||||
|
||||
/**
|
||||
* @brief Get a range with the given coordinates.
|
||||
* @param topLeft An XLCellReference object with the coordinates to the top left cell.
|
||||
* @param bottomRight An XLCellReference object with the coordinates to the bottom right cell.
|
||||
* @return A const XLCellRange object with the requested range.
|
||||
*/
|
||||
XLCellRange range(const XLCellReference& topLeft, const XLCellReference& bottomRight) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLRowRange rows() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param rowCount
|
||||
* @return
|
||||
*/
|
||||
XLRowRange rows(uint32_t rowCount) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param firstRow
|
||||
* @param lastRow
|
||||
* @return
|
||||
*/
|
||||
XLRowRange rows(uint32_t firstRow, uint32_t lastRow) const;
|
||||
|
||||
/**
|
||||
* @brief Get the row with the given row number.
|
||||
* @param rowNumber The number of the row to retrieve.
|
||||
* @return A pointer to the XLRow object.
|
||||
*/
|
||||
XLRow row(uint32_t rowNumber) const;
|
||||
|
||||
/**
|
||||
* @brief Get the column with the given column number.
|
||||
* @param columnNumber The number of the column to retrieve.
|
||||
* @return A pointer to the XLColumn object.
|
||||
*/
|
||||
XLColumn column(uint16_t columnNumber) const;
|
||||
|
||||
/**
|
||||
* @brief Get an XLCellReference to the last (bottom right) cell in the worksheet.
|
||||
* @return An XLCellReference for the last cell.
|
||||
*/
|
||||
XLCellReference lastCell() const noexcept;
|
||||
|
||||
/**
|
||||
* @brief Get the number of columns in the worksheet.
|
||||
* @return The number of columns.
|
||||
*/
|
||||
uint16_t columnCount() const noexcept;
|
||||
|
||||
/**
|
||||
* @brief Get the number of rows in the worksheet.
|
||||
* @return The number of rows.
|
||||
*/
|
||||
uint32_t rowCount() const noexcept;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param oldName
|
||||
* @param newName
|
||||
*/
|
||||
void updateSheetName(const std::string& oldName, const std::string& newName);
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLColor getColor_impl() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param color
|
||||
*/
|
||||
void setColor_impl(const XLColor& color);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
bool isSelected_impl() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param selected
|
||||
*/
|
||||
void setSelected_impl(bool selected);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
bool isActive_impl() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param selected
|
||||
*/
|
||||
void setActive_impl();
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Class representing the an Excel chartsheet.
|
||||
* @todo This class is largely unimplemented and works just as a placeholder.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLChartsheet final : public XLSheetBase<XLChartsheet>
|
||||
{
|
||||
friend class XLSheetBase<XLChartsheet>;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// Public Member Functions
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Default constructor
|
||||
*/
|
||||
XLChartsheet() : XLSheetBase(nullptr) {};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param xmlData
|
||||
*/
|
||||
explicit XLChartsheet(XLXmlData* xmlData);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLChartsheet(const XLChartsheet& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLChartsheet(XLChartsheet&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
~XLChartsheet();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLChartsheet& operator=(const XLChartsheet& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLChartsheet& operator=(XLChartsheet&& other) noexcept = default;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLColor getColor_impl() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param color
|
||||
*/
|
||||
void setColor_impl(const XLColor& color);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
bool isSelected_impl() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param selected
|
||||
*/
|
||||
void setSelected_impl(bool selected);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The XLAbstractSheet is a generalized sheet class, which functions as superclass for specialized classes,
|
||||
* such as XLWorksheet. It implements functionality common to all sheet types. This is a pure abstract class,
|
||||
* so it cannot be instantiated.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLSheet final : public XLXmlFile
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The constructor. There are no default constructor, so all parameters must be provided for
|
||||
* constructing an XLAbstractSheet object. Since this is a pure abstract class, instantiation is only
|
||||
* possible via one of the derived classes.
|
||||
* @param xmlData
|
||||
*/
|
||||
explicit XLSheet(XLXmlData* xmlData);
|
||||
|
||||
/**
|
||||
* @brief The copy constructor.
|
||||
* @param other The object to be copied.
|
||||
* @note The default copy constructor is used, i.e. only shallow copying of pointer data members.
|
||||
*/
|
||||
XLSheet(const XLSheet& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLSheet(XLSheet&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief The destructor
|
||||
* @note The default destructor is used, since cleanup of pointer data members is not required.
|
||||
*/
|
||||
~XLSheet() = default;
|
||||
|
||||
/**
|
||||
* @brief Assignment operator
|
||||
* @return A reference to the new object.
|
||||
* @note The default assignment operator is used, i.e. only shallow copying of pointer data members.
|
||||
*/
|
||||
XLSheet& operator=(const XLSheet& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLSheet& operator=(XLSheet&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief Method for getting the current visibility state of the sheet.
|
||||
* @return An XLSheetState enum object, with the current sheet state.
|
||||
*/
|
||||
XLSheetState visibility() const;
|
||||
|
||||
/**
|
||||
* @brief Method for setting the state of the sheet.
|
||||
* @param state An XLSheetState enum object with the new state.
|
||||
* @bug For some reason, this method doesn't work. The data is written correctly to the xml file, but the sheet
|
||||
* is not hidden when opening the file in Excel.
|
||||
*/
|
||||
void setVisibility(XLSheetState state);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLColor color() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param color
|
||||
*/
|
||||
void setColor(const XLColor& color);
|
||||
|
||||
/**
|
||||
* @brief Method for getting the index of the sheet.
|
||||
* @return An int with the index of the sheet.
|
||||
*/
|
||||
uint16_t index() const;
|
||||
|
||||
/**
|
||||
* @brief Method for setting the index of the sheet. This effectively moves the sheet to a different position.
|
||||
*/
|
||||
void setIndex(uint16_t index);
|
||||
|
||||
/**
|
||||
* @brief Method to retrieve the name of the sheet.
|
||||
* @return A std::string with the sheet name.
|
||||
*/
|
||||
std::string name() const;
|
||||
|
||||
/**
|
||||
* @brief Method for renaming the sheet.
|
||||
* @param name A std::string with the new name.
|
||||
*/
|
||||
void setName(const std::string& name);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param selected
|
||||
*/
|
||||
void setSelected(bool selected);
|
||||
|
||||
/**
|
||||
* @brief Method to get the type of the sheet.
|
||||
* @return An XLSheetType enum object with the sheet type.
|
||||
*/
|
||||
template<
|
||||
typename SheetType,
|
||||
typename std::enable_if<std::is_same_v<SheetType, XLWorksheet> || std::is_same_v<SheetType, XLChartsheet>>::type* = nullptr>
|
||||
bool isType() const
|
||||
{
|
||||
return std::holds_alternative<SheetType>(m_sheet);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Method for cloning the sheet.
|
||||
* @param newName A std::string with the name of the clone
|
||||
* @return A pointer to the cloned object.
|
||||
* @note This is a pure abstract method. I.e. it is implemented in subclasses.
|
||||
*/
|
||||
void clone(const std::string& newName);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @tparam T
|
||||
* @return
|
||||
*/
|
||||
template<typename T, typename std::enable_if<std::is_same_v<T, XLWorksheet> || std::is_same_v<T, XLChartsheet>>::type* = nullptr>
|
||||
T get() const
|
||||
{
|
||||
try {
|
||||
if constexpr (std::is_same<T, XLWorksheet>::value)
|
||||
return std::get<XLWorksheet>(m_sheet);
|
||||
|
||||
else if constexpr (std::is_same<T, XLChartsheet>::value)
|
||||
return std::get<XLChartsheet>(m_sheet);
|
||||
}
|
||||
|
||||
catch (const std::bad_variant_access&) {
|
||||
throw XLSheetError("XLSheet object does not contain the requested sheet type.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
operator XLWorksheet() const; // NOLINT
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
operator XLChartsheet() const; // NOLINT
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// Private Member Variables
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
private:
|
||||
std::variant<XLWorksheet, XLChartsheet> m_sheet; /**< */
|
||||
};
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLSHEET_HPP
|
||||
373
thirdparty/OpenXLSX/include/headers/XLWorkbook.hpp
vendored
Normal file
373
thirdparty/OpenXLSX/include/headers/XLWorkbook.hpp
vendored
Normal file
@@ -0,0 +1,373 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLWORKBOOK_HPP
|
||||
#define OPENXLSX_XLWORKBOOK_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== External Includes ===== //
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
#include "XLCommandQuery.hpp"
|
||||
#include "XLContentTypes.hpp"
|
||||
#include "XLException.hpp"
|
||||
#include "XLRelationships.hpp"
|
||||
#include "XLXmlFile.hpp"
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
class XLSharedStrings;
|
||||
|
||||
class XLSheet;
|
||||
|
||||
class XLWorksheet;
|
||||
|
||||
class XLChartsheet;
|
||||
|
||||
/**
|
||||
* @brief The XLSheetType class is an enumeration of the available sheet types, e.g. Worksheet (ordinary
|
||||
* spreadsheets), and Chartsheet (sheets with only a chart).
|
||||
*/
|
||||
enum class XLSheetType { Worksheet, Chartsheet, Dialogsheet, Macrosheet };
|
||||
|
||||
/**
|
||||
* @brief This class encapsulates the concept of a Workbook. It provides access to the individual sheets
|
||||
* (worksheets or chartsheets), as well as functionality for adding, deleting, moving and renaming sheets.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLWorkbook : public XLXmlFile
|
||||
{
|
||||
friend class XLSheet;
|
||||
friend class XLDocument;
|
||||
|
||||
public: // ---------- Public Member Functions ---------- //
|
||||
/**
|
||||
* @brief Default constructor. Creates an empty ('null') XLWorkbook object.
|
||||
*/
|
||||
XLWorkbook() = default;
|
||||
|
||||
/**
|
||||
* @brief Constructor. Takes a pointer to an XLXmlData object (stored in the parent XLDocument object).
|
||||
* @param xmlData A pointer to the underlying XLXmlData object, which holds the XML data.
|
||||
* @note Do not create an XLWorkbook object directly. Get access through the an XLDocument object.
|
||||
*/
|
||||
explicit XLWorkbook(XLXmlData* xmlData);
|
||||
|
||||
/**
|
||||
* @brief Copy Constructor.
|
||||
* @param other The XLWorkbook object to be copied.
|
||||
* @note The copy constructor has been explicitly defaulted.
|
||||
*/
|
||||
XLWorkbook(const XLWorkbook& other) = default;
|
||||
|
||||
/**
|
||||
* @brief Move constructor.
|
||||
* @param other The XLWorkbook to be moved.
|
||||
* @note The move constructor has been explicitly defaulted.
|
||||
*/
|
||||
XLWorkbook(XLWorkbook&& other) = default;
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
* @note Default destructor specified
|
||||
*/
|
||||
~XLWorkbook();
|
||||
|
||||
/**
|
||||
* @brief Copy assignment operator.
|
||||
* @param other The XLWorkbook object to be assigned to the current.
|
||||
* @return A reference to *this
|
||||
* @note The copy assignment operator has been explicitly deleted, as XLWorkbook objects should not be copied.
|
||||
*/
|
||||
XLWorkbook& operator=(const XLWorkbook& other) = default;
|
||||
|
||||
/**
|
||||
* @brief Move assignment operator.
|
||||
* @param other The XLWorkbook to be move assigned.
|
||||
* @return A reference to *this
|
||||
* @note The move assignment operator has been explicitly deleted, as XLWorkbook objects should not be moved.
|
||||
*/
|
||||
XLWorkbook& operator=(XLWorkbook&& other) = default;
|
||||
|
||||
/**
|
||||
* @brief Get the sheet (worksheet or chartsheet) at the given index.
|
||||
* @param index The index at which the desired sheet is located.
|
||||
* @return A pointer to an XLAbstractSheet with the sheet at the index.
|
||||
* @note The index must be 1-based (rather than 0-based) as this is the default for Excel spreadsheets.
|
||||
*/
|
||||
XLSheet sheet(uint16_t index);
|
||||
|
||||
/**
|
||||
* @brief Get the sheet (worksheet or chartsheet) with the given name.
|
||||
* @param sheetName The name at which the desired sheet is located.
|
||||
* @return A pointer to an XLAbstractSheet with the sheet at the index.
|
||||
*/
|
||||
XLSheet sheet(const std::string& sheetName);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetName
|
||||
* @return
|
||||
*/
|
||||
XLWorksheet worksheet(const std::string& sheetName);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetName
|
||||
* @return
|
||||
*/
|
||||
XLChartsheet chartsheet(const std::string& sheetName);
|
||||
|
||||
/**
|
||||
* @brief Delete sheet (worksheet or chartsheet) from the workbook.
|
||||
* @param sheetName Name of the sheet to delete.
|
||||
* @throws XLException An exception will be thrown if trying to delete the last worksheet in the workbook
|
||||
* @warning A workbook must contain at least one worksheet. Trying to delete the last worksheet from the
|
||||
* workbook will trow an exception.
|
||||
*/
|
||||
void deleteSheet(const std::string& sheetName);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetName
|
||||
*/
|
||||
void addWorksheet(const std::string& sheetName);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param existingName
|
||||
* @param newName
|
||||
*/
|
||||
void cloneSheet(const std::string& existingName, const std::string& newName);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetName
|
||||
* @param index
|
||||
*/
|
||||
void setSheetIndex(const std::string& sheetName, unsigned int index);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetName
|
||||
* @return
|
||||
*/
|
||||
unsigned int indexOfSheet(const std::string& sheetName) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetName
|
||||
* @return
|
||||
*/
|
||||
XLSheetType typeOfSheet(const std::string& sheetName) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
XLSheetType typeOfSheet(unsigned int index) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
unsigned int sheetCount() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
unsigned int worksheetCount() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
unsigned int chartsheetCount() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
std::vector<std::string> sheetNames() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
std::vector<std::string> worksheetNames() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
std::vector<std::string> chartsheetNames() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetName
|
||||
* @return
|
||||
*/
|
||||
bool sheetExists(const std::string& sheetName) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetName
|
||||
* @return
|
||||
*/
|
||||
bool worksheetExists(const std::string& sheetName) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetName
|
||||
* @return
|
||||
*/
|
||||
bool chartsheetExists(const std::string& sheetName) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param oldName
|
||||
* @param newName
|
||||
*/
|
||||
void updateSheetReferences(const std::string& oldName, const std::string& newName);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
XLSharedStrings sharedStrings();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
bool hasSharedStrings() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void deleteNamedRanges();
|
||||
|
||||
/**
|
||||
* @brief set a flag to force full calculation upon loading the file in Excel
|
||||
*/
|
||||
void setFullCalculationOnLoad();
|
||||
|
||||
private: // ---------- Private Member Functions ---------- //
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
uint16_t createInternalSheetID();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetName
|
||||
* @return
|
||||
*/
|
||||
std::string sheetID(const std::string& sheetName);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetID
|
||||
* @return
|
||||
*/
|
||||
std::string sheetName(const std::string& sheetID) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetID
|
||||
* @return
|
||||
*/
|
||||
std::string sheetVisibility(const std::string& sheetID) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetName
|
||||
* @param internalID
|
||||
*/
|
||||
void prepareSheetMetadata(const std::string& sheetName, uint16_t internalID);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetRID
|
||||
* @param newName
|
||||
*/
|
||||
void setSheetName(const std::string& sheetRID, const std::string& newName);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetRID
|
||||
* @param state
|
||||
*/
|
||||
void setSheetVisibility(const std::string& sheetRID, const std::string& state);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetRID
|
||||
* @return
|
||||
*/
|
||||
bool sheetIsActive(const std::string& sheetRID) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param sheetRID
|
||||
* @param state
|
||||
*/
|
||||
void setSheetActive(const std::string& sheetRID);
|
||||
|
||||
|
||||
};
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLWORKBOOK_HPP
|
||||
202
thirdparty/OpenXLSX/include/headers/XLXmlData.hpp
vendored
Normal file
202
thirdparty/OpenXLSX/include/headers/XLXmlData.hpp
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLXMLDATA_HPP
|
||||
#define OPENXLSX_XLXMLDATA_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== External Includes ===== //
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
#include "XLContentTypes.hpp"
|
||||
#include "XLXmlParser.hpp"
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief The XLXmlData class encapsulates the properties and behaviour of the .xml files in an .xlsx file zip
|
||||
* package. Objects of the XLXmlData type are intended to be stored centrally in an XLDocument object, from where
|
||||
* they can be retrieved by other objects that encapsulates the behaviour of Excel elements, such as XLWorkbook
|
||||
* and XLWorksheet.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLXmlData final
|
||||
{
|
||||
public:
|
||||
// ===== PUBLIC MEMBER FUNCTIONS ===== //
|
||||
|
||||
/**
|
||||
* @brief Default constructor. All member variables are default constructed. Except for
|
||||
* the raw XML data, none of the member variables can be modified after construction. Hence, objects created
|
||||
* using the default constructor can only serve as null objects and targets for the move assignemnt operator.
|
||||
*/
|
||||
XLXmlData() = default;
|
||||
|
||||
/**
|
||||
* @brief Constructor. This constructor creates objects with the given parameters. the xmlId and the xmlType
|
||||
* parameters have default values. These are only useful for relationship (.rels) files and the
|
||||
* [Content_Types].xml file located in the root directory of the zip package.
|
||||
* @param parentDoc A pointer to the parent XLDocument object.
|
||||
* @param xmlPath A std::string with the file path in zip package.
|
||||
* @param xmlId A std::string with the relationship ID of the file (used in the XLRelationships class)
|
||||
* @param xmlType The type of object the XML file represents, e.g. XLWorkbook or XLWorksheet.
|
||||
*/
|
||||
XLXmlData(XLDocument* parentDoc,
|
||||
const std::string& xmlPath,
|
||||
const std::string& xmlId = "",
|
||||
XLContentType xmlType = XLContentType::Unknown);
|
||||
|
||||
/**
|
||||
* @brief Default destructor. The XLXmlData does not manage any dynamically allocated resources, so a default
|
||||
* destructor will suffice.
|
||||
*/
|
||||
~XLXmlData();
|
||||
|
||||
/**
|
||||
* @brief Copy constructor. The m_xmlDoc data member is a XMLDocument object, which is non-copyable. Hence,
|
||||
* the XLXmlData objects have a explicitly deleted copy constructor.
|
||||
* @param other
|
||||
*/
|
||||
XLXmlData(const XLXmlData& other) = delete;
|
||||
|
||||
/**
|
||||
* @brief Move constructor. All data members are trivially movable. Hence an explicitly defaulted move
|
||||
* constructor is sufficient.
|
||||
* @param other
|
||||
*/
|
||||
XLXmlData(XLXmlData&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief Copy assignment operator. The m_xmlDoc data member is a XMLDocument object, which is non-copyable.
|
||||
* Hence, the XLXmlData objects have a explicitly deleted copy assignment operator.
|
||||
*/
|
||||
XLXmlData& operator=(const XLXmlData& other) = delete;
|
||||
|
||||
/**
|
||||
* @brief Move assignment operator. All data members are trivially movable. Hence an explicitly defaulted move
|
||||
* constructor is sufficient.
|
||||
* @param other the XLXmlData object to be moved from.
|
||||
* @return A reference to the moved-to object.
|
||||
*/
|
||||
XLXmlData& operator=(XLXmlData&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief Set the raw data for the underlying XML document. Being able to set the XML data directly is useful
|
||||
* when creating a new file using a XML file template. E.g., when creating a new worksheet, the XML code for
|
||||
* a minimum viable XLWorksheet object can be added using this function.
|
||||
* @param data A std::string with the raw XML text.
|
||||
*/
|
||||
void setRawData(const std::string& data);
|
||||
|
||||
/**
|
||||
* @brief Get the raw data for the underlying XML document. This function will retrieve the raw XML text data
|
||||
* from the underlying XMLDocument object. This will mainly be used when saving data to the .xlsx package
|
||||
* using the save function in the XLDocument class.
|
||||
* @return A std::string with the raw XML text data.
|
||||
*/
|
||||
std::string getRawData() const;
|
||||
|
||||
/**
|
||||
* @brief Access the parent XLDocument object.
|
||||
* @return A pointer to the parent XLDocument object.
|
||||
*/
|
||||
XLDocument* getParentDoc();
|
||||
|
||||
/**
|
||||
* @brief Access the parent XLDocument object.
|
||||
* @return A const pointer to the parent XLDocument object.
|
||||
*/
|
||||
const XLDocument* getParentDoc() const;
|
||||
|
||||
/**
|
||||
* @brief Retrieve the path of the XML data in the .xlsx zip archive.
|
||||
* @return A std::string with the path.
|
||||
*/
|
||||
std::string getXmlPath() const;
|
||||
|
||||
/**
|
||||
* @brief Retrieve the relationship ID of the XML file.
|
||||
* @return A std::string with the relationship ID.
|
||||
*/
|
||||
std::string getXmlID() const;
|
||||
|
||||
/**
|
||||
* @brief Retrieve the type represented by the XML data.
|
||||
* @return A XLContentType getValue representing the type.
|
||||
*/
|
||||
XLContentType getXmlType() const;
|
||||
|
||||
/**
|
||||
* @brief Access the underlying XMLDocument object.
|
||||
* @return A pointer to the XMLDocument object.
|
||||
*/
|
||||
XMLDocument* getXmlDocument();
|
||||
|
||||
/**
|
||||
* @brief Access the underlying XMLDocument object.
|
||||
* @return A const pointer to the XMLDocument object.
|
||||
*/
|
||||
const XMLDocument* getXmlDocument() const;
|
||||
|
||||
private:
|
||||
// ===== PRIVATE MEMBER VARIABLES ===== //
|
||||
|
||||
XLDocument* m_parentDoc {}; /**< A pointer to the parent XLDocument object. >*/
|
||||
std::string m_xmlPath {}; /**< The path of the XML data in the .xlsx zip archive. >*/
|
||||
std::string m_xmlID {}; /**< The relationship ID of the XML data. >*/
|
||||
XLContentType m_xmlType {}; /**< The type represented by the XML data. >*/
|
||||
mutable std::unique_ptr<XMLDocument> m_xmlDoc; /**< The underlying XMLDocument object. >*/
|
||||
};
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLXMLDATA_HPP
|
||||
163
thirdparty/OpenXLSX/include/headers/XLXmlFile.hpp
vendored
Normal file
163
thirdparty/OpenXLSX/include/headers/XLXmlFile.hpp
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLXMLFILE_HPP
|
||||
#define OPENXLSX_XLXMLFILE_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
#include "XLXmlParser.hpp"
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
class XLXmlData;
|
||||
class XLDocument;
|
||||
|
||||
/**
|
||||
* @brief The XLXmlFile class provides an interface for derived classes to use.
|
||||
* It functions as an ancestor to all classes which are represented by an .xml file in an .xlsx package.
|
||||
* @warning The XLXmlFile class is not intended to be instantiated on it's own, but to provide an interface for
|
||||
* derived classes. Also, it should not be used polymorphically. For that reason, the destructor is not declared virtual.
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLXmlFile
|
||||
{
|
||||
public: // ===== PUBLIC MEMBER FUNCTIONS
|
||||
/**
|
||||
* @brief Default constructor.
|
||||
*/
|
||||
XLXmlFile() = default;
|
||||
|
||||
/**
|
||||
* @brief Constructor. Creates an object based on the xmlData input.
|
||||
* @param xmlData An XLXmlData object with the XML data to be represented by the object.
|
||||
*/
|
||||
explicit XLXmlFile(XLXmlData* xmlData);
|
||||
|
||||
/**
|
||||
* @brief Copy constructor. Default implementation used.
|
||||
* @param other The object to copy.
|
||||
*/
|
||||
XLXmlFile(const XLXmlFile& other) = default;
|
||||
|
||||
/**
|
||||
* @brief Move constructor. Default implementation used.
|
||||
* @param other The object to move.
|
||||
*/
|
||||
XLXmlFile(XLXmlFile&& other) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief Destructor. Default implementation used.
|
||||
*/
|
||||
~XLXmlFile();
|
||||
|
||||
/**
|
||||
* @brief The copy assignment operator. The default implementation has been used.
|
||||
* @param other The object to copy.
|
||||
* @return A reference to the new object.
|
||||
*/
|
||||
XLXmlFile& operator=(const XLXmlFile& other) = default;
|
||||
|
||||
/**
|
||||
* @brief The move assignment operator. The default implementation has been used.
|
||||
* @param other The object to move.
|
||||
* @return A reference to the new object.
|
||||
*/
|
||||
XLXmlFile& operator=(XLXmlFile&& other) noexcept = default;
|
||||
|
||||
protected: // ===== PROTECTED MEMBER FUNCTIONS
|
||||
/**
|
||||
* @brief Method for getting the XML data represented by the object.
|
||||
* @return A std::string with the XML data.
|
||||
*/
|
||||
std::string xmlData() const;
|
||||
|
||||
/**
|
||||
* @brief Provide the XML data represented by the object.
|
||||
* @param xmlData A std::string with the XML data.
|
||||
*/
|
||||
void setXmlData(const std::string& xmlData);
|
||||
|
||||
/**
|
||||
* @brief This function returns the relationship ID (the ID used in the XLRelationships objects) for the object.
|
||||
* @return A std::string with the ID. Not all spreadsheet objects may have a relationship ID. In those cases an empty string is
|
||||
* returned.
|
||||
*/
|
||||
std::string relationshipID() const;
|
||||
|
||||
/**
|
||||
* @brief This function provides access to the parent XLDocument object.
|
||||
* @return A reference to the parent XLDocument object.
|
||||
*/
|
||||
XLDocument& parentDoc();
|
||||
|
||||
/**
|
||||
* @brief This function provides access to the parent XLDocument object.
|
||||
* @return A const reference to the parent XLDocument object.
|
||||
*/
|
||||
const XLDocument& parentDoc() const;
|
||||
|
||||
/**
|
||||
* @brief This function provides access to the underlying XMLDocument object.
|
||||
* @return A reference to the XMLDocument object.
|
||||
*/
|
||||
XMLDocument& xmlDocument();
|
||||
|
||||
/**
|
||||
* @brief This function provides access to the underlying XMLDocument object.
|
||||
* @return A const reference to the XMLDocument object.
|
||||
*/
|
||||
const XMLDocument& xmlDocument() const;
|
||||
|
||||
protected: // ===== PRIVATE MEMBER VARIABLES
|
||||
XLXmlData* m_xmlData { nullptr }; /**< The underlying XML data object. */
|
||||
};
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLXMLFILE_HPP
|
||||
62
thirdparty/OpenXLSX/include/headers/XLXmlParser.hpp
vendored
Normal file
62
thirdparty/OpenXLSX/include/headers/XLXmlParser.hpp
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLXMLPARSER_HPP
|
||||
#define OPENXLSX_XLXMLPARSER_HPP
|
||||
|
||||
namespace pugi
|
||||
{
|
||||
class xml_node;
|
||||
class xml_attribute;
|
||||
class xml_document;
|
||||
} // namespace pugi
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
using XMLNode = pugi::xml_node;
|
||||
using XMLAttribute = pugi::xml_attribute;
|
||||
using XMLDocument = pugi::xml_document;
|
||||
} // namespace OpenXLSX
|
||||
#endif // OPENXLSX_XLXMLPARSER_HPP
|
||||
169
thirdparty/OpenXLSX/include/headers/XLZipArchive.hpp
vendored
Normal file
169
thirdparty/OpenXLSX/include/headers/XLZipArchive.hpp
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
|
||||
____ ____ ___ ____ ____ ____ ___
|
||||
6MMMMb `MM( )M' `MM' 6MMMMb\`MM( )M'
|
||||
8P Y8 `MM. d' MM 6M' ` `MM. d'
|
||||
6M Mb __ ____ ____ ___ __ `MM. d' MM MM `MM. d'
|
||||
MM MM `M6MMMMb 6MMMMb `MM 6MMb `MM. d' MM YM. `MM. d'
|
||||
MM MM MM' `Mb 6M' `Mb MMM9 `Mb `MMd MM YMMMMb `MMd
|
||||
MM MM MM MM MM MM MM' MM dMM. MM `Mb dMM.
|
||||
MM MM MM MM MMMMMMMM MM MM d'`MM. MM MM d'`MM.
|
||||
YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
|
||||
8b d8 MM. ,M9 YM d9 MM MM d' `MM. MM / L ,M9 d' `MM.
|
||||
YMMMM9 MMYMMM9 YMMMM9 _MM_ _MM_M(_ _)MM_ _MMMMMMM MYMMMM9 _M(_ _)MM_
|
||||
MM
|
||||
MM
|
||||
_MM_
|
||||
|
||||
Copyright (c) 2018, Kenneth Troldal Balslev
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the author nor the
|
||||
names of any contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef OPENXLSX_XLZIPARCHIVE_HPP
|
||||
#define OPENXLSX_XLZIPARCHIVE_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
// ===== OpenXLSX Includes ===== //
|
||||
#include "OpenXLSX-Exports.hpp"
|
||||
|
||||
namespace Zippy
|
||||
{
|
||||
class ZipArchive;
|
||||
} // namespace Zippy
|
||||
|
||||
namespace OpenXLSX
|
||||
{
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class OPENXLSX_EXPORT XLZipArchive
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
XLZipArchive();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLZipArchive(const XLZipArchive& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
*/
|
||||
XLZipArchive(XLZipArchive&& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
~XLZipArchive();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLZipArchive& operator=(const XLZipArchive& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
XLZipArchive& operator=(XLZipArchive&& other) = default;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
explicit operator bool() const;
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @return
|
||||
*/
|
||||
bool isOpen() const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param fileName
|
||||
*/
|
||||
void open(const std::string& fileName);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void close();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param path
|
||||
*/
|
||||
void save(const std::string& path = "");
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param name
|
||||
* @param data
|
||||
*/
|
||||
void addEntry(const std::string& name, const std::string& data);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param entryName
|
||||
*/
|
||||
void deleteEntry(const std::string& entryName);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
std::string getEntry(const std::string& name);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param entryName
|
||||
* @return
|
||||
*/
|
||||
bool hasEntry(const std::string& entryName);
|
||||
|
||||
private:
|
||||
std::shared_ptr<Zippy::ZipArchive> m_archive; /**< */
|
||||
};
|
||||
} // namespace OpenXLSX
|
||||
|
||||
#pragma warning(pop)
|
||||
#endif // OPENXLSX_XLZIPARCHIVE_HPP
|
||||
Reference in New Issue
Block a user