Skip to content

Commit

Permalink
Merge branch 'main' into copy
Browse files Browse the repository at this point in the history
# Conflicts:
#	lib/directory.cpp
#	lib/file.cpp
  • Loading branch information
bugdea1er committed Mar 7, 2024
2 parents 321a709 + e0816c7 commit 977d0c1
Show file tree
Hide file tree
Showing 8 changed files with 244 additions and 264 deletions.
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ project(tmp LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
find_package(Filesystem REQUIRED)

add_library(${PROJECT_NAME} STATIC
lib/directory.cpp
lib/file.cpp
lib/path.cpp)
add_library(${PROJECT_NAME} STATIC src/tmp.cpp)

add_library(tmp::tmp ALIAS ${PROJECT_NAME})
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17)
Expand Down
1 change: 0 additions & 1 deletion include/tmp/directory
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,4 @@ public:
directory(const directory&) = delete; ///< not copy-constructible
auto operator=(const directory&) = delete; ///< not copy-assignable
};

} // namespace tmp
2 changes: 1 addition & 1 deletion include/tmp/file
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <filesystem>
#include <fstream>
#include <string>
#include <string_view>

namespace tmp {
Expand Down Expand Up @@ -98,5 +99,4 @@ private:
/// @throws std::filesystem::filesystem_error if cannot create a file
explicit file(std::string_view prefix, bool binary);
};

} // namespace tmp
16 changes: 0 additions & 16 deletions include/tmp/path
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ namespace tmp {
/// The managed path is deleted of when either of the following happens:
/// - the managing tmp::path object is destroyed
/// - the managing tmp::path object is assigned another path via operator=
///
/// Subclass are encouraged to use tmp::path::make_pattern function to obtain
/// a temporary path pattern suitable for use in mktemp-like functions
class path {
/// The managed path
std::filesystem::path underlying;
Expand Down Expand Up @@ -47,22 +44,9 @@ public:
path(const path&) = delete; ///< not copy-constructible
auto operator=(const path&) = delete; ///< not copy-assignable

/// Creates a path pattern with the given prefix
///
/// The pattern consists of the system's temporary directory path, the given
/// prefix, and six 'X' characters that must be replaced by random
/// characters to ensure uniqueness
///
/// The parent of the resulting path is created when this function is called
/// @param prefix A prefix to be used in the path pattern
/// @returns A path pattern for the unique temporary path
/// @throws std::filesystem::filesystem_error if cannot create the parent
static std::filesystem::path make_pattern(std::string_view prefix);

protected:
/// Constructs a tmp::path which owns @p path
/// @param path A path to manage
explicit path(std::filesystem::path path);
};

} // namespace tmp
53 changes: 0 additions & 53 deletions lib/directory.cpp

This file was deleted.

87 changes: 0 additions & 87 deletions lib/file.cpp

This file was deleted.

102 changes: 0 additions & 102 deletions lib/path.cpp

This file was deleted.

Loading

0 comments on commit 977d0c1

Please sign in to comment.