Tidy up formatting

This commit is contained in:
Vinnie Falco 2019-10-20 20:52:24 -07:00
parent 5a52804094
commit 38cbceadaa
15 changed files with 167 additions and 225 deletions

View File

@ -36,7 +36,7 @@ namespace json = boost::json;
boost::beast::unit_test::dstream dout{std::cerr};
//------------------------------------------------------------------------------
//----------------------------------------------------------
class pool_storage : public json::storage
{
@ -76,7 +76,7 @@ public:
}
};
//------------------------------------------------------------------------------
//----------------------------------------------------------
class any_impl
{
@ -87,7 +87,7 @@ public:
virtual void parse(boost::string_view s) = 0;
};
//------------------------------------------------------------------------------
//----------------------------------------------------------
class boost_impl : public any_impl
{
@ -125,7 +125,7 @@ public:
}
};
//------------------------------------------------------------------------------
//----------------------------------------------------------
class nlohmann_impl : public any_impl
{
@ -150,7 +150,7 @@ public:
}
};
//------------------------------------------------------------------------------
//----------------------------------------------------------
class rapidjson_impl : public any_impl
{
@ -170,7 +170,7 @@ public:
}
};
//------------------------------------------------------------------------------
//----------------------------------------------------------
class factory
{
@ -388,7 +388,7 @@ public:
}
};
//------------------------------------------------------------------------------
//----------------------------------------------------------
// parse random documents
void

View File

@ -88,7 +88,7 @@ last() const noexcept
v->as_array().end();
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
const_iterator::
const_iterator(

View File

@ -19,7 +19,7 @@
namespace boost {
namespace json {
//------------------------------------------------------------------------------
//----------------------------------------------------------
struct array::table
{
@ -83,7 +83,7 @@ struct array::table
size_type n) noexcept;
};
//------------------------------------------------------------------------------
//----------------------------------------------------------
struct array::undo_create
{
@ -113,7 +113,7 @@ public:
}
};
//------------------------------------------------------------------------------
//----------------------------------------------------------
struct array::undo_insert
{
@ -143,11 +143,11 @@ struct array::undo_insert
}
};
//------------------------------------------------------------------------------
//----------------------------------------------------------
//
// Element access
//
//------------------------------------------------------------------------------
//----------------------------------------------------------
auto
array::
@ -239,11 +239,11 @@ data() const noexcept ->
return tab_->begin();
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
//
// Iterators
//
//------------------------------------------------------------------------------
//----------------------------------------------------------
auto
array::
@ -365,11 +365,11 @@ crend() const noexcept ->
return const_reverse_iterator(tab_->begin());
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
//
// Capacity
//
//------------------------------------------------------------------------------
//----------------------------------------------------------
bool
array::
@ -407,7 +407,7 @@ capacity() const noexcept ->
return tab_->d.capacity;
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
template<class InputIt, class>
array::
@ -463,7 +463,7 @@ emplace_back(Arg&& arg) ->
end(), std::forward<Arg>(arg));
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
template<class InputIt>
array::

View File

