Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
!/OpenXLSX/external/*
!/OpenXLSX/headers
!/OpenXLSX/headers/*
!/OpenXLSX/module.modulemap
!/OpenXLSX/swiftpm
!/OpenXLSX/swiftpm/*
!/OpenXLSX/OpenXLSXConfig.cmake
!/OpenXLSX/OpenXLSX.hpp
!/OpenXLSX/sources
Expand All @@ -103,3 +106,5 @@
!/Tests/catch/*.hpp
!/Tests/CMakeLists.txt
!/Tests/*.cpp

!/Package.swift
1 change: 1 addition & 0 deletions OpenXLSX/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ if ("${OPENXLSX_LIBRARY_TYPE}" STREQUAL "SHARED")

endif()

target_compile_definitions(OpenXLSX PUBLIC OPENXLSX_CMAKE)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To address (4), I added a flag to indicate that the build was performed using CMake.


if (OPENXLSX_ENABLE_NOWIDE)
target_compile_definitions(OpenXLSX PRIVATE ENABLE_NOWIDE)
Expand Down
29 changes: 29 additions & 0 deletions OpenXLSX/external/zippy/zippy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,11 +633,16 @@ namespace ns_miniz
#endif
#pragma once

} // namespace ns_miniz

#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

namespace ns_miniz
{

/* ------------------- Types and macros */
typedef unsigned char mz_uint8;

Expand Down Expand Up @@ -4657,8 +4662,20 @@ namespace ns_miniz
# define MZ_FILE void*
# else

# ifdef __cplusplus
}
# endif
} // namespace ns_miniz

# include <sys/stat.h>

namespace ns_miniz
{
# ifdef __cplusplus
extern "C"
{
# endif

# if defined(_MSC_VER) || defined(__MINGW64__)
static FILE* mz_fopen(const char* pFilename, const char* pMode)
{
Expand Down Expand Up @@ -4738,8 +4755,20 @@ namespace ns_miniz
# elif defined(__APPLE__)
# ifndef MINIZ_NO_TIME

# ifdef __cplusplus
}
# endif
} // namespace ns_miniz

# include <utime.h>

namespace ns_miniz
{
# ifdef __cplusplus
extern "C"
{
# endif

# endif

# define MZ_FOPEN(f, m) FILESYSTEM_NAMESPACE::fopen(f, m)
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/IZipArchive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#endif // _MSC_VER

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As part of addressing (4), I modified the code to include the indirect header.


#include <memory>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLCell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#include <memory>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLCellReference.hpp"
#include "XLCellValue.hpp"
#include "XLFormula.hpp"
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLCellIterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.

#include <algorithm>

#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLCell.hpp"
#include "XLCellReference.hpp"
#include "XLIterator.hpp"
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLCellRange.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#include <memory>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLCell.hpp"
#include "XLCellIterator.hpp"
#include "XLCellReference.hpp"
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLCellReference.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#include <utility>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"

namespace OpenXLSX
{
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLCellValue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#include <variant>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLDateTime.hpp"
#include "XLException.hpp"
#include "XLXmlParser.hpp"
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLColor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#include <string>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"

namespace OpenXLSX
{
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLColumn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#include <memory>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLStyles.hpp" // XLStyleIndex
#include "XLXmlParser.hpp"

Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLComments.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
// #include <variant>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
// #include "XLCell.hpp"
// #include "XLCellReference.hpp"
// #include "XLColor.hpp"
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLContentTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#include <vector>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLXmlFile.hpp"
#include "XLXmlParser.hpp"

Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLDateTime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#include <ctime>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLException.hpp"

// ========== CLASS AND ENUM TYPE DEFINITIONS ========== //
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLDocument.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.

// ===== OpenXLSX Includes ===== //
#include "IZipArchive.hpp"
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLCommandQuery.hpp"
#include "XLContentTypes.hpp"
#include "XLProperties.hpp"
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLException.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#include <string> // std::string - Issue #278 should be resolved by this

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"

namespace OpenXLSX
{
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLFormula.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#include <variant>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLXmlParser.hpp"

// ========== CLASS AND ENUM TYPE DEFINITIONS ========== //
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLMergeCells.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#include <string>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLCellReference.hpp"
#include "XLXmlParser.hpp" // XMLNode, pugi node types

Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLProperties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#include <string>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLXmlFile.hpp"

namespace OpenXLSX
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLRelationships.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#include <vector>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLXmlFile.hpp"
#include "XLXmlParser.hpp"

Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLRow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#endif // _MSC_VER

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLRowData.hpp"

// ========== CLASS AND ENUM TYPE DEFINITIONS ========== //
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLRowData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <vector>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLCell.hpp"
#include "XLConstants.hpp"
#include "XLException.hpp"
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLSharedStrings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#include <string>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLXmlFile.hpp"

namespace OpenXLSX
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLSheet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#include <variant>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLCell.hpp"
#include "XLCellReference.hpp"
#include "XLColor.hpp"
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLStyles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#include <vector>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLColor.hpp"
#include "XLXmlFile.hpp"
#include "XLXmlParser.hpp"
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLWorkbook.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#include <vector>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLXmlFile.hpp"

namespace OpenXLSX
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLXmlData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#include <string>

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLContentTypes.hpp"
#include "XLXmlParser.hpp"

Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLXmlFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#endif // _MSC_VER

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"
#include "XLXmlParser.hpp"

namespace OpenXLSX
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLXmlParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.

// ===== pugixml.hpp needed for pugi::impl::xml_memory_page_type_mask, pugi::xml_node_type, pugi::char_t, pugi::node_element, pugi::xml_node, pugi::xml_attribute, pugi::xml_document
#include <external/pugixml/pugixml.hpp> // not sure why the full include path is needed within the header file
#include <XLException.hpp>
#include "XLException.hpp"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is part of the changes made to address (3).


namespace { // anonymous namespace to define constants / functions that shall not be exported from this module
constexpr const int XLMaxNamespacedNameLen = 100;
Expand Down
2 changes: 1 addition & 1 deletion OpenXLSX/headers/XLZipArchive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ YM M9 MM MM MM MM MM d' `MM. MM MM d' `MM.
#endif // _MSC_VER

// ===== OpenXLSX Includes ===== //
#include "OpenXLSX-Exports.hpp"
#include "include-exports-header.hpp"

namespace Zippy
{
Expand Down
5 changes: 5 additions & 0 deletions OpenXLSX/headers/include-exports-header.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifdef OPENXLSX_CMAKE
#include "OpenXLSX-Exports.hpp"
#else
#include "swiftpm/OpenXLSX-Exports.hpp"
#endif
6 changes: 6 additions & 0 deletions OpenXLSX/module.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module CxxOpenXLSX {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Clang module name is prefixed as CxxOpenXLSX. This is because, in Swift, situations can arise where having the same name for a module and a type contained within that module becomes inconvenient.
Since the library includes the OpenXLSX namespace, which is imported as a top-level type in Swift, the module name is adjusted to avoid conflicts with it.
Additionally, it is a common convention in Swift to use the Cxx prefix for C++ targets.

header "OpenXLSX.hpp"
export *
requires cplusplus
}

42 changes: 42 additions & 0 deletions OpenXLSX/swiftpm/OpenXLSX-Exports.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

#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 __attribute__ ((__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

#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef OPENXLSX_NO_DEPRECATED
# define OPENXLSX_NO_DEPRECATED
# endif
#endif

#endif /* OPENXLSX_EXPORT_H */
Loading