diff --git a/docs/source/includes/_api_reference.md b/docs/source/includes/_api_reference.md index f4a0e5d4..6ce287ca 100644 --- a/docs/source/includes/_api_reference.md +++ b/docs/source/includes/_api_reference.md @@ -124,6 +124,8 @@ Returns the protection of this cell. Creates a new format in the workbook, sets its protection to the given protection, and applies the format to this cell. #### ```bool xlnt::cell::has_style() const``` Returns true if this cell has had a style applied to it. +#### ```class style xlnt::cell::style()``` +Returns a wrapper pointing to the named style applied to this cell. #### ```const class style xlnt::cell::style() const``` Returns a wrapper pointing to the named style applied to this cell. #### ```void xlnt::cell::style(const class style &new_style)``` @@ -188,11 +190,12 @@ Returns true if this cell the same cell as comparand (compared by reference). Returns true if this cell is uninitialized. ### cell_reference_hash #### ```std::size_t xlnt::cell_reference_hash::operator()(const cell_reference &k) const``` +Returns a hash representing a particular cell_reference. ### cell_reference #### ```static std::pair xlnt::cell_reference::split_reference(const std::string &reference_string)``` -Split a coordinate string like "A1" into an equivalent pair like {"A", 1}. +Splits a coordinate string like "A1" into an equivalent pair like {"A", 1}. #### ```static std::pair xlnt::cell_reference::split_reference(const std::string &reference_string, bool &absolute_column, bool &absolute_row)``` -Split a coordinate string like "A1" into an equivalent pair like {"A", 1}. Reference parameters absolute_column and absolute_row will be set to true if column part or row part are prefixed by a dollar-sign indicating they are absolute, otherwise false. +Splits a coordinate string like "A1" into an equivalent pair like {"A", 1}. Reference parameters absolute_column and absolute_row will be set to true if column part or row part are prefixed by a dollar-sign indicating they are absolute, otherwise false. #### ```xlnt::cell_reference::cell_reference()``` Default constructor makes a reference to the top-left-most cell, "A1". #### ```xlnt::cell_reference::cell_reference(const char *reference_string)``` @@ -202,47 +205,47 @@ Constructs a cell_reference from a string reprenting a cell coordinate (e.g. $B1 #### ```xlnt::cell_reference::cell_reference(column_t column, row_t row)``` Constructs a cell_reference from a 1-indexed column index and row index. #### ```cell_reference& xlnt::cell_reference::make_absolute(bool absolute_column=true, bool absolute_row=true)``` -Convert a coordinate to an absolute coordinate string (e.g. B12 -> $B$12) Defaulting to true, absolute_column and absolute_row can optionally control whether the resulting cell_reference has an absolute column (e.g. B12 -> $B12) and absolute row (e.g. B12 -> B$12) respectively. +Converts a coordinate to an absolute coordinate string (e.g. B12 -> $B$12) Defaulting to true, absolute_column and absolute_row can optionally control whether the resulting cell_reference has an absolute column (e.g. B12 -> $B12) and absolute row (e.g. B12 -> B$12) respectively. #### ```bool xlnt::cell_reference::column_absolute() const``` -Return true if the reference refers to an absolute column, otherwise false. +Returns true if the reference refers to an absolute column, otherwise false. #### ```void xlnt::cell_reference::column_absolute(bool absolute_column)``` -Make this reference have an absolute column if absolute_column is true, otherwise not absolute. +Makes this reference have an absolute column if absolute_column is true, otherwise not absolute. #### ```bool xlnt::cell_reference::row_absolute() const``` -Return true if the reference refers to an absolute row, otherwise false. +Returns true if the reference refers to an absolute row, otherwise false. #### ```void xlnt::cell_reference::row_absolute(bool absolute_row)``` -Make this reference have an absolute row if absolute_row is true, otherwise not absolute. +Makes this reference have an absolute row if absolute_row is true, otherwise not absolute. #### ```column_t xlnt::cell_reference::column() const``` -Return a string that identifies the column of this reference (e.g. second column from left is "B") +Returns a string that identifies the column of this reference (e.g. second column from left is "B") #### ```void xlnt::cell_reference::column(const std::string &column_string)``` -Set the column of this reference from a string that identifies a particular column. +Sets the column of this reference from a string that identifies a particular column. #### ```column_t::index_t xlnt::cell_reference::column_index() const``` -Return a 1-indexed numeric index of the column of this reference. +Returns a 1-indexed numeric index of the column of this reference. #### ```void xlnt::cell_reference::column_index(column_t column)``` -Set the column of this reference from a 1-indexed number that identifies a particular column. +Sets the column of this reference from a 1-indexed number that identifies a particular column. #### ```row_t xlnt::cell_reference::row() const``` -Return a 1-indexed numeric index of the row of this reference. +Returns a 1-indexed numeric index of the row of this reference. #### ```void xlnt::cell_reference::row(row_t row)``` -Set the row of this reference from a 1-indexed number that identifies a particular row. +Sets the row of this reference from a 1-indexed number that identifies a particular row. #### ```cell_reference xlnt::cell_reference::make_offset(int column_offset, int row_offset) const``` -Return a cell_reference offset from this cell_reference by the number of columns and rows specified by the parameters. A negative value for column_offset or row_offset results in a reference above or left of this cell_reference, respectively. +Returns a cell_reference offset from this cell_reference by the number of columns and rows specified by the parameters. A negative value for column_offset or row_offset results in a reference above or left of this cell_reference, respectively. #### ```std::string xlnt::cell_reference::to_string() const``` -Return a string like "A1" for cell_reference(1, 1). +Returns a string like "A1" for cell_reference(1, 1). #### ```range_reference xlnt::cell_reference::to_range() const``` -Return a 1x1 range_reference containing only this cell_reference. +Returns a 1x1 range_reference containing only this cell_reference. #### ```range_reference xlnt::cell_reference::operator,(const cell_reference &other) const``` I've always wanted to overload the comma operator. cell_reference("A", 1), cell_reference("B", 1) will return range_reference(cell_reference("A", 1), cell_reference("B", 1)) #### ```bool xlnt::cell_reference::operator==(const cell_reference &comparand) const``` -Return true if this reference is identical to comparand including in absoluteness of column and row. +Returns true if this reference is identical to comparand including in absoluteness of column and row. #### ```bool xlnt::cell_reference::operator==(const std::string &reference_string) const``` -Construct a cell_reference from reference_string and return the result of their comparison. +Constructs a cell_reference from reference_string and return the result of their comparison. #### ```bool xlnt::cell_reference::operator==(const char *reference_string) const``` -Construct a cell_reference from reference_string and return the result of their comparison. +Constructs a cell_reference from reference_string and return the result of their comparison. #### ```bool xlnt::cell_reference::operator!=(const cell_reference &comparand) const``` -Return true if this reference is not identical to comparand including in absoluteness of column and row. +Returns true if this reference is not identical to comparand including in absoluteness of column and row. #### ```bool xlnt::cell_reference::operator!=(const std::string &reference_string) const``` -Construct a cell_reference from reference_string and return the result of their comparison. +Constructs a cell_reference from reference_string and return the result of their comparison. #### ```bool xlnt::cell_reference::operator!=(const char *reference_string) const``` -Construct a cell_reference from reference_string and return the result of their comparison. +Constructs a cell_reference from reference_string and return the result of their comparison. ### comment #### ```xlnt::comment::comment()``` Constructs a new blank comment. @@ -251,33 +254,36 @@ Constructs a new comment with the given text and author. #### ```xlnt::comment::comment(const std::string &text, const std::string &author)``` Constructs a new comment with the given unformatted text and author. #### ```rich_text xlnt::comment::text() const``` -Return the text that will be displayed for this comment. +Returns the text that will be displayed for this comment. #### ```std::string xlnt::comment::plain_text() const``` -Return the plain text that will be displayed for this comment without formatting information. +Returns the plain text that will be displayed for this comment without formatting information. #### ```std::string xlnt::comment::author() const``` -Return the author of this comment. +Returns the author of this comment. #### ```void xlnt::comment::hide()``` -Make this comment only visible when the associated cell is hovered. +Makes this comment only visible when the associated cell is hovered. #### ```void xlnt::comment::show()``` -Make this comment always visible. +Makes this comment always visible. #### ```bool xlnt::comment::visible() const``` Returns true if this comment is not hidden. #### ```void xlnt::comment::position(int left, int top)``` -Set the absolute position of this cell to the given coordinates. +Sets the absolute position of this cell to the given coordinates. #### ```int xlnt::comment::left() const``` Returns the distance from the left side of the sheet to the left side of the comment. #### ```int xlnt::comment::top() const``` Returns the distance from the top of the sheet to the top of the comment. #### ```void xlnt::comment::size(int width, int height)``` -Set the size of the comment. +Sets the size of the comment. #### ```int xlnt::comment::width() const``` Returns the width of this comment. #### ```int xlnt::comment::height() const``` Returns the height of this comment. -#### ```bool operator==(const comment &left, const comment &right)``` -Return true if both comments are equivalent. +#### ```bool xlnt::comment::operator==(const comment &other) const``` +Return true if this comment is equivalent to other. +#### ```bool xlnt::comment::operator!=(const comment &other) const``` +Returns true if this comment is not equivalent to other. ### column_t #### ```using xlnt::column_t::index_t = std::uint32_tundefined``` +Alias declaration for the internal numeric type of this column. #### ```index_t xlnt::column_t::indexundefined``` Internal numeric value of this column index. #### ```static index_t xlnt::column_t::column_index_from_string(const std::string &column_string)``` @@ -285,120 +291,114 @@ Convert a column letter into a column number (e.g. B -> 2) #### ```static std::string xlnt::column_t::column_string_from_index(index_t column_index)``` Convert a column number into a column letter (3 -> 'C') #### ```xlnt::column_t::column_t()``` -Default column_t is the first (left-most) column. +Default constructor. The column points to the "A" column. #### ```xlnt::column_t::column_t(index_t column_index)``` -Construct a column from a number. +Constructs a column from a number. #### ```xlnt::column_t::column_t(const std::string &column_string)``` -Construct a column from a string. +Constructs a column from a string. #### ```xlnt::column_t::column_t(const char *column_string)``` -Construct a column from a string. +Constructs a column from a string. #### ```xlnt::column_t::column_t(const column_t &other)``` -Copy constructor +Copy constructor. Constructs a column by copying it from other. #### ```xlnt::column_t::column_t(column_t &&other)``` -Move constructor +Move constructor. Constructs a column by moving it from other. #### ```std::string xlnt::column_t::column_string() const``` -Return a string representation of this column index. +Returns a string representation of this column index. #### ```column_t& xlnt::column_t::operator=(column_t rhs)``` -Set this column to be the same as rhs's and return reference to self. +Sets this column to be the same as rhs's and return reference to self. #### ```column_t& xlnt::column_t::operator=(const std::string &rhs)``` -Set this column to be equal to rhs and return reference to self. +Sets this column to be equal to rhs and return reference to self. #### ```column_t& xlnt::column_t::operator=(const char *rhs)``` -Set this column to be equal to rhs and return reference to self. +Sets this column to be equal to rhs and return reference to self. #### ```bool xlnt::column_t::operator==(const column_t &other) const``` -Return true if this column refers to the same column as other. +Returns true if this column refers to the same column as other. #### ```bool xlnt::column_t::operator!=(const column_t &other) const``` -Return true if this column doesn't refer to the same column as other. +Returns true if this column doesn't refer to the same column as other. #### ```bool xlnt::column_t::operator==(int other) const``` -Return true if this column refers to the same column as other. +Returns true if this column refers to the same column as other. #### ```bool xlnt::column_t::operator==(index_t other) const``` -Return true if this column refers to the same column as other. +Returns true if this column refers to the same column as other. #### ```bool xlnt::column_t::operator==(const std::string &other) const``` -Return true if this column refers to the same column as other. +Returns true if this column refers to the same column as other. #### ```bool xlnt::column_t::operator==(const char *other) const``` -Return true if this column refers to the same column as other. +Returns true if this column refers to the same column as other. #### ```bool xlnt::column_t::operator!=(int other) const``` -Return true if this column doesn't refer to the same column as other. +Returns true if this column doesn't refer to the same column as other. #### ```bool xlnt::column_t::operator!=(index_t other) const``` -Return true if this column doesn't refer to the same column as other. +Returns true if this column doesn't refer to the same column as other. #### ```bool xlnt::column_t::operator!=(const std::string &other) const``` -Return true if this column doesn't refer to the same column as other. +Returns true if this column doesn't refer to the same column as other. #### ```bool xlnt::column_t::operator!=(const char *other) const``` -Return true if this column doesn't refer to the same column as other. +Returns true if this column doesn't refer to the same column as other. #### ```bool xlnt::column_t::operator>(const column_t &other) const``` -Return true if other is to the right of this column. +Returns true if other is to the right of this column. #### ```bool xlnt::column_t::operator>=(const column_t &other) const``` -Return true if other is to the right of or equal to this column. +Returns true if other is to the right of or equal to this column. #### ```bool xlnt::column_t::operator<(const column_t &other) const``` -Return true if other is to the left of this column. +Returns true if other is to the left of this column. #### ```bool xlnt::column_t::operator<=(const column_t &other) const``` -Return true if other is to the left of or equal to this column. +Returns true if other is to the left of or equal to this column. #### ```bool xlnt::column_t::operator>(const column_t::index_t &other) const``` -Return true if other is to the right of this column. +Returns true if other is to the right of this column. #### ```bool xlnt::column_t::operator>=(const column_t::index_t &other) const``` -Return true if other is to the right of or equal to this column. +Returns true if other is to the right of or equal to this column. #### ```bool xlnt::column_t::operator<(const column_t::index_t &other) const``` -Return true if other is to the left of this column. +Returns true if other is to the left of this column. #### ```bool xlnt::column_t::operator<=(const column_t::index_t &other) const``` -Return true if other is to the left of or equal to this column. +Returns true if other is to the left of or equal to this column. #### ```column_t& xlnt::column_t::operator++()``` -Pre-increment this column, making it point to the column one to the right. +Pre-increments this column, making it point to the column one to the right and returning a reference to it. #### ```column_t& xlnt::column_t::operator--()``` -Pre-deccrement this column, making it point to the column one to the left. +Pre-deccrements this column, making it point to the column one to the left and returning a reference to it. #### ```column_t xlnt::column_t::operator++(int)``` -Post-increment this column, making it point to the column one to the right and returning the old column. +Post-increments this column, making it point to the column one to the right and returning the old column. #### ```column_t xlnt::column_t::operator--(int)``` -Post-decrement this column, making it point to the column one to the left and returning the old column. +Post-decrements this column, making it point to the column one to the left and returning the old column. #### ```column_t& xlnt::column_t::operator+=(const column_t &rhs)``` -Add rhs to this column and return a reference to this column. +Adds rhs to this column and returns a reference to this column. #### ```column_t& xlnt::column_t::operator-=(const column_t &rhs)``` -Subtrac rhs from this column and return a reference to this column. -#### ```column_t& xlnt::column_t::operator*=(const column_t &rhs)``` -Multiply this column by rhs and return a reference to this column. -#### ```column_t& xlnt::column_t::operator/=(const column_t &rhs)``` -Divide this column by rhs and return a reference to this column. -#### ```column_t& xlnt::column_t::operator%=(const column_t &rhs)``` -Mod this column by rhs and return a reference to this column. +Subtracts rhs from this column and returns a reference to this column. #### ```column_t operator+(column_t lhs, const column_t &rhs)``` -Return the result of adding rhs to this column. +Returns the result of adding rhs to this column. #### ```column_t operator-(column_t lhs, const column_t &rhs)``` -Return the result of subtracing lhs by rhs column. -#### ```column_t operator*(column_t lhs, const column_t &rhs)``` -Return the result of multiply lhs by rhs column. -#### ```column_t operator/(column_t lhs, const column_t &rhs)``` -Return the result of divide lhs by rhs column. -#### ```column_t operator%(column_t lhs, const column_t &rhs)``` -Return the result of mod lhs by rhs column. +Returns the result of subtracing lhs by rhs column. #### ```bool operator>(const column_t::index_t &left, const column_t &right)``` -Return true if other is to the right of this column. +Returns true if other is to the right of this column. #### ```bool operator>=(const column_t::index_t &left, const column_t &right)``` -Return true if other is to the right of or equal to this column. +Returns true if other is to the right of or equal to this column. #### ```bool operator<(const column_t::index_t &left, const column_t &right)``` -Return true if other is to the left of this column. +Returns true if other is to the left of this column. #### ```bool operator<=(const column_t::index_t &left, const column_t &right)``` -Return true if other is to the left of or equal to this column. +Returns true if other is to the left of or equal to this column. #### ```void swap(column_t &left, column_t &right)``` -Swap the columns that left and right refer to. +Swaps the columns that left and right refer to. ### column_hash #### ```std::size_t xlnt::column_hash::operator()(const column_t &k) const``` +Returns the result of hashing column k. ### column_t > #### ```size_t std::hash< xlnt::column_t >::operator()(const xlnt::column_t &k) const``` +Returns the result of hashing column k. ### rich_text #### ```xlnt::rich_text::rich_text()=default``` +Constructs an empty rich text object with no font and empty text. #### ```xlnt::rich_text::rich_text(const std::string &plain_text)``` +Constructs a rich text object with the given text and no font. #### ```xlnt::rich_text::rich_text(const std::string &plain_text, const class font &text_font)``` +Constructs a rich text object with the given text and font. #### ```xlnt::rich_text::rich_text(const rich_text_run &single_run)``` +Copy constructor. #### ```void xlnt::rich_text::clear()``` -Remove all text runs from this text. +Removes all text runs from this text. #### ```void xlnt::rich_text::plain_text(const std::string &s)``` -Clear any runs in this text and add a single run with default formatting and the given string as its textual content. +Clears any runs in this text and adds a single run with default formatting and the given string as its textual content. #### ```std::string xlnt::rich_text::plain_text() const``` -Combine the textual content of each text run in order and return the result. +Combines the textual content of each text run in order and returns the result. #### ```std::vector xlnt::rich_text::runs() const``` Returns a copy of the individual runs that comprise this text. #### ```void xlnt::rich_text::runs(const std::vector< rich_text_run > &new_runs)``` -Set the runs of this text all at once. +Sets the runs of this text all at once. #### ```void xlnt::rich_text::add_run(const rich_text_run &t)``` -Add a new run to the end of the set of runs. +Adds a new run to the end of the set of runs. #### ```bool xlnt::rich_text::operator==(const rich_text &rhs) const``` Returns true if the runs that make up this text are identical to those in rhs. #### ```bool xlnt::rich_text::operator==(const std::string &rhs) const``` @@ -522,24 +522,36 @@ Returns true if this URI is equivalent to other. ## Styles Module ### alignment #### ```bool xlnt::alignment::shrink() const``` +Returns true if shrink-to-fit has been enabled. #### ```alignment& xlnt::alignment::shrink(bool shrink_to_fit)``` +Sets whether the font size should be reduced until all of the text fits in a cell without wrapping. #### ```bool xlnt::alignment::wrap() const``` +Returns true if text-wrapping has been enabled. #### ```alignment& xlnt::alignment::wrap(bool wrap_text)``` +Sets whether text in a cell should continue to multiple lines if it doesn't fit in one line. #### ```optional xlnt::alignment::indent() const``` +Returns the optional value of indentation width in number of spaces. #### ```alignment& xlnt::alignment::indent(int indent_size)``` +Sets the indent size in number of spaces from the side of the cell. This will only take effect when left or right horizontal alignment has also been set. #### ```optional xlnt::alignment::rotation() const``` +Returns the optional value of rotation for text in the cell in degrees. #### ```alignment& xlnt::alignment::rotation(int text_rotation)``` +Sets the rotation for text in the cell in degrees. #### ```optional xlnt::alignment::horizontal() const``` +Returns the optional horizontal alignment. #### ```alignment& xlnt::alignment::horizontal(horizontal_alignment horizontal)``` +Sets the horizontal alignment. #### ```optional xlnt::alignment::vertical() const``` +Returns the optional vertical alignment. #### ```alignment& xlnt::alignment::vertical(vertical_alignment vertical)``` +Sets the vertical alignment. #### ```bool xlnt::alignment::operator==(const alignment &other) const``` Returns true if this alignment is equivalent to other. #### ```bool xlnt::alignment::operator!=(const alignment &other) const``` Returns true if this alignment is not equivalent to other. ### border #### ```static const std::vector& xlnt::border::all_sides()``` -A vector to the all of the border sides for iteration. +Returns a vector containing all of the border sides to be used for iteration. #### ```xlnt::border::border()``` Constructs a default border. #### ```optional xlnt::border::side(border_side s) const``` @@ -569,80 +581,142 @@ Returns true if left is exactly equal to right. Returns true if left is not exactly equal to right. ### indexed_color #### ```xlnt::indexed_color::indexed_color(std::size_t index)``` +Constructs an indexed_color from an index. #### ```std::size_t xlnt::indexed_color::index() const``` +Returns the index this color points to. #### ```void xlnt::indexed_color::index(std::size_t index)``` +Sets the index to index. ### theme_color #### ```xlnt::theme_color::theme_color(std::size_t index)``` +Constructs a theme_color from an index. #### ```std::size_t xlnt::theme_color::index() const``` +Returns the index of the color in the theme this points to. #### ```void xlnt::theme_color::index(std::size_t index)``` +Sets the index of this color to index. ### rgb_color #### ```xlnt::rgb_color::rgb_color(const std::string &hex_string)``` +Constructs an RGB color from a string in the form #[aa]rrggbb #### ```xlnt::rgb_color::rgb_color(std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t a=255)``` +Constructs an RGB color from red, green, and blue values in the range 0 to 255 plus an optional alpha which defaults to fully opaque. #### ```std::string xlnt::rgb_color::hex_string() const``` +Returns a string representation of this color in the form #aarrggbb #### ```std::uint8_t xlnt::rgb_color::red() const``` +Returns a byte representing the red component of this color #### ```std::uint8_t xlnt::rgb_color::green() const``` +Returns a byte representing the red component of this color #### ```std::uint8_t xlnt::rgb_color::blue() const``` +Returns a byte representing the blue component of this color #### ```std::uint8_t xlnt::rgb_color::alpha() const``` +Returns a byte representing the alpha component of this color #### ```std::array xlnt::rgb_color::rgb() const``` +Returns the red, green, and blue components of this color separately in an array in that order. #### ```std::array xlnt::rgb_color::rgba() const``` +Returns the red, green, blue, and alpha components of this color separately in an array in that order. ### color #### ```static const color xlnt::color::black()``` +Returns the color #000000 #### ```static const color xlnt::color::white()``` +Returns the color #ffffff #### ```static const color xlnt::color::red()``` +Returns the color #ff0000 #### ```static const color xlnt::color::darkred()``` +Returns the color #8b0000 #### ```static const color xlnt::color::blue()``` +Returns the color #00ff00 #### ```static const color xlnt::color::darkblue()``` +Returns the color #008b00 #### ```static const color xlnt::color::green()``` +Returns the color #0000ff #### ```static const color xlnt::color::darkgreen()``` +Returns the color #00008b #### ```static const color xlnt::color::yellow()``` +Returns the color #ffff00 #### ```static const color xlnt::color::darkyellow()``` +Returns the color #cccc00 #### ```xlnt::color::color()``` +Constructs a default color #### ```xlnt::color::color(const rgb_color &rgb)``` +Constructs a color from a given RGB color #### ```xlnt::color::color(const indexed_color &indexed)``` +Constructs a color from a given indexed color #### ```xlnt::color::color(const theme_color &theme)``` +Constructs a color from a given theme color #### ```color_type xlnt::color::type() const``` -#### ```bool xlnt::color::is_auto() const``` +Returns the type of this color +#### ```bool xlnt::color::auto_() const``` +Returns true if this color has been set to auto #### ```void xlnt::color::auto_(bool value)``` -#### ```const rgb_color& xlnt::color::rgb() const``` -#### ```const indexed_color& xlnt::color::indexed() const``` -#### ```const theme_color& xlnt::color::theme() const``` +Sets the auto property of this color to value +#### ```rgb_color xlnt::color::rgb() const``` +Returns the internal indexed color representing this color. If this is not an RGB color, an invalid_attribute exception will be thrown. +#### ```indexed_color xlnt::color::indexed() const``` +Returns the internal indexed color representing this color. If this is not an indexed color, an invalid_attribute exception will be thrown. +#### ```theme_color xlnt::color::theme() const``` +Returns the internal indexed color representing this color. If this is not a theme color, an invalid_attribute exception will be thrown. #### ```double xlnt::color::tint() const``` +Returns the tint of this color. #### ```void xlnt::color::tint(double tint)``` +Sets the tint of this color to tint. Tints lighten or darken an existing color by multiplying the color with the tint. #### ```bool xlnt::color::operator==(const color &other) const``` +Returns true if this color is equivalent to other #### ```bool xlnt::color::operator!=(const color &other) const``` +Returns true if this color is not equivalent to other ### pattern_fill #### ```xlnt::pattern_fill::pattern_fill()``` +Constructs a default pattern fill with a none pattern and no colors. #### ```pattern_fill_type xlnt::pattern_fill::type() const``` +Returns the pattern used by this fill #### ```pattern_fill& xlnt::pattern_fill::type(pattern_fill_type new_type)``` +Sets the pattern of this fill and returns a reference to it. #### ```optional xlnt::pattern_fill::foreground() const``` +Returns the optional foreground color of this fill #### ```pattern_fill& xlnt::pattern_fill::foreground(const color &foreground)``` +Sets the foreground color and returns a reference to this pattern. #### ```optional xlnt::pattern_fill::background() const``` +Returns the optional background color of this fill #### ```pattern_fill& xlnt::pattern_fill::background(const color &background)``` -#### ```bool operator==(const pattern_fill &left, const pattern_fill &right)``` -Returns true if left is exactly equal to right. -#### ```bool operator!=(const pattern_fill &left, const pattern_fill &right)``` -Returns true if left is not exactly equal to right. +Sets the foreground color and returns a reference to this pattern. +#### ```bool xlnt::pattern_fill::operator==(const pattern_fill &other) const``` +Returns true if this pattern fill is equivalent to other. +#### ```bool xlnt::pattern_fill::operator!=(const pattern_fill &other) const``` +Returns true if this pattern fill is not equivalent to other. ### gradient_fill #### ```xlnt::gradient_fill::gradient_fill()``` +Constructs a default linear fill #### ```gradient_fill_type xlnt::gradient_fill::type() const``` +Returns the type of this gradient fill #### ```gradient_fill& xlnt::gradient_fill::type(gradient_fill_type new_type)``` +Sets the type of this gradient fill #### ```gradient_fill& xlnt::gradient_fill::degree(double degree)``` +Sets the angle of the gradient in degrees #### ```double xlnt::gradient_fill::degree() const``` +Returns the angle of the gradient #### ```double xlnt::gradient_fill::left() const``` +Returns the distance from the left where the gradient starts. #### ```gradient_fill& xlnt::gradient_fill::left(double value)``` +Sets the distance from the left where the gradient starts. #### ```double xlnt::gradient_fill::right() const``` +Returns the distance from the right where the gradient starts. #### ```gradient_fill& xlnt::gradient_fill::right(double value)``` +Sets the distance from the right where the gradient starts. #### ```double xlnt::gradient_fill::top() const``` +Returns the distance from the top where the gradient starts. #### ```gradient_fill& xlnt::gradient_fill::top(double value)``` +Sets the distance from the top where the gradient starts. #### ```double xlnt::gradient_fill::bottom() const``` +Returns the distance from the bottom where the gradient starts. #### ```gradient_fill& xlnt::gradient_fill::bottom(double value)``` +Sets the distance from the bottom where the gradient starts. #### ```gradient_fill& xlnt::gradient_fill::add_stop(double position, color stop_color)``` +Adds a gradient stop at position with the given color. #### ```gradient_fill& xlnt::gradient_fill::clear_stops()``` +Deletes all stops from the gradient. #### ```std::unordered_map xlnt::gradient_fill::stops() const``` -#### ```bool operator==(const gradient_fill &left, const gradient_fill &right)``` -Returns true if left is exactly equal to right. -#### ```bool operator!=(const gradient_fill &left, const gradient_fill &right)``` -Returns true if left is not exactly equal to right. +Returns all of the gradient stops. +#### ```bool xlnt::gradient_fill::operator==(const gradient_fill &other) const``` +Returns true if the gradient is equivalent to other. +#### ```bool xlnt::gradient_fill::operator!=(const gradient_fill &right) const``` +Returns true if the gradient is not equivalent to other. ### fill #### ```static fill xlnt::fill::solid(const color &fill_color)``` Helper method for the most common use case, setting the fill color of a cell to a single solid color. The foreground and background colors of a fill are not the same as the foreground and background colors of a cell. When setting a fill color in Excel, a new fill is created with the given color as the fill's fgColor and index color number 64 as the bgColor. This method creates a fill in the same way. @@ -658,285 +732,482 @@ Returns the fill_type of this fill depending on how it was constructed. Returns the gradient fill represented by this fill. Throws an invalid_attribute exception if this is not a gradient fill. #### ```class pattern_fill xlnt::fill::pattern_fill() const``` Returns the pattern fill represented by this fill. Throws an invalid_attribute exception if this is not a pattern fill. -#### ```bool operator==(const fill &left, const fill &right)``` +#### ```bool xlnt::fill::operator==(const fill &other) const``` Returns true if left is exactly equal to right. -#### ```bool operator!=(const fill &left, const fill &right)``` +#### ```bool xlnt::fill::operator!=(const fill &other) const``` Returns true if left is not exactly equal to right. ### font #### ```undefinedundefined``` -#### ```bool operator==(const font &left, const font &right)``` -Returns true if left is exactly equal to right. -#### ```bool operator!=(const font &left, const font &right)``` -Returns true if left is not exactly equal to right. +Text can be underlined in the enumerated ways #### ```xlnt::font::font()``` +Constructs a default font. Calibri, size 12 #### ```font& xlnt::font::bold(bool bold)``` +Sets the bold state of the font to bold and returns a reference to the font. #### ```bool xlnt::font::bold() const``` +Returns the bold state of the font. #### ```font& xlnt::font::superscript(bool superscript)``` +Sets the bold state of the font to bold and returns a reference to the font. #### ```bool xlnt::font::superscript() const``` +Returns true if this font has a superscript applied. #### ```font& xlnt::font::italic(bool italic)``` +Sets the bold state of the font to bold and returns a reference to the font. #### ```bool xlnt::font::italic() const``` +Returns true if this font has italics applied. #### ```font& xlnt::font::strikethrough(bool strikethrough)``` +Sets the bold state of the font to bold and returns a reference to the font. #### ```bool xlnt::font::strikethrough() const``` +Returns true if this font has a strikethrough applied. #### ```font& xlnt::font::outline(bool outline)``` +Sets the bold state of the font to bold and returns a reference to the font. #### ```bool xlnt::font::outline() const``` +Returns true if this font has an outline applied. #### ```font& xlnt::font::shadow(bool shadow)``` +Sets the shadow state of the font to shadow and returns a reference to the font. #### ```bool xlnt::font::shadow() const``` +Returns true if this font has a shadow applied. #### ```font& xlnt::font::underline(underline_style new_underline)``` +Sets the underline state of the font to new_underline and returns a reference to the font. #### ```bool xlnt::font::underlined() const``` +Returns true if this font has any type of underline applied. #### ```underline_style xlnt::font::underline() const``` +Returns the particular style of underline this font has applied. #### ```bool xlnt::font::has_size() const``` +Returns true if this font has a defined size. #### ```font& xlnt::font::size(double size)``` +Sets the size of the font to size and returns a reference to the font. #### ```double xlnt::font::size() const``` +Returns the size of the font. #### ```bool xlnt::font::has_name() const``` +Returns true if this font has a particular face applied (e.g. "Comic Sans"). #### ```font& xlnt::font::name(const std::string &name)``` +Sets the font face to name and returns a reference to the font. #### ```std::string xlnt::font::name() const``` +Returns the name of the font face. #### ```bool xlnt::font::has_color() const``` +Returns true if this font has a color applied. #### ```font& xlnt::font::color(const color &c)``` +Sets the color of the font to c and returns a reference to the font. #### ```xlnt::color xlnt::font::color() const``` +Returns the color that this font is using. #### ```bool xlnt::font::has_family() const``` +Returns true if this font has a family defined. #### ```font& xlnt::font::family(std::size_t family)``` +Sets the family index of the font to family and returns a reference to the font. #### ```std::size_t xlnt::font::family() const``` +Returns the family index for the font. #### ```bool xlnt::font::has_charset() const``` +Returns true if this font has a charset defined. #### ```font& xlnt::font::charset(std::size_t charset)``` +Sets the charset of the font to charset and returns a reference to the font. #### ```std::size_t xlnt::font::charset() const``` +Returns the charset of the font. #### ```bool xlnt::font::has_scheme() const``` +Returns true if this font has a scheme. #### ```font& xlnt::font::scheme(const std::string &scheme)``` +Sets the scheme of the font to scheme and returns a reference to the font. #### ```std::string xlnt::font::scheme() const``` +Returns the scheme of this font. +#### ```bool xlnt::font::operator==(const font &other) const``` +Returns true if left is exactly equal to right. +#### ```bool xlnt::font::operator!=(const font &other) const``` +Returns true if left is not exactly equal to right. ### format #### ```friend struct detail::stylesheetundefined``` -#### ```std::size_t xlnt::format::id() const``` -#### ```class alignment& xlnt::format::alignment()``` -#### ```const class alignment& xlnt::format::alignment() const``` -#### ```format xlnt::format::alignment(const xlnt::alignment &new_alignment, bool applied)``` +#### ```friend class detail::xlsx_producerundefined``` +#### ```class alignment xlnt::format::alignment() const``` +Returns the alignment of this format. +#### ```format xlnt::format::alignment(const xlnt::alignment &new_alignment, bool applied=true)``` +Sets the alignment of this format to new_alignment. Applied, which defaults to true, determines whether the alignment should be enabled for cells using this format. #### ```bool xlnt::format::alignment_applied() const``` -#### ```class border& xlnt::format::border()``` -#### ```const class border& xlnt::format::border() const``` -#### ```format xlnt::format::border(const xlnt::border &new_border, bool applied)``` +Returns true if the alignment of this format should be applied to cells using it. +#### ```class border xlnt::format::border() const``` +Returns the border of this format. +#### ```format xlnt::format::border(const xlnt::border &new_border, bool applied=true)``` +Sets the border of this format to new_border. Applied, which defaults to true, determines whether the border should be enabled for cells using this format. #### ```bool xlnt::format::border_applied() const``` -#### ```class fill& xlnt::format::fill()``` -#### ```const class fill& xlnt::format::fill() const``` -#### ```format xlnt::format::fill(const xlnt::fill &new_fill, bool applied)``` +Returns true if the border set for this format should be applied to cells using the format. +#### ```class fill xlnt::format::fill() const``` +Returns the fill of this format. +#### ```format xlnt::format::fill(const xlnt::fill &new_fill, bool applied=true)``` +Sets the fill of this format to new_fill. Applied, which defaults to true, determines whether the border should be enabled for cells using this format. #### ```bool xlnt::format::fill_applied() const``` -#### ```class font& xlnt::format::font()``` -#### ```const class font& xlnt::format::font() const``` -#### ```format xlnt::format::font(const xlnt::font &new_font, bool applied)``` +Returns true if the fill set for this format should be applied to cells using the format. +#### ```class font xlnt::format::font() const``` +Returns the font of this format. +#### ```format xlnt::format::font(const xlnt::font &new_font, bool applied=true)``` +Sets the font of this format to new_font. Applied, which defaults to true, determines whether the font should be enabled for cells using this format. #### ```bool xlnt::format::font_applied() const``` -#### ```class number_format& xlnt::format::number_format()``` -#### ```const class number_format& xlnt::format::number_format() const``` -#### ```format xlnt::format::number_format(const xlnt::number_format &new_number_format, bool applied)``` +Returns true if the font set for this format should be applied to cells using the format. +#### ```class number_format xlnt::format::number_format() const``` +Returns the number format of this format. +#### ```format xlnt::format::number_format(const xlnt::number_format &new_number_format, bool applied=true)``` +Sets the number format of this format to new_number_format. Applied, which defaults to true, determines whether the number format should be enabled for cells using this format. #### ```bool xlnt::format::number_format_applied() const``` -#### ```class protection& xlnt::format::protection()``` -#### ```const class protection& xlnt::format::protection() const``` -#### ```format xlnt::format::protection(const xlnt::protection &new_protection, bool applied)``` +Returns true if the number_format set for this format should be applied to cells using the format. +#### ```class protection xlnt::format::protection() const``` +Returns the protection of this format. #### ```bool xlnt::format::protection_applied() const``` +Returns true if the protection set for this format should be applied to cells using the format. +#### ```format xlnt::format::protection(const xlnt::protection &new_protection, bool applied=true)``` +Sets the protection of this format to new_protection. Applied, which defaults to true, determines whether the protection should be enabled for cells using this format. #### ```bool xlnt::format::pivot_button() const``` +Returns true if the pivot table interface is enabled for this format. #### ```void xlnt::format::pivot_button(bool show)``` +If show is true, a pivot table interface will be displayed for cells using this format. #### ```bool xlnt::format::quote_prefix() const``` +Returns true if this format should add a single-quote prefix for all text values. #### ```void xlnt::format::quote_prefix(bool quote)``` +If quote is true, enables a single-quote prefix for all text values in cells using this format (e.g. "abc" will appear as "'abc"). The text will also not be stored in sharedStrings when this is enabled. #### ```bool xlnt::format::has_style() const``` +Returns true if this format has a corresponding style applied. #### ```void xlnt::format::clear_style()``` +Removes the style from this format if it exists. #### ```format xlnt::format::style(const std::string &name)``` +Sets the style of this format to a style with the given name. #### ```format xlnt::format::style(const class style &new_style)``` +Sets the style of this format to new_style. +#### ```class style xlnt::format::style()``` +Returns the style of this format. If it has no style, an invalid_parameter exception will be thrown. #### ```const class style xlnt::format::style() const``` +Returns the style of this format. If it has no style, an invalid_parameters exception will be thrown. ### number_format #### ```static const number_format xlnt::number_format::general()``` +Number format "General" #### ```static const number_format xlnt::number_format::text()``` +Number format "@" #### ```static const number_format xlnt::number_format::number()``` +Number format "0" #### ```static const number_format xlnt::number_format::number_00()``` +Number format "00" #### ```static const number_format xlnt::number_format::number_comma_separated1()``` +Number format "#,##0.00" #### ```static const number_format xlnt::number_format::percentage()``` +Number format "0%" #### ```static const number_format xlnt::number_format::percentage_00()``` +Number format "0.00%" #### ```static const number_format xlnt::number_format::date_yyyymmdd2()``` +Number format "yyyy-mm-dd" #### ```static const number_format xlnt::number_format::date_yymmdd()``` +Number format "yy-mm-dd" #### ```static const number_format xlnt::number_format::date_ddmmyyyy()``` +Number format "dd/mm/yy" #### ```static const number_format xlnt::number_format::date_dmyslash()``` +Number format "d/m/yy" #### ```static const number_format xlnt::number_format::date_dmyminus()``` +Number format "d-m-yy" #### ```static const number_format xlnt::number_format::date_dmminus()``` +Number format "d-m" #### ```static const number_format xlnt::number_format::date_myminus()``` +Number format "m-yy" #### ```static const number_format xlnt::number_format::date_xlsx14()``` +Number format "mm-dd-yy" #### ```static const number_format xlnt::number_format::date_xlsx15()``` +Number format "d-mmm-yy" #### ```static const number_format xlnt::number_format::date_xlsx16()``` +Number format "d-mmm" #### ```static const number_format xlnt::number_format::date_xlsx17()``` +Number format "mmm-yy" #### ```static const number_format xlnt::number_format::date_xlsx22()``` +Number format "m/d/yy h:mm" #### ```static const number_format xlnt::number_format::date_datetime()``` +Number format "yyyy-mm-dd h:mm:ss" #### ```static const number_format xlnt::number_format::date_time1()``` +Number format "h:mm AM/PM" #### ```static const number_format xlnt::number_format::date_time2()``` +Number format "h:mm:ss AM/PM" #### ```static const number_format xlnt::number_format::date_time3()``` +Number format "h:mm" #### ```static const number_format xlnt::number_format::date_time4()``` +Number format "h:mm:ss" #### ```static const number_format xlnt::number_format::date_time5()``` +Number format "mm:ss" #### ```static const number_format xlnt::number_format::date_time6()``` +Number format "h:mm:ss" #### ```static bool xlnt::number_format::is_builtin_format(std::size_t builtin_id)``` +Returns true if the given format ID corresponds to a known builtin format. #### ```static const number_format& xlnt::number_format::from_builtin_id(std::size_t builtin_id)``` +Returns the format with the given ID. Thows an invalid_parameter exception if builtin_id is not a valid ID. #### ```xlnt::number_format::number_format()``` +Constructs a default number_format equivalent to "General" #### ```xlnt::number_format::number_format(std::size_t builtin_id)``` +Constructs a number format equivalent to that returned from number_format::from_builtin_id(builtin_id). #### ```xlnt::number_format::number_format(const std::string &code)``` +Constructs a number format from a code string. If the string matches a builtin ID, its ID will also be set to match the builtin ID. #### ```xlnt::number_format::number_format(const std::string &code, std::size_t custom_id)``` +Constructs a number format from a code string and custom ID. Custom ID should generally be >= 164. #### ```void xlnt::number_format::format_string(const std::string &format_code)``` +Sets the format code of this number format to format_code. #### ```void xlnt::number_format::format_string(const std::string &format_code, std::size_t custom_id)``` +Sets the format code of this number format to format_code and the ID to custom_id. #### ```std::string xlnt::number_format::format_string() const``` +Returns the format code this number format uses. #### ```bool xlnt::number_format::has_id() const``` +Returns true if this number format has an ID. #### ```void xlnt::number_format::id(std::size_t id)``` +Sets the ID of this number format to id. #### ```std::size_t xlnt::number_format::id() const``` +Returns the ID of this format. #### ```std::string xlnt::number_format::format(const std::string &text) const``` +Returns text formatted according to this number format's format code. #### ```std::string xlnt::number_format::format(long double number, calendar base_date) const``` +Returns number formatted according to this number format's format code with the given base date. #### ```bool xlnt::number_format::is_date_format() const``` -#### ```bool operator==(const number_format &left, const number_format &right)``` -Returns true if left is exactly equal to right. -#### ```bool operator!=(const number_format &left, const number_format &right)``` -Returns true if left is not exactly equal to right. +Returns true if this format code returns a number formatted as a date. +#### ```bool xlnt::number_format::operator==(const number_format &other) const``` +Returns true if this format is equivalent to other. +#### ```bool xlnt::number_format::operator!=(const number_format &other) const``` +Returns true if this format is not equivalent to other. ### protection #### ```static protection xlnt::protection::unlocked_and_visible()``` +Returns an unlocked and unhidden protection object. #### ```static protection xlnt::protection::locked_and_visible()``` +Returns a locked and unhidden protection object. #### ```static protection xlnt::protection::unlocked_and_hidden()``` +Returns an unlocked and hidden protection object. #### ```static protection xlnt::protection::locked_and_hidden()``` +Returns a locked and hidden protection object. #### ```xlnt::protection::protection()``` +Constructs a default unlocked unhidden protection object. #### ```bool xlnt::protection::locked() const``` +Returns true if cells using this protection should be locked. #### ```protection& xlnt::protection::locked(bool locked)``` +Sets the locked state of the protection to locked and returns a reference to the protection. #### ```bool xlnt::protection::hidden() const``` +Returns true if cells using this protection should be hidden. #### ```protection& xlnt::protection::hidden(bool hidden)``` -#### ```bool operator==(const protection &left, const protection &right)``` -Returns true if left is exactly equal to right. -#### ```bool operator!=(const protection &left, const protection &right)``` -Returns true if left is not exactly equal to right. +Sets the hidden state of the protection to hidden and returns a reference to the protection. +#### ```bool xlnt::protection::operator==(const protection &other) const``` +Returns true if this protections is equivalent to right. +#### ```bool xlnt::protection::operator!=(const protection &other) const``` +Returns true if this protection is not equivalent to right. ### style #### ```friend struct detail::stylesheetundefined``` #### ```friend class detail::xlsx_consumerundefined``` #### ```xlnt::style::style()=delete``` Delete zero-argument constructor #### ```xlnt::style::style(const style &other)=default``` -Default copy constructor +Default copy constructor. Constructs a style using the same PIMPL as other. #### ```std::string xlnt::style::name() const``` -Return the name of this style. +Returns the name of this style. #### ```style xlnt::style::name(const std::string &name)``` +Sets the name of this style to name. #### ```bool xlnt::style::hidden() const``` +Returns true if this style is hidden. #### ```style xlnt::style::hidden(bool value)``` -#### ```optional xlnt::style::custom() const``` -#### ```style xlnt::style::custom(bool value)``` -#### ```optional xlnt::style::builtin_id() const``` -#### ```style xlnt::style::builtin_id(std::size_t builtin_id)``` -#### ```class alignment& xlnt::style::alignment()``` -#### ```const class alignment& xlnt::style::alignment() const``` -#### ```style xlnt::style::alignment(const xlnt::alignment &new_alignment, bool applied=true)``` +Sets the hidden state of this style to value. A hidden style will not be shown in the list of selectable styles in the UI, but will still apply its formatting to cells using it. +#### ```bool xlnt::style::custom_builtin() const``` +Returns true if this is a builtin style that has been customized and should therefore be persisted in the workbook. +#### ```std::size_t xlnt::style::builtin_id() const``` +Returns the index of the builtin style that this style is an instance of or is a customized version thereof. If style::builtin() is false, this will throw an invalid_attribute exception. +#### ```bool xlnt::style::builtin() const``` +Returns true if this is a builtin style. +#### ```class alignment xlnt::style::alignment() const``` +Returns the alignment of this style. #### ```bool xlnt::style::alignment_applied() const``` -#### ```class border& xlnt::style::border()``` -#### ```const class border& xlnt::style::border() const``` -#### ```style xlnt::style::border(const xlnt::border &new_border, bool applied=true)``` +Returns true if the alignment of this style should be applied to cells using it. +#### ```style xlnt::style::alignment(const xlnt::alignment &new_alignment, bool applied=true)``` +Sets the alignment of this style to new_alignment. Applied, which defaults to true, determines whether the alignment should be enabled for cells using this style. +#### ```class border xlnt::style::border() const``` +Returns the border of this style. #### ```bool xlnt::style::border_applied() const``` -#### ```class fill& xlnt::style::fill()``` -#### ```const class fill& xlnt::style::fill() const``` -#### ```style xlnt::style::fill(const xlnt::fill &new_fill, bool applied=true)``` +Returns true if the border set for this style should be applied to cells using the style. +#### ```style xlnt::style::border(const xlnt::border &new_border, bool applied=true)``` +Sets the border of this style to new_border. Applied, which defaults to true, determines whether the border should be enabled for cells using this style. +#### ```class fill xlnt::style::fill() const``` +Returns the fill of this style. #### ```bool xlnt::style::fill_applied() const``` -#### ```class font& xlnt::style::font()``` -#### ```const class font& xlnt::style::font() const``` -#### ```style xlnt::style::font(const xlnt::font &new_font, bool applied=true)``` +Returns true if the fill set for this style should be applied to cells using the style. +#### ```style xlnt::style::fill(const xlnt::fill &new_fill, bool applied=true)``` +Sets the fill of this style to new_fill. Applied, which defaults to true, determines whether the border should be enabled for cells using this style. +#### ```class font xlnt::style::font() const``` +Returns the font of this style. #### ```bool xlnt::style::font_applied() const``` -#### ```class number_format& xlnt::style::number_format()``` -#### ```const class number_format& xlnt::style::number_format() const``` -#### ```style xlnt::style::number_format(const xlnt::number_format &new_number_format, bool applied=true)``` +Returns true if the font set for this style should be applied to cells using the style. +#### ```style xlnt::style::font(const xlnt::font &new_font, bool applied=true)``` +Sets the font of this style to new_font. Applied, which defaults to true, determines whether the font should be enabled for cells using this style. +#### ```class number_format xlnt::style::number_format() const``` +Returns the number_format of this style. #### ```bool xlnt::style::number_format_applied() const``` -#### ```class protection& xlnt::style::protection()``` -#### ```const class protection& xlnt::style::protection() const``` -#### ```style xlnt::style::protection(const xlnt::protection &new_protection, bool applied=true)``` +Returns true if the number_format set for this style should be applied to cells using the style. +#### ```style xlnt::style::number_format(const xlnt::number_format &new_number_format, bool applied=true)``` +Sets the number format of this style to new_number_format. Applied, which defaults to true, determines whether the number format should be enabled for cells using this style. +#### ```class protection xlnt::style::protection() const``` +Returns the protection of this style. #### ```bool xlnt::style::protection_applied() const``` +Returns true if the protection set for this style should be applied to cells using the style. +#### ```style xlnt::style::protection(const xlnt::protection &new_protection, bool applied=true)``` +Sets the border of this style to new_protection. Applied, which defaults to true, determines whether the protection should be enabled for cells using this style. #### ```bool xlnt::style::pivot_button() const``` +Returns true if the pivot table interface is enabled for this style. #### ```void xlnt::style::pivot_button(bool show)``` +If show is true, a pivot table interface will be displayed for cells using this style. #### ```bool xlnt::style::quote_prefix() const``` +Returns true if this style should add a single-quote prefix for all text values. #### ```void xlnt::style::quote_prefix(bool quote)``` +If quote is true, enables a single-quote prefix for all text values in cells using this style (e.g. "abc" will appear as "'abc"). The text will also not be stored in sharedStrings when this is enabled. #### ```bool xlnt::style::operator==(const style &other) const``` +Returns true if this style is equivalent to other. +#### ```bool xlnt::style::operator!=(const style &other) const``` +Returns true if this style is not equivalent to other. ## Utils Module ### date #### ```int xlnt::date::yearundefined``` +The year #### ```int xlnt::date::monthundefined``` +The month #### ```int xlnt::date::dayundefined``` +The day #### ```static date xlnt::date::today()``` Return the current date according to the system time. #### ```static date xlnt::date::from_number(int days_since_base_year, calendar base_date)``` Return a date by adding days_since_base_year to base_date. This includes leap years. #### ```xlnt::date::date(int year_, int month_, int day_)``` +Constructs a data from a given year, month, and day. #### ```int xlnt::date::to_number(calendar base_date) const``` Return the number of days between this date and base_date. #### ```int xlnt::date::weekday() const``` +Calculates and returns the day of the week that this date represents in the range 0 to 6 where 0 represents Sunday. #### ```bool xlnt::date::operator==(const date &comparand) const``` Return true if this date is equal to comparand. ### datetime #### ```int xlnt::datetime::yearundefined``` +The year #### ```int xlnt::datetime::monthundefined``` +The month #### ```int xlnt::datetime::dayundefined``` +The day #### ```int xlnt::datetime::hourundefined``` +The hour #### ```int xlnt::datetime::minuteundefined``` +The minute #### ```int xlnt::datetime::secondundefined``` +The second #### ```int xlnt::datetime::microsecondundefined``` +The microsecond #### ```static datetime xlnt::datetime::now()``` -Return the current date and time according to the system time. +Returns the current date and time according to the system time. #### ```static datetime xlnt::datetime::today()``` -Return the current date and time according to the system time. This is equivalent to datetime::now(). +Returns the current date and time according to the system time. This is equivalent to datetime::now(). #### ```static datetime xlnt::datetime::from_number(long double number, calendar base_date)``` -Return a datetime from number by converting the integer part into a date and the fractional part into a time according to date::from_number and time::from_number. +Returns a datetime from number by converting the integer part into a date and the fractional part into a time according to date::from_number and time::from_number. #### ```static datetime xlnt::datetime::from_iso_string(const std::string &iso_string)``` +Returns a datetime equivalent to the ISO-formatted string iso_string. #### ```xlnt::datetime::datetime(const date &d, const time &t)``` +Constructs a datetime from a date and a time. #### ```xlnt::datetime::datetime(int year_, int month_, int day_, int hour_=0, int minute_=0, int second_=0, int microsecond_=0)``` +Constructs a datetime from a year, month, and day plus optional hour, minute, second, and microsecond. #### ```std::string xlnt::datetime::to_string() const``` +Returns a string represenation of this date and time. #### ```std::string xlnt::datetime::to_iso_string() const``` +Returns an ISO-formatted string representation of this date and time. #### ```long double xlnt::datetime::to_number(calendar base_date) const``` +Returns this datetime as a number of seconds since 1900 or 1904 (depending on base_date provided). #### ```bool xlnt::datetime::operator==(const datetime &comparand) const``` +Returns true if this datetime is equivalent to comparand. #### ```int xlnt::datetime::weekday() const``` +Calculates and returns the day of the week that this date represents in the range 0 to 6 where 0 represents Sunday. ### exception #### ```xlnt::exception::exception(const std::string &message)``` +Constructs an exception with a message. This message will be returned by std::exception::what(), an inherited member of this class. #### ```xlnt::exception::exception(const exception &)=default``` +Default copy constructor. #### ```virtual xlnt::exception::~exception()``` +Destructor #### ```void xlnt::exception::message(const std::string &message)``` +Sets the message after the xlnt::exception is constructed. This can show more specific information than std::exception::what(). ### invalid_parameter #### ```xlnt::invalid_parameter::invalid_parameter()``` +Default constructor. #### ```xlnt::invalid_parameter::invalid_parameter(const invalid_parameter &)=default``` +Default copy constructor. #### ```virtual xlnt::invalid_parameter::~invalid_parameter()``` +Destructor ### invalid_sheet_title #### ```xlnt::invalid_sheet_title::invalid_sheet_title(const std::string &title)``` +Default constructor. #### ```xlnt::invalid_sheet_title::invalid_sheet_title(const invalid_sheet_title &)=default``` +Default copy constructor. #### ```virtual xlnt::invalid_sheet_title::~invalid_sheet_title()``` +Destructor ### missing_number_format #### ```xlnt::missing_number_format::missing_number_format()``` +Default constructor. +#### ```xlnt::missing_number_format::missing_number_format(const missing_number_format &)=default``` +Default copy constructor. #### ```virtual xlnt::missing_number_format::~missing_number_format()``` +Destructor ### invalid_file #### ```xlnt::invalid_file::invalid_file(const std::string &filename)``` +Constructs an invalid_file exception thrown when attempt to access the given filename. #### ```xlnt::invalid_file::invalid_file(const invalid_file &)=default``` +Default copy constructor. #### ```virtual xlnt::invalid_file::~invalid_file()``` +Destructor ### illegal_character #### ```xlnt::illegal_character::illegal_character(char c)``` +Constructs an illegal_character exception thrown as a result of the given character. #### ```xlnt::illegal_character::illegal_character(const illegal_character &)=default``` +Default copy constructor. #### ```virtual xlnt::illegal_character::~illegal_character()``` +Destructor ### invalid_data_type #### ```xlnt::invalid_data_type::invalid_data_type()``` +Default constructor. #### ```xlnt::invalid_data_type::invalid_data_type(const invalid_data_type &)=default``` +Default copy constructor. #### ```virtual xlnt::invalid_data_type::~invalid_data_type()``` -### invalid_column_string_index -#### ```xlnt::invalid_column_string_index::invalid_column_string_index()``` -#### ```xlnt::invalid_column_string_index::invalid_column_string_index(const invalid_column_string_index &)=default``` -#### ```virtual xlnt::invalid_column_string_index::~invalid_column_string_index()``` +Destructor +### invalid_column_index +#### ```xlnt::invalid_column_index::invalid_column_index()``` +Default constructor. +#### ```xlnt::invalid_column_index::invalid_column_index(const invalid_column_index &)=default``` +Default copy constructor. +#### ```virtual xlnt::invalid_column_index::~invalid_column_index()``` +Destructor ### invalid_cell_reference #### ```xlnt::invalid_cell_reference::invalid_cell_reference(column_t column, row_t row)``` +Constructs an invalid_cell_reference exception for the given column and row. #### ```xlnt::invalid_cell_reference::invalid_cell_reference(const std::string &reference_string)``` +Constructs an invalid_cell_reference exception for the given string. #### ```xlnt::invalid_cell_reference::invalid_cell_reference(const invalid_cell_reference &)=default``` +Default copy constructor. #### ```virtual xlnt::invalid_cell_reference::~invalid_cell_reference()``` +Destructor ### invalid_attribute #### ```xlnt::invalid_attribute::invalid_attribute()``` +Default constructor. #### ```xlnt::invalid_attribute::invalid_attribute(const invalid_attribute &)=default``` +Default copy constructor. #### ```virtual xlnt::invalid_attribute::~invalid_attribute()``` +Destructor ### key_not_found #### ```xlnt::key_not_found::key_not_found()``` +Default constructor. #### ```xlnt::key_not_found::key_not_found(const key_not_found &)=default``` +Default copy constructor. #### ```virtual xlnt::key_not_found::~key_not_found()``` +Destructor ### no_visible_worksheets #### ```xlnt::no_visible_worksheets::no_visible_worksheets()``` +Default constructor. #### ```xlnt::no_visible_worksheets::no_visible_worksheets(const no_visible_worksheets &)=default``` +Default copy constructor. #### ```virtual xlnt::no_visible_worksheets::~no_visible_worksheets()``` +Destructor ### unhandled_switch_case #### ```xlnt::unhandled_switch_case::unhandled_switch_case()``` +Default constructor. #### ```xlnt::unhandled_switch_case::unhandled_switch_case(const unhandled_switch_case &)=default``` +Default copy constructor. #### ```virtual xlnt::unhandled_switch_case::~unhandled_switch_case()``` +Destructor ### unsupported #### ```xlnt::unsupported::unsupported(const std::string &message)``` +Constructs an unsupported exception with a message describing the unsupported feature. #### ```xlnt::unsupported::unsupported(const unsupported &)=default``` +Default copy constructor. #### ```virtual xlnt::unsupported::~unsupported()``` +Destructor ### optional #### ```xlnt::optional< T >::optional()``` Default contructor. is_set() will be false initially. @@ -999,36 +1270,54 @@ Open the file pointed to by this path and return a string containing the files c Append the provided part to this path and return the result. #### ```path xlnt::path::append(const path &to_append) const``` Append the provided part to this path and return the result. -#### ```bool operator==(const path &left, const path &right)``` +#### ```bool xlnt::path::operator==(const path &other) const``` Returns true if left path is equal to right path. ### path > #### ```size_t std::hash< xlnt::path >::operator()(const xlnt::path &p) const``` +Returns a hashed represenation of the given path. ### scoped_enum_hash #### ```std::size_t xlnt::scoped_enum_hash< Enum >::operator()(Enum e) const``` Cast the enumeration e to a std::size_t and hash that value using std::hash. ### time #### ```int xlnt::time::hourundefined``` +The hour #### ```int xlnt::time::minuteundefined``` +The minute #### ```int xlnt::time::secondundefined``` +The second #### ```int xlnt::time::microsecondundefined``` +The microsecond #### ```static time xlnt::time::now()``` Return the current time according to the system time. #### ```static time xlnt::time::from_number(long double number)``` Return a time from a number representing a fraction of a day. The integer part of number will be ignored. 0.5 would return time(12, 0, 0, 0) or noon, halfway through the day. #### ```xlnt::time::time(int hour_=0, int minute_=0, int second_=0, int microsecond_=0)``` +Constructs a time object from an optional hour, minute, second, and microsecond. #### ```xlnt::time::time(const std::string &time_string)``` +Constructs a time object from a string representing the time. #### ```long double xlnt::time::to_number() const``` +Returns a numeric representation of the time in the range 0-1 where the value is equal to the fraction of the day elapsed. #### ```bool xlnt::time::operator==(const time &comparand) const``` +Returns true if this time is equivalent to comparand. ### timedelta #### ```int xlnt::timedelta::daysundefined``` +The days #### ```int xlnt::timedelta::hoursundefined``` +The hours #### ```int xlnt::timedelta::minutesundefined``` +The minutes #### ```int xlnt::timedelta::secondsundefined``` +The seconds #### ```int xlnt::timedelta::microsecondsundefined``` +The microseconds #### ```static timedelta xlnt::timedelta::from_number(long double number)``` +Returns a timedelta from a number representing the factional number of days elapsed. #### ```xlnt::timedelta::timedelta()``` +Constructs a timedelta equal to zero. #### ```xlnt::timedelta::timedelta(int days_, int hours_, int minutes_, int seconds_, int microseconds_)``` +Constructs a timedelta from a number of days, hours, minutes, seconds, and microseconds. #### ```long double xlnt::timedelta::to_number() const``` +Returns a numeric representation of this timedelta as a fractional number of days. ### variant #### ```undefinedundefined``` The possible types a variant can hold. @@ -1085,9 +1374,13 @@ The settings to allow the structure and windows lock to be removed. Constructs a new document security object with default values. ### lock_verifier #### ```std::string xlnt::document_security::lock_verifier::hash_algorithmundefined``` +The algorithm used to create and verify this lock. #### ```std::string xlnt::document_security::lock_verifier::saltundefined``` +The initial salt combined with the password used to prevent rainbow table attacks #### ```std::string xlnt::document_security::lock_verifier::hashundefined``` +The actual hash value represented as a string #### ```std::size_t xlnt::document_security::lock_verifier::spin_countundefined``` +The number of times the hash should be applied to the password combined with the salt. This allows the difficulty of the hash to be increased as computing power increases. ### external_book ### named_range #### ```using xlnt::named_range::target = std::pairundefined``` @@ -1298,6 +1591,8 @@ Returns the named style with the given name. Returns the named style with the given name. #### ```class style xlnt::workbook::create_style(const std::string &name)``` Creates a new style and returns it. +#### ```class style xlnt::workbook::create_builtin_style(std::size_t builtin_id)``` +Creates a new style and returns it. #### ```void xlnt::workbook::clear_styles()``` Clear all named styles from cells and remove the styles from from the styelsheet. This leaves all other styling in place (e.g. cell formats). #### ```class manifest& xlnt::workbook::manifest()``` @@ -1618,169 +1913,298 @@ Returns the footer margin Sets the footer margin to footer ### page_setup #### ```xlnt::page_setup::page_setup()``` +Default constructor. #### ```xlnt::page_break xlnt::page_setup::page_break() const``` +Returns the page break. #### ```void xlnt::page_setup::page_break(xlnt::page_break b)``` +Sets the page break to b. #### ```xlnt::sheet_state xlnt::page_setup::sheet_state() const``` +Returns the current sheet state of this page setup. #### ```void xlnt::page_setup::sheet_state(xlnt::sheet_state sheet_state)``` +Sets the sheet state to sheet_state. #### ```xlnt::paper_size xlnt::page_setup::paper_size() const``` +Returns the paper size which should be used to print the worksheet using this page setup. #### ```void xlnt::page_setup::paper_size(xlnt::paper_size paper_size)``` +Sets the paper size of this page setup. #### ```xlnt::orientation xlnt::page_setup::orientation() const``` +Returns the orientation of the worksheet using this page setup. #### ```void xlnt::page_setup::orientation(xlnt::orientation orientation)``` +Sets the orientation of the page. #### ```bool xlnt::page_setup::fit_to_page() const``` +Returns true if this worksheet should be scaled to fit on a single page during printing. #### ```void xlnt::page_setup::fit_to_page(bool fit_to_page)``` +If true, forces the worksheet to be scaled to fit on a single page during printing. #### ```bool xlnt::page_setup::fit_to_height() const``` +Returns true if the height of this worksheet should be scaled to fit on a printed page. #### ```void xlnt::page_setup::fit_to_height(bool fit_to_height)``` +Sets whether the height of the page should be scaled to fit on a printed page. #### ```bool xlnt::page_setup::fit_to_width() const``` +Returns true if the width of this worksheet should be scaled to fit on a printed page. #### ```void xlnt::page_setup::fit_to_width(bool fit_to_width)``` +Sets whether the width of the page should be scaled to fit on a printed page. #### ```void xlnt::page_setup::horizontal_centered(bool horizontal_centered)``` +Sets whether the worksheet should be centered horizontall on the page if it takes up less than a full page. #### ```bool xlnt::page_setup::horizontal_centered() const``` +Returns whether horizontal centering has been enabled. #### ```void xlnt::page_setup::vertical_centered(bool vertical_centered)``` +Sets whether the worksheet should be vertically centered on the page if it takes up less than a full page. #### ```bool xlnt::page_setup::vertical_centered() const``` +Returns whether vertical centering has been enabled. #### ```void xlnt::page_setup::scale(double scale)``` +Sets the factor by which the page should be scaled during printing. #### ```double xlnt::page_setup::scale() const``` +Returns the factor by which the page should be scaled during printing. ### pane #### ```optional xlnt::pane::top_left_cellundefined``` +The optional top left cell #### ```pane_state xlnt::pane::stateundefined``` +The state of the pane #### ```pane_corner xlnt::pane::active_paneundefined``` +The pane which contains the active cell #### ```row_t xlnt::pane::y_splitundefined``` +The row where the split should take place #### ```column_t xlnt::pane::x_splitundefined``` +The column where the split should take place #### ```bool xlnt::pane::operator==(const pane &rhs) const``` Returns true if this pane is equal to rhs based on its top-left cell, state, active pane, and x/y split location. ### range #### ```using xlnt::range::iterator = range_iteratorundefined``` +Alias for the iterator type #### ```using xlnt::range::const_iterator = const_range_iteratorundefined``` +Alias for the const iterator type #### ```using xlnt::range::reverse_iterator = std::reverse_iteratorundefined``` +Alias for the reverse iterator type #### ```using xlnt::range::const_reverse_iterator = std::reverse_iteratorundefined``` +Alias for the const reverse iterator type #### ```xlnt::range::range(worksheet ws, const range_reference &reference, major_order order=major_order::row, bool skip_null=false)``` +Constructs a range on the given worksheet. #### ```xlnt::range::~range()``` +Desctructor #### ```xlnt::range::range(const range &)=default``` -#### ```cell_vector xlnt::range::operator[](std::size_t vector_index)``` -#### ```const cell_vector xlnt::range::operator[](std::size_t vector_index) const``` -#### ```bool xlnt::range::operator==(const range &comparand) const``` -#### ```bool xlnt::range::operator!=(const range &comparand) const``` -#### ```cell_vector xlnt::range::vector(std::size_t vector_index)``` -#### ```const cell_vector xlnt::range::vector(std::size_t vector_index) const``` +Default copy constructor. +#### ```cell_vector xlnt::range::vector(std::size_t n)``` +Returns a vector pointing to the n-th row or column in this range (depending on major order). +#### ```const cell_vector xlnt::range::vector(std::size_t n) const``` +Returns a vector pointing to the n-th row or column in this range (depending on major order). #### ```class cell xlnt::range::cell(const cell_reference &ref)``` +Returns a cell in the range relative to its top left cell. #### ```const class cell xlnt::range::cell(const cell_reference &ref) const``` +Returns a cell in the range relative to its top left cell. #### ```range_reference xlnt::range::reference() const``` +Returns the reference defining the bounds of this range. #### ```std::size_t xlnt::range::length() const``` +Returns the number of rows or columns in this range (depending on major order). #### ```bool xlnt::range::contains(const cell_reference &ref)``` +Returns true if the given cell exists in the parent worksheet of this range. #### ```range xlnt::range::alignment(const xlnt::alignment &new_alignment)``` +Sets the alignment of all cells in the range to new_alignment and returns the range. #### ```range xlnt::range::border(const xlnt::border &new_border)``` +Sets the border of all cells in the range to new_border and returns the range. #### ```range xlnt::range::fill(const xlnt::fill &new_fill)``` +Sets the fill of all cells in the range to new_fill and returns the range. #### ```range xlnt::range::font(const xlnt::font &new_font)``` +Sets the font of all cells in the range to new_font and returns the range. #### ```range xlnt::range::number_format(const xlnt::number_format &new_number_format)``` +Sets the number format of all cells in the range to new_number_format and returns the range. #### ```range xlnt::range::protection(const xlnt::protection &new_protection)``` +Sets the protection of all cells in the range to new_protection and returns the range. #### ```range xlnt::range::style(const class style &new_style)``` Sets the named style applied to all cells in this range to a style named style_name. #### ```range xlnt::range::style(const std::string &style_name)``` Sets the named style applied to all cells in this range to a style named style_name. If this style has not been previously created in the workbook, a key_not_found exception will be thrown. #### ```cell_vector xlnt::range::front()``` +Returns the first row or column in this range. #### ```const cell_vector xlnt::range::front() const``` +Returns the first row or column in this range. #### ```cell_vector xlnt::range::back()``` +Returns the last row or column in this range. #### ```const cell_vector xlnt::range::back() const``` +Returns the last row or column in this range. #### ```iterator xlnt::range::begin()``` +Returns an iterator to the first row or column in this range. #### ```iterator xlnt::range::end()``` +Returns an iterator to one past the last row or column in this range. #### ```const_iterator xlnt::range::begin() const``` +Returns an iterator to the first row or column in this range. #### ```const_iterator xlnt::range::end() const``` +Returns an iterator to one past the last row or column in this range. #### ```const_iterator xlnt::range::cbegin() const``` +Returns an iterator to the first row or column in this range. #### ```const_iterator xlnt::range::cend() const``` +Returns an iterator to one past the last row or column in this range. #### ```reverse_iterator xlnt::range::rbegin()``` +Returns a reverse iterator to the first row or column in this range. #### ```reverse_iterator xlnt::range::rend()``` +Returns a reverse iterator to one past the last row or column in this range. #### ```const_reverse_iterator xlnt::range::rbegin() const``` +Returns a reverse iterator to the first row or column in this range. #### ```const_reverse_iterator xlnt::range::rend() const``` +Returns a reverse iterator to one past the last row or column in this range. #### ```const_reverse_iterator xlnt::range::crbegin() const``` +Returns a reverse iterator to the first row or column in this range. #### ```const_reverse_iterator xlnt::range::crend() const``` +Returns a reverse iterator to one past the last row or column in this range. #### ```void xlnt::range::apply(std::function< void(class cell)> f)``` +Applies function f to all cells in the range +#### ```cell_vector xlnt::range::operator[](std::size_t n)``` +Returns the n-th row or column in this range. +#### ```const cell_vector xlnt::range::operator[](std::size_t n) const``` +Returns the n-th row or column in this range. +#### ```bool xlnt::range::operator==(const range &comparand) const``` +Returns true if this range is equivalent to comparand. +#### ```bool xlnt::range::operator!=(const range &comparand) const``` +Returns true if this range is not equivalent to comparand. ### range_iterator #### ```xlnt::range_iterator::range_iterator(worksheet &ws, const cell_reference &cursor, const range_reference &bounds, major_order order, bool skip_null)``` +Constructs a range iterator on a worksheet, cell pointing to the current row or column, range bounds, an order, and whether or not to skip null column/rows. #### ```xlnt::range_iterator::range_iterator(const range_iterator &other)``` +Copy constructor. #### ```cell_vector xlnt::range_iterator::operator*() const``` +Dereference the iterator to return a column or row. #### ```range_iterator& xlnt::range_iterator::operator=(const range_iterator &)=default``` +Default assignment operator. #### ```bool xlnt::range_iterator::operator==(const range_iterator &other) const``` +Returns true if this iterator is equivalent to other. #### ```bool xlnt::range_iterator::operator!=(const range_iterator &other) const``` +Returns true if this iterator is not equivalent to other. #### ```range_iterator& xlnt::range_iterator::operator--()``` +Pre-decrement the iterator to point to the previous row/column. #### ```range_iterator xlnt::range_iterator::operator--(int)``` +Post-decrement the iterator to point to the previous row/column. #### ```range_iterator& xlnt::range_iterator::operator++()``` +Pre-increment the iterator to point to the next row/column. #### ```range_iterator xlnt::range_iterator::operator++(int)``` +Post-increment the iterator to point to the next row/column. ### const_range_iterator #### ```xlnt::const_range_iterator::const_range_iterator(const worksheet &ws, const cell_reference &cursor, const range_reference &bounds, major_order order, bool skip_null)``` +Constructs a range iterator on a worksheet, cell pointing to the current row or column, range bounds, an order, and whether or not to skip null column/rows. #### ```xlnt::const_range_iterator::const_range_iterator(const const_range_iterator &other)``` +Copy constructor. #### ```const cell_vector xlnt::const_range_iterator::operator*() const``` +Dereferennce the iterator to return the current column/row. #### ```const_range_iterator& xlnt::const_range_iterator::operator=(const const_range_iterator &)=default``` +Default assignment operator. #### ```bool xlnt::const_range_iterator::operator==(const const_range_iterator &other) const``` +Returns true if this iterator is equivalent to other. #### ```bool xlnt::const_range_iterator::operator!=(const const_range_iterator &other) const``` +Returns true if this iterator is not equivalent to other. #### ```const_range_iterator& xlnt::const_range_iterator::operator--()``` +Pre-decrement the iterator to point to the next row/column. #### ```const_range_iterator xlnt::const_range_iterator::operator--(int)``` +Post-decrement the iterator to point to the next row/column. #### ```const_range_iterator& xlnt::const_range_iterator::operator++()``` +Pre-increment the iterator to point to the next row/column. #### ```const_range_iterator xlnt::const_range_iterator::operator++(int)``` +Post-increment the iterator to point to the next row/column. ### range_reference #### ```static range_reference xlnt::range_reference::make_absolute(const range_reference &relative_reference)``` -Convert a coordinate to an absolute coordinate string (B12 -> $B$12) +Converts relative reference coordinates to absolute coordinates (B12 -> $B$12) #### ```xlnt::range_reference::range_reference()``` +Constructs a range reference equal to A1:A1 #### ```xlnt::range_reference::range_reference(const std::string &range_string)``` +Constructs a range reference equivalent to the provided range_string in the form :. #### ```xlnt::range_reference::range_reference(const char *range_string)``` +Constructs a range reference equivalent to the provided range_string in the form :. #### ```xlnt::range_reference::range_reference(const std::pair< cell_reference, cell_reference > &reference_pair)``` +Constructs a range reference from a pair of cell references. #### ```xlnt::range_reference::range_reference(const cell_reference &start, const cell_reference &end)``` +Constructs a range reference from cell references indicating top left and bottom right coordinates of the range. #### ```xlnt::range_reference::range_reference(column_t column_index_start, row_t row_index_start, column_t column_index_end, row_t row_index_end)``` +Constructs a range reference from column and row indices. #### ```bool xlnt::range_reference::is_single_cell() const``` +Returns true if the range has a width and height of 1 cell. #### ```std::size_t xlnt::range_reference::width() const``` +Returns the number of columns encompassed by this range. #### ```std::size_t xlnt::range_reference::height() const``` -#### ```cell_reference xlnt::range_reference::top_left()``` +Returns the number of rows encompassed by this range. #### ```cell_reference xlnt::range_reference::top_left() const``` -#### ```cell_reference xlnt::range_reference::top_right()``` +Returns the coordinate of the top left cell of this range. #### ```cell_reference xlnt::range_reference::top_right() const``` -#### ```cell_reference xlnt::range_reference::bottom_left()``` +Returns the coordinate of the top right cell of this range. #### ```cell_reference xlnt::range_reference::bottom_left() const``` -#### ```cell_reference xlnt::range_reference::bottom_right()``` +Returns the coordinate of the bottom left cell of this range. #### ```cell_reference xlnt::range_reference::bottom_right() const``` +Returns the coordinate of the bottom right cell of this range. #### ```range_reference xlnt::range_reference::make_offset(int column_offset, int row_offset) const``` +Returns a new range reference with the same width and height as this range but shifted by the given number of columns and rows. #### ```std::string xlnt::range_reference::to_string() const``` +Returns a string representation of this range. #### ```bool xlnt::range_reference::operator==(const range_reference &comparand) const``` +Returns true if this range is equivalent to the other range. #### ```bool xlnt::range_reference::operator==(const std::string &reference_string) const``` +Returns true if this range is equivalent to the string representation of the other range. #### ```bool xlnt::range_reference::operator==(const char *reference_string) const``` +Returns true if this range is equivalent to the string representation of the other range. #### ```bool xlnt::range_reference::operator!=(const range_reference &comparand) const``` +Returns true if this range is not equivalent to the other range. #### ```bool xlnt::range_reference::operator!=(const std::string &reference_string) const``` +Returns true if this range is not equivalent to the string representation of the other range. #### ```bool xlnt::range_reference::operator!=(const char *reference_string) const``` -#### ```bool operator==(const std::string &reference_string, const range_reference &ref)``` -#### ```bool operator==(const char *reference_string, const range_reference &ref)``` -#### ```bool operator!=(const std::string &reference_string, const range_reference &ref)``` -#### ```bool operator!=(const char *reference_string, const range_reference &ref)``` +Returns true if this range is not equivalent to the string representation of the other range. ### row_properties #### ```optional xlnt::row_properties::heightundefined``` +Optional height #### ```bool xlnt::row_properties::custom_heightundefined``` +Whether or not the height is different from the default #### ```bool xlnt::row_properties::hiddenundefined``` +Whether or not the row should be hidden #### ```optional xlnt::row_properties::styleundefined``` +The index to the style used by all cells in this row ### selection #### ```bool xlnt::selection::has_active_cell() const``` +Returns true if this selection has a defined active cell. #### ```cell_reference xlnt::selection::active_cell() const``` +Returns the cell reference of the active cell. #### ```void xlnt::selection::active_cell(const cell_reference &ref)``` +Sets the active cell to that pointed to by ref. #### ```range_reference xlnt::selection::sqref() const``` +Returns the range encompassed by this selection. #### ```pane_corner xlnt::selection::pane() const``` +Returns the sheet quadrant of this selection. #### ```void xlnt::selection::pane(pane_corner corner)``` +Sets the sheet quadrant of this selection to corner. #### ```bool xlnt::selection::operator==(const selection &rhs) const``` Returns true if this selection is equal to rhs based on its active cell, sqref, and pane. ### sheet_protection #### ```static std::string xlnt::sheet_protection::hash_password(const std::string &password)``` +Calculates and returns the hash of the given protection password. #### ```void xlnt::sheet_protection::password(const std::string &password)``` +Sets the protection password to password. #### ```std::string xlnt::sheet_protection::hashed_password() const``` +Returns the hash of the password set for this sheet protection. ### sheet_view #### ```void xlnt::sheet_view::id(std::size_t new_id)``` +Sets the ID of this view to new_id. #### ```std::size_t xlnt::sheet_view::id() const``` +Returns the ID of this view. #### ```bool xlnt::sheet_view::has_pane() const``` +Returns true if this view has a pane defined. #### ```struct pane& xlnt::sheet_view::pane()``` +Returns a reference to this view's pane. #### ```const struct pane& xlnt::sheet_view::pane() const``` +Returns a reference to this view's pane. #### ```void xlnt::sheet_view::clear_pane()``` +Removes the defined pane from this view. #### ```void xlnt::sheet_view::pane(const struct pane &new_pane)``` +Sets the pane of this view to new_pane. #### ```bool xlnt::sheet_view::has_selections() const``` +Returns true if this view has any selections. #### ```void xlnt::sheet_view::add_selection(const class selection &new_selection)``` +Adds the given selection to the collection of selections. #### ```void xlnt::sheet_view::clear_selections()``` +Removes all selections. #### ```std::vector xlnt::sheet_view::selections() const``` +Returns the collection of selections as a vector. #### ```class xlnt::selection& xlnt::sheet_view::selection(std::size_t index)``` +Returns the selection at the given index. #### ```void xlnt::sheet_view::show_grid_lines(bool show)``` +If show is true, grid lines will be shown for sheets using this view. #### ```bool xlnt::sheet_view::show_grid_lines() const``` +Returns true if grid lines will be shown for sheets using this view. #### ```void xlnt::sheet_view::default_grid_color(bool is_default)``` +If is_default is true, the default grid color will be used. #### ```bool xlnt::sheet_view::default_grid_color() const``` +Returns true if the default grid color will be used. #### ```void xlnt::sheet_view::type(sheet_view_type new_type)``` Sets the type of this view. #### ```sheet_view_type xlnt::sheet_view::type() const``` @@ -1875,8 +2299,11 @@ Calculate the height of the given row. This will be the default row height if a #### ```cell_reference xlnt::worksheet::point_pos(int left, int top) const``` Returns a reference to the cell at the given point coordinates. #### ```void xlnt::worksheet::create_named_range(const std::string &name, const std::string &reference_string)``` +Creates a new named range with the given name encompassing the string representing a range. #### ```void xlnt::worksheet::create_named_range(const std::string &name, const range_reference &reference)``` +Creates a new named range with the given name encompassing the given range reference. #### ```bool xlnt::worksheet::has_named_range(const std::string &name) const``` +Returns true if this worksheet contains a named range with the given name. #### ```class range xlnt::worksheet::named_range(const std::string &name)``` Returns the named range with the given name. Throws key_not_found exception if the named range doesn't exist. #### ```const class range xlnt::worksheet::named_range(const std::string &name) const``` @@ -1884,23 +2311,37 @@ Returns the named range with the given name. Throws key_not_found exception if t #### ```void xlnt::worksheet::remove_named_range(const std::string &name)``` Removes a named range with the given name. #### ```row_t xlnt::worksheet::lowest_row() const``` +Returns the row of the first non-empty cell in the worksheet. #### ```row_t xlnt::worksheet::highest_row() const``` +Returns the row of the last non-empty cell in the worksheet. #### ```row_t xlnt::worksheet::next_row() const``` +Returns the row directly below the last non-empty cell in the worksheet. #### ```column_t xlnt::worksheet::lowest_column() const``` +Returns the column of the first non-empty cell in the worksheet. #### ```column_t xlnt::worksheet::highest_column() const``` +Returns the column of the last non-empty cell in the worksheet. #### ```range_reference xlnt::worksheet::calculate_dimension() const``` +Returns a range_reference pointing to the full range of non-empty cells in the worksheet. #### ```void xlnt::worksheet::merge_cells(const std::string &reference_string)``` +Merges the cells within the range represented by the given string. #### ```void xlnt::worksheet::merge_cells(const range_reference &reference)``` -#### ```void xlnt::worksheet::merge_cells(column_t start_column, row_t start_row, column_t end_column, row_t end_row)``` +Merges the cells within the given range. #### ```void xlnt::worksheet::unmerge_cells(const std::string &reference_string)``` +Removes the merging of the cells in the range represented by the given string. #### ```void xlnt::worksheet::unmerge_cells(const range_reference &reference)``` -#### ```void xlnt::worksheet::unmerge_cells(column_t start_column, row_t start_row, column_t end_column, row_t end_row)``` +Removes the merging of the cells in the given range. #### ```std::vector xlnt::worksheet::merged_ranges() const``` +Returns a vector of references of all merged ranges in the worksheet. #### ```bool xlnt::worksheet::operator==(const worksheet &other) const``` +Returns true if this worksheet refers to the same worksheet as other. #### ```bool xlnt::worksheet::operator!=(const worksheet &other) const``` +Returns true if this worksheet doesn't refer to the same worksheet as other. #### ```bool xlnt::worksheet::operator==(std::nullptr_t) const``` +Returns true if this worksheet is null. #### ```bool xlnt::worksheet::operator!=(std::nullptr_t) const``` +Returns true if this worksheet is not null. #### ```void xlnt::worksheet::operator=(const worksheet &other)``` +Sets the internal pointer of this worksheet object to point to other. #### ```class cell xlnt::worksheet::operator[](const cell_reference &reference)``` Convenience method for worksheet::cell method. #### ```const class cell xlnt::worksheet::operator[](const cell_reference &reference) const``` diff --git a/include/xlnt/cell/cell_reference.hpp b/include/xlnt/cell/cell_reference.hpp index 7ad847fc..b9472f72 100644 --- a/include/xlnt/cell/cell_reference.hpp +++ b/include/xlnt/cell/cell_reference.hpp @@ -42,7 +42,7 @@ class range_reference; struct XLNT_API cell_reference_hash { /// - /// + /// Returns a hash representing a particular cell_reference. /// std::size_t operator()(const cell_reference &k) const; }; @@ -58,12 +58,12 @@ class XLNT_API cell_reference { public: /// - /// Split a coordinate string like "A1" into an equivalent pair like {"A", 1}. + /// Splits a coordinate string like "A1" into an equivalent pair like {"A", 1}. /// static std::pair split_reference(const std::string &reference_string); /// - /// Split a coordinate string like "A1" into an equivalent pair like {"A", 1}. + /// Splits a coordinate string like "A1" into an equivalent pair like {"A", 1}. /// Reference parameters absolute_column and absolute_row will be set to true /// if column part or row part are prefixed by a dollar-sign indicating they /// are absolute, otherwise false. @@ -98,7 +98,7 @@ public: // absoluteness /// - /// Convert a coordinate to an absolute coordinate string (e.g. B12 -> $B$12) + /// Converts a coordinate to an absolute coordinate string (e.g. B12 -> $B$12) /// Defaulting to true, absolute_column and absolute_row can optionally control /// whether the resulting cell_reference has an absolute column (e.g. B12 -> $B12) /// and absolute row (e.g. B12 -> B$12) respectively. @@ -113,23 +113,23 @@ public: cell_reference &make_absolute(bool absolute_column = true, bool absolute_row = true); /// - /// Return true if the reference refers to an absolute column, otherwise false. + /// Returns true if the reference refers to an absolute column, otherwise false. /// bool column_absolute() const; /// - /// Make this reference have an absolute column if absolute_column is true, + /// Makes this reference have an absolute column if absolute_column is true, /// otherwise not absolute. /// void column_absolute(bool absolute_column); /// - /// Return true if the reference refers to an absolute row, otherwise false. + /// Returns true if the reference refers to an absolute row, otherwise false. /// bool row_absolute() const; /// - /// Make this reference have an absolute row if absolute_row is true, + /// Makes this reference have an absolute row if absolute_row is true, /// otherwise not absolute. /// void row_absolute(bool absolute_row); @@ -137,38 +137,38 @@ public: // getters/setters /// - /// Return a string that identifies the column of this reference + /// Returns a string that identifies the column of this reference /// (e.g. second column from left is "B") /// column_t column() const; /// - /// Set the column of this reference from a string that identifies a particular column. + /// Sets the column of this reference from a string that identifies a particular column. /// void column(const std::string &column_string); /// - /// Return a 1-indexed numeric index of the column of this reference. + /// Returns a 1-indexed numeric index of the column of this reference. /// column_t::index_t column_index() const; /// - /// Set the column of this reference from a 1-indexed number that identifies a particular column. + /// Sets the column of this reference from a 1-indexed number that identifies a particular column. /// void column_index(column_t column); /// - /// Return a 1-indexed numeric index of the row of this reference. + /// Returns a 1-indexed numeric index of the row of this reference. /// row_t row() const; /// - /// Set the row of this reference from a 1-indexed number that identifies a particular row. + /// Sets the row of this reference from a 1-indexed number that identifies a particular row. /// void row(row_t row); /// - /// Return a cell_reference offset from this cell_reference by + /// Returns a cell_reference offset from this cell_reference by /// the number of columns and rows specified by the parameters. /// A negative value for column_offset or row_offset results /// in a reference above or left of this cell_reference, respectively. @@ -176,12 +176,12 @@ public: cell_reference make_offset(int column_offset, int row_offset) const; /// - /// Return a string like "A1" for cell_reference(1, 1). + /// Returns a string like "A1" for cell_reference(1, 1). /// std::string to_string() const; /// - /// Return a 1x1 range_reference containing only this cell_reference. + /// Returns a 1x1 range_reference containing only this cell_reference. /// range_reference to_range() const; @@ -195,37 +195,37 @@ public: range_reference operator,(const cell_reference &other) const; /// - /// Return true if this reference is identical to comparand including + /// Returns true if this reference is identical to comparand including /// in absoluteness of column and row. /// bool operator==(const cell_reference &comparand) const; /// - /// Construct a cell_reference from reference_string and return the result + /// Constructs a cell_reference from reference_string and return the result /// of their comparison. /// bool operator==(const std::string &reference_string) const; /// - /// Construct a cell_reference from reference_string and return the result + /// Constructs a cell_reference from reference_string and return the result /// of their comparison. /// bool operator==(const char *reference_string) const; /// - /// Return true if this reference is not identical to comparand including + /// Returns true if this reference is not identical to comparand including /// in absoluteness of column and row. /// bool operator!=(const cell_reference &comparand) const; /// - /// Construct a cell_reference from reference_string and return the result + /// Constructs a cell_reference from reference_string and return the result /// of their comparison. /// bool operator!=(const std::string &reference_string) const; /// - /// Construct a cell_reference from reference_string and return the result + /// Constructs a cell_reference from reference_string and return the result /// of their comparison. /// bool operator!=(const char *reference_string) const; diff --git a/include/xlnt/cell/comment.hpp b/include/xlnt/cell/comment.hpp index c44ad152..9b3a7c8a 100644 --- a/include/xlnt/cell/comment.hpp +++ b/include/xlnt/cell/comment.hpp @@ -52,27 +52,27 @@ public: comment(const std::string &text, const std::string &author); /// - /// Return the text that will be displayed for this comment. + /// Returns the text that will be displayed for this comment. /// rich_text text() const; /// - /// Return the plain text that will be displayed for this comment without formatting information. + /// Returns the plain text that will be displayed for this comment without formatting information. /// std::string plain_text() const; /// - /// Return the author of this comment. + /// Returns the author of this comment. /// std::string author() const; /// - /// Make this comment only visible when the associated cell is hovered. + /// Makes this comment only visible when the associated cell is hovered. /// void hide(); /// - /// Make this comment always visible. + /// Makes this comment always visible. /// void show(); @@ -82,7 +82,7 @@ public: bool visible() const; /// - /// Set the absolute position of this cell to the given coordinates. + /// Sets the absolute position of this cell to the given coordinates. /// void position(int left, int top); @@ -97,7 +97,7 @@ public: int top() const; /// - /// Set the size of the comment. + /// Sets the size of the comment. /// void size(int width, int height); @@ -112,9 +112,14 @@ public: int height() const; /// - /// Return true if both comments are equivalent. + /// Return true if this comment is equivalent to other. /// - friend XLNT_API bool operator==(const comment &left, const comment &right); + bool operator==(const comment &other) const; + + /// + /// Returns true if this comment is not equivalent to other. + /// + bool operator!=(const comment &other) const; private: /// diff --git a/include/xlnt/cell/index_types.hpp b/include/xlnt/cell/index_types.hpp index b828eee9..63dbd8ac 100644 --- a/include/xlnt/cell/index_types.hpp +++ b/include/xlnt/cell/index_types.hpp @@ -48,7 +48,7 @@ class XLNT_API column_t { public: /// - /// + /// Alias declaration for the internal numeric type of this column. /// using index_t = std::uint32_t; @@ -73,237 +73,207 @@ public: static std::string column_string_from_index(index_t column_index); /// - /// Default column_t is the first (left-most) column. + /// Default constructor. The column points to the "A" column. /// column_t(); /// - /// Construct a column from a number. + /// Constructs a column from a number. /// column_t(index_t column_index); /// - /// Construct a column from a string. + /// Constructs a column from a string. /// column_t(const std::string &column_string); /// - /// Construct a column from a string. + /// Constructs a column from a string. /// column_t(const char *column_string); /// - /// Copy constructor + /// Copy constructor. Constructs a column by copying it from other. /// column_t(const column_t &other); /// - /// Move constructor + /// Move constructor. Constructs a column by moving it from other. /// column_t(column_t &&other); /// - /// Return a string representation of this column index. + /// Returns a string representation of this column index. /// std::string column_string() const; /// - /// Set this column to be the same as rhs's and return reference to self. + /// Sets this column to be the same as rhs's and return reference to self. /// column_t &operator=(column_t rhs); /// - /// Set this column to be equal to rhs and return reference to self. + /// Sets this column to be equal to rhs and return reference to self. /// column_t &operator=(const std::string &rhs); /// - /// Set this column to be equal to rhs and return reference to self. + /// Sets this column to be equal to rhs and return reference to self. /// column_t &operator=(const char *rhs); /// - /// Return true if this column refers to the same column as other. + /// Returns true if this column refers to the same column as other. /// bool operator==(const column_t &other) const; /// - /// Return true if this column doesn't refer to the same column as other. + /// Returns true if this column doesn't refer to the same column as other. /// bool operator!=(const column_t &other) const; /// - /// Return true if this column refers to the same column as other. + /// Returns true if this column refers to the same column as other. /// bool operator==(int other) const; /// - /// Return true if this column refers to the same column as other. + /// Returns true if this column refers to the same column as other. /// bool operator==(index_t other) const; /// - /// Return true if this column refers to the same column as other. + /// Returns true if this column refers to the same column as other. /// bool operator==(const std::string &other) const; /// - /// Return true if this column refers to the same column as other. + /// Returns true if this column refers to the same column as other. /// bool operator==(const char *other) const; /// - /// Return true if this column doesn't refer to the same column as other. + /// Returns true if this column doesn't refer to the same column as other. /// bool operator!=(int other) const; /// - /// Return true if this column doesn't refer to the same column as other. + /// Returns true if this column doesn't refer to the same column as other. /// bool operator!=(index_t other) const; /// - /// Return true if this column doesn't refer to the same column as other. + /// Returns true if this column doesn't refer to the same column as other. /// bool operator!=(const std::string &other) const; /// - /// Return true if this column doesn't refer to the same column as other. + /// Returns true if this column doesn't refer to the same column as other. /// bool operator!=(const char *other) const; /// - /// Return true if other is to the right of this column. + /// Returns true if other is to the right of this column. /// bool operator>(const column_t &other) const; /// - /// Return true if other is to the right of or equal to this column. + /// Returns true if other is to the right of or equal to this column. /// bool operator>=(const column_t &other) const; /// - /// Return true if other is to the left of this column. + /// Returns true if other is to the left of this column. /// bool operator<(const column_t &other) const; /// - /// Return true if other is to the left of or equal to this column. + /// Returns true if other is to the left of or equal to this column. /// bool operator<=(const column_t &other) const; /// - /// Return true if other is to the right of this column. + /// Returns true if other is to the right of this column. /// bool operator>(const column_t::index_t &other) const; /// - /// Return true if other is to the right of or equal to this column. + /// Returns true if other is to the right of or equal to this column. /// bool operator>=(const column_t::index_t &other) const; /// - /// Return true if other is to the left of this column. + /// Returns true if other is to the left of this column. /// bool operator<(const column_t::index_t &other) const; /// - /// Return true if other is to the left of or equal to this column. + /// Returns true if other is to the left of or equal to this column. /// bool operator<=(const column_t::index_t &other) const; /// - /// Pre-increment this column, making it point to the column one to the right. + /// Pre-increments this column, making it point to the column one to the right and returning a reference to it. /// column_t &operator++(); /// - /// Pre-deccrement this column, making it point to the column one to the left. + /// Pre-deccrements this column, making it point to the column one to the left and returning a reference to it. /// column_t &operator--(); /// - /// Post-increment this column, making it point to the column one to the right and returning the old column. + /// Post-increments this column, making it point to the column one to the right and returning the old column. /// column_t operator++(int); /// - /// Post-decrement this column, making it point to the column one to the left and returning the old column. + /// Post-decrements this column, making it point to the column one to the left and returning the old column. /// column_t operator--(int); /// - /// Return the result of adding rhs to this column. + /// Returns the result of adding rhs to this column. /// friend XLNT_API column_t operator+(column_t lhs, const column_t &rhs); /// - /// Return the result of subtracing lhs by rhs column. + /// Returns the result of subtracing lhs by rhs column. /// friend XLNT_API column_t operator-(column_t lhs, const column_t &rhs); /// - /// Return the result of multiply lhs by rhs column. - /// - friend XLNT_API column_t operator*(column_t lhs, const column_t &rhs); - - /// - /// Return the result of divide lhs by rhs column. - /// - friend XLNT_API column_t operator/(column_t lhs, const column_t &rhs); - - /// - /// Return the result of mod lhs by rhs column. - /// - friend XLNT_API column_t operator%(column_t lhs, const column_t &rhs); - - /// - /// Add rhs to this column and return a reference to this column. + /// Adds rhs to this column and returns a reference to this column. /// column_t &operator+=(const column_t &rhs); /// - /// Subtrac rhs from this column and return a reference to this column. + /// Subtracts rhs from this column and returns a reference to this column. /// column_t &operator-=(const column_t &rhs); /// - /// Multiply this column by rhs and return a reference to this column. - /// - column_t &operator*=(const column_t &rhs); - - /// - /// Divide this column by rhs and return a reference to this column. - /// - column_t &operator/=(const column_t &rhs); - - /// - /// Mod this column by rhs and return a reference to this column. - /// - column_t &operator%=(const column_t &rhs); - - /// - /// Return true if other is to the right of this column. + /// Returns true if other is to the right of this column. /// friend XLNT_API bool operator>(const column_t::index_t &left, const column_t &right); /// - /// Return true if other is to the right of or equal to this column. + /// Returns true if other is to the right of or equal to this column. /// friend XLNT_API bool operator>=(const column_t::index_t &left, const column_t &right); /// - /// Return true if other is to the left of this column. + /// Returns true if other is to the left of this column. /// friend XLNT_API bool operator<(const column_t::index_t &left, const column_t &right); /// - /// Return true if other is to the left of or equal to this column. + /// Returns true if other is to the left of or equal to this column. /// friend XLNT_API bool operator<=(const column_t::index_t &left, const column_t &right); /// - /// Swap the columns that left and right refer to. + /// Swaps the columns that left and right refer to. /// friend XLNT_API void swap(column_t &left, column_t &right); @@ -315,12 +285,12 @@ public: /// /// Functor for hashing a column. -/// Allows for use of std::unordered_set and similar. +/// Allows for use of std::unordered_set and similar. /// struct XLNT_API column_hash { /// - /// + /// Returns the result of hashing column k. /// std::size_t operator()(const column_t &k) const; }; @@ -336,7 +306,7 @@ template <> struct hash { /// - /// + /// Returns the result of hashing column k. /// size_t operator()(const xlnt::column_t &k) const { diff --git a/include/xlnt/cell/rich_text.hpp b/include/xlnt/cell/rich_text.hpp index 1a1cdf52..ef1da435 100644 --- a/include/xlnt/cell/rich_text.hpp +++ b/include/xlnt/cell/rich_text.hpp @@ -39,38 +39,38 @@ class XLNT_API rich_text { public: /// - /// + /// Constructs an empty rich text object with no font and empty text. /// rich_text() = default; /// - /// + /// Constructs a rich text object with the given text and no font. /// rich_text(const std::string &plain_text); /// - /// + /// Constructs a rich text object with the given text and font. /// rich_text(const std::string &plain_text, const class font &text_font); /// - /// + /// Copy constructor. /// rich_text(const rich_text_run &single_run); /// - /// Remove all text runs from this text. + /// Removes all text runs from this text. /// void clear(); /// - /// Clear any runs in this text and add a single run with default formatting and + /// Clears any runs in this text and adds a single run with default formatting and /// the given string as its textual content. /// void plain_text(const std::string &s); /// - /// Combine the textual content of each text run in order and return the result. + /// Combines the textual content of each text run in order and returns the result. /// std::string plain_text() const; @@ -80,12 +80,12 @@ public: std::vector runs() const; /// - /// Set the runs of this text all at once. + /// Sets the runs of this text all at once. /// void runs(const std::vector &new_runs); /// - /// Add a new run to the end of the set of runs. + /// Adds a new run to the end of the set of runs. /// void add_run(const rich_text_run &t); @@ -101,7 +101,7 @@ public: private: /// - /// + /// The runs that make up this rich text. /// std::vector runs_; }; diff --git a/include/xlnt/styles/border.hpp b/include/xlnt/styles/border.hpp index 718b0ff3..1f548492 100644 --- a/include/xlnt/styles/border.hpp +++ b/include/xlnt/styles/border.hpp @@ -143,7 +143,7 @@ public: }; /// - /// A vector to the all of the border sides for iteration. + /// Returns a vector containing all of the border sides to be used for iteration. /// static const std::vector &all_sides(); diff --git a/include/xlnt/styles/color.hpp b/include/xlnt/styles/color.hpp index c5790550..39629f2a 100644 --- a/include/xlnt/styles/color.hpp +++ b/include/xlnt/styles/color.hpp @@ -37,24 +37,25 @@ namespace xlnt { class XLNT_API indexed_color { public: + //TODO: should this be explicit? /// - /// + /// Constructs an indexed_color from an index. /// indexed_color(std::size_t index); /// - /// + /// Returns the index this color points to. /// std::size_t index() const; /// - /// + /// Sets the index to index. /// void index(std::size_t index); private: /// - /// + /// The index of this color /// std::size_t index_; }; @@ -66,23 +67,23 @@ class XLNT_API theme_color { public: /// - /// + /// Constructs a theme_color from an index. /// theme_color(std::size_t index); /// - /// + /// Returns the index of the color in the theme this points to. /// std::size_t index() const; /// - /// + /// Sets the index of this color to index. /// void index(std::size_t index); private: /// - /// + /// The index of the color /// std::size_t index_; }; diff --git a/include/xlnt/styles/fill.hpp b/include/xlnt/styles/fill.hpp index 293cbad8..0479ad40 100644 --- a/include/xlnt/styles/fill.hpp +++ b/include/xlnt/styles/fill.hpp @@ -59,7 +59,7 @@ enum class XLNT_API pattern_fill_type }; /// -/// Represents a fill which colors the cell based on a foreground and +/// Represents a fill which colors the cell based on a foreground and /// background color and a pattern. /// class XLNT_API pattern_fill @@ -112,23 +112,23 @@ public: private: /// - /// + /// The type of this pattern_fill /// pattern_fill_type type_ = pattern_fill_type::none; /// - /// + /// The optional foreground color /// optional foreground_; /// - /// + /// THe optional background color /// optional background_; }; /// -/// +/// Enumerates the types of gradient fills /// enum class XLNT_API gradient_fill_type { @@ -174,117 +174,117 @@ public: // Left /// - /// + /// Returns the distance from the left where the gradient starts. /// double left() const; /// - /// + /// Sets the distance from the left where the gradient starts. /// gradient_fill &left(double value); // Right /// - /// + /// Returns the distance from the right where the gradient starts. /// double right() const; /// - /// + /// Sets the distance from the right where the gradient starts. /// gradient_fill &right(double value); // Top /// - /// + /// Returns the distance from the top where the gradient starts. /// double top() const; /// - /// + /// Sets the distance from the top where the gradient starts. /// gradient_fill &top(double value); // Bottom /// - /// + /// Returns the distance from the bottom where the gradient starts. /// double bottom() const; /// - /// + /// Sets the distance from the bottom where the gradient starts. /// gradient_fill &bottom(double value); // Stops /// - /// + /// Adds a gradient stop at position with the given color. /// gradient_fill &add_stop(double position, color stop_color); /// - /// + /// Deletes all stops from the gradient. /// gradient_fill &clear_stops(); /// - /// + /// Returns all of the gradient stops. /// std::unordered_map stops() const; /// - /// Returns true if left is exactly equal to right. + /// Returns true if the gradient is equivalent to other. /// bool operator==(const gradient_fill &other) const; /// - /// Returns true if left is not exactly equal to right. + /// Returns true if the gradient is not equivalent to other. /// bool operator!=(const gradient_fill &right) const; private: /// - /// + /// The type of gradient /// gradient_fill_type type_ = gradient_fill_type::linear; /// - /// + /// The angle of the gradient /// double degree_ = 0; /// - /// + /// THe left distance /// double left_ = 0; /// - /// + /// THe right distance /// double right_ = 0; /// - /// + /// The top distance /// double top_ = 0; /// - /// + /// The bottom distance /// double bottom_ = 0; /// - /// + /// The gradient stops and colors /// std::unordered_map stops_; }; /// -/// +/// Enumerates the possible fill types /// enum class XLNT_API fill_type { diff --git a/include/xlnt/styles/font.hpp b/include/xlnt/styles/font.hpp index 000dfc4f..2cb9f42a 100644 --- a/include/xlnt/styles/font.hpp +++ b/include/xlnt/styles/font.hpp @@ -41,7 +41,7 @@ class XLNT_API font { public: /// - /// + /// Text can be underlined in the enumerated ways /// enum class underline_style { @@ -53,258 +53,257 @@ public: }; /// - /// + /// Constructs a default font. Calibri, size 12 /// font(); /// - /// + /// Sets the bold state of the font to bold and returns a reference to the font. /// font &bold(bool bold); /// - /// + /// Returns the bold state of the font. /// bool bold() const; /// - /// + /// Sets the bold state of the font to bold and returns a reference to the font. /// font &superscript(bool superscript); /// - /// + /// Returns true if this font has a superscript applied. /// bool superscript() const; /// - /// + /// Sets the bold state of the font to bold and returns a reference to the font. /// font &italic(bool italic); /// - /// + /// Returns true if this font has italics applied. /// bool italic() const; /// - /// + /// Sets the bold state of the font to bold and returns a reference to the font. /// font &strikethrough(bool strikethrough); /// - /// + /// Returns true if this font has a strikethrough applied. /// bool strikethrough() const; /// - /// + /// Sets the bold state of the font to bold and returns a reference to the font. /// font &outline(bool outline); /// - /// + /// Returns true if this font has an outline applied. /// bool outline() const; /// - /// + /// Sets the shadow state of the font to shadow and returns a reference to the font. /// font &shadow(bool shadow); /// - /// + /// Returns true if this font has a shadow applied. /// bool shadow() const; /// - /// + /// Sets the underline state of the font to new_underline and returns a reference to the font. /// font &underline(underline_style new_underline); /// - /// + /// Returns true if this font has any type of underline applied. /// bool underlined() const; /// - /// + /// Returns the particular style of underline this font has applied. /// underline_style underline() const; /// - /// + /// Returns true if this font has a defined size. /// bool has_size() const; /// - /// + /// Sets the size of the font to size and returns a reference to the font. /// font &size(double size); /// - /// + /// Returns the size of the font. /// double size() const; /// - /// + /// Returns true if this font has a particular face applied (e.g. "Comic Sans"). /// bool has_name() const; /// - /// + /// Sets the font face to name and returns a reference to the font. /// font &name(const std::string &name); /// - /// + /// Returns the name of the font face. /// std::string name() const; /// - /// + /// Returns true if this font has a color applied. /// bool has_color() const; /// - /// + /// Sets the color of the font to c and returns a reference to the font. /// font &color(const color &c); /// - /// + /// Returns the color that this font is using. /// xlnt::color color() const; /// - /// + /// Returns true if this font has a family defined. /// bool has_family() const; /// - /// + /// Sets the family index of the font to family and returns a reference to the font. /// font &family(std::size_t family); /// - /// + /// Returns the family index for the font. /// std::size_t family() const; /// - /// + /// Returns true if this font has a charset defined. /// bool has_charset() const; + // TODO: charset should be an enum, not a number + /// - /// + /// Sets the charset of the font to charset and returns a reference to the font. /// font &charset(std::size_t charset); /// - /// + /// Returns the charset of the font. /// std::size_t charset() const; /// - /// + /// Returns true if this font has a scheme. /// bool has_scheme() const; /// - /// + /// Sets the scheme of the font to scheme and returns a reference to the font. /// font &scheme(const std::string &scheme); /// - /// + /// Returns the scheme of this font. /// std::string scheme() const; /// /// Returns true if left is exactly equal to right. /// - XLNT_API friend bool operator==(const font &left, const font &right); + bool operator==(const font &other) const; /// /// Returns true if left is not exactly equal to right. /// - XLNT_API friend bool operator!=(const font &left, const font &right) - { - return !(left == right); - } + bool operator!=(const font &other) const; private: friend class style; /// - /// + /// The name of the font /// optional name_; /// - /// + /// size /// optional size_; /// - /// + /// bold /// bool bold_ = false; /// - /// + /// italic /// bool italic_ = false; /// - /// + /// superscript /// bool superscript_ = false; /// - /// + /// subscript /// bool subscript_ = false; /// - /// + /// strikethrough /// bool strikethrough_ = false; /// - /// + /// outline /// bool outline_ = false; /// - /// + /// shadow /// bool shadow_ = false; /// - /// + /// underline style /// underline_style underline_ = underline_style::none; /// - /// + /// color /// optional color_; /// - /// + /// family /// optional family_; /// - /// + /// charset /// optional charset_; /// - /// + /// scheme /// optional scheme_; }; diff --git a/include/xlnt/styles/format.hpp b/include/xlnt/styles/format.hpp index 0117aabb..0a549cf5 100755 --- a/include/xlnt/styles/format.hpp +++ b/include/xlnt/styles/format.hpp @@ -53,207 +53,176 @@ class xlsx_producer; class XLNT_API format { public: - // Alignment - /// - /// + /// Returns the alignment of this format. /// - class alignment &alignment(); + class alignment alignment() const; /// - /// + /// Sets the alignment of this format to new_alignment. Applied, which defaults + /// to true, determines whether the alignment should be enabled for cells using + /// this format. /// - const class alignment &alignment() const; + format alignment(const xlnt::alignment &new_alignment, bool applied = true); /// - /// - /// - format alignment(const xlnt::alignment &new_alignment, bool applied); - - /// - /// + /// Returns true if the alignment of this format should be applied to cells + /// using it. /// bool alignment_applied() const; - // Border - /// - /// + /// Returns the border of this format. /// - class border &border(); + class border border() const; /// - /// + /// Sets the border of this format to new_border. Applied, which defaults + /// to true, determines whether the border should be enabled for cells using + /// this format. /// - const class border &border() const; + format border(const xlnt::border &new_border, bool applied = true); /// - /// - /// - format border(const xlnt::border &new_border, bool applied); - - /// - /// + /// Returns true if the border set for this format should be applied to cells using the format. /// bool border_applied() const; - // Fill - /// - /// + /// Returns the fill of this format. /// - class fill &fill(); + class fill fill() const; /// - /// + /// Sets the fill of this format to new_fill. Applied, which defaults + /// to true, determines whether the border should be enabled for cells using + /// this format. /// - const class fill &fill() const; + format fill(const xlnt::fill &new_fill, bool applied = true); /// - /// - /// - format fill(const xlnt::fill &new_fill, bool applied); - - /// - /// + /// Returns true if the fill set for this format should be applied to cells using the format. /// bool fill_applied() const; - // Font - /// - /// + /// Returns the font of this format. /// - class font &font(); + class font font() const; /// - /// + /// Sets the font of this format to new_font. Applied, which defaults + /// to true, determines whether the font should be enabled for cells using + /// this format. /// - const class font &font() const; + format font(const xlnt::font &new_font, bool applied = true); /// - /// - /// - format font(const xlnt::font &new_font, bool applied); - - /// - /// + /// Returns true if the font set for this format should be applied to cells using the format. /// bool font_applied() const; - // Number Format - /// - /// + /// Returns the number format of this format. /// - class number_format &number_format(); + class number_format number_format() const; /// - /// + /// Sets the number format of this format to new_number_format. Applied, which defaults + /// to true, determines whether the number format should be enabled for cells using + /// this format. /// - const class number_format &number_format() const; + format number_format(const xlnt::number_format &new_number_format, bool applied = true); /// - /// - /// - format number_format(const xlnt::number_format &new_number_format, bool applied); - - /// - /// + /// Returns true if the number_format set for this format should be applied to cells using the format. /// bool number_format_applied() const; - // Protection - /// - /// + /// Returns the protection of this format. /// - class protection &protection(); + class protection protection() const; /// - /// - /// - const class protection &protection() const; - - /// - /// - /// - format protection(const xlnt::protection &new_protection, bool applied); - - /// - /// + /// Returns true if the protection set for this format should be applied to cells using the format. /// bool protection_applied() const; /// - /// + /// Sets the protection of this format to new_protection. Applied, which defaults + /// to true, determines whether the protection should be enabled for cells using + /// this format. + /// + format protection(const xlnt::protection &new_protection, bool applied = true); + + /// + /// Returns true if the pivot table interface is enabled for this format. /// bool pivot_button() const; /// - /// + /// If show is true, a pivot table interface will be displayed for cells using + /// this format. /// void pivot_button(bool show); /// - /// + /// Returns true if this format should add a single-quote prefix for all text values. /// bool quote_prefix() const; /// - /// + /// If quote is true, enables a single-quote prefix for all text values in cells + /// using this format (e.g. "abc" will appear as "'abc"). The text will also not + /// be stored in sharedStrings when this is enabled. /// void quote_prefix(bool quote); - // Style - /// - /// + /// Returns true if this format has a corresponding style applied. /// bool has_style() const; /// - /// + /// Removes the style from this format if it exists. /// void clear_style(); /// - /// + /// Sets the style of this format to a style with the given name. /// format style(const std::string &name); /// - /// + /// Sets the style of this format to new_style. /// format style(const class style &new_style); /// - /// + /// Returns the style of this format. If it has no style, an invalid_parameter + /// exception will be thrown. /// class style style(); - /// - /// - /// - const class style style() const; + /// + /// Returns the style of this format. If it has no style, an invalid_parameters + /// exception will be thrown. + /// + const class style style() const; private: friend struct detail::stylesheet; - friend class detail::xlsx_producer; + friend class detail::xlsx_producer; friend class cell; /// - /// + /// Constructs a format from an impl pointer. /// format(detail::format_impl *d); - /// - /// - /// - std::size_t id() const; - /// - /// + /// The internal implementation of this format /// detail::format_impl *d_; }; diff --git a/include/xlnt/styles/number_format.hpp b/include/xlnt/styles/number_format.hpp index aa31bfae..46869540 100644 --- a/include/xlnt/styles/number_format.hpp +++ b/include/xlnt/styles/number_format.hpp @@ -28,6 +28,7 @@ #include #include +#include namespace xlnt { @@ -40,236 +41,232 @@ class XLNT_API number_format { public: /// - /// + /// Number format "General" /// static const number_format general(); /// - /// + /// Number format "@" /// static const number_format text(); /// - /// + /// Number format "0" /// static const number_format number(); /// - /// + /// Number format "00" /// static const number_format number_00(); /// - /// + /// Number format "#,##0.00" /// static const number_format number_comma_separated1(); /// - /// + /// Number format "0%" /// static const number_format percentage(); /// - /// + /// Number format "0.00%" /// static const number_format percentage_00(); /// - /// + /// Number format "yyyy-mm-dd" /// static const number_format date_yyyymmdd2(); /// - /// + /// Number format "yy-mm-dd" /// static const number_format date_yymmdd(); /// - /// + /// Number format "dd/mm/yy" /// static const number_format date_ddmmyyyy(); /// - /// + /// Number format "d/m/yy" /// static const number_format date_dmyslash(); /// - /// + /// Number format "d-m-yy" /// static const number_format date_dmyminus(); /// - /// + /// Number format "d-m" /// static const number_format date_dmminus(); /// - /// + /// Number format "m-yy" /// static const number_format date_myminus(); /// - /// + /// Number format "mm-dd-yy" /// static const number_format date_xlsx14(); /// - /// + /// Number format "d-mmm-yy" /// static const number_format date_xlsx15(); /// - /// + /// Number format "d-mmm" /// static const number_format date_xlsx16(); /// - /// + /// Number format "mmm-yy" /// static const number_format date_xlsx17(); /// - /// + /// Number format "m/d/yy h:mm" /// static const number_format date_xlsx22(); /// - /// + /// Number format "yyyy-mm-dd h:mm:ss" /// static const number_format date_datetime(); /// - /// + /// Number format "h:mm AM/PM" /// static const number_format date_time1(); /// - /// + /// Number format "h:mm:ss AM/PM" /// static const number_format date_time2(); /// - /// + /// Number format "h:mm" /// static const number_format date_time3(); /// - /// + /// Number format "h:mm:ss" /// static const number_format date_time4(); /// - /// + /// Number format "mm:ss" /// static const number_format date_time5(); /// - /// + /// Number format "h:mm:ss" /// static const number_format date_time6(); /// - /// + /// Returns true if the given format ID corresponds to a known builtin format. /// static bool is_builtin_format(std::size_t builtin_id); /// - /// + /// Returns the format with the given ID. Thows an invalid_parameter exception + /// if builtin_id is not a valid ID. /// static const number_format &from_builtin_id(std::size_t builtin_id); /// - /// + /// Constructs a default number_format equivalent to "General" /// number_format(); /// - /// + /// Constructs a number format equivalent to that returned from number_format::from_builtin_id(builtin_id). /// number_format(std::size_t builtin_id); /// - /// + /// Constructs a number format from a code string. If the string matches a builtin ID, + /// its ID will also be set to match the builtin ID. /// number_format(const std::string &code); /// - /// + /// Constructs a number format from a code string and custom ID. Custom ID should generally + /// be >= 164. /// number_format(const std::string &code, std::size_t custom_id); /// - /// + /// Sets the format code of this number format to format_code. /// void format_string(const std::string &format_code); /// - /// + /// Sets the format code of this number format to format_code and the ID to custom_id. /// void format_string(const std::string &format_code, std::size_t custom_id); /// - /// + /// Returns the format code this number format uses. /// std::string format_string() const; /// - /// + /// Returns true if this number format has an ID. /// bool has_id() const; /// - /// + /// Sets the ID of this number format to id. /// void id(std::size_t id); /// - /// + /// Returns the ID of this format. /// std::size_t id() const; /// - /// + /// Returns text formatted according to this number format's format code. /// std::string format(const std::string &text) const; /// - /// + /// Returns number formatted according to this number format's format code + /// with the given base date. /// std::string format(long double number, calendar base_date) const; /// - /// + /// Returns true if this format code returns a number formatted as a date. /// bool is_date_format() const; /// - /// Returns true if left is exactly equal to right. + /// Returns true if this format is equivalent to other. /// - XLNT_API friend bool operator==(const number_format &left, const number_format &right); + bool operator==(const number_format &other) const; /// - /// Returns true if left is not exactly equal to right. + /// Returns true if this format is not equivalent to other. /// - XLNT_API friend bool operator!=(const number_format &left, const number_format &right) - { - return !(left == right); - } + bool operator!=(const number_format &other) const; private: /// - /// + /// The optional ID /// - bool id_set_; + optional id_; /// - /// - /// - std::size_t id_; - - /// - /// + /// The format code /// std::string format_string_; }; diff --git a/include/xlnt/styles/protection.hpp b/include/xlnt/styles/protection.hpp index 03456e19..9b9d8f1f 100644 --- a/include/xlnt/styles/protection.hpp +++ b/include/xlnt/styles/protection.hpp @@ -38,71 +38,68 @@ class XLNT_API protection { public: /// - /// + /// Returns an unlocked and unhidden protection object. /// static protection unlocked_and_visible(); /// - /// + /// Returns a locked and unhidden protection object. /// static protection locked_and_visible(); /// - /// + /// Returns an unlocked and hidden protection object. /// static protection unlocked_and_hidden(); /// - /// + /// Returns a locked and hidden protection object. /// static protection locked_and_hidden(); /// - /// + /// Constructs a default unlocked unhidden protection object. /// protection(); /// - /// + /// Returns true if cells using this protection should be locked. /// bool locked() const; /// - /// + /// Sets the locked state of the protection to locked and returns a reference to the protection. /// protection &locked(bool locked); /// - /// + /// Returns true if cells using this protection should be hidden. /// bool hidden() const; /// - /// + /// Sets the hidden state of the protection to hidden and returns a reference to the protection. /// protection &hidden(bool hidden); /// - /// Returns true if left is exactly equal to right. + /// Returns true if this protections is equivalent to right. /// - XLNT_API friend bool operator==(const protection &left, const protection &right); + bool operator==(const protection &other) const; /// - /// Returns true if left is not exactly equal to right. + /// Returns true if this protection is not equivalent to right. /// - XLNT_API friend bool operator!=(const protection &left, const protection &right) - { - return !(left == right); - } + bool operator!=(const protection &other) const; private: /// - /// + /// Whether the cell using this protection is locked or not /// bool locked_; /// - /// + /// Whether the cell using this protection is hidden or not /// bool hidden_; }; diff --git a/include/xlnt/styles/style.hpp b/include/xlnt/styles/style.hpp index c76432b4..d75fcb7e 100755 --- a/include/xlnt/styles/style.hpp +++ b/include/xlnt/styles/style.hpp @@ -112,91 +112,101 @@ public: /// class alignment alignment() const; - /// - /// Returns true if the alignment of this style should be applied to cells - /// using it. - /// - bool alignment_applied() const; + /// + /// Returns true if the alignment of this style should be applied to cells + /// using it. + /// + bool alignment_applied() const; /// /// Sets the alignment of this style to new_alignment. Applied, which defaults - /// to true, determines whether the alignment should be enabled for cells using - /// this style. + /// to true, determines whether the alignment should be enabled for cells using + /// this style. /// style alignment(const xlnt::alignment &new_alignment, bool applied = true); /// - /// + /// Returns the border of this style. /// class border border() const; - /// - /// - /// - bool border_applied() const; + /// + /// Returns true if the border set for this style should be applied to cells using the style. + /// + bool border_applied() const; /// - /// + /// Sets the border of this style to new_border. Applied, which defaults + /// to true, determines whether the border should be enabled for cells using + /// this style. /// style border(const xlnt::border &new_border, bool applied = true); /// - /// + /// Returns the fill of this style. /// class fill fill() const; - /// - /// - /// - bool fill_applied() const; + /// + /// Returns true if the fill set for this style should be applied to cells using the style. + /// + bool fill_applied() const; /// - /// + /// Sets the fill of this style to new_fill. Applied, which defaults + /// to true, determines whether the border should be enabled for cells using + /// this style. /// style fill(const xlnt::fill &new_fill, bool applied = true); /// - /// + /// Returns the font of this style. /// class font font() const; - /// - /// - /// - bool font_applied() const; + /// + /// Returns true if the font set for this style should be applied to cells using the style. + /// + bool font_applied() const; /// - /// + /// Sets the font of this style to new_font. Applied, which defaults + /// to true, determines whether the font should be enabled for cells using + /// this style. /// style font(const xlnt::font &new_font, bool applied = true); /// - /// + /// Returns the number_format of this style. /// class number_format number_format() const; - /// - /// - /// - bool number_format_applied() const; + /// + /// Returns true if the number_format set for this style should be applied to cells using the style. + /// + bool number_format_applied() const; /// - /// + /// Sets the number format of this style to new_number_format. Applied, which defaults + /// to true, determines whether the number format should be enabled for cells using + /// this style. /// style number_format(const xlnt::number_format &new_number_format, bool applied = true); /// - /// + /// Returns the protection of this style. /// class protection protection() const; - /// - /// - /// - bool protection_applied() const; + /// + /// Returns true if the protection set for this style should be applied to cells using the style. + /// + bool protection_applied() const; /// - /// + /// Sets the border of this style to new_protection. Applied, which defaults + /// to true, determines whether the protection should be enabled for cells using + /// this style. /// style protection(const xlnt::protection &new_protection, bool applied = true); @@ -238,12 +248,12 @@ private: friend class detail::xlsx_consumer; /// - /// + /// Constructs a style from an impl pointer. /// style(detail::style_impl *d); /// - /// + /// The internal implementation of this style /// detail::style_impl *d_; }; diff --git a/include/xlnt/utils/date.hpp b/include/xlnt/utils/date.hpp index 49a5ab03..7a589492 100644 --- a/include/xlnt/utils/date.hpp +++ b/include/xlnt/utils/date.hpp @@ -49,7 +49,7 @@ struct XLNT_API date static date from_number(int days_since_base_year, calendar base_date); /// - /// + /// Constructs a data from a given year, month, and day. /// date(int year_, int month_, int day_); @@ -59,7 +59,8 @@ struct XLNT_API date int to_number(calendar base_date) const; /// - /// + /// Calculates and returns the day of the week that this date represents in the range + /// 0 to 6 where 0 represents Sunday. /// int weekday() const; @@ -69,17 +70,17 @@ struct XLNT_API date bool operator==(const date &comparand) const; /// - /// + /// The year /// int year; /// - /// + /// The month /// int month; /// - /// + /// The day /// int day; }; diff --git a/include/xlnt/utils/datetime.hpp b/include/xlnt/utils/datetime.hpp index 5d10cef5..e8a42f9e 100644 --- a/include/xlnt/utils/datetime.hpp +++ b/include/xlnt/utils/datetime.hpp @@ -39,95 +39,96 @@ struct time; struct XLNT_API datetime { /// - /// Return the current date and time according to the system time. + /// Returns the current date and time according to the system time. /// static datetime now(); /// - /// Return the current date and time according to the system time. + /// Returns the current date and time according to the system time. /// This is equivalent to datetime::now(). /// static datetime today(); /// - /// Return a datetime from number by converting the integer part into + /// Returns a datetime from number by converting the integer part into /// a date and the fractional part into a time according to date::from_number /// and time::from_number. /// static datetime from_number(long double number, calendar base_date); /// - /// + /// Returns a datetime equivalent to the ISO-formatted string iso_string. /// static datetime from_iso_string(const std::string &iso_string); /// - /// + /// Constructs a datetime from a date and a time. /// datetime(const date &d, const time &t); /// - /// + /// Constructs a datetime from a year, month, and day plus optional hour, minute, second, and microsecond. /// datetime(int year_, int month_, int day_, int hour_ = 0, int minute_ = 0, int second_ = 0, int microsecond_ = 0); /// - /// + /// Returns a string represenation of this date and time. /// std::string to_string() const; /// - /// + /// Returns an ISO-formatted string representation of this date and time. /// std::string to_iso_string() const; /// - /// + /// Returns this datetime as a number of seconds since 1900 or 1904 (depending on base_date provided). /// long double to_number(calendar base_date) const; /// - /// + /// Returns true if this datetime is equivalent to comparand. /// bool operator==(const datetime &comparand) const; /// - /// + /// Calculates and returns the day of the week that this date represents in the range + /// 0 to 6 where 0 represents Sunday. /// int weekday() const; /// - /// + /// The year /// int year; /// - /// + /// The month /// int month; /// - /// + /// The day /// int day; /// - /// + /// The hour /// int hour; /// - /// + /// The minute /// int minute; /// - /// + /// The second /// int second; /// - /// + /// The microsecond /// int microsecond; }; diff --git a/include/xlnt/utils/exceptions.hpp b/include/xlnt/utils/exceptions.hpp index 8d0776e2..3b108e77 100644 --- a/include/xlnt/utils/exceptions.hpp +++ b/include/xlnt/utils/exceptions.hpp @@ -39,28 +39,30 @@ class XLNT_API exception : public std::runtime_error { public: /// - /// + /// Constructs an exception with a message. This message will be + /// returned by std::exception::what(), an inherited member of this class. /// exception(const std::string &message); /// - /// + /// Default copy constructor. /// exception(const exception &) = default; /// - /// + /// Destructor /// virtual ~exception(); /// - /// + /// Sets the message after the xlnt::exception is constructed. This can show + /// more specific information than std::exception::what(). /// void message(const std::string &message); private: /// - /// + /// The exception message /// std::string message_; }; @@ -72,17 +74,17 @@ class XLNT_API invalid_parameter : public exception { public: /// - /// + /// Default constructor. /// invalid_parameter(); /// - /// + /// Default copy constructor. /// invalid_parameter(const invalid_parameter &) = default; /// - /// + /// Destructor /// virtual ~invalid_parameter(); }; @@ -94,17 +96,17 @@ class XLNT_API invalid_sheet_title : public exception { public: /// - /// + /// Default constructor. /// invalid_sheet_title(const std::string &title); /// - /// + /// Default copy constructor. /// invalid_sheet_title(const invalid_sheet_title &) = default; /// - /// + /// Destructor /// virtual ~invalid_sheet_title(); }; @@ -116,12 +118,17 @@ class XLNT_API missing_number_format : public exception { public: /// - /// + /// Default constructor. /// missing_number_format(); /// - /// + /// Default copy constructor. + /// + missing_number_format(const missing_number_format &) = default; + + /// + /// Destructor /// virtual ~missing_number_format(); }; @@ -133,17 +140,18 @@ class XLNT_API invalid_file : public exception { public: /// - /// + /// Constructs an invalid_file exception thrown when attempt to access + /// the given filename. /// invalid_file(const std::string &filename); /// - /// + /// Default copy constructor. /// invalid_file(const invalid_file &) = default; /// - /// + /// Destructor /// virtual ~invalid_file(); }; @@ -156,17 +164,17 @@ class XLNT_API illegal_character : public exception { public: /// - /// + /// Constructs an illegal_character exception thrown as a result of the given character. /// illegal_character(char c); /// - /// + /// Default copy constructor. /// illegal_character(const illegal_character &) = default; /// - /// + /// Destructor /// virtual ~illegal_character(); }; @@ -178,41 +186,41 @@ class XLNT_API invalid_data_type : public exception { public: /// - /// + /// Default constructor. /// invalid_data_type(); /// - /// + /// Default copy constructor. /// invalid_data_type(const invalid_data_type &) = default; /// - /// + /// Destructor /// virtual ~invalid_data_type(); }; /// -/// Exception for bad column names in A1-style cell references. +/// Exception for bad column indices in A1-style cell references. /// -class XLNT_API invalid_column_string_index : public exception +class XLNT_API invalid_column_index : public exception { public: /// - /// + /// Default constructor. /// - invalid_column_string_index(); + invalid_column_index(); /// - /// + /// Default copy constructor. /// - invalid_column_string_index(const invalid_column_string_index &) = default; + invalid_column_index(const invalid_column_index &) = default; /// - /// + /// Destructor /// - virtual ~invalid_column_string_index(); + virtual ~invalid_column_index(); }; /// @@ -222,22 +230,22 @@ class XLNT_API invalid_cell_reference : public exception { public: /// - /// + /// Constructs an invalid_cell_reference exception for the given column and row. /// invalid_cell_reference(column_t column, row_t row); /// - /// + /// Constructs an invalid_cell_reference exception for the given string. /// invalid_cell_reference(const std::string &reference_string); /// - /// + /// Default copy constructor. /// invalid_cell_reference(const invalid_cell_reference &) = default; /// - /// + /// Destructor /// virtual ~invalid_cell_reference(); }; @@ -249,17 +257,17 @@ class XLNT_API invalid_attribute : public exception { public: /// - /// + /// Default constructor. /// invalid_attribute(); /// - /// + /// Default copy constructor. /// invalid_attribute(const invalid_attribute &) = default; /// - /// + /// Destructor /// virtual ~invalid_attribute(); }; @@ -271,17 +279,17 @@ class XLNT_API key_not_found : public exception { public: /// - /// + /// Default constructor. /// key_not_found(); /// - /// + /// Default copy constructor. /// key_not_found(const key_not_found &) = default; /// - /// + /// Destructor /// virtual ~key_not_found(); }; @@ -293,17 +301,17 @@ class XLNT_API no_visible_worksheets : public exception { public: /// - /// + /// Default constructor. /// no_visible_worksheets(); /// - /// + /// Default copy constructor. /// no_visible_worksheets(const no_visible_worksheets &) = default; /// - /// + /// Destructor /// virtual ~no_visible_worksheets(); }; @@ -315,17 +323,17 @@ class XLNT_API unhandled_switch_case : public exception { public: /// - /// + /// Default constructor. /// unhandled_switch_case(); /// - /// + /// Default copy constructor. /// unhandled_switch_case(const unhandled_switch_case &) = default; /// - /// + /// Destructor /// virtual ~unhandled_switch_case(); }; @@ -337,17 +345,18 @@ class XLNT_API unsupported : public exception { public: /// - /// + /// Constructs an unsupported exception with a message describing the unsupported + /// feature. /// unsupported(const std::string &message); /// - /// + /// Default copy constructor. /// unsupported(const unsupported &) = default; /// - /// + /// Destructor /// virtual ~unsupported(); }; diff --git a/include/xlnt/utils/path.hpp b/include/xlnt/utils/path.hpp index 72654aa2..d21979af 100644 --- a/include/xlnt/utils/path.hpp +++ b/include/xlnt/utils/path.hpp @@ -166,7 +166,7 @@ public: /// /// Returns true if left path is equal to right path. /// - friend XLNT_API bool operator==(const path &left, const path &right); + bool operator==(const path &other) const; private: /// @@ -196,7 +196,7 @@ template <> struct hash { /// - /// + /// Returns a hashed represenation of the given path. /// size_t operator()(const xlnt::path &p) const { diff --git a/include/xlnt/utils/time.hpp b/include/xlnt/utils/time.hpp index 980e7a5d..c275f3fb 100644 --- a/include/xlnt/utils/time.hpp +++ b/include/xlnt/utils/time.hpp @@ -49,42 +49,43 @@ struct XLNT_API time static time from_number(long double number); /// - /// + /// Constructs a time object from an optional hour, minute, second, and microsecond. /// explicit time(int hour_ = 0, int minute_ = 0, int second_ = 0, int microsecond_ = 0); /// - /// + /// Constructs a time object from a string representing the time. /// explicit time(const std::string &time_string); /// - /// + /// Returns a numeric representation of the time in the range 0-1 where the value + /// is equal to the fraction of the day elapsed. /// long double to_number() const; /// - /// + /// Returns true if this time is equivalent to comparand. /// bool operator==(const time &comparand) const; /// - /// + /// The hour /// int hour; /// - /// + /// The minute /// int minute; /// - /// + /// The second /// int second; /// - /// + /// The microsecond /// int microsecond; }; diff --git a/include/xlnt/utils/timedelta.hpp b/include/xlnt/utils/timedelta.hpp index f346d305..6ea773b1 100644 --- a/include/xlnt/utils/timedelta.hpp +++ b/include/xlnt/utils/timedelta.hpp @@ -31,52 +31,52 @@ namespace xlnt { /// /// Represents a span of time between two datetimes. This is -/// not fully supported yet. +/// not fully supported yet throughout the library. /// struct XLNT_API timedelta { /// - /// + /// Returns a timedelta from a number representing the factional number of days elapsed. /// static timedelta from_number(long double number); /// - /// + /// Constructs a timedelta equal to zero. /// timedelta(); /// - /// + /// Constructs a timedelta from a number of days, hours, minutes, seconds, and microseconds. /// timedelta(int days_, int hours_, int minutes_, int seconds_, int microseconds_); /// - /// + /// Returns a numeric representation of this timedelta as a fractional number of days. /// long double to_number() const; /// - /// + /// The days /// int days; /// - /// + /// The hours /// int hours; /// - /// + /// The minutes /// int minutes; /// - /// + /// The seconds /// int seconds; /// - /// + /// The microseconds /// int microseconds; }; diff --git a/include/xlnt/workbook/document_security.hpp b/include/xlnt/workbook/document_security.hpp index 52256384..ac368a4f 100644 --- a/include/xlnt/workbook/document_security.hpp +++ b/include/xlnt/workbook/document_security.hpp @@ -43,22 +43,23 @@ public: struct lock_verifier { /// - /// + /// The algorithm used to create and verify this lock. /// std::string hash_algorithm; /// - /// + /// The initial salt combined with the password used to prevent rainbow table attacks /// std::string salt; /// - /// + /// The actual hash value represented as a string /// std::string hash; /// - /// + /// The number of times the hash should be applied to the password combined with the salt. + /// This allows the difficulty of the hash to be increased as computing power increases. /// std::size_t spin_count; }; diff --git a/include/xlnt/worksheet/page_setup.hpp b/include/xlnt/worksheet/page_setup.hpp index d8358f7f..ae398bf5 100644 --- a/include/xlnt/worksheet/page_setup.hpp +++ b/include/xlnt/worksheet/page_setup.hpp @@ -83,158 +83,160 @@ struct XLNT_API page_setup { public: /// - /// + /// Default constructor. /// page_setup(); /// - /// + /// Returns the page break. /// xlnt::page_break page_break() const; /// - /// + /// Sets the page break to b. /// void page_break(xlnt::page_break b); /// - /// + /// Returns the current sheet state of this page setup. /// xlnt::sheet_state sheet_state() const; /// - /// + /// Sets the sheet state to sheet_state. /// void sheet_state(xlnt::sheet_state sheet_state); /// - /// + /// Returns the paper size which should be used to print the worksheet using this page setup. /// xlnt::paper_size paper_size() const; /// - /// + /// Sets the paper size of this page setup. /// void paper_size(xlnt::paper_size paper_size); /// - /// + /// Returns the orientation of the worksheet using this page setup. /// xlnt::orientation orientation() const; /// - /// + /// Sets the orientation of the page. /// void orientation(xlnt::orientation orientation); /// - /// + /// Returns true if this worksheet should be scaled to fit on a single page during printing. /// bool fit_to_page() const; /// - /// + /// If true, forces the worksheet to be scaled to fit on a single page during printing. /// void fit_to_page(bool fit_to_page); /// - /// + /// Returns true if the height of this worksheet should be scaled to fit on a printed page. /// bool fit_to_height() const; /// - /// + /// Sets whether the height of the page should be scaled to fit on a printed page. /// void fit_to_height(bool fit_to_height); /// - /// + /// Returns true if the width of this worksheet should be scaled to fit on a printed page. /// bool fit_to_width() const; /// - /// + /// Sets whether the width of the page should be scaled to fit on a printed page. /// void fit_to_width(bool fit_to_width); /// - /// + /// Sets whether the worksheet should be centered horizontall on the page if it takes + /// up less than a full page. /// void horizontal_centered(bool horizontal_centered); /// - /// + /// Returns whether horizontal centering has been enabled. /// bool horizontal_centered() const; /// - /// + /// Sets whether the worksheet should be vertically centered on the page if it takes + /// up less than a full page. /// void vertical_centered(bool vertical_centered); /// - /// + /// Returns whether vertical centering has been enabled. /// bool vertical_centered() const; /// - /// + /// Sets the factor by which the page should be scaled during printing. /// void scale(double scale); /// - /// + /// Returns the factor by which the page should be scaled during printing. /// double scale() const; private: /// - /// + /// The break /// xlnt::page_break break_; /// - /// + /// The sheet state /// xlnt::sheet_state sheet_state_; /// - /// + /// The paper size /// xlnt::paper_size paper_size_; /// - /// + /// The orientation /// xlnt::orientation orientation_; /// - /// + /// Whether or not to fit to page /// bool fit_to_page_; /// - /// + /// Whether or not to fit to height /// bool fit_to_height_; /// - /// + /// Whether or not to fit to width /// bool fit_to_width_; /// - /// + /// Whether or not to center the content horizontally /// bool horizontal_centered_; /// - /// + /// Whether or not to center the conent vertically /// bool vertical_centered_; /// - /// + /// The amount to scale the worksheet /// double scale_; }; diff --git a/include/xlnt/worksheet/pane.hpp b/include/xlnt/worksheet/pane.hpp index 01f1d387..7ed8d176 100644 --- a/include/xlnt/worksheet/pane.hpp +++ b/include/xlnt/worksheet/pane.hpp @@ -31,7 +31,7 @@ namespace xlnt { /// -/// +/// Enumeration of possible states of a pane /// enum class XLNT_API pane_state { @@ -41,7 +41,7 @@ enum class XLNT_API pane_state }; /// -/// +/// Enumeration of the four quadrants of a worksheet /// enum class XLNT_API pane_corner { @@ -57,27 +57,27 @@ enum class XLNT_API pane_corner struct XLNT_API pane { /// - /// + /// The optional top left cell /// optional top_left_cell; /// - /// + /// The state of the pane /// pane_state state = pane_state::split; /// - /// + /// The pane which contains the active cell /// pane_corner active_pane = pane_corner::top_left; /// - /// + /// The row where the split should take place /// row_t y_split = 1; /// - /// + /// The column where the split should take place /// column_t x_split = 1; diff --git a/include/xlnt/worksheet/range.hpp b/include/xlnt/worksheet/range.hpp index 159dbe05..046d8bd9 100644 --- a/include/xlnt/worksheet/range.hpp +++ b/include/xlnt/worksheet/range.hpp @@ -48,122 +48,106 @@ class XLNT_API range { public: /// - /// + /// Alias for the iterator type /// using iterator = range_iterator; /// - /// + /// Alias for the const iterator type /// using const_iterator = const_range_iterator; /// - /// + /// Alias for the reverse iterator type /// using reverse_iterator = std::reverse_iterator; /// - /// + /// Alias for the const reverse iterator type /// using const_reverse_iterator = std::reverse_iterator; /// - /// + /// Constructs a range on the given worksheet. /// - range(worksheet ws, const range_reference &reference, major_order order = major_order::row, bool skip_null = false); + range(worksheet ws, const range_reference &reference, + major_order order = major_order::row, bool skip_null = false); /// - /// + /// Desctructor /// ~range(); /// - /// + /// Default copy constructor. /// range(const range &) = default; /// - /// + /// Returns a vector pointing to the n-th row or column in this range (depending + /// on major order). /// - cell_vector operator[](std::size_t vector_index); + cell_vector vector(std::size_t n); /// - /// + /// Returns a vector pointing to the n-th row or column in this range (depending + /// on major order). /// - const cell_vector operator[](std::size_t vector_index) const; + const cell_vector vector(std::size_t n) const; /// - /// - /// - bool operator==(const range &comparand) const; - - /// - /// - /// - bool operator!=(const range &comparand) const; - - /// - /// - /// - cell_vector vector(std::size_t vector_index); - - /// - /// - /// - const cell_vector vector(std::size_t vector_index) const; - - /// - /// + /// Returns a cell in the range relative to its top left cell. /// class cell cell(const cell_reference &ref); /// - /// + /// Returns a cell in the range relative to its top left cell. /// const class cell cell(const cell_reference &ref) const; /// - /// + /// Returns the reference defining the bounds of this range. /// range_reference reference() const; /// - /// + /// Returns the number of rows or columns in this range (depending on major order). /// std::size_t length() const; /// - /// + /// Returns true if the given cell exists in the parent worksheet of this range. /// bool contains(const cell_reference &ref); /// - /// + /// Sets the alignment of all cells in the range to new_alignment and returns the range. /// range alignment(const xlnt::alignment &new_alignment); /// - /// + /// Sets the border of all cells in the range to new_border and returns the range. /// range border(const xlnt::border &new_border); /// - /// + /// Sets the fill of all cells in the range to new_fill and returns the range. /// range fill(const xlnt::fill &new_fill); /// - /// + /// Sets the font of all cells in the range to new_font and returns the range. /// range font(const xlnt::font &new_font); /// - /// + /// Sets the number format of all cells in the range to new_number_format and + /// returns the range. /// range number_format(const xlnt::number_format &new_number_format); /// - /// + /// Sets the protection of all cells in the range to new_protection and returns the range. /// range protection(const xlnt::protection &new_protection); @@ -180,108 +164,128 @@ public: range style(const std::string &style_name); /// - /// + /// Returns the first row or column in this range. /// cell_vector front(); /// - /// + /// Returns the first row or column in this range. /// const cell_vector front() const; /// - /// + /// Returns the last row or column in this range. /// cell_vector back(); /// - /// + /// Returns the last row or column in this range. /// const cell_vector back() const; /// - /// + /// Returns an iterator to the first row or column in this range. /// iterator begin(); /// - /// + /// Returns an iterator to one past the last row or column in this range. /// iterator end(); /// - /// + /// Returns an iterator to the first row or column in this range. /// const_iterator begin() const; /// - /// + /// Returns an iterator to one past the last row or column in this range. /// const_iterator end() const; /// - /// + /// Returns an iterator to the first row or column in this range. /// const_iterator cbegin() const; /// - /// + /// Returns an iterator to one past the last row or column in this range. /// const_iterator cend() const; /// - /// + /// Returns a reverse iterator to the first row or column in this range. /// reverse_iterator rbegin(); /// - /// + /// Returns a reverse iterator to one past the last row or column in this range. /// reverse_iterator rend(); /// - /// + /// Returns a reverse iterator to the first row or column in this range. /// const_reverse_iterator rbegin() const; /// - /// + /// Returns a reverse iterator to one past the last row or column in this range. /// const_reverse_iterator rend() const; /// - /// + /// Returns a reverse iterator to the first row or column in this range. /// const_reverse_iterator crbegin() const; /// - /// + /// Returns a reverse iterator to one past the last row or column in this range. /// const_reverse_iterator crend() const; /// - /// + /// Applies function f to all cells in the range /// void apply(std::function f); + /// + /// Returns the n-th row or column in this range. + /// + cell_vector operator[](std::size_t n); + + /// + /// Returns the n-th row or column in this range. + /// + const cell_vector operator[](std::size_t n) const; + + /// + /// Returns true if this range is equivalent to comparand. + /// + bool operator==(const range &comparand) const; + + /// + /// Returns true if this range is not equivalent to comparand. + /// + bool operator!=(const range &comparand) const; + private: /// - /// + /// The worksheet this range is within /// worksheet ws_; /// - /// + /// The reference of this range /// range_reference ref_; /// - /// + /// Whether this range should be iterated by columns or rows first /// major_order order_; /// - /// + /// Whether null rows/columns and cells should be skipped during iteration /// bool skip_null_; }; diff --git a/include/xlnt/worksheet/range_iterator.hpp b/include/xlnt/worksheet/range_iterator.hpp index 0ac26caf..1b47a519 100644 --- a/include/xlnt/worksheet/range_iterator.hpp +++ b/include/xlnt/worksheet/range_iterator.hpp @@ -49,74 +49,75 @@ class XLNT_API range_iterator : public r_iter_type { public: /// - /// + /// Constructs a range iterator on a worksheet, cell pointing to the current + /// row or column, range bounds, an order, and whether or not to skip null column/rows. /// range_iterator(worksheet &ws, const cell_reference &cursor, const range_reference &bounds, major_order order, bool skip_null); /// - /// + /// Copy constructor. /// range_iterator(const range_iterator &other); /// - /// + /// Dereference the iterator to return a column or row. /// cell_vector operator*() const; /// - /// + /// Default assignment operator. /// range_iterator &operator=(const range_iterator &) = default; /// - /// + /// Returns true if this iterator is equivalent to other. /// bool operator==(const range_iterator &other) const; /// - /// + /// Returns true if this iterator is not equivalent to other. /// bool operator!=(const range_iterator &other) const; /// - /// + /// Pre-decrement the iterator to point to the previous row/column. /// range_iterator &operator--(); /// - /// + /// Post-decrement the iterator to point to the previous row/column. /// range_iterator operator--(int); /// - /// + /// Pre-increment the iterator to point to the next row/column. /// range_iterator &operator++(); /// - /// + /// Post-increment the iterator to point to the next row/column. /// range_iterator operator++(int); private: /// - /// + /// The worksheet /// worksheet ws_; /// - /// + /// The first cell in the current row/column /// cell_reference cursor_; /// - /// + /// The bounds of the range /// range_reference bounds_; /// - /// + /// Whether rows or columns should be iterated over first /// major_order order_; @@ -140,74 +141,75 @@ class XLNT_API const_range_iterator : public cr_iter_type { public: /// - /// + /// Constructs a range iterator on a worksheet, cell pointing to the current + /// row or column, range bounds, an order, and whether or not to skip null column/rows. /// const_range_iterator(const worksheet &ws, const cell_reference &cursor, const range_reference &bounds, major_order order, bool skip_null); /// - /// + /// Copy constructor. /// const_range_iterator(const const_range_iterator &other); /// - /// + /// Dereferennce the iterator to return the current column/row. /// const cell_vector operator*() const; /// - /// + /// Default assignment operator. /// const_range_iterator &operator=(const const_range_iterator &) = default; /// - /// + /// Returns true if this iterator is equivalent to other. /// bool operator==(const const_range_iterator &other) const; /// - /// + /// Returns true if this iterator is not equivalent to other. /// bool operator!=(const const_range_iterator &other) const; /// - /// + /// Pre-decrement the iterator to point to the next row/column. /// const_range_iterator &operator--(); /// - /// + /// Post-decrement the iterator to point to the next row/column. /// const_range_iterator operator--(int); /// - /// + /// Pre-increment the iterator to point to the next row/column. /// const_range_iterator &operator++(); /// - /// + /// Post-increment the iterator to point to the next row/column. /// const_range_iterator operator++(int); private: /// - /// + /// The implementation of the worksheet this iterator points to /// detail::worksheet_impl *ws_; /// - /// + /// The first cell in the current row or column this iterator points to /// cell_reference cursor_; /// - /// + /// The range this iterator starts and ends in /// range_reference bounds_; /// - /// + /// Determines whether iteration should move through rows or columns first /// major_order order_; diff --git a/include/xlnt/worksheet/range_reference.hpp b/include/xlnt/worksheet/range_reference.hpp index 78a44dd8..8f911ba3 100644 --- a/include/xlnt/worksheet/range_reference.hpp +++ b/include/xlnt/worksheet/range_reference.hpp @@ -36,165 +36,155 @@ class XLNT_API range_reference { public: /// - /// Convert a coordinate to an absolute coordinate string (B12 -> $B$12) + /// Converts relative reference coordinates to absolute coordinates (B12 -> $B$12) /// static range_reference make_absolute(const range_reference &relative_reference); /// - /// + /// Constructs a range reference equal to A1:A1 /// range_reference(); /// - /// + /// Constructs a range reference equivalent to the provided range_string in the form + /// :. /// explicit range_reference(const std::string &range_string); /// - /// + /// Constructs a range reference equivalent to the provided range_string in the form + /// :. /// explicit range_reference(const char *range_string); /// - /// + /// Constructs a range reference from a pair of cell references. /// explicit range_reference(const std::pair &reference_pair); /// - /// + /// Constructs a range reference from cell references indicating top + /// left and bottom right coordinates of the range. /// range_reference(const cell_reference &start, const cell_reference &end); /// - /// + /// Constructs a range reference from column and row indices. /// - range_reference(column_t column_index_start, row_t row_index_start, column_t column_index_end, row_t row_index_end); + range_reference(column_t column_index_start, row_t row_index_start, + column_t column_index_end, row_t row_index_end); /// - /// + /// Returns true if the range has a width and height of 1 cell. /// bool is_single_cell() const; /// - /// + /// Returns the number of columns encompassed by this range. /// std::size_t width() const; /// - /// + /// Returns the number of rows encompassed by this range. /// std::size_t height() const; /// - /// - /// - cell_reference top_left(); - - /// - /// + /// Returns the coordinate of the top left cell of this range. /// cell_reference top_left() const; /// - /// - /// - cell_reference top_right(); - - /// - /// + /// Returns the coordinate of the top right cell of this range. /// cell_reference top_right() const; /// - /// - /// - cell_reference bottom_left(); - - /// - /// + /// Returns the coordinate of the bottom left cell of this range. /// cell_reference bottom_left() const; /// - /// - /// - cell_reference bottom_right(); - - /// - /// + /// Returns the coordinate of the bottom right cell of this range. /// cell_reference bottom_right() const; /// - /// + /// Returns a new range reference with the same width and height as this + /// range but shifted by the given number of columns and rows. /// range_reference make_offset(int column_offset, int row_offset) const; /// - /// + /// Returns a string representation of this range. /// std::string to_string() const; /// - /// + /// Returns true if this range is equivalent to the other range. /// bool operator==(const range_reference &comparand) const; /// - /// + /// Returns true if this range is equivalent to the string representation + /// of the other range. /// bool operator==(const std::string &reference_string) const; /// - /// + /// Returns true if this range is equivalent to the string representation + /// of the other range. /// bool operator==(const char *reference_string) const; /// - /// + /// Returns true if this range is not equivalent to the other range. /// bool operator!=(const range_reference &comparand) const; /// - /// + /// Returns true if this range is not equivalent to the string representation + /// of the other range. /// bool operator!=(const std::string &reference_string) const; /// - /// + /// Returns true if this range is not equivalent to the string representation + /// of the other range. /// bool operator!=(const char *reference_string) const; - /// - /// - /// - XLNT_API friend bool operator==(const std::string &reference_string, const range_reference &ref); - - /// - /// - /// - XLNT_API friend bool operator==(const char *reference_string, const range_reference &ref); - - /// - /// - /// - XLNT_API friend bool operator!=(const std::string &reference_string, const range_reference &ref); - - /// - /// - /// - XLNT_API friend bool operator!=(const char *reference_string, const range_reference &ref); - private: /// - /// + /// The top left cell in the range /// cell_reference top_left_; /// - /// + /// The bottom right cell in the range /// cell_reference bottom_right_; }; +/// +/// Returns true if the string representation of the range is equivalent to ref. +/// +XLNT_API bool operator==(const std::string &reference_string, const range_reference &ref); + +/// +/// Returns true if the string representation of the range is equivalent to ref. +/// +XLNT_API bool operator==(const char *reference_string, const range_reference &ref); + +/// +/// Returns true if the string representation of the range is not equivalent to ref. +/// +XLNT_API bool operator!=(const std::string &reference_string, const range_reference &ref); + +/// +/// Returns true if the string representation of the range is not equivalent to ref. +/// +XLNT_API bool operator!=(const char *reference_string, const range_reference &ref); + + } // namespace xlnt diff --git a/include/xlnt/worksheet/row_properties.hpp b/include/xlnt/worksheet/row_properties.hpp index 47520529..911492e8 100644 --- a/include/xlnt/worksheet/row_properties.hpp +++ b/include/xlnt/worksheet/row_properties.hpp @@ -35,22 +35,22 @@ class XLNT_API row_properties { public: /// - /// + /// Optional height /// optional height; /// - /// + /// Whether or not the height is different from the default /// bool custom_height = false; /// - /// + /// Whether or not the row should be hidden /// bool hidden = false; /// - /// + /// The index to the style used by all cells in this row /// optional style; }; diff --git a/include/xlnt/worksheet/selection.hpp b/include/xlnt/worksheet/selection.hpp index 1ed4ea3d..e467c997 100644 --- a/include/xlnt/worksheet/selection.hpp +++ b/include/xlnt/worksheet/selection.hpp @@ -37,7 +37,7 @@ class XLNT_API selection { public: /// - /// + /// Returns true if this selection has a defined active cell. /// bool has_active_cell() const { @@ -45,7 +45,7 @@ public: } /// - /// + /// Returns the cell reference of the active cell. /// cell_reference active_cell() const { @@ -53,7 +53,7 @@ public: } /// - /// + /// Sets the active cell to that pointed to by ref. /// void active_cell(const cell_reference &ref) { @@ -61,7 +61,7 @@ public: } /// - /// + /// Returns the range encompassed by this selection. /// range_reference sqref() const { @@ -69,7 +69,7 @@ public: } /// - /// + /// Returns the sheet quadrant of this selection. /// pane_corner pane() const { @@ -77,7 +77,7 @@ public: } /// - /// + /// Sets the sheet quadrant of this selection to corner. /// void pane(pane_corner corner) { @@ -91,22 +91,23 @@ public: bool operator==(const selection &rhs) const { return active_cell_ == rhs.active_cell_ - && sqref_ == rhs.sqref_ && pane_ == rhs.pane_; + && sqref_ == rhs.sqref_ + && pane_ == rhs.pane_; } private: /// - /// + /// The active cell /// optional active_cell_; /// - /// + /// The range /// range_reference sqref_; /// - /// + /// The quadrant /// pane_corner pane_; }; diff --git a/include/xlnt/worksheet/sheet_protection.hpp b/include/xlnt/worksheet/sheet_protection.hpp index 89600fec..67d8e506 100644 --- a/include/xlnt/worksheet/sheet_protection.hpp +++ b/include/xlnt/worksheet/sheet_protection.hpp @@ -30,6 +30,8 @@ namespace xlnt { +// TOOD: does this really need its own class? + /// /// Protection applied to a particular worksheet to prevent it from being modified. /// @@ -37,23 +39,23 @@ class XLNT_API sheet_protection { public: /// - /// + /// Calculates and returns the hash of the given protection password. /// static std::string hash_password(const std::string &password); /// - /// + /// Sets the protection password to password. /// void password(const std::string &password); /// - /// + /// Returns the hash of the password set for this sheet protection. /// std::string hashed_password() const; private: /// - /// + /// The hash of the password. /// std::string hashed_password_; }; diff --git a/include/xlnt/worksheet/sheet_view.hpp b/include/xlnt/worksheet/sheet_view.hpp index 3ed4996a..a742c799 100644 --- a/include/xlnt/worksheet/sheet_view.hpp +++ b/include/xlnt/worksheet/sheet_view.hpp @@ -32,7 +32,7 @@ namespace xlnt { /// -/// +/// Enumeration of possible types of sheet views /// enum class sheet_view_type { @@ -49,7 +49,7 @@ class XLNT_API sheet_view { public: /// - /// + /// Sets the ID of this view to new_id. /// void id(std::size_t new_id) { @@ -57,7 +57,7 @@ public: } /// - /// + /// Returns the ID of this view. /// std::size_t id() const { @@ -65,7 +65,7 @@ public: } /// - /// + /// Returns true if this view has a pane defined. /// bool has_pane() const { @@ -73,7 +73,7 @@ public: } /// - /// + /// Returns a reference to this view's pane. /// struct pane &pane() { @@ -81,7 +81,7 @@ public: } /// - /// + /// Returns a reference to this view's pane. /// const struct pane &pane() const { @@ -89,7 +89,7 @@ public: } /// - /// + /// Removes the defined pane from this view. /// void clear_pane() { @@ -97,7 +97,7 @@ public: } /// - /// + /// Sets the pane of this view to new_pane. /// void pane(const struct pane &new_pane) { @@ -105,7 +105,7 @@ public: } /// - /// + /// Returns true if this view has any selections. /// bool has_selections() const { @@ -113,7 +113,7 @@ public: } /// - /// + /// Adds the given selection to the collection of selections. /// void add_selection(const class selection &new_selection) { @@ -121,7 +121,7 @@ public: } /// - /// + /// Removes all selections. /// void clear_selections() { @@ -129,7 +129,7 @@ public: } /// - /// + /// Returns the collection of selections as a vector. /// std::vector selections() const { @@ -137,7 +137,7 @@ public: } /// - /// + /// Returns the selection at the given index. /// class xlnt::selection &selection(std::size_t index) { @@ -145,7 +145,7 @@ public: } /// - /// + /// If show is true, grid lines will be shown for sheets using this view. /// void show_grid_lines(bool show) { @@ -153,7 +153,7 @@ public: } /// - /// + /// Returns true if grid lines will be shown for sheets using this view. /// bool show_grid_lines() const { @@ -161,7 +161,7 @@ public: } /// - /// + /// If is_default is true, the default grid color will be used. /// void default_grid_color(bool is_default) { @@ -169,7 +169,7 @@ public: } /// - /// + /// Returns true if the default grid color will be used. /// bool default_grid_color() const { @@ -205,32 +205,32 @@ public: private: /// - /// + /// The id /// std::size_t id_ = 0; /// - /// + /// Whether or not to show grid lines /// bool show_grid_lines_ = true; /// - /// + /// Whether or not to use the default grid color /// bool default_grid_color_ = true; /// - /// + /// The type of this view /// sheet_view_type type_ = sheet_view_type::normal; /// - /// + /// The optional pane /// optional pane_; /// - /// + /// The collection of selections /// std::vector selections_; }; diff --git a/include/xlnt/worksheet/worksheet.hpp b/include/xlnt/worksheet/worksheet.hpp index 2a967797..b5988c34 100644 --- a/include/xlnt/worksheet/worksheet.hpp +++ b/include/xlnt/worksheet/worksheet.hpp @@ -320,17 +320,17 @@ public: // named range /// - /// + /// Creates a new named range with the given name encompassing the string representing a range. /// void create_named_range(const std::string &name, const std::string &reference_string); /// - /// + /// Creates a new named range with the given name encompassing the given range reference. /// void create_named_range(const std::string &name, const range_reference &reference); /// - /// + /// Returns true if this worksheet contains a named range with the given name. /// bool has_named_range(const std::string &name) const; @@ -354,96 +354,86 @@ public: // extents /// - /// + /// Returns the row of the first non-empty cell in the worksheet. /// row_t lowest_row() const; /// - /// + /// Returns the row of the last non-empty cell in the worksheet. /// row_t highest_row() const; /// - /// + /// Returns the row directly below the last non-empty cell in the worksheet. /// row_t next_row() const; /// - /// + /// Returns the column of the first non-empty cell in the worksheet. /// column_t lowest_column() const; /// - /// + /// Returns the column of the last non-empty cell in the worksheet. /// column_t highest_column() const; /// - /// + /// Returns a range_reference pointing to the full range of non-empty cells in the worksheet. /// range_reference calculate_dimension() const; // cell merge /// - /// + /// Merges the cells within the range represented by the given string. /// void merge_cells(const std::string &reference_string); /// - /// + /// Merges the cells within the given range. /// void merge_cells(const range_reference &reference); /// - /// - /// - void merge_cells(column_t start_column, row_t start_row, column_t end_column, row_t end_row); - - /// - /// + /// Removes the merging of the cells in the range represented by the given string. /// void unmerge_cells(const std::string &reference_string); /// - /// + /// Removes the merging of the cells in the given range. /// void unmerge_cells(const range_reference &reference); /// - /// - /// - void unmerge_cells(column_t start_column, row_t start_row, column_t end_column, row_t end_row); - - /// - /// + /// Returns a vector of references of all merged ranges in the worksheet. /// std::vector merged_ranges() const; // operators /// - /// + /// Returns true if this worksheet refers to the same worksheet as other. /// bool operator==(const worksheet &other) const; /// - /// + /// Returns true if this worksheet doesn't refer to the same worksheet as other. /// bool operator!=(const worksheet &other) const; /// - /// + /// Returns true if this worksheet is null. /// bool operator==(std::nullptr_t) const; /// - /// + /// Returns true if this worksheet is not null. /// bool operator!=(std::nullptr_t) const; /// - /// + /// Sets the internal pointer of this worksheet object to point to other. /// void operator=(const worksheet &other); diff --git a/source/cell/comment.cpp b/source/cell/comment.cpp index 94d4aece..0eb7aa23 100644 --- a/source/cell/comment.cpp +++ b/source/cell/comment.cpp @@ -103,9 +103,14 @@ int comment::height() const return height_; } -XLNT_API bool operator==(const comment &left, const comment &right) +bool comment::operator==(const comment &other) const { - return left.text_ == right.text_ && left.author_ == right.author_; + return text_ == other.text_ && author_ == other.author_; +} + +bool comment::operator!=(const comment &other) const +{ + return !(*this == other); } } // namespace xlnt diff --git a/source/cell/index_types.cpp b/source/cell/index_types.cpp index cae5c65e..16b42138 100644 --- a/source/cell/index_types.cpp +++ b/source/cell/index_types.cpp @@ -33,7 +33,7 @@ column_t::index_t column_t::column_index_from_string(const std::string &column_s { if (column_string.length() > 3 || column_string.empty()) { - throw invalid_column_string_index(); + throw invalid_column_index(); } column_t::index_t column_index = 0; @@ -43,7 +43,7 @@ column_t::index_t column_t::column_index_from_string(const std::string &column_s { if (!std::isalpha(column_string[static_cast(i)], std::locale::classic())) { - throw invalid_column_string_index(); + throw invalid_column_index(); } auto char_index = std::toupper(column_string[static_cast(i)], std::locale::classic()) - 'A'; @@ -65,7 +65,7 @@ std::string column_t::column_string_from_index(column_t::index_t column_index) // columns if (column_index < constants::min_column() || column_index > constants::max_column()) { - throw invalid_column_string_index(); + throw invalid_column_index(); } int temp = static_cast(column_index); @@ -268,24 +268,6 @@ column_t operator-(column_t lhs, const column_t &rhs) return lhs; } -column_t operator*(column_t lhs, const column_t &rhs) -{ - lhs *= rhs; - return lhs; -} - -column_t operator/(column_t lhs, const column_t &rhs) -{ - lhs /= rhs; - return lhs; -} - -column_t operator%(column_t lhs, const column_t &rhs) -{ - lhs %= rhs; - return lhs; -} - column_t &column_t::operator+=(const column_t &rhs) { index += rhs.index; @@ -298,24 +280,6 @@ column_t &column_t::operator-=(const column_t &rhs) return *this; } -column_t &column_t::operator*=(const column_t &rhs) -{ - index *= rhs.index; - return *this; -} - -column_t &column_t::operator/=(const column_t &rhs) -{ - index /= rhs.index; - return *this; -} - -column_t &column_t::operator%=(const column_t &rhs) -{ - index %= rhs.index; - return *this; -} - bool operator>(const column_t::index_t &left, const column_t &right) { return column_t(left) > right; diff --git a/source/cell/tests/test_cell.hpp b/source/cell/tests/test_cell.hpp index 59d5d29c..08f8718d 100644 --- a/source/cell/tests/test_cell.hpp +++ b/source/cell/tests/test_cell.hpp @@ -58,7 +58,7 @@ public: TS_ASSERT(cell.value() == xlnt::time(0, 30, 33, 865633)); } - void test_ctor() + void test_constructor() { xlnt::workbook wb; auto ws = wb.active_sheet(); @@ -195,6 +195,7 @@ public: auto cell = ws.cell(xlnt::cell_reference(1, 1)); cell.value(xlnt::datetime(2010, 7, 13, 6, 37, 41)); + TS_ASSERT(cell.data_type() == xlnt::cell::type::numeric); TS_ASSERT(cell.value() == 40372.27616898148L); TS_ASSERT(cell.is_date()); @@ -270,7 +271,8 @@ public: auto cell = ws.cell(xlnt::cell_reference(1, 1)); // The bytes 0x00 through 0x1F inclusive must be manually escaped in values. - auto illegal_chrs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; + auto illegal_chrs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; for(auto i : illegal_chrs) { diff --git a/source/cell/tests/test_index_types.hpp b/source/cell/tests/test_index_types.hpp index dc217f95..f5a01768 100644 --- a/source/cell/tests/test_index_types.hpp +++ b/source/cell/tests/test_index_types.hpp @@ -8,25 +8,39 @@ class test_index_types : public CxxTest::TestSuite { public: - void test_bad_string() + void test_bad_string_empty() { - TS_ASSERT_THROWS(xlnt::column_t::column_index_from_string(""), xlnt::invalid_column_string_index); - TS_ASSERT_THROWS(xlnt::column_t::column_index_from_string("ABCD"), xlnt::invalid_column_string_index); - TS_ASSERT_THROWS(xlnt::column_t::column_index_from_string("123"), xlnt::invalid_column_string_index); + TS_ASSERT_THROWS(xlnt::column_t::column_index_from_string(""), + xlnt::invalid_column_index); } - void test_bad_column() + void test_bad_string_too_long() { - TS_ASSERT_THROWS(xlnt::column_t::column_string_from_index(0), xlnt::invalid_column_string_index); + TS_ASSERT_THROWS(xlnt::column_t::column_index_from_string("ABCD"), + xlnt::invalid_column_index); + } + + void test_bad_string_numbers() + { + TS_ASSERT_THROWS(xlnt::column_t::column_index_from_string("123"), + xlnt::invalid_column_index); + } + + void test_bad_index_zero() + { + TS_ASSERT_THROWS(xlnt::column_t::column_string_from_index(0), + xlnt::invalid_column_index); } void test_column_operators() { - xlnt::column_t c1; + auto c1 = xlnt::column_t(); c1 = "B"; - xlnt::column_t c2; - std::string d = "D"; + + auto c2 = xlnt::column_t(); + const auto d = std::string("D"); c2 = d; + TS_ASSERT(c1 != c2); TS_ASSERT(c1 == static_cast(2)); TS_ASSERT(c2 == d); @@ -44,18 +58,7 @@ public: TS_ASSERT_EQUALS(c2, 2); c2 = 4; - - TS_ASSERT_EQUALS(c1 * c2, 8); - TS_ASSERT_EQUALS(c2 / c1, 2); - TS_ASSERT_EQUALS(c2 % c1, 0); - - c1 *= c2; - TS_ASSERT_EQUALS(c1, 8); - c1 /= c2; - TS_ASSERT_EQUALS(c1, 2); c1 = 3; - c1 %= c2; - TS_ASSERT_EQUALS(c1, 3); TS_ASSERT(c2 <= 4); TS_ASSERT(!(c2 < 3)); diff --git a/source/detail/format_impl.hpp b/source/detail/format_impl.hpp index a62799b8..8b8e3771 100755 --- a/source/detail/format_impl.hpp +++ b/source/detail/format_impl.hpp @@ -58,11 +58,19 @@ struct format_impl { return left.parent == right.parent && left.alignment_id == right.alignment_id + && left.alignment_applied == right.alignment_applied && left.border_id == right.border_id + && left.border_applied == right.border_applied && left.fill_id == right.fill_id + && left.fill_applied == right.fill_applied && left.font_id == right.font_id + && left.font_applied == right.font_applied && left.number_format_id == right.number_format_id + && left.number_format_applied == right.number_format_applied && left.protection_id == right.protection_id + && left.protection_applied == right.protection_applied + && left.pivot_button_ == right.pivot_button_ + && left.quote_prefix_ == right.quote_prefix_ && left.style == right.style; } }; diff --git a/source/detail/xlsx_producer.cpp b/source/detail/xlsx_producer.cpp index c28cf6bd..6fbd554e 100755 --- a/source/detail/xlsx_producer.cpp +++ b/source/detail/xlsx_producer.cpp @@ -2181,7 +2181,7 @@ void xlsx_producer::write_worksheet(const relationship &rel) if (cell.has_format()) { - write_attribute("s", cell.format().id()); + write_attribute("s", cell.format().d_->id); } if (cell.has_hyperlink()) diff --git a/source/styles/color.cpp b/source/styles/color.cpp index 8f24977b..a5c32c3d 100644 --- a/source/styles/color.cpp +++ b/source/styles/color.cpp @@ -120,7 +120,7 @@ std::uint8_t rgb_color::alpha() const std::array rgb_color::rgb() const { - return { red(), green(), blue() }; + return {{red(), green(), blue()}}; } std::array rgb_color::rgba() const diff --git a/source/styles/font.cpp b/source/styles/font.cpp index 6fde2812..4d300835 100644 --- a/source/styles/font.cpp +++ b/source/styles/font.cpp @@ -207,78 +207,78 @@ std::string font::scheme() const return scheme_.get(); } -XLNT_API bool operator==(const font &left, const font &right) +bool font::operator==(const font &other) const { - if (left.bold() != right.bold()) + if (bold() != other.bold()) { return false; } - if (left.has_color() != right.has_color()) + if (has_color() != other.has_color()) { return false; } - if (left.has_color()) + if (has_color()) { - if (left.color() != right.color()) + if (color() != other.color()) { return false; } } - if (left.has_family() != right.has_family()) + if (has_family() != other.has_family()) { return false; } - if (left.has_family()) + if (has_family()) { - if (left.family() != right.family()) + if (family() != other.family()) { return false; } } - if (left.italic() != right.italic()) + if (italic() != other.italic()) { return false; } - if (left.name() != right.name()) + if (name() != other.name()) { return false; } - if (left.has_scheme() != right.has_scheme()) + if (has_scheme() != other.has_scheme()) { return false; } - if (left.has_scheme()) + if (has_scheme()) { - if (left.scheme() != right.scheme()) + if (scheme() != other.scheme()) { return false; } } - if (std::fabs(left.size() - right.size()) != 0.0) + if (std::fabs(size() - other.size()) != 0.0) { return false; } - if (left.strikethrough() != right.strikethrough()) + if (strikethrough() != other.strikethrough()) { return false; } - if (left.superscript() != right.superscript()) + if (superscript() != other.superscript()) { return false; } - if (left.underline() != right.underline()) + if (underline() != other.underline()) { return false; } diff --git a/source/styles/format.cpp b/source/styles/format.cpp index 4f1dab3f..aa7c6645 100755 --- a/source/styles/format.cpp +++ b/source/styles/format.cpp @@ -34,11 +34,6 @@ format::format(detail::format_impl *d) { } -std::size_t format::id() const -{ - return d_->id; -} - void format::clear_style() { d_->style.clear(); @@ -81,12 +76,7 @@ const style format::style() const return d_->parent->style(d_->style.get()); } -xlnt::alignment &format::alignment() -{ - return d_->parent->alignments.at(d_->alignment_id.get()); -} - -const xlnt::alignment &format::alignment() const +xlnt::alignment format::alignment() const { return d_->parent->alignments.at(d_->alignment_id.get()); } @@ -97,12 +87,7 @@ format format::alignment(const xlnt::alignment &new_alignment, bool applied) return format(d_); } -xlnt::border &format::border() -{ - return d_->parent->borders.at(d_->border_id.get()); -} - -const xlnt::border &format::border() const +xlnt::border format::border() const { return d_->parent->borders.at(d_->border_id.get()); } @@ -113,12 +98,7 @@ format format::border(const xlnt::border &new_border, bool applied) return format(d_); } -xlnt::fill &format::fill() -{ - return d_->parent->fills.at(d_->fill_id.get()); -} - -const xlnt::fill &format::fill() const +xlnt::fill format::fill() const { return d_->parent->fills.at(d_->fill_id.get()); } @@ -129,12 +109,7 @@ format format::fill(const xlnt::fill &new_fill, bool applied) return format(d_); } -xlnt::font &format::font() -{ - return d_->parent->fonts.at(d_->font_id.get()); -} - -const xlnt::font &format::font() const +xlnt::font format::font() const { return d_->parent->fonts.at(d_->font_id.get()); } @@ -145,12 +120,7 @@ format format::font(const xlnt::font &new_font, bool applied) return format(d_); } -xlnt::number_format &format::number_format() -{ - return d_->parent->number_formats.at(d_->number_format_id.get()); -} - -const xlnt::number_format &format::number_format() const +xlnt::number_format format::number_format() const { if (number_format::is_builtin_format(d_->number_format_id.get())) { @@ -175,12 +145,7 @@ format format::number_format(const xlnt::number_format &new_number_format, bool return format(d_); } -xlnt::protection &format::protection() -{ - return d_->parent->protections.at(d_->protection_id.get()); -} - -const xlnt::protection &format::protection() const +xlnt::protection format::protection() const { return d_->parent->protections.at(d_->protection_id.get()); } diff --git a/source/styles/number_format.cpp b/source/styles/number_format.cpp index e08ea033..9527b2cc 100644 --- a/source/styles/number_format.cpp +++ b/source/styles/number_format.cpp @@ -244,15 +244,13 @@ number_format::number_format(std::size_t id) } number_format::number_format(const std::string &format_string) - : id_set_(false), id_(0) + : format_string_(format_string) { - this->format_string(format_string); } -number_format::number_format(const std::string &format_string, std::size_t id) - : id_set_(false), id_(0) +number_format::number_format(const std::string &format, std::size_t id) { - this->format_string(format_string, id); + format_string(format, id); } bool number_format::is_builtin_format(std::size_t builtin_id) @@ -279,14 +277,12 @@ void number_format::format_string(const std::string &format_string) { format_string_ = format_string; id_ = 0; - id_set_ = false; for (const auto &pair : builtin_formats()) { if (pair.second.format_string() == format_string) { id_ = pair.first; - id_set_ = true; break; } } @@ -296,28 +292,26 @@ void number_format::format_string(const std::string &format_string, std::size_t { format_string_ = format_string; id_ = id; - id_set_ = true; } bool number_format::has_id() const { - return id_set_; + return id_.is_set(); } void number_format::id(std::size_t id) { id_ = id; - id_set_ = true; } std::size_t number_format::id() const { - if (!id_set_) + if (!has_id()) { throw invalid_attribute(); } - return id_; + return id_.get(); } bool number_format::is_date_format() const @@ -355,9 +349,14 @@ std::string number_format::format(long double number, calendar base_date) const return detail::number_formatter(format_string_, base_date).format_number(number); } -XLNT_API bool operator==(const number_format &left, const number_format &right) +bool number_format::operator==(const number_format &other) const { - return left.format_string_ == right.format_string_; + return format_string_ == other.format_string_; +} + +bool number_format::operator!=(const number_format &other) const +{ + return !(*this == other); } } // namespace xlnt diff --git a/source/styles/protection.cpp b/source/styles/protection.cpp index c15b39e2..f626e85d 100644 --- a/source/styles/protection.cpp +++ b/source/styles/protection.cpp @@ -53,9 +53,14 @@ protection &protection::hidden(bool hidden) return *this; } -XLNT_API bool operator==(const protection &left, const protection &right) +bool protection::operator==(const protection &other) const { - return left.locked_ == right.locked_ && left.hidden_ == right.hidden_; + return locked_ == other.locked_ && hidden_ == other.hidden_; +} + +bool protection::operator!=(const protection &other) const +{ + return !(*this == other); } } // namespace xlnt diff --git a/source/utils/exceptions.cpp b/source/utils/exceptions.cpp index 795ad8e1..6cb7a86e 100644 --- a/source/utils/exceptions.cpp +++ b/source/utils/exceptions.cpp @@ -27,7 +27,7 @@ namespace xlnt { exception::exception(const std::string &message) - : std::runtime_error("xlnt::error : " + message) + : std::runtime_error("xlnt::exception : " + message) { this->message(message); } @@ -63,12 +63,12 @@ invalid_sheet_title::~invalid_sheet_title() { } -invalid_column_string_index::invalid_column_string_index() +invalid_column_index::invalid_column_index() : exception("column string index error") { } -invalid_column_string_index::~invalid_column_string_index() +invalid_column_index::~invalid_column_index() { } diff --git a/source/utils/path.cpp b/source/utils/path.cpp index 34a6bc40..f48c3682 100644 --- a/source/utils/path.cpp +++ b/source/utils/path.cpp @@ -315,9 +315,9 @@ path path::relative_to(const path &base_path) const return result; } -bool operator==(const path &left, const path &right) +bool path::operator==(const path &other) const { - return left.internal_ == right.internal_; + return internal_ == other.internal_; } } // namespace xlnt diff --git a/source/worksheet/range_reference.cpp b/source/worksheet/range_reference.cpp index e0e56ca1..8137c708 100644 --- a/source/worksheet/range_reference.cpp +++ b/source/worksheet/range_reference.cpp @@ -118,41 +118,21 @@ bool range_reference::operator!=(const range_reference &comparand) const return comparand.top_left_ != top_left_ || comparand.bottom_right_ != bottom_right_; } -cell_reference range_reference::top_left() -{ - return top_left_; -} - cell_reference range_reference::top_left() const { return top_left_; } -cell_reference range_reference::top_right() -{ - return cell_reference(bottom_right_.column(), top_left_.row()); -} - cell_reference range_reference::top_right() const { return cell_reference(bottom_right_.column(), top_left_.row()); } -cell_reference range_reference::bottom_left() -{ - return cell_reference(top_left_.column(), bottom_right_.row()); -} - cell_reference range_reference::bottom_left() const { return cell_reference(top_left_.column(), bottom_right_.row()); } -cell_reference range_reference::bottom_right() -{ - return bottom_right_; -} - cell_reference range_reference::bottom_right() const { return bottom_right_; diff --git a/source/worksheet/tests/test_worksheet.hpp b/source/worksheet/tests/test_worksheet.hpp index dfcda232..4b1dd3b9 100644 --- a/source/worksheet/tests/test_worksheet.hpp +++ b/source/worksheet/tests/test_worksheet.hpp @@ -303,15 +303,6 @@ public: TS_ASSERT(!ws.cell("D4").has_value()); } - void test_merge_coordinate() - { - xlnt::workbook wb; - auto ws = wb.active_sheet(); - ws.merge_cells(1, 1, 4, 4); - std::vector expected = { xlnt::range_reference("A1:D4") }; - TS_ASSERT_EQUALS(ws.merged_ranges(), expected); - } - void test_unmerge_bad() { xlnt::workbook wb; @@ -330,16 +321,6 @@ public: TS_ASSERT_EQUALS(ws.merged_ranges().size(), 0); } - void test_unmerge_coordinate() - { - xlnt::workbook wb; - auto ws = wb.active_sheet(); - ws.merge_cells("A1:D4"); - TS_ASSERT_EQUALS(ws.merged_ranges().size(), 1); - ws.unmerge_cells(1, 1, 4, 4); - TS_ASSERT_EQUALS(ws.merged_ranges().size(), 0); - } - void test_print_titles_old() { xlnt::workbook wb; diff --git a/source/worksheet/worksheet.cpp b/source/worksheet/worksheet.cpp index 56382446..f18efa16 100644 --- a/source/worksheet/worksheet.cpp +++ b/source/worksheet/worksheet.cpp @@ -568,11 +568,6 @@ void worksheet::merge_cells(const range_reference &reference) } } -void worksheet::merge_cells(column_t start_column, row_t start_row, column_t end_column, row_t end_row) -{ - merge_cells(xlnt::range_reference(start_column, start_row, end_column, end_row)); -} - void worksheet::unmerge_cells(const range_reference &reference) { auto match = std::find(d_->merged_cells_.begin(), d_->merged_cells_.end(), reference); @@ -593,11 +588,6 @@ void worksheet::unmerge_cells(const range_reference &reference) } } -void worksheet::unmerge_cells(column_t start_column, row_t start_row, column_t end_column, row_t end_row) -{ - unmerge_cells(xlnt::range_reference(start_column, start_row, end_column, end_row)); -} - row_t worksheet::next_row() const { auto row = highest_row() + 1;