fix formatting

This commit is contained in:
Thomas Fussell 2016-01-17 22:23:31 -08:00
parent 15eeccf044
commit 34aa24bdd6
67 changed files with 349 additions and 321 deletions

View File

@ -1,6 +1,9 @@
---
BasedOnStyle: LLVM
AccessModifierOffset: 0
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: true
@ -21,7 +24,7 @@ BraceWrapping:
BreakBeforeBraces: Custom
ColumnLimit: 120
ConstructorInitializerAllOnOneLineOrOnePerLine: true
Cpp11BracedListStyle: false
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
IndentCaseLabels: false
@ -30,6 +33,7 @@ KeepEmptyLinesAtTheStartOfBlocks: false
Language: Cpp
NamespaceIndentation: None
MaxEmptyLinesToKeep: 1
PenaltyBreakComment: 1000
PointerAlignment: Right
SpaceAfterCStyleCast: false
SpaceBeforeParens: ControlStatements

View File

@ -51,7 +51,9 @@ struct datetime;
struct time;
struct timedelta;
namespace detail { struct cell_impl; }
namespace detail {
struct cell_impl;
}
/// <summary>
/// Describes cell associated properties.
@ -66,7 +68,7 @@ class XLNT_CLASS cell
{
public:
using type = cell_type;
/// <summary>
/// Return a map of error strings such as \#DIV/0! and their associated indices.
/// </summary>
@ -126,7 +128,7 @@ public:
/// Return the type of this cell.
/// </summary>
type get_data_type() const;
/// <summary>
/// Set the type of this cell.
/// </summary>
@ -146,130 +148,130 @@ public:
bool is_date() const;
// position
/// <summary>
/// Return a cell_reference that points to the location of this cell.
/// </summary>
cell_reference get_reference() const;
/// <summary>
/// Return the column of this cell.
/// </summary>
column_t get_column() const;
/// <summary>
/// Return the row of this cell.
/// </summary>
row_t get_row() const;
/// <summary>
/// Return the location of this cell as an ordered pair.
/// </summary>
std::pair<int, int> get_anchor() const;
// hyperlink
/// <summary>
/// Return a relationship representing this cell's hyperlink.
/// </summary>
relationship get_hyperlink() const;
/// <summary>
/// Add a hyperlink to this cell pointing to the URI of the given value.
/// </summary>
void set_hyperlink(const std::string &value);
/// <summary>
/// Return true if this cell has a hyperlink set.
/// </summary>
bool has_hyperlink() const;
// style
/// <summary>
/// Return true if this cell has had a style applied to it.
/// </summary>
bool has_style() const;
/// <summary>
/// Return the index of this cell's style in its parent workbook.
/// This is also the index of the style in the stylesheet XML, xl/styles.xml.
/// </summary>
std::size_t get_style_id() const;
/// <summary>
/// Set the style index of this cell. This should be an existing style in
/// the parent workbook.
/// </summary>
void set_style_id(std::size_t style_id);
/// <summary>
/// Return the number format of this cell.
/// </summary>
const number_format &get_number_format() const;
void set_number_format(const number_format &format);
/// <summary>
/// Return the font applied to the text in this cell.
/// </summary>
const font &get_font() const;
void set_font(const font &font_);
/// <summary>
/// Return the fill applied to this cell.
/// </summary>
const fill &get_fill() const;
void set_fill(const fill &fill_);
/// <summary>
/// Return the border of this cell.
/// </summary>
const border &get_border() const;
void set_border(const border &border_);
/// <summary>
/// Return the alignment of the text in this cell.
/// </summary>
const alignment &get_alignment() const;
void set_alignment(const alignment &alignment_);
/// <summary>
/// Return the protection of this cell.
/// </summary>
const protection &get_protection() const;
void set_protection(const protection &protection_);
void set_pivot_button(bool b);
/// <summary>
/// Return true iff pivot button?
/// </summary>
bool pivot_button() const;
void set_quote_prefix(bool b);
/// <summary>
/// Return true iff quote prefix?
/// </summary>
bool quote_prefix() const;
// comment
/// <summary>
/// Return the comment of this cell.
/// </summary>
comment get_comment();
/// <summary>
/// Return the comment of this cell.
/// </summary>
const comment get_comment() const;
void set_comment(const comment &comment);
void clear_comment();
bool has_comment() const;
@ -294,13 +296,13 @@ public:
std::string to_string() const;
// merging
/// <summary>
/// Return true iff this cell has been merged with one or more
/// surrounding cells.
/// </summary>
bool is_merged() const;
/// <summary>
/// Make this a merged cell iff merged is true.
/// Generally, this shouldn't be called directly. Instead,
@ -312,7 +314,7 @@ public:
/// Return the error string that is stored in this cell.
/// </summary>
std::string get_error() const;
/// <summary>
/// Directly assign the value of this cell to be the given error.
/// </summary>
@ -323,12 +325,12 @@ public:
/// a relative offset given by the parameters.
/// </summary>
cell offset(int column, int row);
/// <summary>
/// Return the worksheet that owns this cell.
/// </summary>
worksheet get_parent();
/// <summary>
/// Return the worksheet that owns this cell.
/// </summary>
@ -346,7 +348,7 @@ public:
std::string check_string(const std::string &to_check);
// operators
/// <summary>
/// Make this cell point to rhs.
/// The cell originally pointed to by this cell will be unchanged.
@ -357,30 +359,30 @@ public:
/// Return true if this cell the same cell as comparand (compare by reference).
/// </summary>
bool operator==(const cell &comparand) const;
/// <summary>
/// Return true if this cell is uninitialized.
/// </summary>
bool operator==(std::nullptr_t) const;
// friend operators, so we can put cell on either side of comparisons with other types
/// <summary>
/// Return true if this cell is uninitialized.
/// </summary>
friend XLNT_FUNCTION bool operator==(std::nullptr_t, const cell &cell);
/// <summary>
/// Return the result of left.get_reference() < right.get_reference().
/// What's the point of this?
/// </summary>
friend XLNT_FUNCTION bool operator<(cell left, cell right);
/// <summary>
/// Convenience function for writing cell to an ostream.
/// Uses cell::to_string() internally.
/// </summary>
friend XLNT_FUNCTION std::ostream &operator<<(std::ostream &stream, const xlnt::cell &cell);
/// <summary>
/// Convenience function for writing cell to an ostream.
/// Uses cell::to_string() internally.
/// </summary>
friend XLNT_FUNCTION std::ostream &operator<<(std::ostream &stream, const xlnt::cell &cell);
private:
// make these friends so they can use the private constructor
@ -392,7 +394,7 @@ private:
/// Private constructor to create a cell from its implementation.
/// </summary>
cell(detail::cell_impl *d);
/// <summary>
/// A pointer to this cell's implementation.
/// </summary>

View File

@ -52,7 +52,7 @@ struct XLNT_CLASS cell_reference_hash
/// </summary>
class XLNT_CLASS cell_reference
{
public:
public:
/// <summary>
/// Split a coordinate string like "A1" into an equivalent pair like {"A", 1}.
/// </summary>
@ -64,41 +64,41 @@ class XLNT_CLASS cell_reference
/// if column part or row part are prefixed by a dollar-sign indicating they
/// are absolute, otherwise false.
/// </summary>
static std::pair<std::string, row_t> split_reference(const std::string &reference_string,
bool &absolute_column, bool &absolute_row);
static std::pair<std::string, row_t> split_reference(
const std::string &reference_string, bool &absolute_column, bool &absolute_row);
// constructors
/// <summary>
/// Default constructor makes a reference to the top-left-most cell, "A1".
/// </summary>
cell_reference();
//TODO: should these be explicit? The implicit conversion is nice sometimes.
// TODO: should these be explicit? The implicit conversion is nice sometimes.
/// <summary>
/// Constructs a cell_reference from a string reprenting a cell coordinate (e.g. $B14).
/// </summary>
cell_reference(const char *reference_string);
/// <summary>
/// Constructs a cell_reference from a string reprenting a cell coordinate (e.g. $B14).
/// </summary>
cell_reference(const std::string &reference_string);
/// <summary>
/// Constructs a cell_reference from a string reprenting a column (e.g. A) and
/// a 1-indexed row.
/// </summary>
cell_reference(const std::string &column, row_t row);
/// <summary>
/// Constructs a cell_reference from a 1-indexed column index and row index.
/// </summary>
cell_reference(column_t column, row_t row);
// absoluateness
/// <summary>
/// Convert a coordinate to an absolute coordinate string (e.g. B12 -> $B$12)
/// Defaulting to true, absolute_column and absolute_row can optionally control
@ -113,7 +113,7 @@ class XLNT_CLASS cell_reference
/// return copy;
/// </remarks>
cell_reference &make_absolute(bool absolute_column = true, bool absolute_row = true);
/// <summary>
/// Return true if the reference refers to an absolute column, otherwise false.
/// </summary>
@ -137,13 +137,13 @@ class XLNT_CLASS cell_reference
void row_absolute(bool absolute_row);
// getters/setters
/// <summary>
/// Return a string that identifies the column of this reference
/// (e.g. second column from left is "B")
/// </summary>
column_t get_column() const;
/// <summary>
/// Set the column of this reference from a string that identifies a particular column.
/// </summary>
@ -153,7 +153,7 @@ class XLNT_CLASS cell_reference
/// Return a 1-indexed numeric index of the column of this reference.
/// </summary>
column_t get_column_index() const;
/// <summary>
/// Set the column of this reference from a 1-indexed number that identifies a particular column.
/// </summary>
@ -163,7 +163,7 @@ class XLNT_CLASS cell_reference
/// Return a 1-indexed numeric index of the row of this reference.
/// </summary>
row_t get_row() const;
/// <summary>
/// Set the row of this reference from a 1-indexed number that identifies a particular row.
/// </summary>
@ -188,7 +188,7 @@ class XLNT_CLASS cell_reference
range_reference to_range() const;
// operators
/// <summary>
/// I've always wanted to overload the comma operator.
/// cell_reference("A", 1), cell_reference("B", 1) will return
@ -201,44 +201,44 @@ class XLNT_CLASS cell_reference
/// in absoluteness of column and row.
/// </summary>
bool operator==(const cell_reference &comparand) const;
/// <summary>
/// Construct a cell_reference from reference_string and return the result
/// of their comparison.
/// </summary>
bool operator==(const std::string &reference_string) const;
/// <summary>
/// Construct a cell_reference from reference_string and return the result
/// of their comparison.
/// </summary>
bool operator==(const char *reference_string) const;
/// <summary>
/// Return true if this reference is not identical to comparand including
/// in absoluteness of column and row.
/// </summary>
bool operator!=(const cell_reference &comparand) const;
/// <summary>
/// Construct a cell_reference from reference_string and return the result
/// of their comparison.
/// </summary>
bool operator!=(const std::string &reference_string) const;
/// <summary>
/// Construct a cell_reference from reference_string and return the result
/// of their comparison.
/// </summary>
bool operator!=(const char *reference_string) const;
//TODO: are these useful? maybe get rid of them
// TODO: are these useful? maybe get rid of them
bool operator<(const cell_reference &other);
bool operator>(const cell_reference &other);
bool operator<=(const cell_reference &other);
bool operator>=(const cell_reference &other);
private:
private:
/// <summary>
/// Index of the column. Important: this is one-indexed to conform
/// with Excel. Column "A", the first column, would have an index of 1.
@ -255,7 +255,7 @@ class XLNT_CLASS cell_reference
/// True if the reference's row is absolute. This looks like "A$1" in Excel.
/// </summary>
bool absolute_row_;
/// <summary>
/// True if the reference's column is absolute. This looks like "$A1" in Excel.
/// </summary>

View File

@ -30,31 +30,33 @@
namespace xlnt {
class cell;
namespace detail { struct comment_impl; }
namespace detail {
struct comment_impl;
}
/// <summary>
/// A comment can be applied to a cell to provide extra information.
/// </summary>
class XLNT_CLASS comment
{
public:
public:
/// <summary>
/// The default constructor makes an invalid comment without a parent cell.
/// </summary>
comment();
/// <summary>
/// Constructs a comment applied to the given cell, parent, and with the comment
/// text and author set to the provided respective values.
comment(cell parent, const std::string &text, const std::string &auth);
~comment();
/// <summary>
/// Return the text that will be displayed for this comment.
/// </summary>
std::string get_text() const;
/// <summary>
/// Return the author of this comment.
/// </summary>
@ -68,14 +70,14 @@ class XLNT_CLASS comment
/// </summary>
bool operator==(const comment &other) const;
private:
private:
friend class cell; // cell needs access to private constructor
/// <summary>
/// Construct a comment from an implementation of a comment.
/// </summary>
comment(detail::comment_impl *d);
/// <summary>
/// Pointer to the implementation of this comment.
/// This allows comments to be passed by value while

View File

@ -67,62 +67,62 @@ public:
/// ordinals by adding 64.
/// </remarks>
static std::string column_string_from_index(index_t column_index);
/// <summary>
/// Default column_t is the first (left-most) column.
/// </summary>
column_t();
/// <summary>
/// Construct a column from a number.
/// </summary>
column_t(index_t column_index);
/// <summary>
/// Construct a column from a string.
/// </summary>
explicit column_t(const std::string &column_string);
/// <summary>
/// Construct a column from a string.
/// </summary>
explicit column_t(const char *column_string);
/// <summary>
/// Copy constructor
/// </summary>
column_t(const column_t &other);
/// <summary>
/// Move constructor
/// </summary>
column_t(column_t &&other);
/// <summary>
/// Return a string representation of this column index.
/// </summary>
std::string column_string() const;
/// <summary>
/// Set this column to be the same as rhs's and return reference to self.
/// </summary>
column_t &operator=(column_t rhs);
/// <summary>
/// Set this column to be equal to rhs and return reference to self.
/// </summary>
column_t &operator=(const std::string &rhs);
/// <summary>
/// Set this column to be equal to rhs and return reference to self.
/// </summary>
column_t &operator=(const char *rhs);
/// <summary>
/// Return true if this column refers to the same column as other.
/// </summary>
bool operator==(const column_t &other) const;
/// <summary>
/// Return true if this column doesn't refer to the same column as other.
/// </summary>
@ -132,177 +132,177 @@ public:
/// Return true if this column refers to the same column as other.
/// </summary>
bool operator==(int other) const;
/// <summary>
/// Return true if this column refers to the same column as other.
/// </summary>
bool operator==(index_t other) const;
/// <summary>
/// Return true if this column refers to the same column as other.
/// </summary>
bool operator==(const std::string &other) const;
/// <summary>
/// Return true if this column refers to the same column as other.
/// </summary>
bool operator==(const char *other) const;
/// <summary>
/// Return true if this column doesn't refer to the same column as other.
/// </summary>
bool operator!=(int other) const;
/// <summary>
/// Return true if this column doesn't refer to the same column as other.
/// </summary>
bool operator!=(index_t other) const;
/// <summary>
/// Return true if this column doesn't refer to the same column as other.
/// </summary>
bool operator!=(const std::string &other) const;
/// <summary>
/// Return true if this column doesn't refer to the same column as other.
/// </summary>
bool operator!=(const char *other) const;
/// <summary>
/// Return true if other is to the right of this column.
/// </summary>
bool operator>(const column_t &other) const;
/// <summary>
/// Return true if other is to the right of or equal to this column.
/// </summary>
bool operator>=(const column_t &other) const;
/// <summary>
/// Return true if other is to the left of this column.
/// </summary>
bool operator<(const column_t &other) const;
/// <summary>
/// Return true if other is to the left of or equal to this column.
/// </summary>
bool operator<=(const column_t &other) const;
/// <summary>
/// Return true if other is to the right of this column.
/// </summary>
bool operator>(const column_t::index_t &other) const;
/// <summary>
/// Return true if other is to the right of or equal to this column.
/// </summary>
bool operator>=(const column_t::index_t &other) const;
/// <summary>
/// Return true if other is to the left of this column.
/// </summary>
bool operator<(const column_t::index_t &other) const;
/// <summary>
/// Return true if other is to the left of or equal to this column.
/// </summary>
bool operator<=(const column_t::index_t &other) const;
/// <summary>
/// Pre-increment this column, making it point to the column one to the right.
/// </summary>
column_t &operator++();
/// <summary>
/// Pre-deccrement this column, making it point to the column one to the left.
/// </summary>
column_t &operator--();
/// <summary>
/// Post-increment this column, making it point to the column one to the right and returning the old column.
/// </summary>
column_t operator++(int);
/// <summary>
/// Post-decrement this column, making it point to the column one to the left and returning the old column.
/// </summary>
column_t operator--(int);
/// <summary>
/// Return the result of adding rhs to this column.
/// </summary>
column_t operator+(const column_t &rhs);
/// <summary>
/// Return the result of adding rhs to this column.
/// </summary>
column_t operator-(const column_t &rhs);
/// <summary>
/// Return the result of adding rhs to this column.
/// </summary>
column_t operator*(const column_t &rhs);
/// <summary>
/// Return the result of adding rhs to this column.
/// </summary>
column_t operator/(const column_t &rhs);
/// <summary>
/// Return the result of adding rhs to this column.
/// </summary>
column_t operator%(const column_t &rhs);
/// <summary>
/// Add rhs to this column and return a reference to this column.
/// </summary>
column_t &operator+=(const column_t &rhs);
/// <summary>
/// Subtrac rhs from this column and return a reference to this column.
/// </summary>
column_t &operator-=(const column_t &rhs);
/// <summary>
/// Multiply this column by rhs and return a reference to this column.
/// </summary>
column_t &operator*=(const column_t &rhs);
/// <summary>
/// Divide this column by rhs and return a reference to this column.
/// </summary>
column_t &operator/=(const column_t &rhs);
/// <summary>
/// Mod this column by rhs and return a reference to this column.
/// </summary>
column_t &operator%=(const column_t &rhs);
/// <summary>
/// Return true if other is to the right of this column.
/// </summary>
friend bool operator>(const column_t::index_t &left, const column_t &right);
/// <summary>
/// Return true if other is to the right of or equal to this column.
/// </summary>
friend bool operator>=(const column_t::index_t &left, const column_t &right);
/// <summary>
/// Return true if other is to the left of this column.
/// </summary>
friend bool operator<(const column_t::index_t &left, const column_t &right);
/// <summary>
/// Return true if other is to the left of or equal to this column.
/// </summary>
friend bool operator<=(const column_t::index_t &left, const column_t &right);
/// <summary>
/// Swap the columns that left and right refer to.
/// </summary>
friend void swap(column_t &left, column_t &right);
/// <summary>
/// Internal numeric value of this column index.
/// </summary>
@ -329,7 +329,7 @@ struct hash<xlnt::column_t>
{
return hasher(k);
}
xlnt::column_hash hasher;
};

View File

@ -27,7 +27,8 @@
namespace xlnt {
class XLNT_CLASS axis {
class XLNT_CLASS axis
{
};
} // namespace xlnt

View File

@ -27,7 +27,8 @@
namespace xlnt {
class XLNT_CLASS bar_chart {
class XLNT_CLASS bar_chart
{
};
} // namespace xlnt

View File

@ -27,7 +27,8 @@
namespace xlnt {
class XLNT_CLASS chart {
class XLNT_CLASS chart
{
};
} // namespace xlnt

View File

@ -27,7 +27,8 @@
namespace xlnt {
class XLNT_CLASS error_bar {
class XLNT_CLASS error_bar
{
};
} // namespace xlnt

View File

@ -27,7 +27,8 @@
namespace xlnt {
class XLNT_CLASS graph_chart {
class XLNT_CLASS graph_chart
{
};
} // namespace xlnt

View File

@ -27,7 +27,8 @@
namespace xlnt {
class XLNT_CLASS legend {
class XLNT_CLASS legend
{
};
} // namespace xlnt

View File

@ -27,7 +27,8 @@
namespace xlnt {
class XLNT_CLASS line_chart {
class XLNT_CLASS line_chart
{
};
} // namespace xlnt

View File

@ -27,7 +27,8 @@
namespace xlnt {
class XLNT_CLASS pie_chart {
class XLNT_CLASS pie_chart
{
};
} // namespace xlnt

View File

@ -27,7 +27,8 @@
namespace xlnt {
class XLNT_CLASS scatter_chart {
class XLNT_CLASS scatter_chart
{
};
} // namespace xlnt

View File

@ -27,7 +27,8 @@
namespace xlnt {
class XLNT_CLASS series {
class XLNT_CLASS series
{
};
} // namespace xlnt

View File

@ -32,10 +32,10 @@ struct drawing_struct;
class XLNT_CLASS drawing
{
public:
public:
drawing();
private:
private:
friend class worksheet;
drawing(drawing_struct *root);
drawing_struct *root_;

View File

@ -27,7 +27,8 @@
namespace xlnt {
class XLNT_CLASS known_formulae {
class XLNT_CLASS known_formulae
{
};
} // namespace xlnt

View File

@ -27,7 +27,8 @@
namespace xlnt {
class XLNT_CLASS tokenizer {
class XLNT_CLASS tokenizer
{
};
} // namespace xlnt

View File

@ -47,7 +47,7 @@ class XLNT_CLASS translator
void translate_range(const range_reference &range_ref);
void translate_formula(const cell_reference &dest);
private:
private:
const std::string ROW_RANGE_RE;
const std::string COL_RANGE_RE;
const std::string CELL_REF_RE;

View File

@ -36,7 +36,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS default_type
{
public:
public:
default_type();
default_type(const std::string &extension, const std::string &content_type);
default_type(const default_type &other);
@ -45,7 +45,7 @@ class XLNT_CLASS default_type
std::string get_extension() const;
std::string get_content_type() const;
private:
private:
std::string extension_;
std::string content_type_;
};

View File

@ -38,18 +38,18 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS manifest
{
public:
public:
bool has_default_type(const std::string &extension) const;
std::string get_default_type(const std::string &extension) const;
const std::vector<default_type> &get_default_types() const;
void add_default_type(const std::string &extension, const std::string &content_type);
bool has_override_type(const std::string &part_name) const;
std::string get_override_type(const std::string &part_name) const;
const std::vector<override_type> &get_override_types() const;
void add_override_type(const std::string &part_name, const std::string &content_type);
private:
private:
std::vector<default_type> default_types_;
std::vector<override_type> override_types_;
};

View File

@ -35,7 +35,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS override_type
{
public:
public:
override_type();
override_type(const std::string &extension, const std::string &content_type);
override_type(const override_type &other);
@ -44,7 +44,7 @@ class XLNT_CLASS override_type
std::string get_part_name() const;
std::string get_content_type() const;
private:
private:
std::string part_name_;
std::string content_type_;
};

View File

@ -50,7 +50,7 @@ enum class XLNT_CLASS target_mode
/// </summary>
class XLNT_CLASS relationship
{
public:
public:
enum class type
{
invalid,
@ -70,11 +70,11 @@ class XLNT_CLASS relationship
static type type_from_string(const std::string &type_string);
static std::string type_to_string(type t);
relationship();
relationship(const std::string &t, const std::string &r_id = "", const std::string &target_uri = "");
relationship(type t, const std::string &r_id = "", const std::string &target_uri = "");
/// <summary>
@ -98,12 +98,12 @@ class XLNT_CLASS relationship
std::string get_target_uri() const;
type get_type() const;
std::string get_type_string() const;
bool operator==(const relationship &rhs) const;
private:
private:
type type_;
std::string id_;
std::string source_uri_;

View File

@ -83,7 +83,7 @@ struct XLNT_CLASS zip_info
/// </summary>
class XLNT_CLASS zip_file
{
public:
public:
zip_file();
zip_file(const std::string &filename);
zip_file(const std::vector<unsigned char> &bytes);
@ -143,7 +143,7 @@ class XLNT_CLASS zip_file
std::string comment;
private:
private:
void start_read();
void start_write();

View File

@ -46,7 +46,7 @@ class XLNT_CLASS comment_serializer
xml_document write_comments() const;
xml_document write_comments_vml() const;
private:
private:
worksheet sheet_;
};

View File

@ -41,7 +41,7 @@ class workbook;
/// </summary>
class XLNT_CLASS excel_serializer
{
public:
public:
/// <summary>
///
/// </summary>
@ -73,8 +73,8 @@ class XLNT_CLASS excel_serializer
/// Create a ZIP file in memory, load archive from bytes, then populate workbook
/// with data from archive.
/// </summary>
bool load_virtual_workbook(const std::vector<std::uint8_t> &bytes, bool guess_types = false,
bool data_only = false);
bool load_virtual_workbook(
const std::vector<std::uint8_t> &bytes, bool guess_types = false, bool data_only = false);
/// <summary>
/// Create a ZIP file in memory, save workbook to this archive, then save archive
@ -94,7 +94,7 @@ class XLNT_CLASS excel_serializer
/// </summary>
bool save_stream_workbook(std::ostream &stream, bool as_template = false);
private:
private:
/// <summary>
/// Reads all files in archive and populates workbook with associated data
/// using other appropriate serializers such as workbook_serializer.

View File

@ -37,7 +37,7 @@ class xml_document;
/// </summary>
class XLNT_CLASS manifest_serializer
{
public:
public:
manifest_serializer(manifest &m);
void read_manifest(const xml_document &xml);
@ -45,7 +45,7 @@ class XLNT_CLASS manifest_serializer
std::string determine_document_type() const;
private:
private:
manifest &manifest_;
};

View File

@ -43,17 +43,17 @@ public:
/// Construct a serializer which operates on archive.
/// </summary>
relationship_serializer(zip_file &archive);
/// <summary>
/// Return a vector of relationships corresponding to target.
/// </summary>
std::vector<relationship> read_relationships(const std::string &target);
/// <summary>
/// Write relationships to archive for the given target.
/// </summary>
bool write_relationships(const std::vector<relationship> &relationships, const std::string &target);
private:
/// <summary>
/// Internal archive which is used for reading and writing.

View File

@ -37,7 +37,7 @@ class xml_document;
/// </summary>
class XLNT_CLASS shared_strings_serializer
{
public:
public:
static bool read_shared_strings(const xml_document &xml, std::vector<std::string> &strings);
static xml_document write_shared_strings(const std::vector<std::string> &strings);
};

View File

@ -51,7 +51,7 @@ class xml_node;
/// </summary>
class XLNT_CLASS style_serializer
{
public:
public:
/// <summary>
/// Construct a style_serializer which can write styles.xml based on wb or populate wb
/// with styles from an existing styles.xml.
@ -269,7 +269,7 @@ class XLNT_CLASS style_serializer
/// </summary>
bool write_style(const style &style_, xml_node &style_node) const;
private:
private:
/// <summary>
/// Set in the constructor, this workbook is used as the source or target for all writing or reading, respectively.
/// </summary>

View File

@ -37,11 +37,11 @@ class xml_document;
/// </summary>
class XLNT_CLASS theme_serializer
{
public:
public:
bool read_theme(const xml_document &xml, theme &t);
xml_document write_theme(const theme &t) const;
private:
private:
};
} // namespace xlnt

View File

@ -44,7 +44,7 @@ class xml_node;
/// </summary>
class XLNT_CLASS workbook_serializer
{
public:
public:
using string_pair = std::pair<std::string, std::string>;
workbook_serializer(workbook &wb);
@ -59,7 +59,7 @@ class XLNT_CLASS workbook_serializer
xml_node write_named_ranges() const;
private:
private:
workbook &workbook_;
};

View File

@ -41,13 +41,13 @@ class xml_document;
/// </summary>
class XLNT_CLASS worksheet_serializer
{
public:
public:
worksheet_serializer(worksheet sheet);
bool read_worksheet(const xml_document &xml);
xml_document write_worksheet() const;
private:
private:
worksheet sheet_;
};

View File

@ -29,7 +29,9 @@
#include <xlnt/xlnt_config.hpp>
namespace xlnt {
namespace detail { struct xml_document_impl; }
namespace detail {
struct xml_document_impl;
}
class xml_node;
class xml_serializer;
@ -39,7 +41,7 @@ class xml_serializer;
/// </summary>
class XLNT_CLASS xml_document
{
public:
public:
using string_pair = std::pair<std::string, std::string>;
xml_document();
@ -65,7 +67,7 @@ class XLNT_CLASS xml_document
std::string to_string() const;
xml_document &from_string(const std::string &xml_string);
private:
private:
friend class xml_serializer;
std::unique_ptr<detail::xml_document_impl> d_;
};

View File

@ -29,7 +29,9 @@
#include <xlnt/xlnt_config.hpp>
namespace xlnt {
namespace detail { struct xml_node_impl; }
namespace detail {
struct xml_node_impl;
}
class xml_document;
@ -38,7 +40,7 @@ class xml_document;
/// </summary>
class XLNT_CLASS xml_node
{
public:
public:
using string_pair = std::pair<std::string, std::string>;
xml_node();
@ -68,7 +70,7 @@ class XLNT_CLASS xml_node
std::string to_string() const;
private:
private:
friend class xml_document;
friend class xml_serializer;
xml_node(const detail::xml_node_impl &d);

View File

@ -36,7 +36,7 @@ class xml_node;
/// </summary>
class XLNT_CLASS xml_serializer
{
public:
public:
static std::string serialize(const xml_document &xml);
static xml_document deserialize(const std::string &xml_string);

View File

@ -52,7 +52,7 @@ public:
vertical_alignment get_vertical() const;
void set_vertical(vertical_alignment vertical);
protected:
std::string to_hash_string() const override;

View File

@ -41,7 +41,7 @@ class XLNT_CLASS border : public hashable
{
public:
static border default_border();
std::experimental::optional<side> &get_start();
const std::experimental::optional<side> &get_start() const;
std::experimental::optional<side> &get_end();
@ -63,7 +63,7 @@ public:
protected:
std::string to_hash_string() const override;
private:
std::experimental::optional<side> start_;
std::experimental::optional<side> end_;

View File

@ -61,7 +61,7 @@ public:
color();
color(type t, std::size_t v);
color(type t, const std::string &v);
void set_auto(std::size_t auto_index);
@ -79,7 +79,7 @@ public:
std::size_t get_theme() const;
std::string get_rgb_string() const;
protected:
std::string to_hash_string() const override;

View File

@ -34,7 +34,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS fill : public hashable
{
public:
public:
enum class type
{
none,
@ -73,11 +73,11 @@ class XLNT_CLASS fill : public hashable
};
type get_type() const;
void set_type(type t);
std::string get_pattern_type_string() const;
std::string get_gradient_type_string() const;
pattern_type get_pattern_type() const;
@ -87,17 +87,17 @@ class XLNT_CLASS fill : public hashable
void set_gradient_type(gradient_type t);
std::experimental::optional<color> &get_foreground_color();
const std::experimental::optional<color> &get_foreground_color() const;
std::experimental::optional<color> &get_background_color();
const std::experimental::optional<color> &get_background_color() const;
std::experimental::optional<color> &get_start_color();
const std::experimental::optional<color> &get_start_color() const;
std::experimental::optional<color> &get_end_color();
const std::experimental::optional<color> &get_end_color() const;
@ -105,15 +105,15 @@ class XLNT_CLASS fill : public hashable
void set_rotation(double rotation);
double get_rotation() const;
double get_gradient_left() const;
double get_gradient_right() const;
double get_gradient_top() const;
double get_gradient_bottom() const;
protected:
std::string to_hash_string() const override;

View File

@ -38,7 +38,7 @@ class style;
/// </summary>
class XLNT_CLASS font : public hashable
{
public:
public:
enum class underline_style
{
none,
@ -49,49 +49,49 @@ class XLNT_CLASS font : public hashable
};
void set_bold(bool bold);
bool is_bold() const;
void set_italic(bool italic);
bool is_italic() const;
void set_strikethrough(bool strikethrough);
bool is_strikethrough() const;
void set_underline(underline_style new_underline);
bool is_underline() const;
underline_style get_underline() const;
void set_size(std::size_t size);
std::size_t get_size() const;
void set_name(const std::string &name);
std::string get_name() const;
void set_color(color c);
void set_family(std::size_t family);
void set_scheme(const std::string &scheme);
color get_color() const;
bool has_family() const;
std::size_t get_family() const;
bool has_scheme() const;
protected:
std::string to_hash_string() const override;
private:
private:
friend class style;
std::string name_ = "Calibri";

View File

@ -82,19 +82,19 @@ public:
void set_format_string(const std::string &format_code);
void set_format_string(const std::string &format_code, std::size_t custom_id);
std::string get_format_string() const;
bool has_id() const;
void set_id(std::size_t id);
std::size_t get_id() const;
std::string format(const std::string &text) const;
std::string format(long double number, calendar base_date) const;
bool is_date_format() const;
protected:
std::string to_hash_string() const override;

View File

@ -35,7 +35,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS protection : public hashable
{
public:
public:
enum class type
{
inherit,
@ -48,7 +48,7 @@ class XLNT_CLASS protection : public hashable
void set_locked(type locked_type);
void set_hidden(type hidden_type);
protected:
std::string to_hash_string() const override;

View File

@ -38,20 +38,20 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS side : public hashable
{
public:
public:
side();
std::experimental::optional<border_style> &get_border_style();
const std::experimental::optional<border_style> &get_border_style() const;
std::experimental::optional<color> &get_color();
const std::experimental::optional<color> &get_color() const;
protected:
std::string to_hash_string() const override;
private:
std::experimental::optional<border_style> border_style_;
std::experimental::optional<color> color_;

View File

@ -68,7 +68,7 @@ public:
void apply_font(bool apply);
void apply_number_format(bool apply);
void apply_protection(bool apply);
protected:
std::string to_hash_string() const override;

View File

@ -36,7 +36,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS cell_coordinates_exception : public std::runtime_error
{
public:
public:
cell_coordinates_exception(column_t column, row_t row);
cell_coordinates_exception(const std::string &coord_string);
};

View File

@ -34,7 +34,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS column_string_index_exception : public std::runtime_error
{
public:
public:
column_string_index_exception();
};

View File

@ -34,7 +34,7 @@ class XLNT_CLASS hashable
public:
std::size_t hash() const;
bool operator==(const hashable &other) const;
protected:
virtual std::string to_hash_string() const = 0;
};

View File

@ -35,7 +35,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS invalid_file_exception : public std::runtime_error
{
public:
public:
invalid_file_exception(const std::string &filename);
};

View File

@ -34,7 +34,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS named_range_exception : public std::runtime_error
{
public:
public:
named_range_exception();
};

View File

@ -34,7 +34,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS read_only_workbook_exception : public std::runtime_error
{
public:
public:
read_only_workbook_exception();
};

View File

@ -35,7 +35,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS sheet_title_exception : public std::runtime_error
{
public:
public:
sheet_title_exception(const std::string &title);
};

View File

@ -35,7 +35,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS unicode_decode_error : public std::runtime_error
{
public:
public:
unicode_decode_error();
unicode_decode_error(char c);
unicode_decode_error(std::uint8_t b);

View File

@ -34,13 +34,13 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS document_security
{
public:
public:
document_security();
bool lock_revision;
bool lock_structure;
bool lock_windows;
std::string revision_password;
std::string workbook_password;
};

View File

@ -33,7 +33,7 @@ namespace xlnt {
class range_reference;
class worksheet;
//TODO: why is this not in a class?
// TODO: why is this not in a class?
std::vector<std::pair<std::string, std::string>> XLNT_FUNCTION split_named_range(const std::string &named_range_string);
/// <summary>
@ -42,7 +42,7 @@ std::vector<std::pair<std::string, std::string>> XLNT_FUNCTION split_named_range
/// </summary>
class XLNT_CLASS named_range
{
public:
public:
using target = std::pair<worksheet, range_reference>;
named_range();
@ -54,7 +54,7 @@ class XLNT_CLASS named_range
named_range &operator=(const named_range &other);
private:
private:
std::string name_;
std::vector<target> targets_;
};

View File

@ -56,17 +56,19 @@ class zip_file;
enum class encoding;
namespace detail { struct workbook_impl; } // namespace detail
namespace detail {
struct workbook_impl;
} // namespace detail
/// <summary>
/// workbook is the container for all other parts of the document.
/// </summary>
class XLNT_CLASS workbook
{
public:
public:
class XLNT_CLASS iterator
{
public:
public:
iterator(workbook &wb, std::size_t index);
iterator(const iterator &);
iterator &operator=(const iterator &);
@ -79,14 +81,14 @@ class XLNT_CLASS workbook
iterator operator++(int);
iterator &operator++();
private:
private:
workbook &wb_;
std::size_t index_;
};
class XLNT_CLASS const_iterator
{
public:
public:
const_iterator(const workbook &wb, std::size_t index);
const_iterator(const const_iterator &);
const_iterator &operator=(const const_iterator &);
@ -99,7 +101,7 @@ class XLNT_CLASS workbook
const_iterator operator++(int);
const_iterator &operator++();
private:
private:
const workbook &wb_;
std::size_t index_;
};
@ -251,7 +253,7 @@ class XLNT_CLASS workbook
std::vector<std::string> &get_shared_strings();
const std::vector<std::string> &get_shared_strings() const;
private:
private:
friend class worksheet;
std::shared_ptr<detail::workbook_impl> d_;
};

View File

@ -41,10 +41,10 @@ class range_reference;
/// </summary>
class XLNT_CLASS cell_vector
{
public:
public:
class XLNT_CLASS iterator : public std::iterator<std::bidirectional_iterator_tag, cell>
{
public:
public:
iterator(worksheet ws, const cell_reference &start_cell, major_order order = major_order::row);
iterator(const iterator &other);
@ -56,23 +56,23 @@ class XLNT_CLASS cell_vector
bool operator!=(const iterator &other) const;
iterator &operator--();
iterator operator--(int);
iterator &operator++();
iterator operator++(int);
private:
private:
worksheet ws_;
cell_reference current_cell_;
range_reference range_;
major_order order_;
};
class XLNT_CLASS const_iterator : public std::iterator<std::bidirectional_iterator_tag, const cell>
{
public:
public:
const_iterator(worksheet ws, const cell_reference &start_cell, major_order order = major_order::row);
const_iterator(const const_iterator &other);
@ -88,10 +88,10 @@ class XLNT_CLASS cell_vector
const_iterator operator--(int);
const_iterator &operator++();
const_iterator operator++(int);
private:
private:
worksheet ws_;
cell_reference current_cell_;
range_reference range_;
@ -125,11 +125,11 @@ class XLNT_CLASS cell_vector
const_iterator begin() const;
const_iterator cbegin() const;
const_iterator end() const;
const_iterator cend() const;
private:
private:
worksheet ws_;
range_reference ref_;
major_order order_;

View File

@ -35,20 +35,20 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS footer
{
public:
public:
footer();
void set_text(const std::string &text);
void set_font_name(const std::string &font_name);
void set_font_size(std::size_t font_size);
void set_font_color(const std::string &font_color);
bool is_default() const;
private:
private:
bool default_;
std::string text_;
std::string font_name_;

View File

@ -35,20 +35,20 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS header
{
public:
public:
header();
void set_text(const std::string &text);
void set_font_name(const std::string &font_name);
void set_font_size(std::size_t font_size);
void set_font_color(const std::string &font_color);
bool is_default() const;
private:
private:
bool default_;
std::string text_;
std::string font_name_;

View File

@ -37,13 +37,13 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS header_footer
{
public:
public:
header_footer();
header &get_left_header();
header &get_center_header();
header &get_right_header();
footer &get_left_footer();
footer &get_center_footer();
footer &get_right_footer();
@ -52,7 +52,7 @@ class XLNT_CLASS header_footer
bool is_default_footer() const;
bool is_default() const;
private:
private:
header left_header_, right_header_, center_header_;
footer left_footer_, right_footer_, center_footer_;
};

View File

@ -32,30 +32,30 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS page_margins
{
public:
public:
page_margins();
bool is_default() const;
double get_top() const;
void set_top(double top);
double get_left() const;
void set_left(double left);
double get_bottom() const;
void set_bottom(double bottom);
double get_right() const;
void set_right(double right);
double get_header() const;
void set_header(double header);
double get_footer() const;
void set_footer(double footer);
private:
private:
bool default_;
double top_;
double left_;

View File

@ -36,9 +36,9 @@ namespace xlnt {
/// </summary>
struct XLNT_CLASS page_setup
{
public:
public:
page_setup();
bool is_default() const;
page_break get_break() const;
@ -78,10 +78,10 @@ struct XLNT_CLASS page_setup
bool get_vertical_centered() const;
void set_scale(double scale);
double get_scale() const;
private:
private:
bool default_;
page_break break_;
sheet_state sheet_state_;

View File

@ -41,10 +41,10 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS range
{
public:
public:
using iterator = range_iterator_2d;
using const_iterator = const_range_iterator_2d;
range(worksheet ws, const range_reference &reference, major_order order = major_order::row, bool skip_null = false);
~range();
@ -80,7 +80,7 @@ class XLNT_CLASS range
const_iterator cbegin() const;
const_iterator cend() const;
private:
private:
worksheet ws_;
range_reference ref_;
major_order order_;

View File

@ -32,7 +32,9 @@ namespace xlnt {
class cell_vector;
class worksheet;
namespace detail { struct worksheet_impl; }
namespace detail {
struct worksheet_impl;
}
/// <summary>
/// An iterator used by worksheet and range for traversing
@ -40,7 +42,7 @@ namespace detail { struct worksheet_impl; }
/// </summary>
class XLNT_CLASS range_iterator_2d : public std::iterator<std::bidirectional_iterator_tag, cell_vector>
{
public:
public:
range_iterator_2d(worksheet &ws, const range_reference &start_cell, major_order order = major_order::row);
range_iterator_2d(const range_iterator_2d &other);
@ -59,22 +61,22 @@ class XLNT_CLASS range_iterator_2d : public std::iterator<std::bidirectional_ite
range_iterator_2d operator++(int);
private:
private:
detail::worksheet_impl *ws_;
cell_reference current_cell_;
range_reference range_;
major_order order_;
};
/// <summary>
/// A const version of range_iterator_2d which does not allow modification
/// to the dereferenced cell_vector.
/// </summary>
class XLNT_CLASS const_range_iterator_2d : public std::iterator<std::bidirectional_iterator_tag, const cell_vector>
{
public:
const_range_iterator_2d(const worksheet &ws, const range_reference &start_cell, major_order order = major_order::row);
public:
const_range_iterator_2d(
const worksheet &ws, const range_reference &start_cell, major_order order = major_order::row);
const_range_iterator_2d(const const_range_iterator_2d &other);
@ -92,7 +94,7 @@ class XLNT_CLASS const_range_iterator_2d : public std::iterator<std::bidirection
const_range_iterator_2d operator++(int);
private:
private:
detail::worksheet_impl *ws_;
cell_reference current_cell_;
range_reference range_;

View File

@ -33,7 +33,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS range_reference
{
public:
public:
/// <summary>
/// Convert a coordinate to an absolute coordinate string (B12 -> $B$12)
/// </summary>
@ -47,17 +47,17 @@ class XLNT_CLASS range_reference
range_reference(column_t column_index_start, row_t row_index_start, column_t column_index_end, row_t row_index_end);
bool is_single_cell() const;
std::size_t get_width() const;
std::size_t get_height() const;
cell_reference get_top_left() const;
cell_reference get_bottom_right() const;
cell_reference &get_top_left();
cell_reference &get_bottom_right();
range_reference make_offset(int column_offset, int row_offset) const;
@ -65,17 +65,17 @@ class XLNT_CLASS range_reference
std::string to_string() const;
bool operator==(const range_reference &comparand) const;
bool operator==(const std::string &reference_string) const;
bool operator==(const char *reference_string) const;
bool operator!=(const range_reference &comparand) const;
bool operator!=(const std::string &reference_string) const;
bool operator!=(const char *reference_string) const;
XLNT_FUNCTION friend bool operator==(const std::string &reference_string, const range_reference &ref);
XLNT_FUNCTION friend bool operator==(const char *reference_string, const range_reference &ref);
@ -84,11 +84,9 @@ class XLNT_CLASS range_reference
XLNT_FUNCTION friend bool operator!=(const char *reference_string, const range_reference &ref);
private:
private:
cell_reference top_left_;
cell_reference bottom_right_;
};
} // namespace xlnt

View File

@ -34,13 +34,13 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS sheet_protection
{
public:
public:
static std::string hash_password(const std::string &password);
void set_password(const std::string &password);
std::string get_hashed_password() const;
private:
private:
std::string hashed_password_;
};

View File

@ -51,7 +51,9 @@ class workbook;
struct date;
namespace detail { struct worksheet_impl; }
namespace detail {
struct worksheet_impl;
}
/// <summary>
/// A worksheet is a 2D array of cells starting with cell A1 in the top-left corner
@ -62,7 +64,7 @@ class XLNT_CLASS worksheet
public:
using iterator = range_iterator_2d;
using const_iterator = const_range_iterator_2d;
worksheet();
worksheet(const worksheet &rhs);
worksheet(workbook &parent_workbook, const std::string &title = std::string());
@ -211,15 +213,15 @@ public:
const_iterator cbegin() const;
const_iterator cend() const;
range iter_cells(bool skip_null);
private:
private:
friend class workbook;
friend class cell;
friend class range_iterator_2d;
friend class const_range_iterator_2d;
worksheet(detail::worksheet_impl *d);
detail::worksheet_impl *d_;
};