Skip to content

Commit

Permalink
Add formatter for std::filesystem::path.
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 committed Aug 5, 2024
1 parent 26f3837 commit c621ad6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/uibase/formatters.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "./formatters/enums.h"
#include "./formatters/path.h"
#include "./formatters/qt.h"
#include "./formatters/random_access_containers.h"
#include "./formatters/strings.h"
#include "./formatters/strings.h"
17 changes: 17 additions & 0 deletions include/uibase/formatters/path.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once

#include <filesystem>
#include <format>
#include <type_traits>

template <class CharT>
struct std::formatter<std::filesystem::path, CharT>
: std::formatter<std::filesystem::path::string_type, CharT>
{
template <class FmtContext>
FmtContext::iterator format(const std::filesystem::path& v, FmtContext& ctx) const
{
return std::formatter<std::filesystem::path::string_type, CharT>::format(v.native(),
ctx);
}
};

0 comments on commit c621ad6

Please sign in to comment.