Fixed formatting discrepancies

This commit is contained in:
OpenSauce04 2024-04-29 15:10:42 +01:00
parent b5af14381c
commit 09196d71bc
5 changed files with 78 additions and 112 deletions

View File

@ -3,7 +3,7 @@
// MS compatible compilers support #pragma once // MS compatible compilers support #pragma once
#if defined(_MSC_VER) #if defined(_MSC_VER)
# pragma once #pragma once
#endif #endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
@ -26,50 +26,40 @@
#include <boost/archive/archive_exception.hpp> #include <boost/archive/archive_exception.hpp>
#include <boost/serialization/split_free.hpp>
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/nvp.hpp> #include <boost/serialization/nvp.hpp>
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/split_free.hpp>
namespace boost { namespace boost {
namespace serialization { namespace serialization {
template<class Archive> template <class Archive>
struct std_variant_save_visitor struct std_variant_save_visitor {
{ std_variant_save_visitor(Archive& ar) : m_ar(ar) {}
std_variant_save_visitor(Archive& ar) : template <class T>
m_ar(ar) void operator()(T const& value) const {
{}
template<class T>
void operator()(T const & value) const
{
m_ar << BOOST_SERIALIZATION_NVP(value); m_ar << BOOST_SERIALIZATION_NVP(value);
} }
private: private:
Archive & m_ar; Archive& m_ar;
}; };
template <class Archive>
template<class Archive> struct std_variant_load_visitor {
struct std_variant_load_visitor std_variant_load_visitor(Archive& ar) : m_ar(ar) {}
{ template <class T>
std_variant_load_visitor(Archive& ar) : void operator()(T& value) const {
m_ar(ar)
{}
template<class T>
void operator()(T & value) const
{
m_ar >> BOOST_SERIALIZATION_NVP(value); m_ar >> BOOST_SERIALIZATION_NVP(value);
} }
private: private:
Archive & m_ar; Archive& m_ar;
}; };
template<class Archive, class ...Types> template <class Archive, class... Types>
void save( void save(Archive& ar, std::variant<Types...> const& v, unsigned int /*version*/
Archive & ar, ) {
std::variant<Types...> const & v,
unsigned int /*version*/
){
const std::size_t which = v.index(); const std::size_t which = v.index();
ar << BOOST_SERIALIZATION_NVP(which); ar << BOOST_SERIALIZATION_NVP(which);
std_variant_save_visitor<Archive> visitor(ar); std_variant_save_visitor<Archive> visitor(ar);
@ -78,45 +68,39 @@ void save(
// Minimalist metaprogramming for handling parameter pack // Minimalist metaprogramming for handling parameter pack
namespace mp { namespace mp {
namespace detail { namespace detail {
template <typename Seq> template <typename Seq>
struct front_impl; struct front_impl;
template <template <typename...> class Seq, typename T, typename... Ts> template <template <typename...> class Seq, typename T, typename... Ts>
struct front_impl<Seq<T, Ts...>> { struct front_impl<Seq<T, Ts...>> {
using type = T; using type = T;
}; };
template <typename Seq> template <typename Seq>
struct pop_front_impl; struct pop_front_impl;
template <template <typename...> class Seq, typename T, typename... Ts> template <template <typename...> class Seq, typename T, typename... Ts>
struct pop_front_impl<Seq<T, Ts...>> { struct pop_front_impl<Seq<T, Ts...>> {
using type = Seq<Ts...>; using type = Seq<Ts...>;
}; };
} //namespace detail } // namespace detail
template <typename... Ts> template <typename... Ts>
struct typelist {}; struct typelist {};
template <typename Seq> template <typename Seq>
using front = typename detail::front_impl<Seq>::type; using front = typename detail::front_impl<Seq>::type;
template <typename Seq> template <typename Seq>
using pop_front = typename detail::pop_front_impl<Seq>::type; using pop_front = typename detail::pop_front_impl<Seq>::type;
} // namespace mp } // namespace mp
template<std::size_t N, class Seq> template <std::size_t N, class Seq>
struct variant_impl struct variant_impl {
{ template <class Archive, class V>
template<class Archive, class V> static void load(Archive& ar, std::size_t which, V& v, const unsigned int version) {
static void load ( if (which == 0) {
Archive & ar,
std::size_t which,
V & v,
const unsigned int version
){
if(which == 0){
// note: A non-intrusive implementation (such as this one) // note: A non-intrusive implementation (such as this one)
// necessary has to copy the value. This wouldn't be necessary // necessary has to copy the value. This wouldn't be necessary
// with an implementation that de-serialized to the address of the // with an implementation that de-serialized to the address of the
@ -125,80 +109,62 @@ struct variant_impl
type value; type value;
ar >> BOOST_SERIALIZATION_NVP(value); ar >> BOOST_SERIALIZATION_NVP(value);
v = std::move(value); v = std::move(value);
type * new_address = & std::get<type>(v); type* new_address = &std::get<type>(v);
ar.reset_object_address(new_address, & value); ar.reset_object_address(new_address, &value);
return; return;
} }
//typedef typename mpl::pop_front<S>::type type; // typedef typename mpl::pop_front<S>::type type;
using types = mp::pop_front<Seq>; using types = mp::pop_front<Seq>;
variant_impl<N - 1, types>::load(ar, which - 1, v, version); variant_impl<N - 1, types>::load(ar, which - 1, v, version);
} }
}; };
template<class Seq> template <class Seq>
struct variant_impl<0, Seq> struct variant_impl<0, Seq> {
{ template <class Archive, class V>
template<class Archive, class V> static void load(Archive& /*ar*/, std::size_t /*which*/, V& /*v*/,
static void load ( const unsigned int /*version*/
Archive & /*ar*/, ) {}
std::size_t /*which*/,
V & /*v*/,
const unsigned int /*version*/
){}
}; };
template<class Archive, class... Types> template <class Archive, class... Types>
void load( void load(Archive& ar, std::variant<Types...>& v, const unsigned int version) {
Archive & ar,
std::variant<Types...>& v,
const unsigned int version
){
std::size_t which; std::size_t which;
ar >> BOOST_SERIALIZATION_NVP(which); ar >> BOOST_SERIALIZATION_NVP(which);
if(which >= sizeof...(Types)) if (which >= sizeof...(Types))
// this might happen if a type was removed from the list of variant types // this might happen if a type was removed from the list of variant types
boost::serialization::throw_exception( boost::serialization::throw_exception(boost::archive::archive_exception(
boost::archive::archive_exception( boost::archive::archive_exception::unsupported_version));
boost::archive::archive_exception::unsupported_version
)
);
variant_impl<sizeof...(Types), mp::typelist<Types...>>::load(ar, which, v, version); variant_impl<sizeof...(Types), mp::typelist<Types...>>::load(ar, which, v, version);
} }
template<class Archive,class... Types> template <class Archive, class... Types>
inline void serialize( inline void serialize(Archive& ar, std::variant<Types...>& v, const unsigned int file_version) {
Archive & ar, split_free(ar, v, file_version);
std::variant<Types...> & v,
const unsigned int file_version
){
split_free(ar,v,file_version);
} }
// Specialization for std::monostate // Specialization for std::monostate
template<class Archive> template <class Archive>
void serialize(Archive &ar, std::monostate &, const unsigned int /*version*/) void serialize(Archive& ar, std::monostate&, const unsigned int /*version*/) {}
{}
} // namespace serialization } // namespace serialization
} // namespace boost } // namespace boost
//template<typename T0_, BOOST_VARIANT_ENUM_SHIFTED_PARAMS(typename T)> // template<typename T0_, BOOST_VARIANT_ENUM_SHIFTED_PARAMS(typename T)>
#include <boost/serialization/tracking.hpp> #include <boost/serialization/tracking.hpp>
namespace boost { namespace boost {
namespace serialization { namespace serialization {
template<class... Types> template <class... Types>
struct tracking_level< struct tracking_level<std::variant<Types...>> {
std::variant<Types...>
>{
typedef mpl::integral_c_tag tag; typedef mpl::integral_c_tag tag;
typedef mpl::int_< ::boost::serialization::track_always> type; typedef mpl::int_<::boost::serialization::track_always> type;
BOOST_STATIC_CONSTANT(int, value = type::value); BOOST_STATIC_CONSTANT(int, value = type::value);
}; };
} // namespace serialization } // namespace serialization
} // namespace boost } // namespace boost
#endif //BOOST_SERIALIZATION_VARIANT_HPP #endif // BOOST_SERIALIZATION_VARIANT_HPP

View File

@ -25,7 +25,7 @@ namespace Core {
class ARM_Interface : NonCopyable { class ARM_Interface : NonCopyable {
public: public:
explicit ARM_Interface(u32 id, std::shared_ptr<Core::Timing::Timer> timer) explicit ARM_Interface(u32 id, std::shared_ptr<Core::Timing::Timer> timer)
: timer(timer), id(id){}; : timer(timer), id(id) {};
virtual ~ARM_Interface() {} virtual ~ARM_Interface() {}
struct ThreadContext { struct ThreadContext {

View File

@ -251,7 +251,7 @@ public:
explicit Timing(std::size_t num_cores, u32 cpu_clock_percentage, s64 override_base_ticks = -1); explicit Timing(std::size_t num_cores, u32 cpu_clock_percentage, s64 override_base_ticks = -1);
~Timing(){}; ~Timing() {};
/** /**
* Returns the event_type identifier. if name is not unique, it will assert. * Returns the event_type identifier. if name is not unique, it will assert.

View File

@ -281,7 +281,7 @@ void Module::Interface::GetLastResponseResult(Kernel::HLERequestContext& ctx) {
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
} }
Module::Module(Core::System& system) : system(system){}; Module::Module(Core::System& system) : system(system) {};
Module::~Module() = default; Module::~Module() = default;
void InstallInterfaces(Core::System& system) { void InstallInterfaces(Core::System& system) {

View File

@ -183,7 +183,7 @@ public:
}; };
struct RequestHeader { struct RequestHeader {
RequestHeader(std::string name, std::string value) : name(name), value(value){}; RequestHeader(std::string name, std::string value) : name(name), value(value) {};
std::string name; std::string name;
std::string value; std::string value;
@ -213,10 +213,10 @@ public:
struct Param { struct Param {
Param(const std::vector<u8>& value) Param(const std::vector<u8>& value)
: name(value.begin(), value.end()), value(value.begin(), value.end()){}; : name(value.begin(), value.end()), value(value.begin(), value.end()) {};
Param(const std::string& name, const std::string& value) : name(name), value(value){}; Param(const std::string& name, const std::string& value) : name(name), value(value) {};
Param(const std::string& name, const std::vector<u8>& value) Param(const std::string& name, const std::vector<u8>& value)
: name(name), value(value.begin(), value.end()), is_binary(true){}; : name(name), value(value.begin(), value.end()), is_binary(true) {};
std::string name; std::string name;
std::string value; std::string value;
bool is_binary = false; bool is_binary = false;