Libmagicxx v5.5.0
A C++ wrapper library over the Magic Number Recognition Library.
 
Loading...
Searching...
No Matches
file_concepts.hpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: Copyright (c) 2022-2025 Oğuz Toraman <oguz.toraman@tutanota.com> */
2/* SPDX-License-Identifier: LGPL-3.0-only */
3
4#ifndef FILE_CONCEPTS_HPP
5#define FILE_CONCEPTS_HPP
6
7#include <filesystem>
8
9#include "utility.hpp"
10
11namespace file_concepts {
12
17template <typename ContainerType>
18concept file_container = std::ranges::range<ContainerType>
19 && std::default_initializable<ContainerType>
20 && std::same_as<
21 typename ContainerType::value_type,
22 std::filesystem::path>
23 && requires(ContainerType c, std::filesystem::path p) {
24 c.push_back(p);
25 c.empty();
26 typename ContainerType::value_type;
27 };
28
37[[nodiscard]] inline std::string to_string(
38 const file_container auto& container,
39 const std::string& separator = ", "
40)
41{
42 return utility::to_string(
43 container,
44 separator,
45 [](const std::filesystem::path& path) {
46 return path.string();
47 }
48 );
49}
50
51} /* namespace file_concepts */
52
53#endif /* FILE_CONCEPTS_HPP */
The file_container concept specifies the requirements of a container which can be used as a file cont...
Definition file_concepts.hpp:18
Definition file_concepts.hpp:11
std::string to_string(const file_container auto &container, const std::string &separator=", ")
Convert the file container to a string.
Definition file_concepts.hpp:37
std::string to_string(const ContainerType &container, const std::string &value_separator, StringConverterType string_converter)
Convert any container to string using the string_converter.
Definition utility.hpp:51