fix formatting

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

View File

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

View File

@ -51,7 +51,9 @@ struct datetime;
struct time;
struct timedelta;
namespace detail { struct cell_impl; }
namespace detail {
struct cell_impl;
}
/// <summary>
/// Describes cell associated properties.

View File

@ -52,7 +52,7 @@ struct XLNT_CLASS cell_reference_hash
/// </summary>
class XLNT_CLASS cell_reference
{
public:
public:
/// <summary>
/// Split a coordinate string like "A1" into an equivalent pair like {"A", 1}.
/// </summary>
@ -64,8 +64,8 @@ class XLNT_CLASS cell_reference
/// if column part or row part are prefixed by a dollar-sign indicating they
/// are absolute, otherwise false.
/// </summary>
static std::pair<std::string, row_t> split_reference(const std::string &reference_string,
bool &absolute_column, bool &absolute_row);
static std::pair<std::string, row_t> split_reference(
const std::string &reference_string, bool &absolute_column, bool &absolute_row);
// constructors
@ -74,7 +74,7 @@ class XLNT_CLASS cell_reference
/// </summary>
cell_reference();
//TODO: should these be explicit? The implicit conversion is nice sometimes.
// TODO: should these be explicit? The implicit conversion is nice sometimes.
/// <summary>
/// Constructs a cell_reference from a string reprenting a cell coordinate (e.g. $B14).
@ -232,13 +232,13 @@ class XLNT_CLASS cell_reference
/// </summary>
bool operator!=(const char *reference_string) const;
//TODO: are these useful? maybe get rid of them
// TODO: are these useful? maybe get rid of them
bool operator<(const cell_reference &other);
bool operator>(const cell_reference &other);
bool operator<=(const cell_reference &other);
bool operator>=(const cell_reference &other);
private:
private:
/// <summary>
/// Index of the column. Important: this is one-indexed to conform
/// with Excel. Column "A", the first column, would have an index of 1.

View File

@ -30,14 +30,16 @@
namespace xlnt {
class cell;
namespace detail { struct comment_impl; }
namespace detail {
struct comment_impl;
}
/// <summary>
/// A comment can be applied to a cell to provide extra information.
/// </summary>
class XLNT_CLASS comment
{
public:
public:
/// <summary>
/// The default constructor makes an invalid comment without a parent cell.
/// </summary>
@ -68,7 +70,7 @@ class XLNT_CLASS comment
/// </summary>
bool operator==(const comment &other) const;
private:
private:
friend class cell; // cell needs access to private constructor
/// <summary>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -50,7 +50,7 @@ enum class XLNT_CLASS target_mode
/// </summary>
class XLNT_CLASS relationship
{
public:
public:
enum class type
{
invalid,
@ -103,7 +103,7 @@ class XLNT_CLASS relationship
bool operator==(const relationship &rhs) const;
private:
private:
type type_;
std::string id_;
std::string source_uri_;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,7 +34,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS fill : public hashable
{
public:
public:
enum class type
{
none,

View File

@ -38,7 +38,7 @@ class style;
/// </summary>
class XLNT_CLASS font : public hashable
{
public:
public:
enum class underline_style
{
none,
@ -91,7 +91,7 @@ class XLNT_CLASS font : public hashable
protected:
std::string to_hash_string() const override;
private:
private:
friend class style;
std::string name_ = "Calibri";

View File

@ -35,7 +35,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS protection : public hashable
{
public:
public:
enum class type
{
inherit,

View File

@ -38,7 +38,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS side : public hashable
{
public:
public:
side();
std::experimental::optional<border_style> &get_border_style();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,7 +34,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS document_security
{
public:
public:
document_security();
bool lock_revision;

View File

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

View File

@ -56,14 +56,16 @@ class zip_file;
enum class encoding;
namespace detail { struct workbook_impl; } // namespace detail
namespace detail {
struct workbook_impl;
} // namespace detail
/// <summary>
/// workbook is the container for all other parts of the document.
/// </summary>
class XLNT_CLASS workbook
{
public:
public:
class XLNT_CLASS iterator
{
public:
@ -251,7 +253,7 @@ class XLNT_CLASS workbook
std::vector<std::string> &get_shared_strings();
const std::vector<std::string> &get_shared_strings() const;
private:
private:
friend class worksheet;
std::shared_ptr<detail::workbook_impl> d_;
};

View File

@ -41,7 +41,7 @@ class range_reference;
/// </summary>
class XLNT_CLASS cell_vector
{
public:
public:
class XLNT_CLASS iterator : public std::iterator<std::bidirectional_iterator_tag, cell>
{
public:
@ -129,7 +129,7 @@ class XLNT_CLASS cell_vector
const_iterator end() const;
const_iterator cend() const;
private:
private:
worksheet ws_;
range_reference ref_;
major_order order_;

View File

@ -35,7 +35,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS footer
{
public:
public:
footer();
void set_text(const std::string &text);
@ -48,7 +48,7 @@ class XLNT_CLASS footer
bool is_default() const;
private:
private:
bool default_;
std::string text_;
std::string font_name_;

View File

@ -35,7 +35,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS header
{
public:
public:
header();
void set_text(const std::string &text);
@ -48,7 +48,7 @@ class XLNT_CLASS header
bool is_default() const;
private:
private:
bool default_;
std::string text_;
std::string font_name_;

View File

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

View File

@ -32,7 +32,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS page_margins
{
public:
public:
page_margins();
bool is_default() const;
@ -55,7 +55,7 @@ class XLNT_CLASS page_margins
double get_footer() const;
void set_footer(double footer);
private:
private:
bool default_;
double top_;
double left_;

View File

@ -36,7 +36,7 @@ namespace xlnt {
/// </summary>
struct XLNT_CLASS page_setup
{
public:
public:
page_setup();
bool is_default() const;
@ -81,7 +81,7 @@ struct XLNT_CLASS page_setup
double get_scale() const;
private:
private:
bool default_;
page_break break_;
sheet_state sheet_state_;

View File

@ -41,7 +41,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS range
{
public:
public:
using iterator = range_iterator_2d;
using const_iterator = const_range_iterator_2d;
@ -80,7 +80,7 @@ class XLNT_CLASS range
const_iterator cbegin() const;
const_iterator cend() const;
private:
private:
worksheet ws_;
range_reference ref_;
major_order order_;

View File

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

View File

@ -33,7 +33,7 @@ namespace xlnt {
/// </summary>
class XLNT_CLASS range_reference
{
public:
public:
/// <summary>
/// Convert a coordinate to an absolute coordinate string (B12 -> $B$12)
/// </summary>
@ -84,11 +84,9 @@ class XLNT_CLASS range_reference
XLNT_FUNCTION friend bool operator!=(const char *reference_string, const range_reference &ref);
private:
private:
cell_reference top_left_;
cell_reference bottom_right_;
};
} // namespace xlnt

View File

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

View File

@ -51,7 +51,9 @@ class workbook;
struct date;
namespace detail { struct worksheet_impl; }
namespace detail {
struct worksheet_impl;
}
/// <summary>
/// A worksheet is a 2D array of cells starting with cell A1 in the top-left corner
@ -214,7 +216,7 @@ public:
range iter_cells(bool skip_null);
private:
private:
friend class workbook;
friend class cell;
friend class range_iterator_2d;