add macro to classes and functions for dll export/import

This commit is contained in:
Thomas Fussell 2015-11-04 00:36:14 -05:00
parent 706ece0d27
commit 3bb988c422
60 changed files with 239 additions and 106 deletions

View File

@ -20,10 +20,12 @@ foreach(file ${files})
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endforeach(file) endforeach(file)
message(STATUS "Uninstalling @INC_DEST_DIR@/xlnt")
exec_program("@CMAKE_COMMAND@" exec_program("@CMAKE_COMMAND@"
ARGS "-E remove_directory @INC_DEST_DIR@/xlnt") ARGS "-E remove_directory @INC_DEST_DIR@/xlnt"
OUTPUT_VARIABLE rm_out OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval RETURN_VALUE rm_retval
) )
if(NOT "${rm_retval}" STREQUAL 0) if(NOT "${rm_retval}" STREQUAL 0)

View File

@ -17,6 +17,7 @@ if(NOT LIB_DEST_DIR)
endif() endif()
include_directories(../include) include_directories(../include)
include_directories(../include/xlnt)
include_directories(../source) include_directories(../source)
include_directories(../third-party/miniz) include_directories(../third-party/miniz)
include_directories(../third-party/pugixml/src) include_directories(../third-party/pugixml/src)

View File

@ -29,6 +29,8 @@
#include <xlnt/cell/types.hpp> #include <xlnt/cell/types.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
enum class calendar; enum class calendar;
@ -60,7 +62,7 @@ namespace detail { struct cell_impl; }
/// and any other features of an Excel cell.Utilities for referencing /// and any other features of an Excel cell.Utilities for referencing
/// cells using Excel's 'A1' column/row nomenclature are also provided. /// cells using Excel's 'A1' column/row nomenclature are also provided.
/// </remarks> /// </remarks>
class cell class XLNT_CLASS cell
{ {
public: public:
/// <summary> /// <summary>
@ -407,7 +409,7 @@ private:
/// Convenience function for writing cell to an ostream. /// Convenience function for writing cell to an ostream.
/// Uses cell::to_string() internally. /// Uses cell::to_string() internally.
/// </summary> /// </summary>
inline std::ostream &operator<<(std::ostream &stream, const xlnt::cell &cell) inline std::ostream & XLNT_FUNCTION operator<<(std::ostream &stream, const xlnt::cell &cell)
{ {
return stream << cell.to_string(); return stream << cell.to_string();
} }

View File

@ -28,6 +28,8 @@
#include <xlnt/cell/types.hpp> #include <xlnt/cell/types.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class cell_reference; class cell_reference;
@ -37,7 +39,7 @@ class range_reference;
/// Functor for hashing a cell reference. /// Functor for hashing a cell reference.
/// Allows for use of std::unordered_set<cell_reference, cel_reference_hash> and similar. /// Allows for use of std::unordered_set<cell_reference, cel_reference_hash> and similar.
/// </summary> /// </summary>
struct cell_reference_hash struct XLNT_CLASS cell_reference_hash
{ {
std::size_t operator()(const cell_reference &k) const; std::size_t operator()(const cell_reference &k) const;
}; };
@ -49,7 +51,7 @@ struct cell_reference_hash
/// can be initialized from a string of this form or a 1-indexed ordered pair of the form /// can be initialized from a string of this form or a 1-indexed ordered pair of the form
/// column, row. /// column, row.
/// </summary> /// </summary>
class cell_reference class XLNT_CLASS cell_reference
{ {
public: public:
/// <summary> /// <summary>

View File

@ -2,6 +2,8 @@
#include <string> #include <string>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class cell; class cell;
@ -10,7 +12,7 @@ namespace detail { struct comment_impl; }
/// <summary> /// <summary>
/// A comment can be applied to a cell to provide extra information. /// A comment can be applied to a cell to provide extra information.
/// </summary> /// </summary>
class comment class XLNT_CLASS comment
{ {
public: public:
/// <summary> /// <summary>

View File

@ -26,6 +26,8 @@
#include <cstdint> #include <cstdint>
#include <string> #include <string>
#include "xlnt_config.hpp"
// We might want to change these types for various optimizations in the future // We might want to change these types for various optimizations in the future
// so use typedefs. // so use typedefs.
@ -41,7 +43,7 @@ using row_t = std::uint32_t;
/// or as a 1-indexed index. This class encapsulates both of these forms of /// or as a 1-indexed index. This class encapsulates both of these forms of
/// column referencing and allows for convertions between them. /// column referencing and allows for convertions between them.
/// </summary> /// </summary>
class column_t class XLNT_CLASS column_t
{ {
public: public:
using index_t = std::uint32_t; using index_t = std::uint32_t;
@ -315,7 +317,7 @@ public:
/// Functor for hashing a column. /// Functor for hashing a column.
/// Allows for use of std::unordered_set<column, column_hash> and similar. /// Allows for use of std::unordered_set<column, column_hash> and similar.
/// </summary> /// </summary>
struct column_hash struct XLNT_CLASS column_hash
{ {
std::size_t operator()(const column_t &k) const; std::size_t operator()(const column_t &k) const;
}; };

View File

@ -23,12 +23,14 @@
// @author: see AUTHORS file // @author: see AUTHORS file
#pragma once #pragma once
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class worksheet; class worksheet;
struct drawing_struct; struct drawing_struct;
class drawing class XLNT_CLASS drawing
{ {
public: public:
drawing(); drawing();

View File

@ -1,6 +1,10 @@
#pragma once
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class tokenizer class XLNT_CLASS tokenizer
{ {
}; };

View File

@ -1,12 +1,16 @@
#pragma once
#include <string> #include <string>
#include <vector> #include <vector>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class cell_reference; class cell_reference;
class tokenizer; class tokenizer;
class translator class XLNT_CLASS translator
{ {
translator(const std::string &formula, const cell_reference &ref); translator(const std::string &formula, const cell_reference &ref);

View File

@ -27,12 +27,14 @@
#include <xlnt/utils/datetime.hpp> #include <xlnt/utils/datetime.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
/// <summary> /// <summary>
/// High-level properties of the document. /// High-level properties of the document.
/// </summary> /// </summary>
class document_properties class XLNT_CLASS document_properties
{ {
public: public:
document_properties(); document_properties();

View File

@ -3,9 +3,11 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class default_type class XLNT_CLASS default_type
{ {
public: public:
default_type(); default_type();
@ -27,7 +29,7 @@ class default_type
std::string content_type_; std::string content_type_;
}; };
class override_type class XLNT_CLASS override_type
{ {
public: public:
override_type(); override_type();
@ -49,7 +51,7 @@ class override_type
std::string content_type_; std::string content_type_;
}; };
class manifest class XLNT_CLASS manifest
{ {
public: public:
void add_default_type(const std::string &extension, const std::string &content_type); void add_default_type(const std::string &extension, const std::string &content_type);

View File

@ -7,6 +7,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "xlnt_config.hpp"
// Note: this comes from https://github.com/tfussell/miniz-cpp // Note: this comes from https://github.com/tfussell/miniz-cpp
struct mz_zip_archive_tag; struct mz_zip_archive_tag;
@ -16,7 +18,7 @@ namespace xlnt {
/// <summary> /// <summary>
/// Information about a specific file in zip_file. /// Information about a specific file in zip_file.
/// </summary> /// </summary>
struct zip_info struct XLNT_CLASS zip_info
{ {
/// <summary> /// <summary>
/// A struct representing a particular date and time. /// A struct representing a particular date and time.
@ -57,7 +59,7 @@ struct zip_info
/// A compressed archive file that exists in memory which can read /// A compressed archive file that exists in memory which can read
/// or write to and from the filesystem, std::iostreams, and byte vectors. /// or write to and from the filesystem, std::iostreams, and byte vectors.
/// </summary> /// </summary>
class zip_file class XLNT_CLASS zip_file
{ {
public: public:
zip_file(); zip_file();

View File

@ -28,11 +28,13 @@
#include <xlnt/cell/comment.hpp> #include <xlnt/cell/comment.hpp>
#include <xlnt/worksheet/worksheet.hpp> #include <xlnt/worksheet/worksheet.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class xml_document; class xml_document;
class comment_serializer class XLNT_CLASS comment_serializer
{ {
comment_serializer(worksheet sheet); comment_serializer(worksheet sheet);

View File

@ -1,12 +1,14 @@
#pragma once #pragma once
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
/// <summary> /// <summary>
/// Specifies the encoding used in a worksheet. /// Specifies the encoding used in a worksheet.
/// This isn't really supported yet. /// This isn't really supported yet.
/// </summary> /// </summary>
enum class encoding enum class XLNT_CLASS encoding
{ {
utf8, utf8,
latin1, latin1,

View File

@ -30,6 +30,8 @@
#include <xlnt/packaging/zip_file.hpp> #include <xlnt/packaging/zip_file.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class workbook; class workbook;
@ -38,7 +40,7 @@ class workbook;
/// Handles reading and writing workbooks from an actual XLSX archive /// Handles reading and writing workbooks from an actual XLSX archive
/// using other serializers. /// using other serializers.
/// </summary> /// </summary>
class excel_serializer class XLNT_CLASS excel_serializer
{ {
public: public:
/// <summary> /// <summary>

View File

@ -2,12 +2,14 @@
#include <string> #include <string>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class manifest; class manifest;
class xml_document; class xml_document;
class manifest_serializer class XLNT_CLASS manifest_serializer
{ {
public: public:
manifest_serializer(manifest &m); manifest_serializer(manifest &m);

View File

@ -3,6 +3,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class relationship; class relationship;
@ -11,7 +13,7 @@ class zip_file;
/// <summary> /// <summary>
/// Reads and writes collections of relationshps for a particular file. /// Reads and writes collections of relationshps for a particular file.
/// </summary> /// </summary>
class relationship_serializer class XLNT_CLASS relationship_serializer
{ {
public: public:
/// <summary> /// <summary>

View File

@ -26,11 +26,13 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class xml_document; class xml_document;
class shared_strings_serializer class XLNT_CLASS shared_strings_serializer
{ {
public: public:
static bool read_shared_strings(const xml_document &xml, std::vector<std::string> &strings); static bool read_shared_strings(const xml_document &xml, std::vector<std::string> &strings);

View File

@ -29,6 +29,8 @@
#include <xlnt/workbook/workbook.hpp> #include <xlnt/workbook/workbook.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class alignment; class alignment;
@ -48,7 +50,7 @@ class xml_node;
/// <summary> /// <summary>
/// Reads and writes xl/styles.xml from/to an associated workbook. /// Reads and writes xl/styles.xml from/to an associated workbook.
/// </summary> /// </summary>
class style_serializer class XLNT_CLASS style_serializer
{ {
public: public:
/// <summary> /// <summary>

View File

@ -25,12 +25,14 @@
#include <string> #include <string>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class theme; class theme;
class xml_document; class xml_document;
class theme_serializer class XLNT_CLASS theme_serializer
{ {
public: public:
bool read_theme(const xml_document &xml, theme &t); bool read_theme(const xml_document &xml, theme &t);

View File

@ -26,6 +26,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class document_properties; class document_properties;
@ -37,7 +39,7 @@ class zip_file;
class xml_document; class xml_document;
class xml_node; class xml_node;
class workbook_serializer class XLNT_CLASS workbook_serializer
{ {
public: public:
using string_pair = std::pair<std::string, std::string>; using string_pair = std::pair<std::string, std::string>;

View File

@ -28,6 +28,8 @@
#include <xlnt/worksheet/worksheet.hpp> #include <xlnt/worksheet/worksheet.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class relationship; class relationship;
@ -35,7 +37,7 @@ class workbook;
class worksheet; class worksheet;
class xml_document; class xml_document;
class worksheet_serializer class XLNT_CLASS worksheet_serializer
{ {
public: public:
worksheet_serializer(worksheet sheet); worksheet_serializer(worksheet sheet);

View File

@ -4,15 +4,15 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
namespace detail { namespace detail { struct xml_document_impl; }
struct xml_document_impl;
} // namespace detail
class xml_node; class xml_node;
class xml_serializer; class xml_serializer;
class xml_document class XLNT_CLASS xml_document
{ {
public: public:
using string_pair = std::pair<std::string, std::string>; using string_pair = std::pair<std::string, std::string>;

View File

@ -4,14 +4,14 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
namespace detail { namespace detail { struct xml_node_impl; }
struct xml_node_impl;
} // namespace detail
class xml_document; class xml_document;
class xml_node class XLNT_CLASS xml_node
{ {
public: public:
using string_pair = std::pair<std::string, std::string>; using string_pair = std::pair<std::string, std::string>;

View File

@ -2,12 +2,14 @@
#include <string> #include <string>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class xml_document; class xml_document;
class xml_node; class xml_node;
class xml_serializer class XLNT_CLASS xml_serializer
{ {
public: public:
static std::string serialize(const xml_document &xml); static std::string serialize(const xml_document &xml);

View File

@ -25,12 +25,14 @@
#include <xlnt/utils/hash_combine.hpp> #include <xlnt/utils/hash_combine.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
/// <summary> /// <summary>
/// Alignment options for use in styles. /// Alignment options for use in styles.
/// </summary> /// </summary>
class alignment class XLNT_CLASS alignment
{ {
public: public:
enum class horizontal_alignment enum class horizontal_alignment

View File

@ -29,9 +29,11 @@
#include <xlnt/utils/hash_combine.hpp> #include <xlnt/utils/hash_combine.hpp>
#include <xlnt/styles/side.hpp> #include <xlnt/styles/side.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
enum class diagonal_direction enum class XLNT_CLASS diagonal_direction
{ {
none, none,
up, up,
@ -39,7 +41,7 @@ enum class diagonal_direction
both both
}; };
class border class XLNT_CLASS border
{ {
public: public:
static border default_border(); static border default_border();

View File

@ -27,9 +27,11 @@
#include <xlnt/utils/hash_combine.hpp> #include <xlnt/utils/hash_combine.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class color class XLNT_CLASS color
{ {
public: public:
enum class type enum class type

View File

@ -26,9 +26,11 @@
#include <xlnt/styles/color.hpp> #include <xlnt/styles/color.hpp>
#include <xlnt/utils/hash_combine.hpp> #include <xlnt/utils/hash_combine.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class fill class XLNT_CLASS fill
{ {
public: public:
enum class type enum class type

View File

@ -28,11 +28,13 @@
#include <xlnt/utils/hash_combine.hpp> #include <xlnt/utils/hash_combine.hpp>
#include <xlnt/styles/color.hpp> #include <xlnt/styles/color.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class style; class style;
class font class XLNT_CLASS font
{ {
public: public:
enum class underline_style enum class underline_style

View File

@ -23,11 +23,13 @@
// @author: see AUTHORS file // @author: see AUTHORS file
#pragma once #pragma once
#include "style.hpp" #include <xlnt/styles/style.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class named_style class XLNT_CLASS named_style
{ {
public: public:
named_style(); named_style();

View File

@ -27,9 +27,11 @@
#include <unordered_map> #include <unordered_map>
#include <utility> #include <utility>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class number_format class XLNT_CLASS number_format
{ {
public: public:
static const number_format general(); static const number_format general();

View File

@ -27,9 +27,11 @@
#include <xlnt/utils/hash_combine.hpp> #include <xlnt/utils/hash_combine.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class protection class XLNT_CLASS protection
{ {
public: public:
enum class type enum class type

View File

@ -27,9 +27,11 @@
#include <xlnt/styles/color.hpp> #include <xlnt/styles/color.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
enum class border_style enum class XLNT_CLASS border_style
{ {
none, none,
dashdot, dashdot,
@ -47,7 +49,7 @@ enum class border_style
thin thin
}; };
class side class XLNT_CLASS side
{ {
public: public:
side(); side();

View File

@ -30,11 +30,13 @@
#include <xlnt/styles/number_format.hpp> #include <xlnt/styles/number_format.hpp>
#include <xlnt/styles/protection.hpp> #include <xlnt/styles/protection.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class workbook; class workbook;
class style class XLNT_CLASS style
{ {
public: public:
style(); style();

View File

@ -24,13 +24,15 @@
#include <string> #include <string>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
/// <summary> /// <summary>
/// An enumeration of possible base dates. /// An enumeration of possible base dates.
/// Dates in Excel are stored as days since this base date. /// Dates in Excel are stored as days since this base date.
/// </summary> /// </summary>
enum class calendar enum class XLNT_CLASS calendar
{ {
windows_1900, windows_1900,
mac_1904 mac_1904
@ -41,7 +43,7 @@ enum class calendar
/// It can also be initialized as a number of days since a base date /// It can also be initialized as a number of days since a base date
/// using date::from_number. /// using date::from_number.
/// </summary> /// </summary>
struct date struct XLNT_CLASS date
{ {
/// <summary> /// <summary>
/// Return the current date according to the system time. /// Return the current date according to the system time.
@ -78,7 +80,7 @@ struct date
/// minute, second, and microsecond (0-999999). /// minute, second, and microsecond (0-999999).
/// It can also be initialized as a fraction of a day using time::from_number. /// It can also be initialized as a fraction of a day using time::from_number.
/// </summary> /// </summary>
struct time struct XLNT_CLASS time
{ {
/// <summary> /// <summary>
/// Return the current time according to the system time. /// Return the current time according to the system time.
@ -107,7 +109,7 @@ struct time
int microsecond; int microsecond;
}; };
struct datetime struct XLNT_CLASS datetime
{ {
/// <summary> /// <summary>
/// Return the current date and time according to the system time. /// Return the current date and time according to the system time.
@ -158,7 +160,7 @@ struct datetime
/// Represents a span of time between two datetimes. This is /// Represents a span of time between two datetimes. This is
/// not fully supported yet. /// not fully supported yet.
/// </summary> /// </summary>
struct timedelta struct XLNT_CLASS timedelta
{ {
static timedelta from_number(long double number); static timedelta from_number(long double number);

View File

@ -27,12 +27,14 @@
#include <xlnt/cell/types.hpp> #include <xlnt/cell/types.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
/// <summary> /// <summary>
/// Error for converting between numeric and A1-style cell references. /// Error for converting between numeric and A1-style cell references.
/// </summary> /// </summary>
class cell_coordinates_exception : public std::runtime_error class XLNT_CLASS cell_coordinates_exception : public std::runtime_error
{ {
public: public:
cell_coordinates_exception(column_t column, row_t row); cell_coordinates_exception(column_t column, row_t row);
@ -43,7 +45,7 @@ class cell_coordinates_exception : public std::runtime_error
/// The data submitted which cannot be used directly in Excel files. It /// The data submitted which cannot be used directly in Excel files. It
/// must be removed or escaped. /// must be removed or escaped.
/// </summary> /// </summary>
class illegal_character_error : public std::runtime_error class XLNT_CLASS illegal_character_error : public std::runtime_error
{ {
public: public:
illegal_character_error(char c); illegal_character_error(char c);
@ -52,7 +54,7 @@ class illegal_character_error : public std::runtime_error
/// <summary> /// <summary>
/// Error for bad column names in A1-style cell references. /// Error for bad column names in A1-style cell references.
/// </summary> /// </summary>
class column_string_index_exception : public std::runtime_error class XLNT_CLASS column_string_index_exception : public std::runtime_error
{ {
public: public:
column_string_index_exception(); column_string_index_exception();
@ -61,7 +63,7 @@ class column_string_index_exception : public std::runtime_error
/// <summary> /// <summary>
/// Error for any data type inconsistencies. /// Error for any data type inconsistencies.
/// </summary> /// </summary>
class data_type_exception : public std::runtime_error class XLNT_CLASS data_type_exception : public std::runtime_error
{ {
public: public:
data_type_exception(); data_type_exception();
@ -70,7 +72,7 @@ class data_type_exception : public std::runtime_error
/// <summary> /// <summary>
/// Error for badly formatted named ranges. /// Error for badly formatted named ranges.
/// </summary> /// </summary>
class named_range_exception : public std::runtime_error class XLNT_CLASS named_range_exception : public std::runtime_error
{ {
public: public:
named_range_exception(); named_range_exception();
@ -79,7 +81,7 @@ class named_range_exception : public std::runtime_error
/// <summary> /// <summary>
/// Error for bad sheet names. /// Error for bad sheet names.
/// </summary> /// </summary>
class sheet_title_exception : public std::runtime_error class XLNT_CLASS sheet_title_exception : public std::runtime_error
{ {
public: public:
sheet_title_exception(const std::string &title); sheet_title_exception(const std::string &title);
@ -88,7 +90,7 @@ class sheet_title_exception : public std::runtime_error
/// <summary> /// <summary>
/// Error for trying to open a non-ooxml file. /// Error for trying to open a non-ooxml file.
/// </summary> /// </summary>
class invalid_file_exception : public std::runtime_error class XLNT_CLASS invalid_file_exception : public std::runtime_error
{ {
public: public:
invalid_file_exception(const std::string &filename); invalid_file_exception(const std::string &filename);
@ -97,7 +99,7 @@ class invalid_file_exception : public std::runtime_error
/// <summary> /// <summary>
/// Error for trying to modify a read-only workbook. /// Error for trying to modify a read-only workbook.
/// </summary> /// </summary>
class read_only_workbook_exception : public std::runtime_error class XLNT_CLASS read_only_workbook_exception : public std::runtime_error
{ {
public: public:
read_only_workbook_exception(); read_only_workbook_exception();
@ -106,7 +108,7 @@ class read_only_workbook_exception : public std::runtime_error
/// <summary> /// <summary>
/// Error when a references number format is not in the stylesheet. /// Error when a references number format is not in the stylesheet.
/// </summary> /// </summary>
class missing_number_format : public std::runtime_error class XLNT_CLASS missing_number_format : public std::runtime_error
{ {
public: public:
missing_number_format(); missing_number_format();
@ -115,13 +117,13 @@ class missing_number_format : public std::runtime_error
/// <summary> /// <summary>
/// Error when an attribute value is invalid. /// Error when an attribute value is invalid.
/// </summary> /// </summary>
class attribute_error : public std::runtime_error class XLNT_CLASS attribute_error : public std::runtime_error
{ {
public: public:
attribute_error(); attribute_error();
}; };
class value_error : public std::runtime_error class XLNT_CLASS value_error : public std::runtime_error
{ {
public: public:
value_error() : std::runtime_error("") value_error() : std::runtime_error("")

View File

@ -2,11 +2,13 @@
#include <functional> #include <functional>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
// TODO: Can this be in source->detail, or must it be in a header? // TODO: Can this be in source->detail, or must it be in a header?
template <class T> template <class T>
inline void hash_combine(std::size_t &seed, const T &v) inline void XLNT_FUNCTION hash_combine(std::size_t &seed, const T &v)
{ {
std::hash<T> hasher; std::hash<T> hasher;
seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2); seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);

View File

@ -25,12 +25,14 @@
#include <string> #include <string>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
/// <summary> /// <summary>
/// Security information about the document. /// Security information about the document.
/// </summary> /// </summary>
class document_security class XLNT_CLASS document_security
{ {
public: public:
document_security(); document_security();

View File

@ -1,8 +1,11 @@
#pragma once #pragma once
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class external_book class XLNT_CLASS external_book
{ {
}; };
} }

View File

@ -3,14 +3,16 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class range_reference; class range_reference;
class worksheet; class worksheet;
std::vector<std::pair<std::string, std::string>> split_named_range(const std::string &named_range_string); std::vector<std::pair<std::string, std::string>> XLNT_FUNCTION split_named_range(const std::string &named_range_string);
class named_range class XLNT_CLASS named_range
{ {
public: public:
using target = std::pair<worksheet, range_reference>; using target = std::pair<worksheet, range_reference>;

View File

@ -1,8 +1,10 @@
#pragma once #pragma once
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class theme class XLNT_CLASS theme
{ {
}; };

View File

@ -31,6 +31,8 @@
#include <xlnt/packaging/relationship.hpp> #include <xlnt/packaging/relationship.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class alignment; class alignment;
@ -55,14 +57,12 @@ class zip_file;
enum class encoding; enum class encoding;
namespace detail { namespace detail { struct workbook_impl; } // namespace detail
struct workbook_impl;
} // namespace detail
/// <summary> /// <summary>
/// workbook is the container for all other parts of the document. /// workbook is the container for all other parts of the document.
/// </summary> /// </summary>
class workbook class XLNT_CLASS workbook
{ {
public: public:
class iterator class iterator

View File

@ -7,12 +7,14 @@
#include <xlnt/worksheet/major_order.hpp> #include <xlnt/worksheet/major_order.hpp>
#include <xlnt/worksheet/worksheet.hpp> #include <xlnt/worksheet/worksheet.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class cell; class cell;
class range_reference; class range_reference;
class cell_vector class XLNT_CLASS cell_vector
{ {
public: public:
template <bool is_const = true> template <bool is_const = true>

View File

@ -23,9 +23,11 @@
// @author: see AUTHORS file // @author: see AUTHORS file
#pragma once #pragma once
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class column_properties class XLNT_CLASS column_properties
{ {
public: public:
long double width; long double width;

View File

@ -1,8 +1,10 @@
#pragma once #pragma once
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
enum class major_order enum class XLNT_CLASS major_order
{ {
column, column,
row row

View File

@ -23,9 +23,11 @@
// @author: see AUTHORS file // @author: see AUTHORS file
#pragma once #pragma once
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class page_margins class XLNT_CLASS page_margins
{ {
public: public:
page_margins() : default_(true), top_(0), left_(0), bottom_(0), right_(0), header_(0), footer_(0) page_margins() : default_(true), top_(0), left_(0), bottom_(0), right_(0), header_(0), footer_(0)

View File

@ -23,9 +23,11 @@
// @author: see AUTHORS file // @author: see AUTHORS file
#pragma once #pragma once
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
struct page_setup struct XLNT_CLASS page_setup
{ {
enum class page_break enum class page_break
{ {

View File

@ -22,9 +22,11 @@
// @author: see AUTHORS file // @author: see AUTHORS file
#pragma once #pragma once
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class pane class XLNT_CLASS pane
{ {
}; };

View File

@ -32,9 +32,11 @@
#include <xlnt/worksheet/range_reference.hpp> #include <xlnt/worksheet/range_reference.hpp>
#include <xlnt/worksheet/worksheet.hpp> #include <xlnt/worksheet/worksheet.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class range class XLNT_CLASS range
{ {
public: public:
template <bool is_const = true> template <bool is_const = true>

View File

@ -24,9 +24,11 @@
#include <xlnt/cell/cell_reference.hpp> #include <xlnt/cell/cell_reference.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class range_reference class XLNT_CLASS range_reference
{ {
public: public:
/// <summary> /// <summary>
@ -92,22 +94,22 @@ class range_reference
cell_reference bottom_right_; cell_reference bottom_right_;
}; };
inline bool operator==(const std::string &reference_string, const range_reference &ref) inline bool XLNT_FUNCTION operator==(const std::string &reference_string, const range_reference &ref)
{ {
return ref == reference_string; return ref == reference_string;
} }
inline bool operator==(const char *reference_string, const range_reference &ref) inline bool XLNT_FUNCTION operator==(const char *reference_string, const range_reference &ref)
{ {
return ref == reference_string; return ref == reference_string;
} }
inline bool operator!=(const std::string &reference_string, const range_reference &ref) inline bool XLNT_FUNCTION operator!=(const std::string &reference_string, const range_reference &ref)
{ {
return ref != reference_string; return ref != reference_string;
} }
inline bool operator!=(const char *reference_string, const range_reference &ref) inline bool XLNT_FUNCTION operator!=(const char *reference_string, const range_reference &ref)
{ {
return ref != reference_string; return ref != reference_string;
} }

View File

@ -23,9 +23,11 @@
// @author: see AUTHORS file // @author: see AUTHORS file
#pragma once #pragma once
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class row_properties class XLNT_CLASS row_properties
{ {
public: public:
long double height; long double height;

View File

@ -22,9 +22,11 @@
// @author: see AUTHORS file // @author: see AUTHORS file
#pragma once #pragma once
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class selection class XLNT_CLASS selection
{ {
}; };

View File

@ -2,9 +2,11 @@
#include <string> #include <string>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class sheet_protection class XLNT_CLASS sheet_protection
{ {
public: public:
static std::string hash_password(const std::string &password); static std::string hash_password(const std::string &password);

View File

@ -22,9 +22,11 @@
// @author: see AUTHORS file // @author: see AUTHORS file
#pragma once #pragma once
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class sheet_view class XLNT_CLASS sheet_view
{ {
}; };

View File

@ -33,6 +33,8 @@
#include <xlnt/packaging/relationship.hpp> #include <xlnt/packaging/relationship.hpp>
#include <xlnt/worksheet/page_setup.hpp> #include <xlnt/worksheet/page_setup.hpp>
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class cell; class cell;
@ -47,14 +49,12 @@ class workbook;
struct date; struct date;
namespace detail { namespace detail { struct worksheet_impl; }
struct worksheet_impl;
} // namespace detail
/// <summary> /// <summary>
/// Worksheet header /// Worksheet header
/// </summary> /// </summary>
class header class XLNT_CLASS header
{ {
public: public:
header(); header();
@ -94,7 +94,7 @@ class header
/// <summary> /// <summary>
/// Worksheet footer /// Worksheet footer
/// </summary> /// </summary>
class footer class XLNT_CLASS footer
{ {
public: public:
footer(); footer();
@ -134,7 +134,7 @@ class footer
/// <summary> /// <summary>
/// Worksheet header and footer /// Worksheet header and footer
/// </summary> /// </summary>
class header_footer class XLNT_CLASS header_footer
{ {
public: public:
header_footer(); header_footer();
@ -185,7 +185,7 @@ class header_footer
/// <summary> /// <summary>
/// Worksheet margins /// Worksheet margins
/// </summary> /// </summary>
struct margins struct XLNT_CLASS margins
{ {
public: public:
margins() : default_(true), top_(0), left_(0), bottom_(0), right_(0), header_(0), footer_(0) margins() : default_(true), top_(0), left_(0), bottom_(0), right_(0), header_(0), footer_(0)
@ -264,7 +264,7 @@ struct margins
/// <summary> /// <summary>
/// A worksheet is a 2D array of cells. /// A worksheet is a 2D array of cells.
/// </summary> /// </summary>
class worksheet class XLNT_CLASS worksheet
{ {
public: public:
worksheet(); worksheet();

View File

@ -23,9 +23,11 @@
// @author: see AUTHORS file // @author: see AUTHORS file
#pragma once #pragma once
#include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {
class worksheet_properties class XLNT_CLASS worksheet_properties
{ {
}; };

View File

@ -25,7 +25,7 @@
#include <string> #include <string>
#include <xlnt/config.hpp> #include "xlnt_config.hpp"
#include <xlnt/cell/cell.hpp> #include <xlnt/cell/cell.hpp>
#include <xlnt/cell/cell_reference.hpp> #include <xlnt/cell/cell_reference.hpp>

View File

@ -54,4 +54,27 @@ enum class limit_style
/// </summary> /// </summary>
const limit_style LimitStyle = limit_style::openpyxl; const limit_style LimitStyle = limit_style::openpyxl;
} // If no API is defined, assume default
#ifndef XLNT_API
#ifdef _MSC_VER
#ifdef _DLL
#define XLNT_API __declspec(dllexport)
#else
#define XLNT_API __declspec(dllimport)
#endif
#else
#define XLNT_API
#endif
#endif
// If no API for classes is defined, assume default
#ifndef XLNT_CLASS
#define XLNT_CLASS XLNT_API
#endif
// If no API for functions is defined, assume default
#ifndef XLNT_FUNCTION
#define XLNT_FUNCTION XLNT_API
#endif
} // namespace xlnt

View File

@ -1,8 +1,8 @@
#include <limits> #include <limits>
#include <xlnt/config.hpp> #include <detail/constants.hpp>
#include "constants.hpp" #include "xlnt_config.hpp"
namespace xlnt { namespace xlnt {