aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2018-10-17 21:14:43 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2018-10-17 21:14:43 -0700
commitc237489a6c96fdb8686adf83ee1676f2a5a8517a (patch)
treeab12606c67eb4c17380f815b06970b199321252f
parent3c75d4d61206e5935622d1ad8d2064ee9cf83da4 (diff)
downloadpugixml-clang-format.zip
pugixml-clang-format.tar.gz
pugixml-clang-format.tar.bz2
Fix access modifier offsetclang-format
-rw-r--r--.clang-format1
-rw-r--r--src/pugixml.cpp32
-rw-r--r--src/pugixml.hpp70
-rw-r--r--tests/test.hpp2
-rw-r--r--tests/test_document.cpp10
5 files changed, 58 insertions, 57 deletions
diff --git a/.clang-format b/.clang-format
index 32b3590..04410f5 100644
--- a/.clang-format
+++ b/.clang-format
@@ -2,6 +2,7 @@ Standard: Cpp03
UseTab: ForIndentation
TabWidth: 4
IndentWidth: 4
+AccessModifierOffset: -4
BreakBeforeBraces: Allman
IndentCaseLabels: false
ColumnLimit: 0
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index fb89c59..f0ad30a 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -320,7 +320,7 @@ PUGI__NS_END
PUGI__NS_BEGIN
class compact_hash_table
{
- public:
+public:
compact_hash_table()
: _items(0)
, _capacity(0)
@@ -375,7 +375,7 @@ class compact_hash_table
return true;
}
- private:
+private:
struct item_t
{
const void* key;
@@ -793,7 +793,7 @@ static const uintptr_t compact_alignment = 1 << compact_alignment_log2;
class compact_header
{
- public:
+public:
compact_header(xml_memory_page* page, unsigned int flags)
{
PUGI__STATIC_ASSERT(xml_memory_block_alignment == compact_alignment);
@@ -829,7 +829,7 @@ class compact_header
return const_cast<xml_memory_page*>(reinterpret_cast<const xml_memory_page*>(static_cast<const void*>(page)));
}
- private:
+private:
unsigned char _page;
unsigned char _flags;
};
@@ -856,7 +856,7 @@ PUGI__FN_NO_INLINE void compact_set_value(const void* object, T* value)
template <typename T, int header_offset, int start = -126>
class compact_pointer
{
- public:
+public:
compact_pointer()
: _data(0)
{
@@ -913,14 +913,14 @@ class compact_pointer
return *this;
}
- private:
+private:
unsigned char _data;
};
template <typename T, int header_offset>
class compact_pointer_parent
{
- public:
+public:
compact_pointer_parent()
: _data(0)
{
@@ -995,14 +995,14 @@ class compact_pointer_parent
return *this;
}
- private:
+private:
uint16_t _data;
};
template <int header_offset, int base_offset>
class compact_string
{
- public:
+public:
compact_string()
: _data(0)
{
@@ -1088,7 +1088,7 @@ class compact_string
return 0;
}
- private:
+private:
unsigned char _data;
};
PUGI__NS_END
@@ -3992,7 +3992,7 @@ class xml_buffered_writer
xml_buffered_writer(const xml_buffered_writer&);
xml_buffered_writer& operator=(const xml_buffered_writer&);
- public:
+public:
xml_buffered_writer(xml_writer& writer_, xml_encoding user_encoding)
: writer(writer_)
, bufsize(0)
@@ -8242,7 +8242,7 @@ class xpath_string
{
}
- public:
+public:
static xpath_string from_const(const char_t* str)
{
return xpath_string(str, false, 0);
@@ -9400,7 +9400,7 @@ class xpath_node_set_raw
xpath_node* _end;
xpath_node* _eos;
- public:
+public:
xpath_node_set_raw()
: _type(xpath_node_set::type_unsorted)
, _begin(0)
@@ -9595,7 +9595,7 @@ class xpath_lexer
lexeme_t _cur_lexeme;
- public:
+public:
explicit xpath_lexer(const char_t* query)
: _cur(query)
{
@@ -10024,7 +10024,7 @@ const axis_t axis_to_type<N>::axis = N;
class xpath_ast_node
{
- private:
+private:
// node type
char _type;
char _rettype;
@@ -10789,7 +10789,7 @@ class xpath_ast_node
return ns;
}
- public:
+public:
xpath_ast_node(ast_type_t type, xpath_value_type rettype_, const char_t* value)
: _type(static_cast<char>(type))
, _rettype(static_cast<char>(rettype_))
diff --git a/src/pugixml.hpp b/src/pugixml.hpp
index fb40179..f3b1522 100644
--- a/src/pugixml.hpp
+++ b/src/pugixml.hpp
@@ -283,7 +283,7 @@ class xpath_variable_set;
template <typename It>
class xml_object_range
{
- public:
+public:
typedef It const_iterator;
typedef It iterator;
@@ -296,14 +296,14 @@ class xml_object_range
It begin() const { return _begin; }
It end() const { return _end; }
- private:
+private:
It _begin, _end;
};
// Writer interface for node printing (see xml_node::print)
class PUGIXML_CLASS xml_writer
{
- public:
+public:
virtual ~xml_writer() {}
// Write memory chunk into stream/file/whatever
@@ -313,13 +313,13 @@ class PUGIXML_CLASS xml_writer
// xml_writer implementation for FILE*
class PUGIXML_CLASS xml_writer_file : public xml_writer
{
- public:
+public:
// Construct writer from a FILE* object; void* is used to avoid header dependencies on stdio
xml_writer_file(void* file);
virtual void write(const void* data, size_t size) PUGIXML_OVERRIDE;
- private:
+private:
void* file;
};
@@ -327,14 +327,14 @@ class PUGIXML_CLASS xml_writer_file : public xml_writer
// xml_writer implementation for streams
class PUGIXML_CLASS xml_writer_stream : public xml_writer
{
- public:
+public:
// Construct writer from an output stream object
xml_writer_stream(std::basic_ostream<char, std::char_traits<char> >& stream);
xml_writer_stream(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream);
virtual void write(const void* data, size_t size) PUGIXML_OVERRIDE;
- private:
+private:
std::basic_ostream<char, std::char_traits<char> >* narrow_stream;
std::basic_ostream<wchar_t, std::char_traits<wchar_t> >* wide_stream;
};
@@ -346,12 +346,12 @@ class PUGIXML_CLASS xml_attribute
friend class xml_attribute_iterator;
friend class xml_node;
- private:
+private:
xml_attribute_struct* _attr;
typedef void (*unspecified_bool_type)(xml_attribute***);
- public:
+public:
// Default constructor. Constructs an empty attribute.
xml_attribute();
@@ -453,12 +453,12 @@ class PUGIXML_CLASS xml_node
friend class xml_node_iterator;
friend class xml_named_node_iterator;
- protected:
+protected:
xml_node_struct* _root;
typedef void (*unspecified_bool_type)(xml_node***);
- public:
+public:
// Default constructor. Constructs an empty node.
xml_node();
@@ -726,7 +726,7 @@ class PUGIXML_CLASS xml_text
xml_node_struct* _data_new();
xml_node_struct* _data() const;
- public:
+public:
// Default constructor. Constructs an empty object.
xml_text();
@@ -806,13 +806,13 @@ class PUGIXML_CLASS xml_node_iterator
{
friend class xml_node;
- private:
+private:
mutable xml_node _wrap;
xml_node _parent;
xml_node_iterator(xml_node_struct* ref, xml_node_struct* parent);
- public:
+public:
// Iterator traits
typedef ptrdiff_t difference_type;
typedef xml_node value_type;
@@ -848,13 +848,13 @@ class PUGIXML_CLASS xml_attribute_iterator
{
friend class xml_node;
- private:
+private:
mutable xml_attribute _wrap;
xml_node _parent;
xml_attribute_iterator(xml_attribute_struct* ref, xml_node_struct* parent);
- public:
+public:
// Iterator traits
typedef ptrdiff_t difference_type;
typedef xml_attribute value_type;
@@ -890,7 +890,7 @@ class PUGIXML_CLASS xml_named_node_iterator
{
friend class xml_node;
- public:
+public:
// Iterator traits
typedef ptrdiff_t difference_type;
typedef xml_node value_type;
@@ -920,7 +920,7 @@ class PUGIXML_CLASS xml_named_node_iterator
const xml_named_node_iterator& operator--();
xml_named_node_iterator operator--(int);
- private:
+private:
mutable xml_node _wrap;
xml_node _parent;
const char_t* _name;
@@ -933,14 +933,14 @@ class PUGIXML_CLASS xml_tree_walker
{
friend class xml_node;
- private:
+private:
int _depth;
- protected:
+protected:
// Get current traversal depth
int depth() const;
- public:
+public:
xml_tree_walker();
virtual ~xml_tree_walker();
@@ -1006,7 +1006,7 @@ struct PUGIXML_CLASS xml_parse_result
// Document class (DOM tree root)
class PUGIXML_CLASS xml_document : public xml_node
{
- private:
+private:
char_t* _buffer;
char _memory[192];
@@ -1019,7 +1019,7 @@ class PUGIXML_CLASS xml_document : public xml_node
void _destroy();
void _move(xml_document& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
- public:
+public:
// Default constructor, makes empty document
xml_document();
@@ -1117,7 +1117,7 @@ class PUGIXML_CLASS xpath_variable
{
friend class xpath_variable_set;
- protected:
+protected:
xpath_value_type _type;
xpath_variable* _next;
@@ -1127,7 +1127,7 @@ class PUGIXML_CLASS xpath_variable
xpath_variable(const xpath_variable&);
xpath_variable& operator=(const xpath_variable&);
- public:
+public:
// Get variable name
const char_t* name() const;
@@ -1150,7 +1150,7 @@ class PUGIXML_CLASS xpath_variable
// A set of XPath variables
class PUGIXML_CLASS xpath_variable_set
{
- private:
+private:
xpath_variable* _data[64];
void _assign(const xpath_variable_set& rhs);
@@ -1161,7 +1161,7 @@ class PUGIXML_CLASS xpath_variable_set
static bool _clone(xpath_variable* var, xpath_variable** out_result);
static void _destroy(xpath_variable* var);
- public:
+public:
// Default constructor/destructor
xpath_variable_set();
~xpath_variable_set();
@@ -1193,7 +1193,7 @@ class PUGIXML_CLASS xpath_variable_set
// A compiled XPath query object
class PUGIXML_CLASS xpath_query
{
- private:
+private:
void* _impl;
xpath_parse_result _result;
@@ -1203,7 +1203,7 @@ class PUGIXML_CLASS xpath_query
xpath_query(const xpath_query&);
xpath_query& operator=(const xpath_query&);
- public:
+public:
// Construct a compiled object from XPath expression.
// If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on compilation errors.
explicit xpath_query(const char_t* query, xpath_variable_set* variables = 0);
@@ -1274,10 +1274,10 @@ class PUGIXML_CLASS xpath_query
// XPath exception class
class PUGIXML_CLASS xpath_exception : public std::exception
{
- private:
+private:
xpath_parse_result _result;
- public:
+public:
// Construct exception from parse result
explicit xpath_exception(const xpath_parse_result& result);
@@ -1295,13 +1295,13 @@ class PUGIXML_CLASS xpath_exception : public std::exception
// XPath node class (either xml_node or xml_attribute)
class PUGIXML_CLASS xpath_node
{
- private:
+private:
xml_node _node;
xml_attribute _attribute;
typedef void (*unspecified_bool_type)(xpath_node***);
- public:
+public:
// Default constructor; constructs empty XPath node
xpath_node();
@@ -1336,7 +1336,7 @@ bool PUGIXML_FUNCTION operator||(const xpath_node& lhs, bool rhs);
// A fixed-size collection of XPath nodes
class PUGIXML_CLASS xpath_node_set
{
- public:
+public:
// Collection type
enum type_t
{
@@ -1392,7 +1392,7 @@ class PUGIXML_CLASS xpath_node_set
// Check if collection is empty
bool empty() const;
- private:
+private:
type_t _type;
xpath_node _storage[1];
diff --git a/tests/test.hpp b/tests/test.hpp
index 3785113..b5bd6ba 100644
--- a/tests/test.hpp
+++ b/tests/test.hpp
@@ -108,7 +108,7 @@ struct dummy_fixture
CHECK(doc.load_string(PUGIXML_TEXT(xml), flags)); \
} \
\
- private: \
+ private: \
test_fixture_##name(const test_fixture_##name&); \
test_fixture_##name& operator=(const test_fixture_##name&); \
}; \
diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index c5bebb2..0baa5e9 100644
--- a/tests/test_document.cpp
+++ b/tests/test_document.cpp
@@ -204,7 +204,7 @@ TEST(document_load_stream_wide_error_previous)
template <typename T>
class char_array_buffer : public std::basic_streambuf<T>
{
- public:
+public:
char_array_buffer(T* begin, T* end)
{
this->setg(begin, begin, end);
@@ -310,7 +310,7 @@ TEST(document_load_stream_wide_nonseekable_out_of_memory_large)
template <typename T>
class seek_fail_buffer : public std::basic_streambuf<T>
{
- public:
+public:
int seeks;
seek_fail_buffer()
@@ -348,7 +348,7 @@ TEST(document_load_stream_wide_seekable_fail_seek)
template <typename T>
class tell_fail_buffer : public std::basic_streambuf<T>
{
- public:
+public:
int seeks;
tell_fail_buffer()
@@ -391,7 +391,7 @@ TEST(document_load_stream_wide_seekable_fail_tell)
template <typename T>
class read_fail_buffer : public std::basic_streambuf<T>
{
- public:
+public:
typename std::basic_streambuf<T>::int_type underflow() PUGIXML_OVERRIDE
{
throw std::runtime_error("underflow failed");
@@ -423,7 +423,7 @@ TEST(document_load_stream_wide_nonseekable_fail_read)
template <typename T>
class read_fail_seekable_buffer : public std::basic_streambuf<T>
{
- public:
+public:
typename std::basic_streambuf<T>::pos_type offset;
read_fail_seekable_buffer()