Merge pull request #4653 from tgsm/core-nested

core: use nested namespaces
This commit is contained in:
Pengfei Zhu 2019-02-19 21:38:59 +08:00 committed by GitHub
commit 1d3cef319a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 40 additions and 80 deletions

View file

@ -14,11 +14,9 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// FileSys namespace // FileSys namespace
namespace Service { namespace Service::FS {
namespace FS {
enum class MediaType : u32; enum class MediaType : u32;
} } // namespace Service::FS
} // namespace Service
namespace FileSys { namespace FileSys {

View file

@ -34,8 +34,7 @@ struct hash<Service::APT::AppletId> {
}; };
} // namespace std } // namespace std
namespace HLE { namespace HLE::Applets {
namespace Applets {
static std::unordered_map<Service::APT::AppletId, std::shared_ptr<Applet>> applets; static std::unordered_map<Service::APT::AppletId, std::shared_ptr<Applet>> applets;
/// The CoreTiming event identifier for the Applet update callback. /// The CoreTiming event identifier for the Applet update callback.
@ -136,5 +135,4 @@ void Init() {
void Shutdown() { void Shutdown() {
Core::System::GetInstance().CoreTiming().RemoveEvent(applet_update_event); Core::System::GetInstance().CoreTiming().RemoveEvent(applet_update_event);
} }
} // namespace Applets } // namespace HLE::Applets
} // namespace HLE

View file

@ -8,8 +8,7 @@
#include "core/hle/result.h" #include "core/hle/result.h"
#include "core/hle/service/apt/applet_manager.h" #include "core/hle/service/apt/applet_manager.h"
namespace HLE { namespace HLE::Applets {
namespace Applets {
class Applet { class Applet {
public: public:
@ -86,5 +85,4 @@ void Init();
/// Shuts down the HLE applets /// Shuts down the HLE applets
void Shutdown(); void Shutdown();
} // namespace Applets } // namespace HLE::Applets
} // namespace HLE

View file

@ -7,8 +7,7 @@
#include "core/hle/applets/erreula.h" #include "core/hle/applets/erreula.h"
#include "core/hle/service/apt/apt.h" #include "core/hle/service/apt/apt.h"
namespace HLE { namespace HLE::Applets {
namespace Applets {
ResultCode ErrEula::ReceiveParameter(const Service::APT::MessageParameter& parameter) { ResultCode ErrEula::ReceiveParameter(const Service::APT::MessageParameter& parameter) {
if (parameter.signal != Service::APT::SignalType::Request) { if (parameter.signal != Service::APT::SignalType::Request) {
@ -67,5 +66,4 @@ ResultCode ErrEula::StartImpl(const Service::APT::AppletStartupParameter& parame
void ErrEula::Update() {} void ErrEula::Update() {}
} // namespace Applets } // namespace HLE::Applets
} // namespace HLE

View file

@ -7,8 +7,7 @@
#include "core/hle/applets/applet.h" #include "core/hle/applets/applet.h"
#include "core/hle/kernel/shared_memory.h" #include "core/hle/kernel/shared_memory.h"
namespace HLE { namespace HLE::Applets {
namespace Applets {
class ErrEula final : public Applet { class ErrEula final : public Applet {
public: public:
@ -26,5 +25,4 @@ private:
Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory; Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory;
}; };
} // namespace Applets } // namespace HLE::Applets
} // namespace HLE

View file

@ -15,8 +15,7 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
namespace HLE { namespace HLE::Applets {
namespace Applets {
ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& parameter) { ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& parameter) {
if (parameter.signal != Service::APT::SignalType::Request) { if (parameter.signal != Service::APT::SignalType::Request) {
@ -110,5 +109,4 @@ ResultCode MiiSelector::StartImpl(const Service::APT::AppletStartupParameter& pa
} }
void MiiSelector::Update() {} void MiiSelector::Update() {}
} // namespace Applets } // namespace HLE::Applets
} // namespace HLE

View file

@ -12,8 +12,7 @@
#include "core/hle/result.h" #include "core/hle/result.h"
#include "core/hle/service/apt/apt.h" #include "core/hle/service/apt/apt.h"
namespace HLE { namespace HLE::Applets {
namespace Applets {
struct MiiConfig { struct MiiConfig {
u8 enable_cancel_button; u8 enable_cancel_button;
@ -126,5 +125,4 @@ private:
MiiConfig config; MiiConfig config;
}; };
} // namespace Applets } // namespace HLE::Applets
} // namespace HLE

View file

@ -7,8 +7,7 @@
#include "core/hle/applets/mint.h" #include "core/hle/applets/mint.h"
#include "core/hle/service/apt/apt.h" #include "core/hle/service/apt/apt.h"
namespace HLE { namespace HLE::Applets {
namespace Applets {
ResultCode Mint::ReceiveParameter(const Service::APT::MessageParameter& parameter) { ResultCode Mint::ReceiveParameter(const Service::APT::MessageParameter& parameter) {
if (parameter.signal != Service::APT::SignalType::Request) { if (parameter.signal != Service::APT::SignalType::Request) {
@ -67,5 +66,4 @@ ResultCode Mint::StartImpl(const Service::APT::AppletStartupParameter& parameter
void Mint::Update() {} void Mint::Update() {}
} // namespace Applets } // namespace HLE::Applets
} // namespace HLE

View file

@ -7,8 +7,7 @@
#include "core/hle/applets/applet.h" #include "core/hle/applets/applet.h"
#include "core/hle/kernel/shared_memory.h" #include "core/hle/kernel/shared_memory.h"
namespace HLE { namespace HLE::Applets {
namespace Applets {
class Mint final : public Applet { class Mint final : public Applet {
public: public:
@ -26,5 +25,4 @@ private:
Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory; Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory;
}; };
} // namespace Applets } // namespace HLE::Applets
} // namespace HLE

View file

@ -19,8 +19,7 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
namespace HLE { namespace HLE::Applets {
namespace Applets {
ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter const& parameter) { ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter const& parameter) {
if (parameter.signal != Service::APT::SignalType::Request) { if (parameter.signal != Service::APT::SignalType::Request) {
@ -188,5 +187,4 @@ Frontend::KeyboardConfig SoftwareKeyboard::ToFrontendConfig(
static_cast<bool>(config.filter_flags & SoftwareKeyboardFilter::Callback); static_cast<bool>(config.filter_flags & SoftwareKeyboardFilter::Callback);
return frontend_config; return frontend_config;
} }
} // namespace Applets } // namespace HLE::Applets
} // namespace HLE

View file

@ -13,8 +13,7 @@
#include "core/hle/result.h" #include "core/hle/result.h"
#include "core/hle/service/apt/apt.h" #include "core/hle/service/apt/apt.h"
namespace HLE { namespace HLE::Applets {
namespace Applets {
/// Maximum number of buttons that can be in the keyboard. /// Maximum number of buttons that can be in the keyboard.
constexpr int MAX_BUTTON = 3; constexpr int MAX_BUTTON = 3;
@ -210,5 +209,4 @@ private:
std::shared_ptr<Frontend::SoftwareKeyboard> frontend_applet; std::shared_ptr<Frontend::SoftwareKeyboard> frontend_applet;
}; };
} // namespace Applets } // namespace HLE::Applets
} // namespace HLE

View file

@ -6,8 +6,7 @@
#include <functional> #include <functional>
#include "core/hw/aes/arithmetic128.h" #include "core/hw/aes/arithmetic128.h"
namespace HW { namespace HW::AES {
namespace AES {
AESKey Lrot128(const AESKey& in, u32 rot) { AESKey Lrot128(const AESKey& in, u32 rot) {
AESKey out; AESKey out;
@ -43,5 +42,4 @@ AESKey Xor128(const AESKey& a, const AESKey& b) {
return out; return out;
} }
} // namespace AES } // namespace HW::AES
} // namespace HW

View file

@ -7,11 +7,9 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hw/aes/key.h" #include "core/hw/aes/key.h"
namespace HW { namespace HW::AES {
namespace AES {
AESKey Lrot128(const AESKey& in, u32 rot); AESKey Lrot128(const AESKey& in, u32 rot);
AESKey Add128(const AESKey& a, const AESKey& b); AESKey Add128(const AESKey& a, const AESKey& b);
AESKey Xor128(const AESKey& a, const AESKey& b); AESKey Xor128(const AESKey& a, const AESKey& b);
} // namespace AES } // namespace HW::AES
} // namespace HW

View file

@ -12,8 +12,7 @@
#include "core/hw/aes/ccm.h" #include "core/hw/aes/ccm.h"
#include "core/hw/aes/key.h" #include "core/hw/aes/key.h"
namespace HW { namespace HW::AES {
namespace AES {
namespace { namespace {
@ -91,5 +90,4 @@ std::vector<u8> DecryptVerifyCCM(const std::vector<u8>& cipher, const CCMNonce&
return pdata; return pdata;
} }
} // namespace AES } // namespace HW::AES
} // namespace HW

View file

@ -9,8 +9,7 @@
#include <vector> #include <vector>
#include "common/common_types.h" #include "common/common_types.h"
namespace HW { namespace HW::AES {
namespace AES {
constexpr std::size_t CCM_NONCE_SIZE = 12; constexpr std::size_t CCM_NONCE_SIZE = 12;
constexpr std::size_t CCM_MAC_SIZE = 16; constexpr std::size_t CCM_MAC_SIZE = 16;
@ -37,5 +36,4 @@ std::vector<u8> EncryptSignCCM(const std::vector<u8>& pdata, const CCMNonce& non
std::vector<u8> DecryptVerifyCCM(const std::vector<u8>& cipher, const CCMNonce& nonce, std::vector<u8> DecryptVerifyCCM(const std::vector<u8>& cipher, const CCMNonce& nonce,
std::size_t slot_id); std::size_t slot_id);
} // namespace AES } // namespace HW::AES
} // namespace HW

View file

@ -18,8 +18,7 @@
#include "core/hw/aes/arithmetic128.h" #include "core/hw/aes/arithmetic128.h"
#include "core/hw/aes/key.h" #include "core/hw/aes/key.h"
namespace HW { namespace HW::AES {
namespace AES {
namespace { namespace {
@ -475,5 +474,4 @@ void SelectCommonKeyIndex(u8 index) {
key_slots[KeySlotID::TicketCommonKey].SetKeyY(common_key_y_slots.at(index)); key_slots[KeySlotID::TicketCommonKey].SetKeyY(common_key_y_slots.at(index));
} }
} // namespace AES } // namespace HW::AES
} // namespace HW

View file

@ -8,8 +8,7 @@
#include <cstddef> #include <cstddef>
#include "common/common_types.h" #include "common/common_types.h"
namespace HW { namespace HW::AES {
namespace AES {
enum KeySlotID : std::size_t { enum KeySlotID : std::size_t {
@ -50,5 +49,4 @@ AESKey GetNormalKey(std::size_t slot_id);
void SelectCommonKeyIndex(u8 index); void SelectCommonKeyIndex(u8 index);
} // namespace AES } // namespace HW::AES
} // namespace HW

View file

@ -15,8 +15,7 @@
#include "core/hw/y2r.h" #include "core/hw/y2r.h"
#include "core/memory.h" #include "core/memory.h"
namespace HW { namespace HW::Y2R {
namespace Y2R {
using namespace Service::Y2R; using namespace Service::Y2R;
@ -377,5 +376,4 @@ void PerformConversion(ConversionConfiguration& cvt) {
cvt.output_format, (u8)cvt.alpha); cvt.output_format, (u8)cvt.alpha);
} }
} }
} // namespace Y2R } // namespace HW::Y2R
} // namespace HW

View file

@ -4,14 +4,10 @@
#pragma once #pragma once
namespace Service { namespace Service::Y2R {
namespace Y2R {
struct ConversionConfiguration; struct ConversionConfiguration;
} } // namespace Service::Y2R
} // namespace Service
namespace HW { namespace HW::Y2R {
namespace Y2R {
void PerformConversion(Service::Y2R::ConversionConfiguration& cvt); void PerformConversion(Service::Y2R::ConversionConfiguration& cvt);
} } // namespace HW::Y2R
} // namespace HW