mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
workbook parameterised constructors
Issue #298 - all 4 are simply duplicating existing behaviour, but perhaps we can get a more optimal version in future - istream ctor is intended as an extension point that can then be used to create free/static functions to work with any future data source (vector), while the path ctor is a convenience function for the common case (from file)
This commit is contained in:
parent
e0d62b0835
commit
bb04205dac
|
@ -130,6 +130,31 @@ public:
|
|||
/// </summary>
|
||||
workbook();
|
||||
|
||||
/// <summary>
|
||||
/// load the xlsx file at path
|
||||
/// </summary>
|
||||
workbook(const xlnt::path &file);
|
||||
|
||||
/// <summary>
|
||||
/// load the encrpyted xlsx file at path
|
||||
/// </summary>
|
||||
workbook(const xlnt::path &file, const std::string& password);
|
||||
|
||||
/// <summary>
|
||||
/// construct the workbook from any data stream where the data is the binary form of a workbook
|
||||
/// </summary>
|
||||
workbook(std::istream & data);
|
||||
|
||||
/// <summary>
|
||||
/// construct the workbook from any data stream where the data is the binary form of an encrypted workbook
|
||||
/// </summary>
|
||||
workbook(std::istream &data, const std::string& password);
|
||||
|
||||
/// <summary>
|
||||
/// Move constructor. Constructs a workbook from existing workbook, other.
|
||||
/// </summary>
|
||||
workbook(workbook &&other);
|
||||
|
||||
/// <summary>
|
||||
/// Move constructor. Constructs a workbook from existing workbook, other.
|
||||
/// </summary>
|
||||
|
|
|
@ -500,6 +500,30 @@ workbook::workbook()
|
|||
swap(wb_template);
|
||||
}
|
||||
|
||||
workbook::workbook(const xlnt::path &file)
|
||||
{
|
||||
*this = empty();
|
||||
load(file);
|
||||
}
|
||||
|
||||
workbook::workbook(const xlnt::path &file, const std::string &password)
|
||||
{
|
||||
*this = empty();
|
||||
load(file, password);
|
||||
}
|
||||
|
||||
workbook::workbook(std::istream &data)
|
||||
{
|
||||
*this = empty();
|
||||
load(data);
|
||||
}
|
||||
|
||||
workbook::workbook(std::istream &data, const std::string &password)
|
||||
{
|
||||
*this = empty();
|
||||
load(data, password);
|
||||
}
|
||||
|
||||
workbook::workbook(detail::workbook_impl *impl)
|
||||
: d_(impl)
|
||||
{
|
||||
|
@ -1178,9 +1202,7 @@ workbook::workbook(const workbook &other)
|
|||
d_->stylesheet_.get().parent = this;
|
||||
}
|
||||
|
||||
workbook::~workbook()
|
||||
{
|
||||
}
|
||||
workbook::~workbook() = default;
|
||||
|
||||
bool workbook::has_theme() const
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user