@ -22,7 +22,7 @@
namespace boost {
namespace json {
//------------------------------------------------------------------------------
//----------------------------------------------------------
void
array::
@ -98,7 +98,7 @@ relocate(
}
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
array::
undo_create::
@ -137,7 +137,7 @@ undo_create(
{
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
array::
undo_insert::
@ -175,11 +175,11 @@ undo_insert(
self.tab_->d.size += n;
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
//
// Special Members
//
//------------------------------------------------------------------------------
//----------------------------------------------------------
array::
~array()
@ -188,7 +188,7 @@ array::
tab_->destroy(sp_);
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
array::
array() noexcept
@ -285,7 +285,7 @@ array(
assign(init);
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
array&
array::
@ -305,11 +305,11 @@ operator=(array&& other)
return *this;
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
//
// Capacity
//
//------------------------------------------------------------------------------
//----------------------------------------------------------
void
array::
@ -391,11 +391,11 @@ shrink_to_fit() noexcept
tab->destroy(sp_);
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
//
// Modifiers
//
//------------------------------------------------------------------------------
//----------------------------------------------------------
void
array::
@ -563,7 +563,7 @@ swap(array& other)
::new(&other) array(pilfer(temp1));
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
void
array::

View File

@ -32,111 +32,41 @@ make_error_code(error e)
switch(static_cast<error>(ev))
{
default:
case error::syntax: return
"syntax error";
case error::syntax: return "syntax error";
case error::extra_data: return "extra data";
case error::mantissa_overflow: return "mantissa overflow";
case error::exponent_overflow: return "exponent overflow";
case error::too_deep: return "too deep";
case error::illegal_char: return "illegal character for value";
case error::illegal_control_char: return "illegal control character";
case error::illegal_escape_char: return "illegal character in escape sequence";
case error::illegal_extra_digits: return "illegal extra digits in number";
case error::illegal_extra_chars: return "illegal extra characters";
case error::illegal_leading_surrogate: return "illegal leading surrogate";
case error::illegal_trailing_surrogate: return "illegal trailing surrogate";
case error::extra_data: return
"extra data";
case error::expected_comma: return "expected comma";
case error::expected_colon: return "expected colon";
case error::expected_quotes: return "expected quotes";
case error::expected_hex_digit: return "expected hex digit";
case error::expected_utf16_escape: return "expected utf16 escape";
case error::expected_mantissa: return "expected mantissa";
case error::expected_fraction: return "expected mantissa fraction";
case error::expected_exponent: return "expected exponent";
case error::expected_true: return "expected 'true'";
case error::expected_false: return "expected 'false'";
case error::expected_null: return "expected 'null'";
case error::mantissa_overflow: return
"mantissa overflow";
case error::not_object: return "not an object";
case error::not_array: return "not an array";
case error::not_string: return "not a string";
case error::not_number: return "not a number";
case error::not_bool: return "not a boolean";
case error::not_null: return "not a null";
case error::integer_overflow: return "integer overflowed";
case error::exponent_overflow: return
"exponent overflow";
case error::too_deep: return
"too deep";
//
case error::illegal_char: return
"illegal character for value";
case error::illegal_control_char: return
"illegal control character";
case error::illegal_escape_char: return
"illegal character in escape sequence";
case error::illegal_extra_digits: return
"illegal extra digits in number";
case error::illegal_extra_chars: return
"illegal extra characters";
case error::illegal_leading_surrogate: return
"illegal leading surrogate";
case error::illegal_trailing_surrogate: return
"illegal trailing surrogate";
//
case error::expected_comma: return
"expected comma";
case error::expected_colon: return
"expected colon";
case error::expected_quotes: return
"expected quotes";
case error::expected_hex_digit: return
"expected hex digit";
case error::expected_utf16_escape: return
"expected utf16 escape";
case error::expected_mantissa: return
"expected mantissa";
case error::expected_fraction: return
"expected mantissa fraction";
case error::expected_exponent: return
"expected exponent";
case error::expected_true: return
"expected 'true'";
case error::expected_false: return
"expected 'false'";
case error::expected_null: return
"expected 'null'";
//
case error::not_object: return
"not an object";
case error::not_array: return
"not an array";
case error::not_string: return
"not a string";
case error::not_number: return
"not a number";
case error::not_bool: return
"not a boolean";
case error::not_null: return
"not a null";
case error::integer_overflow: return
"integer overflowed";
//
case error::key_not_found: return
"key not found";
//
case error::test_failure: return
"test failure";
case error::key_not_found: return "key not found";
case error::test_failure: return "test failure";
}
}

View File

@ -24,7 +24,7 @@
namespace boost {
namespace json {
//------------------------------------------------------------------------------
//----------------------------------------------------------
struct number::pow10
{
@ -100,7 +100,7 @@ protected:
mantissa_type const* end_;
};
//------------------------------------------------------------------------------
//----------------------------------------------------------
number::
number(
@ -157,7 +157,7 @@ number(
}
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
number::
number(short i) noexcept
@ -219,7 +219,7 @@ number(double f) noexcept
assign_double(f);
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
bool
number::
@ -371,7 +371,7 @@ print(
std::size_t>(n) };
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
void
number::
@ -397,7 +397,7 @@ assign_double(double f) noexcept
double_ = f;
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
std::ostream&
operator<<(std::ostream& os, number const& n)

View File

@ -17,12 +17,12 @@
namespace boost {
namespace json {
//------------------------------------------------------------------------------
//----------------------------------------------------------
namespace detail {
storage_ptr const&
global_storage()
global_storage() noexcept
{
static storage_ptr const sp =
make_storage_adaptor(
@ -54,18 +54,18 @@ default_storage(storage_ptr sp) noexcept
detail::raw_default_storage() = std::move(sp);
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
void
storage::
addref()
addref() noexcept
{
++refs_;
}
void
storage::
release()
release() noexcept
{
if(--refs_ > 0)
return;
@ -73,45 +73,57 @@ release()
}
storage::
storage()
storage() noexcept
: refs_(1)
{
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
bool
operator==(storage_ptr const& lhs, storage_ptr const& rhs) noexcept
operator==(
storage_ptr const& lhs,
storage_ptr const& rhs) noexcept
{
return lhs.get() == rhs.get();
}
bool
operator==(storage* lhs, storage_ptr const& rhs) noexcept
operator==(
storage* lhs,
storage_ptr const& rhs) noexcept
{
return lhs == rhs.get();
}
bool
operator==(storage_ptr const& lhs, storage* rhs) noexcept
operator==(
storage_ptr const& lhs,
storage* rhs) noexcept
{
return lhs.get() == rhs;
}
bool
operator!=(storage_ptr const& lhs, storage_ptr const& rhs) noexcept
operator!=(
storage_ptr const& lhs,
storage_ptr const& rhs) noexcept
{
return lhs.get() != rhs.get();
}
bool
operator!=(storage* lhs, storage_ptr const& rhs) noexcept
operator!=(
storage* lhs,
storage_ptr const& rhs) noexcept
{
return lhs != rhs.get();
}
bool
operator!=(storage_ptr const& lhs, storage* rhs) noexcept
operator!=(
storage_ptr const& lhs,
storage* rhs) noexcept
{
return lhs.get() != rhs;
}

View File

@ -18,7 +18,7 @@
namespace boost {
namespace json {
//------------------------------------------------------------------------------
//----------------------------------------------------------
template<class InputIt>
void
@ -79,7 +79,7 @@ construct(
u.commit = true;
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
template<class InputIt, class>
string::
@ -150,7 +150,7 @@ insert(
return s_.data() + off;
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
template<class InputIt>
void

View File

@ -21,7 +21,7 @@
namespace boost {
namespace json {
//------------------------------------------------------------------------------
//----------------------------------------------------------
auto
string::
@ -196,7 +196,7 @@ unalloc(storage_ptr const& sp) noexcept
capacity = sizeof(buf) - 1;
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
string::
~string()
@ -204,11 +204,11 @@ string::
s_.destroy(sp_);
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
//
// Construction
//
//------------------------------------------------------------------------------
//----------------------------------------------------------
string::
string() noexcept
@ -344,7 +344,7 @@ string(
assign(s.substr(pos, n));
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
string&
string::
@ -354,7 +354,7 @@ operator=(char ch)
return *this;
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
string&
string::
@ -412,11 +412,11 @@ assign(
return *this;
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
//
// Element Access
//
//------------------------------------------------------------------------------
//----------------------------------------------------------
char&
string::
@ -440,11 +440,11 @@ at(size_type pos) const
return s_.data()[pos];
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
//
// Capacity
//
//------------------------------------------------------------------------------
//----------------------------------------------------------
void
string::
@ -504,11 +504,11 @@ shrink_to_fit()
s_ = tmp;
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
//
// Operations
//
//------------------------------------------------------------------------------
//----------------------------------------------------------
void
string::
@ -517,7 +517,7 @@ clear() noexcept
s_.term(0);
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
void
string::
@ -533,7 +533,7 @@ pop_back()
s_.data()[--s_.size] = 0;
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
string&
string::
@ -557,7 +557,7 @@ append(
return *this;
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
string&
string::
@ -629,7 +629,7 @@ insert(
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
string&
string::
@ -674,7 +674,7 @@ erase(
return data() + pos;
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
void
string::
@ -698,7 +698,7 @@ resize(size_type count, char ch)
impl_size_type>(count);
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
void
string::
@ -720,7 +720,7 @@ swap(string& other)
::new(&other) string(pilfer(temp1));
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
std::ostream&
operator<<(std::ostream& os, string const& s)

View File

@ -17,7 +17,7 @@
namespace boost {
namespace json {
//------------------------------------------------------------------------------
//----------------------------------------------------------
struct value::undo
{
@ -48,7 +48,7 @@ struct value::undo
}
};
//------------------------------------------------------------------------------
//----------------------------------------------------------
namespace detail {
@ -69,7 +69,7 @@ struct is_range<T, boost::void_t<
} // detail
//------------------------------------------------------------------------------
//----------------------------------------------------------
//
// assign to value
//
@ -136,7 +136,7 @@ to_json(std::nullptr_t, value& v)
v.emplace_null();
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
//
// assign value to
//

View File

@ -88,7 +88,7 @@ public:
}
};
//------------------------------------------------------------------------------
//----------------------------------------------------------
/** Manages a type-erased storage object and options for a set of JSON values.
*/
@ -249,7 +249,7 @@ BOOST_JSON_DECL
bool
operator!=(storage_ptr const& lhs, storage* rhs) noexcept;
//------------------------------------------------------------------------------
//----------------------------------------------------------
/** Construct a storage adaptor for the specified allocator
*/

View File

@ -294,11 +294,11 @@ public:
storage_ptr sp =
default_storage());
//--------------------------------------------------------------------------
//------------------------------------------------------
//
// Assignment
//
//--------------------------------------------------------------------------
//------------------------------------------------------
string&
operator=(string const& other)
@ -334,7 +334,7 @@ public:
return assign(s);
}
//--------------------------------------------------------------------------
//------------------------------------------------------
BOOST_JSON_DECL
string&
@ -406,7 +406,7 @@ public:
return assign(s.substr(pos, count));
}
//--------------------------------------------------------------------------
//------------------------------------------------------
storage_ptr const&
get_storage() const noexcept
@ -414,11 +414,11 @@ public:
return sp_;
}
//--------------------------------------------------------------------------
//------------------------------------------------------
//
// Element Access
//
//--------------------------------------------------------------------------
//------------------------------------------------------
BOOST_JSON_DECL
char&
@ -487,11 +487,11 @@ public:
return {data(), size()};
}
//--------------------------------------------------------------------------
//------------------------------------------------------
//
// Iterators
//
//--------------------------------------------------------------------------
//------------------------------------------------------
/** Return an iterator to the first character
@ -682,11 +682,11 @@ public:
return const_reverse_iterator(begin());
}
//--------------------------------------------------------------------------
//------------------------------------------------------
//
// Capacity
//
//--------------------------------------------------------------------------
//------------------------------------------------------
bool
empty() const noexcept
@ -726,17 +726,17 @@ public:
void
shrink_to_fit();
//--------------------------------------------------------------------------
//------------------------------------------------------
//
// Operations
//
//--------------------------------------------------------------------------
//------------------------------------------------------
BOOST_JSON_DECL
void
clear() noexcept;
//--------------------------------------------------------------------------
//------------------------------------------------------
BOOST_JSON_DECL
string&
@ -841,7 +841,7 @@ public:
string_view(t).substr(pos_str, count));
}
//--------------------------------------------------------------------------
//------------------------------------------------------
BOOST_JSON_DECL
string&
@ -859,7 +859,7 @@ public:
const_iterator first,
const_iterator last);
//--------------------------------------------------------------------------
//------------------------------------------------------
BOOST_JSON_DECL
void
@ -869,7 +869,7 @@ public:
void
pop_back();
//--------------------------------------------------------------------------
//------------------------------------------------------
BOOST_JSON_DECL
string&
@ -945,7 +945,7 @@ public:
return append(s.data(), s.size());
}
//--------------------------------------------------------------------------
//------------------------------------------------------
string&
operator+=(string const& s)
@ -983,7 +983,7 @@ public:
return append(t);
}
//--------------------------------------------------------------------------
//------------------------------------------------------
int
compare(string const& s) const noexcept
@ -1070,7 +1070,7 @@ public:
pos1, count1, s, pos2, count2);
}
//--------------------------------------------------------------------------
//------------------------------------------------------
bool
starts_with(string_view s) const noexcept
@ -1108,7 +1108,7 @@ public:
return string_view(*this).ends_with(s);
}
//--------------------------------------------------------------------------
//------------------------------------------------------
string&
replace(
@ -1223,7 +1223,7 @@ public:
size_type pos2,
size_type count2 = npos);
//--------------------------------------------------------------------------
//------------------------------------------------------
string_view
substr(
@ -1233,7 +1233,7 @@ public:
return string_view(*this).substr(pos, count);
}
//--------------------------------------------------------------------------
//------------------------------------------------------
size_type
copy(
@ -1244,7 +1244,7 @@ public:
return string_view(*this).copy(dest, count, pos);
}
//--------------------------------------------------------------------------
//------------------------------------------------------
void
resize(size_type count)
@ -1256,17 +1256,17 @@ public:
void
resize(size_type count, char ch);
//--------------------------------------------------------------------------
//------------------------------------------------------
BOOST_JSON_DECL
void
swap(string& other);
//--------------------------------------------------------------------------
//------------------------------------------------------
//
// Search
//
//--------------------------------------------------------------------------
//------------------------------------------------------
size_type
find(
@ -1315,7 +1315,7 @@ public:
return string_view(*this).find(string_view(t), pos);
}
//--------------------------------------------------------------------------
//------------------------------------------------------
size_type
rfind(
@ -1363,7 +1363,7 @@ public:
return string_view(*this).rfind(string_view(t), pos);
}
//--------------------------------------------------------------------------
//------------------------------------------------------
size_type
find_first_of(
@ -1411,7 +1411,7 @@ public:
return string_view(*this).find_first_of(string_view(t), pos);
}
//--------------------------------------------------------------------------
//------------------------------------------------------
size_type
find_first_not_of(
@ -1459,7 +1459,7 @@ public:
return string_view(*this).find_first_not_of(string_view(t), pos);
}
//--------------------------------------------------------------------------
//------------------------------------------------------
size_type
find_last_of(
@ -1507,7 +1507,7 @@ public:
return string_view(*this).find_last_of(string_view(t), pos);
}
//--------------------------------------------------------------------------
//------------------------------------------------------
size_type
find_last_not_of(
@ -1555,7 +1555,7 @@ public:
return string_view(*this).find_last_not_of(string_view(t), pos);
}
//--------------------------------------------------------------------------
//------------------------------------------------------
private:
class undo;
@ -1585,7 +1585,7 @@ private:
std::input_iterator_tag);
};
//------------------------------------------------------------------------------
//----------------------------------------------------------
inline
void
@ -1594,7 +1594,7 @@ swap(string& lhs, string& rhs)
lhs.swap(rhs);
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
// operator==

View File

@ -491,7 +491,7 @@ public:
}
}
//--------------------------------------------------------------------------
//------------------------------------------------------
void
testCapacity()
@ -500,7 +500,7 @@ public:
object{}.size() < object{}.max_size());
}
//--------------------------------------------------------------------------
//------------------------------------------------------
void
testModifiers()
@ -833,7 +833,7 @@ public:
}
}
//--------------------------------------------------------------------------
//------------------------------------------------------
void
testLookup()
@ -937,7 +937,7 @@ public:
}
}
//--------------------------------------------------------------------------
//------------------------------------------------------
void
testImplementation()

View File

@ -55,7 +55,7 @@ struct unique_storage : storage
}
};
//------------------------------------------------------------------------------
//----------------------------------------------------------
struct test_failure : std::exception
{
@ -110,7 +110,7 @@ struct fail_storage : storage
}
};
//------------------------------------------------------------------------------
//----------------------------------------------------------
class scoped_fail_storage
{
@ -136,7 +136,7 @@ public:
}
};
//------------------------------------------------------------------------------
//----------------------------------------------------------
namespace detail {
@ -478,7 +478,7 @@ public:
}
};
//------------------------------------------------------------------------------
//----------------------------------------------------------
inline
ieee_decimal
@ -595,7 +595,7 @@ parse_ieee_decimal(string_view s)
return p.dec;
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
// wrap an iterator to make an input iterator
template<class FwdIt>
@ -668,7 +668,7 @@ make_input_iterator(FwdIt it)
return input_iterator<FwdIt>(it);
}
//------------------------------------------------------------------------------
//----------------------------------------------------------
inline
bool

View File

@ -55,7 +55,7 @@ struct value_exchange<value_test_ns::T3>
}
};
//------------------------------------------------------------------------------
//----------------------------------------------------------
class value_test : public beast::unit_test::suite
{