clean up styles and hashing, add license boilerplate to all files, update readme, finish moving implementations to source files

This commit is contained in:
Thomas Fussell 2015-12-24 15:51:11 -05:00
parent 7dc48c7c0b
commit 537b76dd3f
89 changed files with 2726 additions and 941 deletions

3
.gitmodules vendored
View File

@ -10,3 +10,6 @@
[submodule "third-party/utfcpp"]
path = third-party/utfcpp
url = https://github.com/nemtrif/utfcpp
[submodule "third-party/Optional"]
path = third-party/Optional
url = https://github.com/akrzemi1/Optional

View File

@ -6,8 +6,6 @@
[![Coveralls Coverage Status](https://coveralls.io/repos/tfussell/xlnt/badge.svg?branch=master&service=github)](https://coveralls.io/github/tfussell/xlnt?branch=master)
[![ReadTheDocs Documentation Status](https://readthedocs.org/projects/xlnt/badge/?version=latest)](http://xlnt.readthedocs.org/en/latest/?badge=latest)
[![License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://opensource.org/licenses/MIT)
[![Github Releases](https://img.shields.io/github/release/tfussell/xlnt.svg)](https://github.com/tfussell/xlnt/releases)
[![Github Issues](https://img.shields.io/github/issues/tfussell/xlnt.svg)](http://github.com/tfussell/xlnt/issues)
## Introduction
xlnt is a C++14 library for reading, writing, and modifying XLSX files as described in [ECMA 376](http://www.ecma-international.org/publications/standards/Ecma-376.htm). The API is based on [openpyxl](https://bitbucket.org/openpyxl/openpyxl), a Python library to read/write Excel 2007 xlsx/xlsm files, and ultimately on [PHPExcel](https://github.com/PHPOffice/PHPExcel), pure PHP library for reading and writing spreadsheet files upon which openpyxl was based. This project is still very much a work in progress, but the core development work is complete.
@ -16,10 +14,11 @@ xlnt is a C++14 library for reading, writing, and modifying XLSX files as descri
Including xlnt in your project
```c++
// with -std=c++14 -Ixlnt/include -Lxlnt/lib -lxlnt
// can also use the generated "xlnt.pc" in ./build directory with pkg-config to get these flags
#include <xlnt/xlnt.hpp>
```
Creating a new spreadsheet and saving it
Creating a new spreadsheet and saving it as book1.xlsx
```c++
xlnt::workbook wb;
xlnt::worksheet ws = wb.get_active_sheet();
@ -31,12 +30,12 @@ ws.freeze_panes("B2");
wb.save("book1.xlsx");
```
Opening an existing spreadsheet and printing all rows
Opening an existing spreadsheet, book2.xlsx, and printing all cells
```c++
xlnt::workbook wb2;
wb2.load("book2.xlsx");
// no need to use references, iterators are only wrappers around pointers to memory in the workbook
// no need to use references, "cell", "range", and "worksheet" classes are only wrappers around pointers to memory in the workbook
for(auto row : wb2["sheet2"].rows())
{
for(auto cell : row)
@ -47,26 +46,35 @@ for(auto row : wb2["sheet2"].rows())
```
## Building
xlnt is regularly built and passes all 200+ tests in GCC 4.8.2, VS2015, and Clang (using Apple LLVM 7.0).
xlnt uses continous integration and passes all 200+ tests in GCC 4.9, VS2015, and Clang (using Apple LLVM 7.0).
Build configurations for Visual Studio 2015, GNU Make, and Xcode can be created using [cmake](https://cmake.org/) and the cmake scripts in the project's cmake directory. To make this process easier, two python scripts are provided, configure and clean. configure will create build workspaces using the system's default cmake generator or the generator name provided as its first argument. Resulting build files can be found in the created directory "./build". The clean script simply removes ./bin, ./lib, and ./build directories. For Windows, two batch files, configure.bat and clean.bat, are wrappers around the correspnding scripts for convenience (can be double-clicked from Explorer).
Build configurations for Visual Studio 2015, GNU Make, and Xcode can be created using [cmake](https://cmake.org/) and the cmake scripts in the project's cmake directory. To make this process easier, two python scripts are provided, configure and clean. configure will create build workspaces using the system's default cmake generator or the generator name provided as its first argument (more information on generators can be found [here](https://cmake.org/cmake/help/v3.3/manual/cmake-generators.7.html)). Resulting build files can be found in the created directory "./build". The clean script simply removes ./bin, ./lib, and ./build directories. For Windows, two batch files, configure.bat and clean.bat, are wrappers around the correspnding scripts for convenience (can be double-clicked from Explorer).
Example Build:
Example Build (shared library by default):
```bash
./configure
cd build
make
```
Example Build, static library with tests:
```bash
./configure --enable-static --disable-shared --enable-tests
cd build
make
```
## Dependencies
xlnt uses the following libraries, which are included in the source tree (pugixml and cxxtest as [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules#Cloning-a-Project-with-Submodules)) for convenience:
xlnt uses the following libraries, which are included in the source tree (all but miniz as [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules#Cloning-a-Project-with-Submodules)) for convenience:
- [miniz v1.15_r4](https://code.google.com/p/miniz/) (public domain/unlicense)
- [pugixml v1.6](http://pugixml.org/) (MIT license)
- [Optional](https://github.com/akrzemi1/Optional) (Boost Software License, Version 1.0)
- [utfcpp v2.3.4](http://utfcpp.sourceforge.net/) (Boost Software License, Version 1.0)
- [cxxtest v4.4](http://cxxtest.com/) (LGPLv3 license [only used for testing, separate from main library assembly])
## Documentation
Full documentation can be found on [Read The Docs](http://xlnt.readthedocs.org/en/latest/).
More extensive documentation with examples can be found on [Read The Docs](http://xlnt.readthedocs.org/en/latest/).
## License
xlnt is currently released to the public for free under the terms of the MIT License:

View File

@ -30,6 +30,7 @@ include_directories(../source)
include_directories(../third-party/miniz)
include_directories(../third-party/pugixml/src)
include_directories(../third-party/utfcpp/source)
include_directories(../third-party/Optional)
FILE(GLOB ROOT_HEADERS ../include/xlnt/*.hpp)
FILE(GLOB CELL_HEADERS ../include/xlnt/cell/*.hpp)

View File

@ -139,10 +139,7 @@ class XLNT_CLASS zip_file
void writestr(const std::string &arcname, const std::string &bytes);
void writestr(const zip_info &arcname, const std::string &bytes);
std::string get_filename() const
{
return filename_;
}
std::string get_filename() const;
std::string comment;

View File

@ -27,13 +27,14 @@
#include <xlnt/utils/hash_combine.hpp>
#include <xlnt/styles/horizontal_alignment.hpp>
#include <xlnt/styles/vertical_alignment.hpp>
#include <xlnt/utils/hashable.hpp>
namespace xlnt {
/// <summary>
/// Alignment options for use in styles.
/// </summary>
class XLNT_CLASS alignment
class XLNT_CLASS alignment : public hashable
{
public:
bool get_wrap_text() const;
@ -52,9 +53,8 @@ class XLNT_CLASS alignment
void set_vertical(vertical_alignment vertical);
bool operator==(const alignment &other) const;
std::size_t hash() const;
protected:
std::string to_hash_string() const override;
private:
horizontal_alignment horizontal_ = horizontal_alignment::none;

View File

@ -25,50 +25,61 @@
#include <cstddef>
#include <functional>
#include <optional.hpp>
#include <xlnt/xlnt_config.hpp>
#include <xlnt/styles/diagonal_direction.hpp>
#include <xlnt/styles/side.hpp>
#include <xlnt/utils/hash_combine.hpp>
#include <xlnt/utils/hashable.hpp>
namespace xlnt {
/// <summary>
/// Describes the border style of a particular cell.
/// </summary>
class XLNT_CLASS border
class XLNT_CLASS border : public hashable
{
public:
static border default_border();
bool start_assigned = false;
side start;
bool end_assigned = false;
side end;
bool left_assigned = false;
side left;
bool right_assigned = false;
side right;
bool top_assigned = false;
side top;
bool bottom_assigned = false;
side bottom;
bool diagonal_assigned = false;
side diagonal;
bool vertical_assigned = false;
side vertical;
bool horizontal_assigned = false;
side horizontal;
std::experimental::optional<side> &get_start();
const std::experimental::optional<side> &get_start() const;
std::experimental::optional<side> &get_end();
const std::experimental::optional<side> &get_end() const;
std::experimental::optional<side> &get_left();
const std::experimental::optional<side> &get_left() const;
std::experimental::optional<side> &get_right();
const std::experimental::optional<side> &get_right() const;
std::experimental::optional<side> &get_top();
const std::experimental::optional<side> &get_top() const;
std::experimental::optional<side> &get_bottom();
const std::experimental::optional<side> &get_bottom() const;
std::experimental::optional<side> &get_diagonal();
const std::experimental::optional<side> &get_diagonal() const;
std::experimental::optional<side> &get_vertical();
const std::experimental::optional<side> &get_vertical() const;
std::experimental::optional<side> &get_horizontal();
const std::experimental::optional<side> &get_horizontal() const;
bool outline = false;
bool diagonal_up = false;
bool diagonal_down = false;
protected:
std::string to_hash_string() const override;
private:
std::experimental::optional<side> start_;
std::experimental::optional<side> end_;
std::experimental::optional<side> left_;
std::experimental::optional<side> right_;
std::experimental::optional<side> top_;
std::experimental::optional<side> bottom_;
std::experimental::optional<side> diagonal_;
std::experimental::optional<side> vertical_;
std::experimental::optional<side> horizontal_;
bool outline_ = false;
bool diagonal_up_ = false;
bool diagonal_down_ = false;
diagonal_direction diagonal_direction_ = diagonal_direction::none;
bool operator==(const border &other) const;
std::size_t hash() const;
};
} // namespace xlnt

View File

@ -24,28 +24,25 @@
#pragma once
#include <xlnt/xlnt_config.hpp>
#include <xlnt/styles/style.hpp>
namespace xlnt {
/// <summary>
/// A named style is simply a style that can be referred to by name rather than by index.
/// </summary>
class XLNT_CLASS named_style
enum class XLNT_CLASS border_style
{
public:
named_style();
std::size_t hash() const;
bool operator==(const named_style &other) const
{
return style_.hash() == other.style_.hash();
}
private:
std::string name_;
style style_;
none,
dashdot,
dashdotdot,
dashed,
dotted,
double_,
hair,
medium,
mediumdashdot,
mediumdashdotdot,
mediumdashed,
slantdashdot,
thick,
thin
};
} // namespace xlnt

View File

@ -26,14 +26,14 @@
#include <string>
#include <xlnt/xlnt_config.hpp>
#include <xlnt/utils/hash_combine.hpp>
#include <xlnt/utils/hashable.hpp>
namespace xlnt {
/// <summary>
/// Colors can be applied to many parts of a cell's style.
/// </summary>
class XLNT_CLASS color
class XLNT_CLASS color : public hashable
{
public:
/// <summary>
@ -58,101 +58,30 @@ public:
static const color yellow();
static const color darkyellow();
color()
{
}
color();
color(type t, std::size_t v) : type_(t), index_(v)
{
}
color(type t, std::size_t v);
color(type t, const std::string &v) : type_(t), rgb_string_(v)
{
}
color(type t, const std::string &v);
void set_auto(std::size_t auto_index)
{
type_ = type::auto_;
index_ = auto_index;
}
void set_auto(std::size_t auto_index);
void set_index(std::size_t index)
{
type_ = type::indexed;
index_ = index;
}
void set_index(std::size_t index);
void set_theme(std::size_t theme)
{
type_ = type::theme;
index_ = theme;
}
void set_theme(std::size_t theme);
type get_type() const
{
return type_;
}
type get_type() const;
std::size_t get_auto() const
{
if (type_ != type::auto_)
{
throw std::runtime_error("not auto color");
}
std::size_t get_auto() const;
return index_;
}
std::size_t get_index() const;
std::size_t get_index() const
{
if (type_ != type::indexed)
{
throw std::runtime_error("not indexed color");
}
std::size_t get_theme() const;
return index_;
}
std::string get_rgb_string() const;
std::size_t get_theme() const
{
if (type_ != type::theme)
{
throw std::runtime_error("not theme color");
}
return index_;
}
std::string get_rgb_string() const
{
if (type_ != type::rgb)
{
throw std::runtime_error("not rgb color");
}
return rgb_string_;
}
std::size_t hash() const
{
auto seed = static_cast<std::size_t>(type_);
if (type_ != type::rgb)
{
hash_combine(seed, index_);
}
else
{
hash_combine(seed, rgb_string_);
}
return seed;
}
bool operator==(const color &other) const
{
return hash() == other.hash();
}
protected:
std::string to_hash_string() const override;
private:
type type_ = type::indexed;

View File

@ -23,16 +23,17 @@
// @author: see AUTHORS file
#pragma once
#include <optional.hpp>
#include <xlnt/xlnt_config.hpp>
#include <xlnt/styles/color.hpp>
#include <xlnt/utils/hash_combine.hpp>
namespace xlnt {
/// <summary>
/// Describes the fill style of a particular cell.
/// </summary>
class XLNT_CLASS fill
class XLNT_CLASS fill : public hashable
{
public:
enum class type
@ -72,266 +73,60 @@ class XLNT_CLASS fill
mediumgray,
};
type get_type() const
{
return type_;
}
void set_type(type t)
{
type_ = t;
}
type get_type() const;
std::string get_pattern_type_string() const
{
if (type_ != type::pattern)
{
throw std::runtime_error("not pattern fill");
}
void set_type(type t);
switch (pattern_type_)
{
case pattern_type::none:
return "none";
case pattern_type::solid:
return "solid";
case pattern_type::darkdown:
return "darkdown";
case pattern_type::darkgray:
return "darkgray";
case pattern_type::darkgrid:
return "darkgrid";
case pattern_type::darkhorizontal:
return "darkhorizontal";
case pattern_type::darktrellis:
return "darktrellis";
case pattern_type::darkup:
return "darkup";
case pattern_type::darkvertical:
return "darkvertical";
case pattern_type::gray0625:
return "gray0625";
case pattern_type::gray125:
return "gray125";
case pattern_type::lightdown:
return "lightdown";
case pattern_type::lightgray:
return "lightgray";
case pattern_type::lightgrid:
return "lightgrid";
case pattern_type::lighthorizontal:
return "lighthorizontal";
case pattern_type::lighttrellis:
return "lighttrellis";
case pattern_type::lightup:
return "lightup";
case pattern_type::lightvertical:
return "lightvertical";
case pattern_type::mediumgray:
return "mediumgray";
default:
throw std::runtime_error("invalid type");
}
}
std::string get_pattern_type_string() const;
std::string get_gradient_type_string() const
{
if (type_ != type::gradient)
{
throw std::runtime_error("not gradient fill");
}
std::string get_gradient_type_string() const;
switch (gradient_type_)
{
case gradient_type::linear:
return "linear";
case gradient_type::path:
return "path";
default:
throw std::runtime_error("invalid type");
}
}
pattern_type get_pattern_type() const;
pattern_type get_pattern_type() const
{
return pattern_type_;
}
void set_pattern_type(pattern_type t);
void set_pattern_type(pattern_type t)
{
type_ = type::pattern;
pattern_type_ = t;
}
void set_gradient_type(gradient_type t);
void set_gradient_type(gradient_type t)
{
type_ = type::gradient;
gradient_type_ = t;
}
std::experimental::optional<color> &get_foreground_color();
void set_start_color(const color &c)
{
start_color_ = c;
start_color_assigned_ = true;
}
const std::experimental::optional<color> &get_foreground_color() const;
void set_end_color(const color &c)
{
end_color_ = c;
end_color_assigned_ = true;
}
std::experimental::optional<color> &get_background_color();
void set_foreground_color(const color &c)
{
foreground_color_ = c;
foreground_color_assigned_ = true;
}
const std::experimental::optional<color> &get_background_color() const;
void set_background_color(const color &c)
{
background_color_ = c;
background_color_assigned_ = true;
}
std::experimental::optional<color> &get_start_color();
color get_foreground_color() const
{
return foreground_color_;
}
const std::experimental::optional<color> &get_start_color() const;
color get_background_color() const
{
return background_color_;
}
std::experimental::optional<color> &get_end_color();
bool has_foreground_color() const
{
return foreground_color_assigned_;
}
const std::experimental::optional<color> &get_end_color() const;
bool has_background_color() const
{
return background_color_assigned_;
}
void set_rotation(double rotation);
bool operator==(const fill &other) const
{
return hash() == other.hash();
}
double get_rotation() const;
void set_rotation(double rotation)
{
rotation_ = rotation;
}
double get_gradient_left() const;
double get_rotation() const
{
return rotation_;
}
double get_gradient_right() const;
std::size_t hash() const
{
auto seed = static_cast<std::size_t>(type_);
double get_gradient_top() const;
if (type_ == type::pattern)
{
hash_combine(seed, static_cast<std::size_t>(pattern_type_));
hash_combine(seed, foreground_color_assigned_);
double get_gradient_bottom() const;
if (foreground_color_assigned_)
{
hash_combine(seed, static_cast<std::size_t>(foreground_color_.get_type()));
switch (foreground_color_.get_type())
{
case color::type::auto_:
hash_combine(seed, static_cast<std::size_t>(foreground_color_.get_auto()));
break;
case color::type::indexed:
hash_combine(seed, static_cast<std::size_t>(foreground_color_.get_index()));
break;
case color::type::theme:
hash_combine(seed, static_cast<std::size_t>(foreground_color_.get_theme()));
break;
case color::type::rgb:
break;
}
}
hash_combine(seed, background_color_assigned_);
if (background_color_assigned_)
{
hash_combine(seed, static_cast<std::size_t>(background_color_.get_type()));
switch (foreground_color_.get_type())
{
case color::type::auto_:
hash_combine(seed, static_cast<std::size_t>(background_color_.get_auto()));
break;
case color::type::indexed:
hash_combine(seed, static_cast<std::size_t>(background_color_.get_index()));
break;
case color::type::theme:
hash_combine(seed, static_cast<std::size_t>(background_color_.get_theme()));
break;
case color::type::rgb:
break;
}
}
}
else if (type_ == type::gradient)
{
hash_combine(seed, static_cast<std::size_t>(gradient_type_));
if (gradient_type_ == gradient_type::path)
{
hash_combine(seed, gradient_path_left_);
hash_combine(seed, gradient_path_right_);
hash_combine(seed, gradient_path_top_);
hash_combine(seed, gradient_path_bottom_);
}
else if (gradient_type_ == gradient_type::linear)
{
hash_combine(seed, rotation_);
}
}
else if (type_ == type::solid)
{
// hash_combine(seed, static_cast<std::size_t>());
}
return seed;
}
double get_gradient_left() const
{
return gradient_path_left_;
}
double get_gradient_right() const
{
return gradient_path_right_;
}
double get_gradient_top() const
{
return gradient_path_top_;
}
double get_gradient_bottom() const
{
return gradient_path_bottom_;
}
protected:
std::string to_hash_string() const override;
private:
type type_ = type::none;
pattern_type pattern_type_;
gradient_type gradient_type_;
double rotation_ = 0;
bool foreground_color_assigned_ = false;
color foreground_color_ = color::black();
bool background_color_assigned_ = false;
color background_color_ = color::white();
bool start_color_assigned_ = false;
color start_color_ = color::white();
bool end_color_assigned_ = false;
color end_color_ = color::black();
std::experimental::optional<color> foreground_color_ = color::black();
std::experimental::optional<color> background_color_ = color::white();
std::experimental::optional<color> start_color_ = color::white();
std::experimental::optional<color> end_color_ = color::black();
double gradient_path_left_ = 0;
double gradient_path_right_ = 0;
double gradient_path_top_ = 0;

View File

@ -36,7 +36,7 @@ class style;
/// <summary>
/// Describes the font style of a particular cell.
/// </summary>
class XLNT_CLASS font
class XLNT_CLASS font : public hashable
{
public:
enum class underline_style
@ -48,130 +48,48 @@ class XLNT_CLASS font
single_accounting
};
void set_bold(bool bold)
{
bold_ = bold;
}
void set_bold(bool bold);
bool is_bold() const
{
return bold_;
}
bool is_bold() const;
void set_italic(bool italic)
{
italic_ = italic;
}
void set_italic(bool italic);
bool is_italic() const
{
return italic_;
}
bool is_italic() const;
void set_strikethrough(bool strikethrough)
{
strikethrough_ = strikethrough;
}
void set_strikethrough(bool strikethrough);
bool is_strikethrough() const
{
return strikethrough_;
}
bool is_strikethrough() const;
void set_underline(underline_style new_underline)
{
underline_ = new_underline;
}
void set_underline(underline_style new_underline);
bool is_underline() const
{
return underline_ != underline_style::none;
}
bool is_underline() const;
underline_style get_underline() const
{
return underline_;
}
underline_style get_underline() const;
void set_size(std::size_t size)
{
size_ = size;
}
void set_size(std::size_t size);
std::size_t get_size() const
{
return size_;
}
std::size_t get_size() const;
void set_name(const std::string &name)
{
name_ = name;
}
std::string get_name() const
{
return name_;
}
void set_name(const std::string &name);
void set_color(color c)
{
color_ = c;
}
std::string get_name() const;
void set_family(std::size_t family)
{
has_family_ = true;
family_ = family;
}
void set_color(color c);
void set_scheme(const std::string &scheme)
{
has_scheme_ = true;
scheme_ = scheme;
}
void set_family(std::size_t family);
color get_color() const
{
return color_;
}
void set_scheme(const std::string &scheme);
bool has_family() const
{
return has_family_;
}
color get_color() const;
std::size_t get_family() const
{
return family_;
}
bool has_family() const;
bool has_scheme() const
{
return has_scheme_;
}
std::size_t get_family() const;
std::size_t hash() const
{
std::size_t seed = 0;
bool has_scheme() const;
hash_combine(seed, bold_);
hash_combine(seed, italic_);
hash_combine(seed, superscript_);
hash_combine(seed, subscript_);
hash_combine(seed, strikethrough_);
hash_combine(seed, name_);
hash_combine(seed, size_);
hash_combine(seed, static_cast<std::size_t>(underline_));
hash_combine(seed, color_.hash());
hash_combine(seed, family_);
hash_combine(seed, scheme_);
return seed;
}
bool operator==(const font &other) const
{
return hash() == other.hash();
}
protected:
std::string to_hash_string() const override;
private:
friend class style;

View File

@ -24,10 +24,9 @@
#pragma once
#include <string>
#include <unordered_map>
#include <utility>
#include <xlnt/xlnt_config.hpp>
#include <xlnt/utils/hashable.hpp>
namespace xlnt {
@ -36,7 +35,7 @@ enum class calendar;
/// <summary>
/// Describes the number formatting applied to text and numbers within a certain cell.
/// </summary>
class XLNT_CLASS number_format
class XLNT_CLASS number_format : public hashable
{
public:
static const number_format general();
@ -91,14 +90,13 @@ class XLNT_CLASS number_format
std::size_t get_id() const;
std::size_t hash() const;
std::string format(const std::string &text) const;
std::string format(long double number, calendar base_date) const;
bool is_date_format() const;
bool operator==(const number_format &other) const;
protected:
std::string to_hash_string() const override;
private:
bool id_set_;

View File

@ -26,14 +26,14 @@
#include <cstddef>
#include <xlnt/xlnt_config.hpp>
#include <xlnt/utils/hash_combine.hpp>
#include <xlnt/utils/hashable.hpp>
namespace xlnt {
/// <summary>
/// Describes the protection style of a particular cell.
/// </summary>
class XLNT_CLASS protection
class XLNT_CLASS protection : public hashable
{
public:
enum class type
@ -46,28 +46,11 @@ class XLNT_CLASS protection
protection();
protection(type locked);
void set_locked(type locked_type)
{
locked_ = locked_type;
}
void set_locked(type locked_type);
void set_hidden(type hidden_type);
void set_hidden(type hidden_type)
{
hidden_ = hidden_type;
}
bool operator==(const protection &other) const
{
return hash() == other.hash();
}
std::size_t hash() const
{
std::size_t seed = static_cast<std::size_t>(locked_);
hash_combine(seed, static_cast<std::size_t>(hidden_));
return seed;
}
protected:
std::string to_hash_string() const override;
private:
type locked_;

View File

@ -24,101 +24,37 @@
#pragma once
#include <cstddef>
#include <optional.hpp>
#include <xlnt/xlnt_config.hpp>
#include <xlnt/styles/border_style.hpp>
#include <xlnt/styles/color.hpp>
#include <xlnt/utils/hashable.hpp>
namespace xlnt {
enum class XLNT_CLASS border_style
{
none,
dashdot,
dashdotdot,
dashed,
dotted,
double_,
hair,
medium,
mediumdashdot,
mediumdashdotdot,
mediumdashed,
slantdashdot,
thick,
thin
};
/// <summary>
/// Describes the one of the sides of a border of a particular cell.
/// </summary>
class XLNT_CLASS side
class XLNT_CLASS side : public hashable
{
public:
side();
std::size_t hash() const
{
std::size_t seed = 0;
std::experimental::optional<border_style> &get_border_style();
hash_combine(seed, style_assigned_);
const std::experimental::optional<border_style> &get_border_style() const;
if (style_assigned_)
{
hash_combine(seed, static_cast<std::size_t>(style_));
}
std::experimental::optional<color> &get_color();
hash_combine(seed, color_assigned_);
const std::experimental::optional<color> &get_color() const;
if (color_assigned_)
{
hash_combine(seed, color_.hash());
}
return seed;
}
border_style get_style() const
{
return style_;
}
color get_color() const
{
return color_;
}
bool is_style_assigned() const
{
return style_assigned_;
}
bool is_color_assigned() const
{
return color_assigned_;
}
bool operator==(const side &other) const
{
return other.style_ == style_ && color_ == other.color_;
}
void set_border_style(border_style bs)
{
style_assigned_ = true;
style_ = bs;
}
void set_color(color new_color)
{
color_assigned_ = true;
color_ = new_color;
}
protected:
std::string to_hash_string() const override;
private:
bool style_assigned_ = false;
border_style style_ = border_style::none;
bool color_assigned_ = false;
color color_ = color::black();
std::experimental::optional<border_style> border_style_;
std::experimental::optional<color> color_;
};
} // namespace xlnt

View File

@ -38,7 +38,7 @@ class workbook;
/// <summary>
/// Describes the entirety of the styling of a particular cell.
/// </summary>
class XLNT_CLASS style
class XLNT_CLASS style : public hashable
{
public:
style();
@ -56,57 +56,21 @@ class XLNT_CLASS style
bool pivot_button() const;
bool quote_prefix() const;
std::size_t get_id() const
{
return id_;
}
std::size_t get_id() const;
std::size_t get_fill_id() const;
std::size_t get_font_id() const;
std::size_t get_border_id() const;
std::size_t get_number_format_id() const;
std::size_t get_fill_id() const
{
return fill_id_;
}
std::size_t get_font_id() const
{
return font_id_;
}
std::size_t get_border_id() const
{
return border_id_;
}
std::size_t get_number_format_id() const
{
return number_format_id_;
}
void apply_alignment(bool apply);
void apply_border(bool apply);
void apply_fill(bool apply);
void apply_font(bool apply);
void apply_number_format(bool apply);
void apply_protection(bool apply);
void apply_alignment(bool apply)
{
alignment_apply_ = apply;
}
void apply_border(bool apply)
{
border_apply_ = apply;
}
void apply_fill(bool apply)
{
fill_apply_ = apply;
}
void apply_font(bool apply)
{
font_apply_ = apply;
}
void apply_number_format(bool apply)
{
number_format_apply_ = apply;
}
void apply_protection(bool apply)
{
protection_apply_ = apply;
}
bool operator==(const style &other) const
{
return hash() == other.hash();
}
protected:
std::string to_hash_string() const override;
private:
friend class style_serializer;

View File

@ -47,9 +47,7 @@ struct XLNT_CLASS date
/// </summary>
static date from_number(int days_since_base_year, calendar base_date);
date(int year_, int month_, int day_) : year(year_), month(month_), day(day_)
{
}
date(int year_, int month_, int day_);
/// <summary>
/// Return the number of days between this date and base_date.

View File

@ -43,10 +43,7 @@ struct XLNT_CLASS datetime
/// Return the current date and time according to the system time.
/// This is equivalent to datetime::now().
/// </summary>
static datetime today()
{
return now();
}
static datetime today();
/// <summary>
/// Return a datetime from number by converting the integer part into
@ -55,16 +52,7 @@ struct XLNT_CLASS datetime
/// </summary>
static datetime from_number(long double number, calendar base_date);
datetime(int year_, int month_, int day_, int hour_ = 0, int minute_ = 0, int second_ = 0, int microsecond_ = 0)
: year(year_),
month(month_),
day(day_),
hour(hour_),
minute(minute_),
second(second_),
microsecond(microsecond_)
{
}
datetime(int year_, int month_, int day_, int hour_ = 0, int minute_ = 0, int second_ = 0, int microsecond_ = 0);
std::string to_string(calendar base_date) const;
long double to_number(calendar base_date) const;

View File

@ -0,0 +1,40 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma once
#include <cstdint>
#include <string>
namespace xlnt {
class hashable
{
public:
std::size_t hash() const;
bool operator==(const hashable &other) const;
protected:
virtual std::string to_hash_string() const = 0;
};
} // namespace

View File

@ -47,10 +47,7 @@ struct XLNT_CLASS time
/// </summary>
static time from_number(long double number);
explicit time(int hour_ = 0, int minute_ = 0, int second_ = 0, int microsecond_ = 0)
: hour(hour_), minute(minute_), second(second_), microsecond(microsecond_)
{
}
explicit time(int hour_ = 0, int minute_ = 0, int second_ = 0, int microsecond_ = 0);
explicit time(const std::string &time_string);
long double to_number() const;

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <cstdint>
#include <string>
#include <vector>

View File

@ -49,14 +49,8 @@ class XLNT_CLASS named_range
named_range(const named_range &other);
named_range(const std::string &name, const std::vector<target> &targets);
std::string get_name() const
{
return name_;
}
const std::vector<target> &get_targets() const
{
return targets_;
}
std::string get_name() const;
const std::vector<target> &get_targets() const;
named_range &operator=(const named_range &other);

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma once
#include <cstdint>

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma once
#include <cstdint>

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma once
#include <cstdint>
@ -17,43 +40,17 @@ class XLNT_CLASS header_footer
public:
header_footer();
header &get_left_header()
{
return left_header_;
}
header &get_center_header()
{
return center_header_;
}
header &get_right_header()
{
return right_header_;
}
footer &get_left_footer()
{
return left_footer_;
}
footer &get_center_footer()
{
return center_footer_;
}
footer &get_right_footer()
{
return right_footer_;
}
header &get_left_header();
header &get_center_header();
header &get_right_header();
bool is_default_header() const
{
return left_header_.is_default() && center_header_.is_default() && right_header_.is_default();
}
bool is_default_footer() const
{
return left_footer_.is_default() && center_footer_.is_default() && right_footer_.is_default();
}
bool is_default() const
{
return is_default_header() && is_default_footer();
}
footer &get_left_footer();
footer &get_center_footer();
footer &get_right_footer();
bool is_default_header() const;
bool is_default_footer() const;
bool is_default() const;
private:
header left_header_, right_header_, center_header_;

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma once
#include <xlnt/xlnt_config.hpp>

View File

@ -37,7 +37,6 @@
#include <xlnt/styles/color.hpp>
#include <xlnt/styles/fill.hpp>
#include <xlnt/styles/font.hpp>
#include <xlnt/styles/named_style.hpp>
#include <xlnt/styles/number_format.hpp>
#include <xlnt/styles/protection.hpp>
#include <xlnt/styles/side.hpp>

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <algorithm>
#include <sstream>

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <locale>
#include <xlnt/cell/cell_reference.hpp>

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/cell/cell.hpp>
#include <xlnt/cell/comment.hpp>

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <locale>
#include <xlnt/cell/index_types.hpp>

View File

@ -1,8 +1,101 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/worksheet/worksheet.hpp>
#include "cell_impl.hpp"
#include "comment_impl.hpp"
namespace {
std::pair<bool, long double> cast_numeric(const std::string &s)
{
const char *str = s.c_str();
char *str_end = nullptr;
auto result = std::strtold(str, &str_end);
if (str_end != str + s.size()) return { false, 0 };
return { true, result };
}
std::pair<bool, long double> cast_percentage(const std::string &s)
{
if (s.back() == '%')
{
auto number = cast_numeric(s.substr(0, s.size() - 1));
if (number.first)
{
return { true, number.second / 100 };
}
}
return { false, 0 };
}
std::pair<bool, xlnt::time> cast_time(const std::string &s)
{
xlnt::time result;
try
{
auto last_colon = s.find_last_of(':');
if (last_colon == std::string::npos) return { false, result };
double seconds = std::stod(s.substr(last_colon + 1));
result.second = static_cast<int>(seconds);
result.microsecond = static_cast<int>((seconds - static_cast<double>(result.second)) * 1e6);
auto first_colon = s.find_first_of(':');
if (first_colon == last_colon)
{
auto decimal_pos = s.find('.');
if (decimal_pos != std::string::npos)
{
result.minute = std::stoi(s.substr(0, first_colon));
}
else
{
result.hour = std::stoi(s.substr(0, first_colon));
result.minute = result.second;
result.second = 0;
}
}
else
{
result.hour = std::stoi(s.substr(0, first_colon));
result.minute = std::stoi(s.substr(first_colon + 1, last_colon - first_colon - 1));
}
}
catch (std::invalid_argument)
{
return { false, result };
}
return { true, result };
}
} // namespace
namespace xlnt {
namespace detail {

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma once
#include <cstdlib>
@ -12,76 +34,6 @@
#include "comment_impl.hpp"
namespace {
std::pair<bool, long double> cast_numeric(const std::string &s)
{
const char *str = s.c_str();
char *str_end = nullptr;
auto result = std::strtold(str, &str_end);
if (str_end != str + s.size()) return { false, 0 };
return { true, result };
}
std::pair<bool, long double> cast_percentage(const std::string &s)
{
if (s.back() == '%')
{
auto number = cast_numeric(s.substr(0, s.size() - 1));
if (number.first)
{
return { true, number.second / 100 };
}
}
return { false, 0 };
}
std::pair<bool, xlnt::time> cast_time(const std::string &s)
{
xlnt::time result;
try
{
auto last_colon = s.find_last_of(':');
if (last_colon == std::string::npos) return { false, result };
double seconds = std::stod(s.substr(last_colon + 1));
result.second = static_cast<int>(seconds);
result.microsecond = static_cast<int>((seconds - static_cast<double>(result.second)) * 1e6);
auto first_colon = s.find_first_of(':');
if (first_colon == last_colon)
{
auto decimal_pos = s.find('.');
if (decimal_pos != std::string::npos)
{
result.minute = std::stoi(s.substr(0, first_colon));
}
else
{
result.hour = std::stoi(s.substr(0, first_colon));
result.minute = result.second;
result.second = 0;
}
}
else
{
result.hour = std::stoi(s.substr(0, first_colon));
result.minute = std::stoi(s.substr(first_colon + 1, last_colon - first_colon - 1));
}
}
catch (std::invalid_argument)
{
return { false, result };
}
return { true, result };
}
} // namespace
namespace xlnt {
class style;

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include "comment_impl.hpp"
namespace xlnt {

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma once
#include <xlnt/cell/comment.hpp>

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <limits>
#include <detail/constants.hpp>

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma once
#include <string>

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma once
/// <summary>

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma once
#ifdef _MSC_VER

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma once
#include <iterator>

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <string>
#include <unordered_map>
#include <vector>

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma once
#include <string>

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#pragma once
#include <detail/include_pugixml.hpp>

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/drawing/drawing.hpp>
namespace xlnt {

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/packaging/default_type.hpp>
namespace xlnt {

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/packaging/document_properties.hpp>
namespace xlnt {

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <algorithm>
#include <stdexcept>

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/packaging/override_type.hpp>
namespace xlnt {

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/packaging/relationship.hpp>
namespace xlnt {

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <algorithm>
#include <cassert>
#include <cstring>
@ -744,4 +767,9 @@ std::pair<bool, std::string> zip_file::testzip()
return { true, "" };
}
std::string zip_file::get_filename() const
{
return filename_;
}
} // namespace xlnt

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/serialization/comment_serializer.hpp>
namespace xlnt {

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <algorithm>
#include <iterator>

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/packaging/manifest.hpp>
#include <xlnt/serialization/manifest_serializer.hpp>
#include <xlnt/serialization/xml_document.hpp>

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/serialization/relationship_serializer.hpp>
#include <xlnt/packaging/relationship.hpp>

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/serialization/shared_strings_serializer.hpp>
#include <xlnt/serialization/xml_document.hpp>
#include <xlnt/serialization/xml_node.hpp>

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/serialization/style_serializer.hpp>
#include <xlnt/serialization/xml_document.hpp>
#include <xlnt/serialization/xml_node.hpp>
@ -420,12 +443,12 @@ fill style_serializer::read_fill(const xml_node &fill_node)
if (pattern_fill_node.has_child("bgColor"))
{
new_fill.set_background_color(read_color(pattern_fill_node.get_child("bgColor")));
new_fill.get_background_color() = read_color(pattern_fill_node.get_child("bgColor"));
}
if (pattern_fill_node.has_child("fgColor"))
{
new_fill.set_foreground_color(read_color(pattern_fill_node.get_child("fgColor")));
new_fill.get_foreground_color() = read_color(pattern_fill_node.get_child("fgColor"));
}
}
@ -438,12 +461,12 @@ side style_serializer::read_side(const xml_node &side_node)
if (side_node.has_attribute("style"))
{
new_side.set_border_style(border_style_from_string(side_node.get_attribute("style")));
new_side.get_border_style() = border_style_from_string(side_node.get_attribute("style"));
}
if (side_node.has_child("color"))
{
new_side.set_color(read_color(side_node.get_child("color")));
new_side.get_color() = read_color(side_node.get_child("color"));
}
return new_side;
@ -465,56 +488,47 @@ border style_serializer::read_border(const xml_node &border_node)
if (border_node.has_child("start"))
{
new_border.start_assigned = true;
new_border.start = read_side(border_node.get_child("start"));
new_border.get_start() = read_side(border_node.get_child("start"));
}
if (border_node.has_child("end"))
{
new_border.end_assigned = true;
new_border.end = read_side(border_node.get_child("end"));
new_border.get_end() = read_side(border_node.get_child("end"));
}
if (border_node.has_child("left"))
{
new_border.left_assigned = true;
new_border.left = read_side(border_node.get_child("left"));
new_border.get_left() = read_side(border_node.get_child("left"));
}
if (border_node.has_child("right"))
{
new_border.right_assigned = true;
new_border.right = read_side(border_node.get_child("right"));
new_border.get_right() = read_side(border_node.get_child("right"));
}
if (border_node.has_child("top"))
{
new_border.top_assigned = true;
new_border.top = read_side(border_node.get_child("top"));
new_border.get_top() = read_side(border_node.get_child("top"));
}
if (border_node.has_child("bottom"))
{
new_border.bottom_assigned = true;
new_border.bottom = read_side(border_node.get_child("bottom"));
new_border.get_bottom() = read_side(border_node.get_child("bottom"));
}
if (border_node.has_child("diagonal"))
{
new_border.diagonal_assigned = true;
new_border.diagonal = read_side(border_node.get_child("diagonal"));
new_border.get_diagonal() = read_side(border_node.get_child("diagonal"));
}
if (border_node.has_child("vertical"))
{
new_border.vertical_assigned = true;
new_border.vertical = read_side(border_node.get_child("vertical"));
new_border.get_vertical() = read_side(border_node.get_child("vertical"));
}
if (border_node.has_child("horizontal"))
{
new_border.horizontal_assigned = true;
new_border.horizontal = read_side(border_node.get_child("horizontal"));
new_border.get_horizontal() = read_side(border_node.get_child("horizontal"));
}
return new_border;
@ -667,40 +681,40 @@ xml_document style_serializer::write_stylesheet() const
auto type_string = fill_.get_pattern_type_string();
pattern_fill_node.add_attribute("patternType", type_string);
if (fill_.has_foreground_color())
if (fill_.get_foreground_color())
{
auto fg_color_node = pattern_fill_node.add_child("fgColor");
switch (fill_.get_foreground_color().get_type())
switch (fill_.get_foreground_color()->get_type())
{
case color::type::auto_:
fg_color_node.add_attribute("auto", std::to_string(fill_.get_foreground_color().get_auto()));
fg_color_node.add_attribute("auto", std::to_string(fill_.get_foreground_color()->get_auto()));
break;
case color::type::theme:
fg_color_node.add_attribute("theme", std::to_string(fill_.get_foreground_color().get_theme()));
fg_color_node.add_attribute("theme", std::to_string(fill_.get_foreground_color()->get_theme()));
break;
case color::type::indexed:
fg_color_node.add_attribute("indexed", std::to_string(fill_.get_foreground_color().get_index()));
fg_color_node.add_attribute("indexed", std::to_string(fill_.get_foreground_color()->get_index()));
break;
default:
throw std::runtime_error("bad type");
}
}
if (fill_.has_background_color())
if (fill_.get_background_color())
{
auto bg_color_node = pattern_fill_node.add_child("bgColor");
switch (fill_.get_background_color().get_type())
switch (fill_.get_background_color()->get_type())
{
case color::type::auto_:
bg_color_node.add_attribute("auto", std::to_string(fill_.get_background_color().get_auto()));
bg_color_node.add_attribute("auto", std::to_string(fill_.get_background_color()->get_auto()));
break;
case color::type::theme:
bg_color_node.add_attribute("theme", std::to_string(fill_.get_background_color().get_theme()));
bg_color_node.add_attribute("theme", std::to_string(fill_.get_background_color()->get_theme()));
break;
case color::type::indexed:
bg_color_node.add_attribute("indexed", std::to_string(fill_.get_background_color().get_index()));
bg_color_node.add_attribute("indexed", std::to_string(fill_.get_background_color()->get_index()));
break;
default:
throw std::runtime_error("bad type");
@ -744,32 +758,32 @@ xml_document style_serializer::write_stylesheet() const
{
auto border_node = borders_node.add_child("border");
std::vector<std::tuple<std::string, const side, bool>> sides;
sides.push_back(std::make_tuple("start", border_.start, border_.start_assigned));
sides.push_back(std::make_tuple("end", border_.end, border_.end_assigned));
sides.push_back(std::make_tuple("left", border_.left, border_.left_assigned));
sides.push_back(std::make_tuple("right", border_.right, border_.right_assigned));
sides.push_back(std::make_tuple("top", border_.top, border_.top_assigned));
sides.push_back(std::make_tuple("bottom", border_.bottom, border_.bottom_assigned));
sides.push_back(std::make_tuple("diagonal", border_.diagonal, border_.diagonal_assigned));
sides.push_back(std::make_tuple("vertical", border_.vertical, border_.vertical_assigned));
sides.push_back(std::make_tuple("horizontal", border_.horizontal, border_.horizontal_assigned));
std::vector<std::tuple<std::string, const std::experimental::optional<side>>> sides;
sides.push_back(std::make_tuple("start", border_.get_start()));
sides.push_back(std::make_tuple("end", border_.get_end()));
sides.push_back(std::make_tuple("left", border_.get_left()));
sides.push_back(std::make_tuple("right", border_.get_right()));
sides.push_back(std::make_tuple("top", border_.get_top()));
sides.push_back(std::make_tuple("bottom", border_.get_bottom()));
sides.push_back(std::make_tuple("diagonal", border_.get_diagonal()));
sides.push_back(std::make_tuple("vertical", border_.get_vertical()));
sides.push_back(std::make_tuple("horizontal", border_.get_horizontal()));
for (const auto &side_tuple : sides)
{
std::string name = std::get<0>(side_tuple);
const side side_ = std::get<1>(side_tuple);
bool assigned = std::get<2>(side_tuple);
std::string current_name = std::get<0>(side_tuple);
const auto current_side = std::get<1>(side_tuple);
if (assigned)
if (current_side)
{
auto side_node = border_node.add_child(name);
auto side_node = border_node.add_child(current_name);
if (side_.is_style_assigned())
if (current_side->get_border_style())
{
std::string style_string;
switch (side_.get_style())
switch (*current_side->get_border_style())
{
case border_style::none:
style_string = "none";
@ -820,17 +834,17 @@ xml_document style_serializer::write_stylesheet() const
side_node.add_attribute("style", style_string);
}
if (side_.is_color_assigned())
if (current_side->get_color())
{
auto color_node = side_node.add_child("color");
if (side_.get_color().get_type() == color::type::indexed)
if (current_side->get_color()->get_type() == color::type::indexed)
{
color_node.add_attribute("indexed", std::to_string(side_.get_color().get_index()));
color_node.add_attribute("indexed", std::to_string(current_side->get_color()->get_index()));
}
else if (side_.get_color().get_type() == color::type::theme)
else if (current_side->get_color()->get_type() == color::type::theme)
{
color_node.add_attribute("theme", std::to_string(side_.get_color().get_theme()));
color_node.add_attribute("theme", std::to_string(current_side->get_color()->get_theme()));
}
else
{

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/serialization/theme_serializer.hpp>
#include <xlnt/serialization/xml_document.hpp>
#include <xlnt/serialization/xml_node.hpp>

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <algorithm>
#include <xlnt/packaging/document_properties.hpp>

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <algorithm>
#include <cmath>
#include <sstream>

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/serialization/xml_document.hpp>
#include <xlnt/serialization/xml_node.hpp>
#include <xlnt/serialization/xml_serializer.hpp>

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/serialization/xml_node.hpp>
#include <xlnt/serialization/xml_serializer.hpp>

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <sstream>
#include <xlnt/serialization/xml_serializer.hpp>

View File

@ -66,21 +66,18 @@ void alignment::set_vertical(vertical_alignment vertical)
vertical_ = vertical;
}
bool alignment::operator==(const alignment &other) const
std::string alignment::to_hash_string() const
{
return hash() == other.hash();
}
std::string hash_string;
std::size_t alignment::hash() const
{
std::size_t seed = 0;
hash_combine(seed, wrap_text_);
hash_combine(seed, shrink_to_fit_);
hash_combine(seed, static_cast<std::size_t>(horizontal_));
hash_combine(seed, static_cast<std::size_t>(vertical_));
hash_combine(seed, text_rotation_);
hash_combine(seed, indent_);
return seed;
hash_string.append(wrap_text_ ? "1" : "0");
hash_string.append(shrink_to_fit_ ? "1" : "0");
hash_string.append(std::to_string(static_cast<std::size_t>(horizontal_)));
hash_string.append(std::to_string(static_cast<std::size_t>(vertical_)));
hash_string.append(std::to_string(text_rotation_));
hash_string.append(std::to_string(indent_));
return hash_string;
}
} // namespace xlnt

View File

@ -1,36 +1,152 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/styles/border.hpp>
namespace xlnt {
bool border::operator==(const border &other) const
std::experimental::optional<side> &border::get_start()
{
return hash() == other.hash();
return start_;
}
std::size_t border::hash() const
const std::experimental::optional<side> &border::get_start() const
{
std::size_t seed = 0;
return start_;
}
hash_combine(seed, start_assigned);
if (start_assigned) hash_combine(seed, start.hash());
hash_combine(seed, end_assigned);
if (end_assigned) hash_combine(seed, end.hash());
hash_combine(seed, left_assigned);
if (left_assigned) hash_combine(seed, left.hash());
hash_combine(seed, right_assigned);
if (right_assigned) hash_combine(seed, right.hash());
hash_combine(seed, top_assigned);
if (top_assigned) hash_combine(seed, top.hash());
hash_combine(seed, bottom_assigned);
if (bottom_assigned) hash_combine(seed, bottom.hash());
hash_combine(seed, diagonal_assigned);
if (diagonal_assigned) hash_combine(seed, diagonal.hash());
hash_combine(seed, vertical_assigned);
if (vertical_assigned) hash_combine(seed, vertical.hash());
hash_combine(seed, horizontal_assigned);
if (horizontal_assigned) hash_combine(seed, horizontal.hash());
std::experimental::optional<side> &border::get_end()
{
return end_;
}
return seed;
const std::experimental::optional<side> &border::get_end() const
{
return end_;
}
std::experimental::optional<side> &border::get_left()
{
return left_;
}
const std::experimental::optional<side> &border::get_left() const
{
return left_;
}
std::experimental::optional<side> &border::get_right()
{
return right_;
}
const std::experimental::optional<side> &border::get_right() const
{
return right_;
}
std::experimental::optional<side> &border::get_top()
{
return top_;
}
const std::experimental::optional<side> &border::get_top() const
{
return top_;
}
std::experimental::optional<side> &border::get_bottom()
{
return bottom_;
}
const std::experimental::optional<side> &border::get_bottom() const
{
return bottom_;
}
std::experimental::optional<side> &border::get_diagonal()
{
return diagonal_;
}
const std::experimental::optional<side> &border::get_diagonal() const
{
return diagonal_;
}
std::experimental::optional<side> &border::get_vertical()
{
return vertical_;
}
const std::experimental::optional<side> &border::get_vertical() const
{
return vertical_;
}
std::experimental::optional<side> &border::get_horizontal()
{
return horizontal_;
}
const std::experimental::optional<side> &border::get_horizontal() const
{
return horizontal_;
}
std::string border::to_hash_string() const
{
std::string hash_string;
hash_string.append(start_ ? "1" : "0");
if (start_) hash_string.append(std::to_string(start_->hash()));
hash_string.append(end_ ? "1" : "0");
if (end_) hash_string.append(std::to_string(end_->hash()));
hash_string.append(left_ ? "1" : "0");
if (left_) hash_string.append(std::to_string(left_->hash()));
hash_string.append(right_ ? "1" : "0");
if (right_) hash_string.append(std::to_string(right_->hash()));
hash_string.append(top_ ? "1" : "0");
if (top_) hash_string.append(std::to_string(top_->hash()));
hash_string.append(bottom_ ? "1" : "0");
if (bottom_) hash_string.append(std::to_string(bottom_->hash()));
hash_string.append(diagonal_ ? "1" : "0");
if (diagonal_) hash_string.append(std::to_string(diagonal_->hash()));
hash_string.append(vertical_ ? "1" : "0");
if (vertical_) hash_string.append(std::to_string(vertical_->hash()));
hash_string.append(horizontal_ ? "1" : "0");
if (horizontal_) hash_string.append(std::to_string(horizontal_->hash()));
return hash_string;
}
} // namespace xlnt

View File

@ -1,10 +0,0 @@
#include <xlnt/styles/side.hpp>
namespace xlnt {
side::side()
{
}
} // namespace xlnt

122
source/styles/color.cpp Normal file
View File

@ -0,0 +1,122 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/styles/color.hpp>
namespace xlnt {
color::color()
{
}
color::color(type t, std::size_t v) : type_(t), index_(v)
{
}
color::color(type t, const std::string &v) : type_(t), rgb_string_(v)
{
}
void color::set_auto(std::size_t auto_index)
{
type_ = type::auto_;
index_ = auto_index;
}
void color::set_index(std::size_t index)
{
type_ = type::indexed;
index_ = index;
}
void color::set_theme(std::size_t theme)
{
type_ = type::theme;
index_ = theme;
}
color::type color::get_type() const
{
return type_;
}
std::size_t color::get_auto() const
{
if (type_ != type::auto_)
{
throw std::runtime_error("not auto color");
}
return index_;
}
std::size_t color::get_index() const
{
if (type_ != type::indexed)
{
throw std::runtime_error("not indexed color");
}
return index_;
}
std::size_t color::get_theme() const
{
if (type_ != type::theme)
{
throw std::runtime_error("not theme color");
}
return index_;
}
std::string color::get_rgb_string() const
{
if (type_ != type::rgb)
{
throw std::runtime_error("not rgb color");
}
return rgb_string_;
}
std::string color::to_hash_string() const
{
std::string hash_string = "color";
hash_string.append(std::to_string(static_cast<std::size_t>(type_)));
if (type_ != type::rgb)
{
hash_string.append(std::to_string(index_));
}
else
{
hash_string.append(rgb_string_);
}
return hash_string;
}
} // namespace xlnt

265
source/styles/fill.cpp Normal file
View File

@ -0,0 +1,265 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/styles/fill.hpp>
namespace xlnt {
fill::type fill::get_type() const
{
return type_;
}
void fill::set_type(type t)
{
type_ = t;
}
std::string fill::get_pattern_type_string() const
{
if (type_ != type::pattern)
{
throw std::runtime_error("not pattern fill");
}
switch (pattern_type_)
{
case pattern_type::none:
return "none";
case pattern_type::solid:
return "solid";
case pattern_type::darkdown:
return "darkdown";
case pattern_type::darkgray:
return "darkgray";
case pattern_type::darkgrid:
return "darkgrid";
case pattern_type::darkhorizontal:
return "darkhorizontal";
case pattern_type::darktrellis:
return "darktrellis";
case pattern_type::darkup:
return "darkup";
case pattern_type::darkvertical:
return "darkvertical";
case pattern_type::gray0625:
return "gray0625";
case pattern_type::gray125:
return "gray125";
case pattern_type::lightdown:
return "lightdown";
case pattern_type::lightgray:
return "lightgray";
case pattern_type::lightgrid:
return "lightgrid";
case pattern_type::lighthorizontal:
return "lighthorizontal";
case pattern_type::lighttrellis:
return "lighttrellis";
case pattern_type::lightup:
return "lightup";
case pattern_type::lightvertical:
return "lightvertical";
case pattern_type::mediumgray:
return "mediumgray";
default:
throw std::runtime_error("invalid type");
}
}
std::string fill::get_gradient_type_string() const
{
if (type_ != type::gradient)
{
throw std::runtime_error("not gradient fill");
}
switch (gradient_type_)
{
case gradient_type::linear:
return "linear";
case gradient_type::path:
return "path";
default:
throw std::runtime_error("invalid type");
}
}
fill::pattern_type fill::get_pattern_type() const
{
return pattern_type_;
}
void fill::set_pattern_type(pattern_type t)
{
type_ = type::pattern;
pattern_type_ = t;
}
void fill::set_gradient_type(gradient_type t)
{
type_ = type::gradient;
gradient_type_ = t;
}
std::experimental::optional<color> &fill::get_foreground_color()
{
return foreground_color_;
}
const std::experimental::optional<color> &fill::get_foreground_color() const
{
return foreground_color_;
}
std::experimental::optional<color> &fill::get_background_color()
{
return background_color_;
}
const std::experimental::optional<color> &fill::get_background_color() const
{
return background_color_;
}
std::experimental::optional<color> &fill::get_start_color()
{
return start_color_;
}
const std::experimental::optional<color> &fill::get_start_color() const
{
return start_color_;
}
std::experimental::optional<color> &fill::get_end_color()
{
return end_color_;
}
const std::experimental::optional<color> &fill::get_end_color() const
{
return end_color_;
}
void fill::set_rotation(double rotation)
{
rotation_ = rotation;
}
double fill::get_rotation() const
{
return rotation_;
}
std::string fill::to_hash_string() const
{
std::string hash_string = "fill";
hash_string.append(std::to_string(static_cast<std::size_t>(type_)));
switch (type_)
{
case type::pattern:
{
hash_string.append(std::to_string(static_cast<std::size_t>(pattern_type_)));
hash_string.append(background_color_ ? "1" : "0");
if (background_color_)
{
hash_string.append(std::to_string(background_color_->hash()));
}
hash_string.append(background_color_ ? "1" : "0");
if (background_color_)
{
hash_string.append(std::to_string(background_color_->hash()));
}
break;
}
case type::gradient:
{
hash_string.append(std::to_string(static_cast<std::size_t>(gradient_type_)));
if (gradient_type_ == gradient_type::path)
{
hash_string.append(std::to_string(gradient_path_left_));
hash_string.append(std::to_string(gradient_path_right_));
hash_string.append(std::to_string(gradient_path_top_));
hash_string.append(std::to_string(gradient_path_bottom_));
}
else if (gradient_type_ == gradient_type::linear)
{
hash_string.append(std::to_string(rotation_));
}
hash_string.append(start_color_ ? "1" : "0");
if (start_color_)
{
hash_string.append(std::to_string(start_color_->hash()));
}
hash_string.append(end_color_ ? "1" : "0");
if (start_color_)
{
hash_string.append(std::to_string(background_color_->hash()));
}
break;
}
default:
{
break;
}
} // switch (type_)
return hash_string;
}
double fill::get_gradient_left() const
{
return gradient_path_left_;
}
double fill::get_gradient_right() const
{
return gradient_path_right_;
}
double fill::get_gradient_top() const
{
return gradient_path_top_;
}
double fill::get_gradient_bottom() const
{
return gradient_path_bottom_;
}
} // namespace xlnt

149
source/styles/font.cpp Normal file
View File

@ -0,0 +1,149 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/styles/font.hpp>
namespace xlnt {
void font::set_bold(bool bold)
{
bold_ = bold;
}
bool font::is_bold() const
{
return bold_;
}
void font::set_italic(bool italic)
{
italic_ = italic;
}
bool font::is_italic() const
{
return italic_;
}
void font::set_strikethrough(bool strikethrough)
{
strikethrough_ = strikethrough;
}
bool font::is_strikethrough() const
{
return strikethrough_;
}
void font::set_underline(underline_style new_underline)
{
underline_ = new_underline;
}
bool font::is_underline() const
{
return underline_ != underline_style::none;
}
font::underline_style font::get_underline() const
{
return underline_;
}
void font::set_size(std::size_t size)
{
size_ = size;
}
std::size_t font::get_size() const
{
return size_;
}
void font::set_name(const std::string &name)
{
name_ = name;
}
std::string font::get_name() const
{
return name_;
}
void font::set_color(color c)
{
color_ = c;
}
void font::set_family(std::size_t family)
{
has_family_ = true;
family_ = family;
}
void font::set_scheme(const std::string &scheme)
{
has_scheme_ = true;
scheme_ = scheme;
}
color font::get_color() const
{
return color_;
}
bool font::has_family() const
{
return has_family_;
}
std::size_t font::get_family() const
{
return family_;
}
bool font::has_scheme() const
{
return has_scheme_;
}
std::string font::to_hash_string() const
{
std::string hash_string = "font";
hash_string.append(std::to_string(bold_));
hash_string.append(std::to_string(italic_));
hash_string.append(std::to_string(superscript_));
hash_string.append(std::to_string(subscript_));
hash_string.append(std::to_string(strikethrough_));
hash_string.append(name_);
hash_string.append(std::to_string(size_));
hash_string.append(std::to_string(static_cast<std::size_t>(underline_)));
hash_string.append(std::to_string(color_.hash()));
hash_string.append(std::to_string(family_));
hash_string.append(scheme_);
return hash_string;
}
} // namespace xlnt

View File

@ -1,6 +1,30 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <algorithm>
#include <cctype>
#include <regex>
#include <unordered_map>
#include <vector>
#include <xlnt/utils/datetime.hpp>
#include <xlnt/utils/hash_combine.hpp>
@ -1067,12 +1091,14 @@ std::string number_format::get_format_string() const
return format_string_;
}
std::size_t number_format::hash() const
std::string number_format::to_hash_string() const
{
std::size_t seed = id_;
hash_combine(seed, format_string_);
std::string hash_string("number_format");
return seed;
hash_string.append(std::to_string(id_));
hash_string.append(format_string_);
return hash_string;
}
@ -1149,9 +1175,4 @@ std::string number_format::format(long double number, calendar base_date) const
return format_number(number, format_string_, base_date);
}
bool number_format::operator==(const number_format &other) const
{
return hash() == other.hash();
}
} // namespace xlnt

View File

@ -1,4 +1,28 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/styles/protection.hpp>
#include <xlnt/utils/hash_combine.hpp>
namespace xlnt {
@ -10,4 +34,24 @@ protection::protection(type t) : locked_(t), hidden_(type::unprotected)
{
}
void protection::set_locked(type locked_type)
{
locked_ = locked_type;
}
void protection::set_hidden(type hidden_type)
{
hidden_ = hidden_type;
}
std::string protection::to_hash_string() const
{
std::string hash_string = "protection";
hash_string.append(std::to_string(static_cast<std::size_t>(locked_)));
hash_string.append(std::to_string(static_cast<std::size_t>(hidden_)));
return hash_string;
}
} // namespace xlnt

73
source/styles/side.cpp Normal file
View File

@ -0,0 +1,73 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/styles/side.hpp>
namespace xlnt {
side::side()
{
}
std::string side::to_hash_string() const
{
std::string hash_string;
hash_string.append(border_style_ ? "1" : "0");
if(border_style_)
{
hash_string.append(std::to_string(static_cast<std::size_t>(*border_style_)));
}
hash_string.append(color_ ? "1" : "0");
if(color_)
{
hash_string.append(std::to_string(color_->hash()));
}
return hash_string;
}
std::experimental::optional<border_style> &side::get_border_style()
{
return border_style_;
}
const std::experimental::optional<border_style> &side::get_border_style() const
{
return border_style_;
}
std::experimental::optional<color> &side::get_color()
{
return color_;
}
const std::experimental::optional<color> &side::get_color() const
{
return color_;
}
} // namespace xlnt

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/cell/cell.hpp>
#include <xlnt/styles/font.hpp>
#include <xlnt/styles/number_format.hpp>
@ -91,29 +114,29 @@ style &style::operator=(const style &other)
return *this;
}
std::size_t style::hash() const
std::string style::to_hash_string() const
{
std::size_t seed = 0;
std::string hash_string("style");
hash_combine(seed, alignment_apply_);
hash_combine(seed, alignment_apply_ ? alignment_.hash() : 0);
hash_string.append(std::to_string(alignment_apply_));
hash_string.append(alignment_apply_ ? std::to_string(alignment_.hash()) : " ");
hash_combine(seed, border_apply_);
hash_combine(seed, border_apply_ ? border_id_ : 0);
hash_string.append(std::to_string(border_apply_));
hash_string.append(border_apply_ ? std::to_string(border_id_) : " ");
hash_combine(seed, font_apply_);
hash_combine(seed, font_apply_ ? font_id_ : 0);
hash_string.append(std::to_string(font_apply_));
hash_string.append(font_apply_ ? std::to_string(font_id_) : " ");
hash_combine(seed, fill_apply_);
hash_combine(seed, fill_apply_ ? fill_id_ : 0);
hash_string.append(std::to_string(fill_apply_));
hash_string.append(fill_apply_ ? std::to_string(fill_id_) : " ");
hash_combine(seed, number_format_apply_);
hash_combine(seed, number_format_apply_ ? number_format_id_ : 0);
hash_string.append(std::to_string(number_format_apply_));
hash_string.append(number_format_apply_ ? std::to_string(number_format_id_) : " ");
hash_combine(seed, protection_apply_);
hash_combine(seed, protection_apply_ ? get_protection().hash() : 0);
hash_string.append(std::to_string(protection_apply_));
hash_string.append(protection_apply_ ? std::to_string(protection_.hash()) : " ");
return seed;
return hash_string;
}
const number_format style::get_number_format() const
@ -156,4 +179,59 @@ bool style::quote_prefix() const
return quote_prefix_;
}
std::size_t style::get_id() const
{
return id_;
}
std::size_t style::get_fill_id() const
{
return fill_id_;
}
std::size_t style::get_font_id() const
{
return font_id_;
}
std::size_t style::get_border_id() const
{
return border_id_;
}
std::size_t style::get_number_format_id() const
{
return number_format_id_;
}
void style::apply_alignment(bool apply)
{
alignment_apply_ = apply;
}
void style::apply_border(bool apply)
{
border_apply_ = apply;
}
void style::apply_fill(bool apply)
{
fill_apply_ = apply;
}
void style::apply_font(bool apply)
{
font_apply_ = apply;
}
void style::apply_number_format(bool apply)
{
number_format_apply_ = apply;
}
void style::apply_protection(bool apply)
{
protection_apply_ = apply;
}
} // namespace xlnt

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <cmath>
#include <ctime>
@ -21,6 +43,10 @@ std::tm safe_localtime(std::time_t raw_time)
namespace xlnt {
date::date(int year_, int month_, int day_) : year(year_), month(month_), day(day_)
{
}
date date::from_number(int days_since_base_year, calendar base_date)
{
date result(0, 0, 0);

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <cmath>
#include <ctime>
@ -56,4 +78,20 @@ datetime datetime::now()
return datetime(1900 + now.tm_year, now.tm_mon + 1, now.tm_mday, now.tm_hour, now.tm_min, now.tm_sec);
}
datetime datetime::today()
{
return now();
}
datetime::datetime(int year_, int month_, int day_, int hour_, int minute_, int second_, int microsecond_)
: year(year_),
month(month_),
day(day_),
hour(hour_),
minute(minute_),
second(second_),
microsecond(microsecond_)
{
}
} // namespace xlnt

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/utils/exceptions.hpp>
namespace xlnt {

39
source/utils/hashable.cpp Normal file
View File

@ -0,0 +1,39 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/utils/hashable.hpp>
namespace xlnt {
std::size_t hashable::hash() const
{
static std::hash<std::string> hasher;
return hasher.operator()(to_hash_string());
}
bool hashable::operator==(const xlnt::hashable &other) const
{
return hash() == other.hash();
}
} // namespace xlnt

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <cmath>
#include <ctime>
@ -43,6 +65,11 @@ time time::from_number(long double raw_time)
return result;
}
time::time(int hour_, int minute_, int second_, int microsecond_)
: hour(hour_), minute(minute_), second(second_), microsecond(microsecond_)
{
}
bool time::operator==(const time &comparand) const
{
return hour == comparand.hour && minute == comparand.minute && second == comparand.second &&

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <cmath>
#include <ctime>

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/utils/utf8string.hpp>
namespace xlnt {

View File

@ -1,4 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/utils/exceptions.hpp>
#include <xlnt/workbook/named_range.hpp>
#include <xlnt/worksheet/range_reference.hpp>
@ -36,6 +58,16 @@ std::vector<std::string> split_string(const std::string &string, char delim)
namespace xlnt {
std::string named_range::get_name() const
{
return name_;
}
const std::vector<named_range::target> &named_range::get_targets() const
{
return targets_;
}
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>> final;

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <algorithm>
#include <array>
#include <fstream>

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/worksheet/cell_vector.hpp>
#include <xlnt/cell/cell.hpp>

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/worksheet/footer.hpp>
namespace xlnt {

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/worksheet/header.hpp>
namespace xlnt {

View File

@ -0,0 +1,66 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/worksheet/header_footer.hpp>
namespace xlnt {
header &header_footer::get_left_header()
{
return left_header_;
}
header &header_footer::get_center_header()
{
return center_header_;
}
header &header_footer::get_right_header()
{
return right_header_;
}
footer &header_footer::get_left_footer()
{
return left_footer_;
}
footer &header_footer::get_center_footer()
{
return center_footer_;
}
footer &header_footer::get_right_footer()
{
return right_footer_;
}
bool header_footer::is_default_header() const
{
return left_header_.is_default() && center_header_.is_default() && right_header_.is_default();
}
bool header_footer::is_default_footer() const
{
return left_footer_.is_default() && center_footer_.is_default() && right_footer_.is_default();
}
bool header_footer::is_default() const
{
return is_default_header() && is_default_footer();
}
} // namespace xlnt

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/worksheet/page_margins.hpp>
namespace xlnt {

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <xlnt/worksheet/range.hpp>
#include <xlnt/cell/cell.hpp>
#include <xlnt/worksheet/range_reference.hpp>

View File

@ -1,3 +1,25 @@
// Copyright (c) 2014-2015 Thomas Fussell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <locale>
#include <xlnt/worksheet/range_reference.hpp>

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <algorithm>
#include <locale>
#include <sstream>

View File

@ -1,3 +1,26 @@
// Copyright (c) 2014-2015 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
#include <algorithm>
#include <limits>

1
third-party/Optional vendored Submodule

@ -0,0 +1 @@
Subproject commit bd25a1baef048fc5d358927718d367e3f821963e