summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/fs/fs_util.cpp8
-rw-r--r--src/common/fs/fs_util.h18
-rw-r--r--src/common/logging/filter.cpp1
-rw-r--r--src/common/logging/types.h1
-rw-r--r--src/common/telemetry.h3
5 files changed, 31 insertions, 0 deletions
diff --git a/src/common/fs/fs_util.cpp b/src/common/fs/fs_util.cpp
index 9f8671982..0068112e6 100644
--- a/src/common/fs/fs_util.cpp
+++ b/src/common/fs/fs_util.cpp
@@ -16,6 +16,10 @@ std::u8string BufferToU8String(std::span<const u8> buffer) {
return std::u8string{buffer.begin(), std::ranges::find(buffer, u8{0})};
}
+std::u8string_view BufferToU8StringView(std::span<const u8> buffer) {
+ return std::u8string_view{reinterpret_cast<const char8_t*>(buffer.data())};
+}
+
std::string ToUTF8String(std::u8string_view u8_string) {
return std::string{u8_string.begin(), u8_string.end()};
}
@@ -24,6 +28,10 @@ std::string BufferToUTF8String(std::span<const u8> buffer) {
return std::string{buffer.begin(), std::ranges::find(buffer, u8{0})};
}
+std::string_view BufferToUTF8StringView(std::span<const u8> buffer) {
+ return std::string_view{reinterpret_cast<const char*>(buffer.data())};
+}
+
std::string PathToUTF8String(const std::filesystem::path& path) {
return ToUTF8String(path.u8string());
}
diff --git a/src/common/fs/fs_util.h b/src/common/fs/fs_util.h
index 1ec82eb35..1620d38c9 100644
--- a/src/common/fs/fs_util.h
+++ b/src/common/fs/fs_util.h
@@ -38,6 +38,15 @@ concept IsChar = std::same_as<T, char>;
[[nodiscard]] std::u8string BufferToU8String(std::span<const u8> buffer);
/**
+ * Same as BufferToU8String, but returns a string view of the buffer.
+ *
+ * @param buffer Buffer of bytes
+ *
+ * @returns UTF-8 encoded std::u8string_view.
+ */
+[[nodiscard]] std::u8string_view BufferToU8StringView(std::span<const u8> buffer);
+
+/**
* Converts a std::u8string or std::u8string_view to a UTF-8 encoded std::string.
*
* @param u8_string UTF-8 encoded u8string
@@ -58,6 +67,15 @@ concept IsChar = std::same_as<T, char>;
[[nodiscard]] std::string BufferToUTF8String(std::span<const u8> buffer);
/**
+ * Same as BufferToUTF8String, but returns a string view of the buffer.
+ *
+ * @param buffer Buffer of bytes
+ *
+ * @returns UTF-8 encoded std::string_view.
+ */
+[[nodiscard]] std::string_view BufferToUTF8StringView(std::span<const u8> buffer);
+
+/**
* Converts a filesystem path to a UTF-8 encoded std::string.
*
* @param path Filesystem path
diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp
index b898a652c..4afc1369a 100644
--- a/src/common/logging/filter.cpp
+++ b/src/common/logging/filter.cpp
@@ -108,6 +108,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
SUB(Service, Migration) \
SUB(Service, Mii) \
SUB(Service, MM) \
+ SUB(Service, MNPP) \
SUB(Service, NCM) \
SUB(Service, NFC) \
SUB(Service, NFP) \
diff --git a/src/common/logging/types.h b/src/common/logging/types.h
index 9ed0c7ad6..2b6e4daa7 100644
--- a/src/common/logging/types.h
+++ b/src/common/logging/types.h
@@ -76,6 +76,7 @@ enum class Class : u8 {
Service_Migration, ///< The migration service
Service_Mii, ///< The Mii service
Service_MM, ///< The MM (Multimedia) service
+ Service_MNPP, ///< The MNPP service
Service_NCM, ///< The NCM service
Service_NFC, ///< The NFC (Near-field communication) service
Service_NFP, ///< The NFP service
diff --git a/src/common/telemetry.h b/src/common/telemetry.h
index d38aeac99..4d632f7eb 100644
--- a/src/common/telemetry.h
+++ b/src/common/telemetry.h
@@ -171,6 +171,9 @@ struct VisitorInterface {
struct NullVisitor final : public VisitorInterface {
YUZU_NON_COPYABLE(NullVisitor);
+ NullVisitor() = default;
+ ~NullVisitor() override = default;
+
void Visit(const Field<bool>& /*field*/) override {}
void Visit(const Field<double>& /*field*/) override {}
void Visit(const Field<float>& /*field*/) override {}