diff --git a/include/xlnt/cell/cell.hpp b/include/xlnt/cell/cell.hpp index 134faacd..630753d2 100644 --- a/include/xlnt/cell/cell.hpp +++ b/include/xlnt/cell/cell.hpp @@ -111,7 +111,9 @@ public: bool has_hyperlink() const; // style + bool has_style() const; std::size_t get_style_id() const; + void set_style_id(std::size_t style_id); const number_format &get_number_format() const; void set_number_format(const number_format &format); const font &get_font() const; diff --git a/include/xlnt/common/hash_combine.hpp b/include/xlnt/common/hash_combine.hpp new file mode 100644 index 00000000..882a270a --- /dev/null +++ b/include/xlnt/common/hash_combine.hpp @@ -0,0 +1,15 @@ +#pragma once + +#include + +namespace xlnt { + +//TODO: Can this be in source->detail, or must it be in a header? +template +inline void hash_combine(std::size_t& seed, const T& v) +{ + std::hash hasher; + seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2); +} + +} // namespace xlnt \ No newline at end of file diff --git a/include/xlnt/reader/excel_reader.hpp b/include/xlnt/reader/excel_reader.hpp index 02769a37..4c46d1e2 100644 --- a/include/xlnt/reader/excel_reader.hpp +++ b/include/xlnt/reader/excel_reader.hpp @@ -23,6 +23,7 @@ // @author: see AUTHORS file #pragma once +#include #include #include @@ -30,9 +31,15 @@ namespace xlnt { class workbook; -std::string CentralDirectorySignature(); -std::string repair_central_directory(const std::string &original); -workbook load_workbook(const std::string &filename, bool guess_types = false, bool data_only = false); -workbook load_workbook(const std::vector &bytes, bool guess_types = false, bool data_only = false); +class excel_reader +{ +public: + static std::string CentralDirectorySignature(); + static std::string repair_central_directory(const std::string &original); + + static workbook load_workbook(std::istream &stream, bool guess_types = false, bool data_only = false); + static workbook load_workbook(const std::string &filename, bool guess_types = false, bool data_only = false); + static workbook load_workbook(const std::vector &bytes, bool guess_types = false, bool data_only = false); +}; } // namespace xlnt diff --git a/include/xlnt/reader/shared_strings_reader.hpp b/include/xlnt/reader/shared_strings_reader.hpp index 01933814..0c575c75 100644 --- a/include/xlnt/reader/shared_strings_reader.hpp +++ b/include/xlnt/reader/shared_strings_reader.hpp @@ -28,9 +28,15 @@ namespace xlnt { -std::vector read_shared_strings(const std::string &xml_string); -void read_string_table(const std::string &xml_source); -std::string get_string(); -std::string get_text(); - +class zip_file; + +class shared_strings_reader +{ +public: + std::vector read_strings(zip_file &archive); + void read_string_table(const std::string &xml_source); + std::string get_string(); + std::string get_text(); +}; + } // namespace xlnt diff --git a/include/xlnt/reader/style_reader.hpp b/include/xlnt/reader/style_reader.hpp index 034fc6a8..35137951 100644 --- a/include/xlnt/reader/style_reader.hpp +++ b/include/xlnt/reader/style_reader.hpp @@ -27,21 +27,60 @@ #include #include -#include "style.h" +#include "xlnt/workbook/workbook.hpp" + +namespace pugi { +class xml_node; +} // namespace pugi namespace xlnt { + +class border; +class fill; +class font; +class named_style; +class number_format; +class style; +class zip_file; -void read_styles(); -void read_custom_num_formats(); -void read_color_index(); -void read_dxfs(); -void read_fonts(); -void read_fills(); -void read_borders(); -void read_named_styles(); -void read_style_names(); -void read_cell_styles(); -void read_xfs(); -void read_style_table(); +class style_reader +{ +public: + style_reader(workbook &wb); + + void read_styles(zip_file &archive); + + const std::vector