Fix access modifier offset

This commit is contained in:
Arseny Kapoulkine 2018-10-17 21:14:43 -07:00
parent 3c75d4d612
commit c237489a6c
5 changed files with 58 additions and 57 deletions

View File

@ -2,6 +2,7 @@ Standard: Cpp03
UseTab: ForIndentation UseTab: ForIndentation
TabWidth: 4 TabWidth: 4
IndentWidth: 4 IndentWidth: 4
AccessModifierOffset: -4
BreakBeforeBraces: Allman BreakBeforeBraces: Allman
IndentCaseLabels: false IndentCaseLabels: false
ColumnLimit: 0 ColumnLimit: 0

View File

@ -320,7 +320,7 @@ PUGI__NS_END
PUGI__NS_BEGIN PUGI__NS_BEGIN
class compact_hash_table class compact_hash_table
{ {
public: public:
compact_hash_table() compact_hash_table()
: _items(0) : _items(0)
, _capacity(0) , _capacity(0)
@ -375,7 +375,7 @@ class compact_hash_table
return true; return true;
} }
private: private:
struct item_t struct item_t
{ {
const void* key; const void* key;
@ -793,7 +793,7 @@ static const uintptr_t compact_alignment = 1 << compact_alignment_log2;
class compact_header class compact_header
{ {
public: public:
compact_header(xml_memory_page* page, unsigned int flags) compact_header(xml_memory_page* page, unsigned int flags)
{ {
PUGI__STATIC_ASSERT(xml_memory_block_alignment == compact_alignment); 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))); return const_cast<xml_memory_page*>(reinterpret_cast<const xml_memory_page*>(static_cast<const void*>(page)));
} }
private: private:
unsigned char _page; unsigned char _page;
unsigned char _flags; 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> template <typename T, int header_offset, int start = -126>
class compact_pointer class compact_pointer
{ {
public: public:
compact_pointer() compact_pointer()
: _data(0) : _data(0)
{ {
@ -913,14 +913,14 @@ class compact_pointer
return *this; return *this;
} }
private: private:
unsigned char _data; unsigned char _data;
}; };
template <typename T, int header_offset> template <typename T, int header_offset>
class compact_pointer_parent class compact_pointer_parent
{ {
public: public:
compact_pointer_parent() compact_pointer_parent()
: _data(0) : _data(0)
{ {
@ -995,14 +995,14 @@ class compact_pointer_parent
return *this; return *this;
} }
private: private:
uint16_t _data; uint16_t _data;
}; };
template <int header_offset, int base_offset> template <int header_offset, int base_offset>
class compact_string class compact_string
{ {
public: public:
compact_string() compact_string()
: _data(0) : _data(0)
{ {
@ -1088,7 +1088,7 @@ class compact_string
return 0; return 0;
} }
private: private:
unsigned char _data; unsigned char _data;
}; };
PUGI__NS_END PUGI__NS_END
@ -3992,7 +3992,7 @@ class xml_buffered_writer
xml_buffered_writer(const xml_buffered_writer&); xml_buffered_writer(const xml_buffered_writer&);
xml_buffered_writer& operator=(const xml_buffered_writer&); xml_buffered_writer& operator=(const xml_buffered_writer&);
public: public:
xml_buffered_writer(xml_writer& writer_, xml_encoding user_encoding) xml_buffered_writer(xml_writer& writer_, xml_encoding user_encoding)
: writer(writer_) : writer(writer_)
, bufsize(0) , bufsize(0)
@ -8242,7 +8242,7 @@ class xpath_string
{ {
} }
public: public:
static xpath_string from_const(const char_t* str) static xpath_string from_const(const char_t* str)
{ {
return xpath_string(str, false, 0); return xpath_string(str, false, 0);
@ -9400,7 +9400,7 @@ class xpath_node_set_raw
xpath_node* _end; xpath_node* _end;
xpath_node* _eos; xpath_node* _eos;
public: public:
xpath_node_set_raw() xpath_node_set_raw()
: _type(xpath_node_set::type_unsorted) : _type(xpath_node_set::type_unsorted)
, _begin(0) , _begin(0)
@ -9595,7 +9595,7 @@ class xpath_lexer
lexeme_t _cur_lexeme; lexeme_t _cur_lexeme;
public: public:
explicit xpath_lexer(const char_t* query) explicit xpath_lexer(const char_t* query)
: _cur(query) : _cur(query)
{ {
@ -10024,7 +10024,7 @@ const axis_t axis_to_type<N>::axis = N;
class xpath_ast_node class xpath_ast_node
{ {
private: private:
// node type // node type
char _type; char _type;
char _rettype; char _rettype;
@ -10789,7 +10789,7 @@ class xpath_ast_node
return ns; return ns;
} }
public: public:
xpath_ast_node(ast_type_t type, xpath_value_type rettype_, const char_t* value) xpath_ast_node(ast_type_t type, xpath_value_type rettype_, const char_t* value)
: _type(static_cast<char>(type)) : _type(static_cast<char>(type))
, _rettype(static_cast<char>(rettype_)) , _rettype(static_cast<char>(rettype_))

View File

@ -283,7 +283,7 @@ class xpath_variable_set;
template <typename It> template <typename It>
class xml_object_range class xml_object_range
{ {
public: public:
typedef It const_iterator; typedef It const_iterator;
typedef It iterator; typedef It iterator;
@ -296,14 +296,14 @@ class xml_object_range
It begin() const { return _begin; } It begin() const { return _begin; }
It end() const { return _end; } It end() const { return _end; }
private: private:
It _begin, _end; It _begin, _end;
}; };
// Writer interface for node printing (see xml_node::print) // Writer interface for node printing (see xml_node::print)
class PUGIXML_CLASS xml_writer class PUGIXML_CLASS xml_writer
{ {
public: public:
virtual ~xml_writer() {} virtual ~xml_writer() {}
// Write memory chunk into stream/file/whatever // Write memory chunk into stream/file/whatever
@ -313,13 +313,13 @@ class PUGIXML_CLASS xml_writer
// xml_writer implementation for FILE* // xml_writer implementation for FILE*
class PUGIXML_CLASS xml_writer_file : public xml_writer 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 // Construct writer from a FILE* object; void* is used to avoid header dependencies on stdio
xml_writer_file(void* file); xml_writer_file(void* file);
virtual void write(const void* data, size_t size) PUGIXML_OVERRIDE; virtual void write(const void* data, size_t size) PUGIXML_OVERRIDE;
private: private:
void* file; void* file;
}; };
@ -327,14 +327,14 @@ class PUGIXML_CLASS xml_writer_file : public xml_writer
// xml_writer implementation for streams // xml_writer implementation for streams
class PUGIXML_CLASS xml_writer_stream : public xml_writer class PUGIXML_CLASS xml_writer_stream : public xml_writer
{ {
public: public:
// Construct writer from an output stream object // 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<char, std::char_traits<char> >& stream);
xml_writer_stream(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& 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; 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<char, std::char_traits<char> >* narrow_stream;
std::basic_ostream<wchar_t, std::char_traits<wchar_t> >* wide_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_attribute_iterator;
friend class xml_node; friend class xml_node;
private: private:
xml_attribute_struct* _attr; xml_attribute_struct* _attr;
typedef void (*unspecified_bool_type)(xml_attribute***); typedef void (*unspecified_bool_type)(xml_attribute***);
public: public:
// Default constructor. Constructs an empty attribute. // Default constructor. Constructs an empty attribute.
xml_attribute(); xml_attribute();
@ -453,12 +453,12 @@ class PUGIXML_CLASS xml_node
friend class xml_node_iterator; friend class xml_node_iterator;
friend class xml_named_node_iterator; friend class xml_named_node_iterator;
protected: protected:
xml_node_struct* _root; xml_node_struct* _root;
typedef void (*unspecified_bool_type)(xml_node***); typedef void (*unspecified_bool_type)(xml_node***);
public: public:
// Default constructor. Constructs an empty node. // Default constructor. Constructs an empty node.
xml_node(); xml_node();
@ -726,7 +726,7 @@ class PUGIXML_CLASS xml_text
xml_node_struct* _data_new(); xml_node_struct* _data_new();
xml_node_struct* _data() const; xml_node_struct* _data() const;
public: public:
// Default constructor. Constructs an empty object. // Default constructor. Constructs an empty object.
xml_text(); xml_text();
@ -806,13 +806,13 @@ class PUGIXML_CLASS xml_node_iterator
{ {
friend class xml_node; friend class xml_node;
private: private:
mutable xml_node _wrap; mutable xml_node _wrap;
xml_node _parent; xml_node _parent;
xml_node_iterator(xml_node_struct* ref, xml_node_struct* parent); xml_node_iterator(xml_node_struct* ref, xml_node_struct* parent);
public: public:
// Iterator traits // Iterator traits
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef xml_node value_type; typedef xml_node value_type;
@ -848,13 +848,13 @@ class PUGIXML_CLASS xml_attribute_iterator
{ {
friend class xml_node; friend class xml_node;
private: private:
mutable xml_attribute _wrap; mutable xml_attribute _wrap;
xml_node _parent; xml_node _parent;
xml_attribute_iterator(xml_attribute_struct* ref, xml_node_struct* parent); xml_attribute_iterator(xml_attribute_struct* ref, xml_node_struct* parent);
public: public:
// Iterator traits // Iterator traits
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef xml_attribute value_type; typedef xml_attribute value_type;
@ -890,7 +890,7 @@ class PUGIXML_CLASS xml_named_node_iterator
{ {
friend class xml_node; friend class xml_node;
public: public:
// Iterator traits // Iterator traits
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef xml_node value_type; typedef xml_node value_type;
@ -920,7 +920,7 @@ class PUGIXML_CLASS xml_named_node_iterator
const xml_named_node_iterator& operator--(); const xml_named_node_iterator& operator--();
xml_named_node_iterator operator--(int); xml_named_node_iterator operator--(int);
private: private:
mutable xml_node _wrap; mutable xml_node _wrap;
xml_node _parent; xml_node _parent;
const char_t* _name; const char_t* _name;
@ -933,14 +933,14 @@ class PUGIXML_CLASS xml_tree_walker
{ {
friend class xml_node; friend class xml_node;
private: private:
int _depth; int _depth;
protected: protected:
// Get current traversal depth // Get current traversal depth
int depth() const; int depth() const;
public: public:
xml_tree_walker(); xml_tree_walker();
virtual ~xml_tree_walker(); virtual ~xml_tree_walker();
@ -1006,7 +1006,7 @@ struct PUGIXML_CLASS xml_parse_result
// Document class (DOM tree root) // Document class (DOM tree root)
class PUGIXML_CLASS xml_document : public xml_node class PUGIXML_CLASS xml_document : public xml_node
{ {
private: private:
char_t* _buffer; char_t* _buffer;
char _memory[192]; char _memory[192];
@ -1019,7 +1019,7 @@ class PUGIXML_CLASS xml_document : public xml_node
void _destroy(); void _destroy();
void _move(xml_document& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT; void _move(xml_document& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
public: public:
// Default constructor, makes empty document // Default constructor, makes empty document
xml_document(); xml_document();
@ -1117,7 +1117,7 @@ class PUGIXML_CLASS xpath_variable
{ {
friend class xpath_variable_set; friend class xpath_variable_set;
protected: protected:
xpath_value_type _type; xpath_value_type _type;
xpath_variable* _next; xpath_variable* _next;
@ -1127,7 +1127,7 @@ class PUGIXML_CLASS xpath_variable
xpath_variable(const xpath_variable&); xpath_variable(const xpath_variable&);
xpath_variable& operator=(const xpath_variable&); xpath_variable& operator=(const xpath_variable&);
public: public:
// Get variable name // Get variable name
const char_t* name() const; const char_t* name() const;
@ -1150,7 +1150,7 @@ class PUGIXML_CLASS xpath_variable
// A set of XPath variables // A set of XPath variables
class PUGIXML_CLASS xpath_variable_set class PUGIXML_CLASS xpath_variable_set
{ {
private: private:
xpath_variable* _data[64]; xpath_variable* _data[64];
void _assign(const xpath_variable_set& rhs); 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 bool _clone(xpath_variable* var, xpath_variable** out_result);
static void _destroy(xpath_variable* var); static void _destroy(xpath_variable* var);
public: public:
// Default constructor/destructor // Default constructor/destructor
xpath_variable_set(); xpath_variable_set();
~xpath_variable_set(); ~xpath_variable_set();
@ -1193,7 +1193,7 @@ class PUGIXML_CLASS xpath_variable_set
// A compiled XPath query object // A compiled XPath query object
class PUGIXML_CLASS xpath_query class PUGIXML_CLASS xpath_query
{ {
private: private:
void* _impl; void* _impl;
xpath_parse_result _result; xpath_parse_result _result;
@ -1203,7 +1203,7 @@ class PUGIXML_CLASS xpath_query
xpath_query(const xpath_query&); xpath_query(const xpath_query&);
xpath_query& operator=(const xpath_query&); xpath_query& operator=(const xpath_query&);
public: public:
// Construct a compiled object from XPath expression. // Construct a compiled object from XPath expression.
// If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on compilation errors. // 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); explicit xpath_query(const char_t* query, xpath_variable_set* variables = 0);
@ -1274,10 +1274,10 @@ class PUGIXML_CLASS xpath_query
// XPath exception class // XPath exception class
class PUGIXML_CLASS xpath_exception : public std::exception class PUGIXML_CLASS xpath_exception : public std::exception
{ {
private: private:
xpath_parse_result _result; xpath_parse_result _result;
public: public:
// Construct exception from parse result // Construct exception from parse result
explicit xpath_exception(const xpath_parse_result& 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) // XPath node class (either xml_node or xml_attribute)
class PUGIXML_CLASS xpath_node class PUGIXML_CLASS xpath_node
{ {
private: private:
xml_node _node; xml_node _node;
xml_attribute _attribute; xml_attribute _attribute;
typedef void (*unspecified_bool_type)(xpath_node***); typedef void (*unspecified_bool_type)(xpath_node***);
public: public:
// Default constructor; constructs empty XPath node // Default constructor; constructs empty XPath node
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 // A fixed-size collection of XPath nodes
class PUGIXML_CLASS xpath_node_set class PUGIXML_CLASS xpath_node_set
{ {
public: public:
// Collection type // Collection type
enum type_t enum type_t
{ {
@ -1392,7 +1392,7 @@ class PUGIXML_CLASS xpath_node_set
// Check if collection is empty // Check if collection is empty
bool empty() const; bool empty() const;
private: private:
type_t _type; type_t _type;
xpath_node _storage[1]; xpath_node _storage[1];

View File

@ -108,7 +108,7 @@ struct dummy_fixture
CHECK(doc.load_string(PUGIXML_TEXT(xml), flags)); \ CHECK(doc.load_string(PUGIXML_TEXT(xml), flags)); \
} \ } \
\ \
private: \ private: \
test_fixture_##name(const test_fixture_##name&); \ test_fixture_##name(const test_fixture_##name&); \
test_fixture_##name& operator=(const test_fixture_##name&); \ test_fixture_##name& operator=(const test_fixture_##name&); \
}; \ }; \

View File

@ -204,7 +204,7 @@ TEST(document_load_stream_wide_error_previous)
template <typename T> template <typename T>
class char_array_buffer : public std::basic_streambuf<T> class char_array_buffer : public std::basic_streambuf<T>
{ {
public: public:
char_array_buffer(T* begin, T* end) char_array_buffer(T* begin, T* end)
{ {
this->setg(begin, begin, end); this->setg(begin, begin, end);
@ -310,7 +310,7 @@ TEST(document_load_stream_wide_nonseekable_out_of_memory_large)
template <typename T> template <typename T>
class seek_fail_buffer : public std::basic_streambuf<T> class seek_fail_buffer : public std::basic_streambuf<T>
{ {
public: public:
int seeks; int seeks;
seek_fail_buffer() seek_fail_buffer()
@ -348,7 +348,7 @@ TEST(document_load_stream_wide_seekable_fail_seek)
template <typename T> template <typename T>
class tell_fail_buffer : public std::basic_streambuf<T> class tell_fail_buffer : public std::basic_streambuf<T>
{ {
public: public:
int seeks; int seeks;
tell_fail_buffer() tell_fail_buffer()
@ -391,7 +391,7 @@ TEST(document_load_stream_wide_seekable_fail_tell)
template <typename T> template <typename T>
class read_fail_buffer : public std::basic_streambuf<T> class read_fail_buffer : public std::basic_streambuf<T>
{ {
public: public:
typename std::basic_streambuf<T>::int_type underflow() PUGIXML_OVERRIDE typename std::basic_streambuf<T>::int_type underflow() PUGIXML_OVERRIDE
{ {
throw std::runtime_error("underflow failed"); throw std::runtime_error("underflow failed");
@ -423,7 +423,7 @@ TEST(document_load_stream_wide_nonseekable_fail_read)
template <typename T> template <typename T>
class read_fail_seekable_buffer : public std::basic_streambuf<T> class read_fail_seekable_buffer : public std::basic_streambuf<T>
{ {
public: public:
typename std::basic_streambuf<T>::pos_type offset; typename std::basic_streambuf<T>::pos_type offset;
read_fail_seekable_buffer() read_fail_seekable_buffer()