xtd 0.2.0
Loading...
Searching...
No Matches
directory_valid.h
Go to the documentation of this file.
1
4#pragma once
5#include "valid.h"
6#include "directory_assert.h"
7
9namespace xtd {
11 namespace tunit {
24 public:
26 directory_valid() = delete;
28
30
32 #if defined(__xtd__cpp_lib_filesystem)
43 static void are_equal(const std::filesystem::directory_entry& expected, const std::filesystem::directory_entry& actual, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
55 static void are_equal(const std::filesystem::directory_entry& expected, const std::filesystem::directory_entry& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
56 #endif
85 static void are_equal(const xtd::io::directory_info& expected, const xtd::io::directory_info& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
86
87 #if defined(__xtd__cpp_lib_filesystem)
101 static void are_not_equal(const std::filesystem::directory_entry& expected, const std::filesystem::directory_entry& actual, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
116 static void are_not_equal(const std::filesystem::directory_entry& expected, const std::filesystem::directory_entry& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
117 #endif
146 static void are_not_equal(const xtd::io::directory_info& expected, const xtd::io::directory_info& actual, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
147
148 #if defined(__xtd__cpp_lib_filesystem)
161 static void does_not_exist(const std::filesystem::directory_entry& directory, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
175 static void does_not_exist(const std::filesystem::directory_entry& directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
176 #endif
177
204 static void does_not_exist(const xtd::io::directory_info& directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
205
217 template<typename char_t>
231 template<typename char_t>
232 static void does_not_exist(const xtd::basic_string<char_t>& directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
233 try {
234 directory_assert::does_not_exist(directory, message, stack_frame);
235 } catch (...) {
236 error();
237 }
238 }
239
241 template<typename char_t>
242 static void does_not_exist(const char_t* directory, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {does_not_exist(directory, xtd::string::empty_string, stack_frame);}
243 template<typename char_t>
244 static void does_not_exist(const char_t* directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {does_not_exist(xtd::basic_string<char_t>(directory), message, stack_frame);}
246
247 #if defined(__xtd__cpp_lib_filesystem)
260 static void exists(const std::filesystem::directory_entry& directory, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
274 static void exists(const std::filesystem::directory_entry& directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
275 #endif
276
303 static void exists(const xtd::io::directory_info& directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
304
316 template<typename char_t>
330 template<typename char_t>
331 static void exists(const xtd::basic_string<char_t>& directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
332 try {
333 directory_assert::exists(directory, message, stack_frame);
334 } catch (...) {
335 error();
336 }
337 }
338
340 template<typename char_t>
341 static void exists(const char_t* directory, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {exists(directory, xtd::string::empty_string, stack_frame);}
342 template<typename char_t>
343 static void exists(const char_t* directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {exists(xtd::basic_string<char_t>(directory), message, stack_frame);}
346 };
347 }
348}
Represents text as a sequence of character units.
Definition basic_string.h:79
static const basic_string empty_string
Represents the empty basic_string.
Definition basic_string.h:124
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h:47
static stack_frame current(const xtd::source_location &value=xtd::source_location::current()) noexcept
Crates a new xtd::diagnostics::stack_frame object corresponding to the location of the call site.
Exposes instance methods for creating, moving, and enumerating through directories and subdirectories...
Definition directory_info.h:129
The base class for assert.
Definition base_assert.h:29
The directory_valid class contains a collection of static methods that implement the most directory a...
Definition directory_valid.h:23
static void does_not_exist(const xtd::io::directory_info &directory, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that directory not exists.
static void are_not_equal(const xtd::io::directory_info &expected, const xtd::io::directory_info &actual, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that two xtd::io::directory_info are not equal.
static void exists(const xtd::io::directory_info &directory, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that directory exists.
static void are_equal(const xtd::io::directory_info &expected, const xtd::io::directory_info &actual, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that two xtd::io::directory_info are equal.
static void does_not_exist(const xtd::io::directory_info &directory, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that directory not exists.
static void exists(const xtd::io::directory_info &directory, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that directory exists.
static void are_equal(const xtd::io::directory_info &expected, const xtd::io::directory_info &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that two xtd::io::directory_info are equal.
static void are_not_equal(const xtd::io::directory_info &expected, const xtd::io::directory_info &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that two xtd::io::directory_info are not equal.
static void does_not_exist(const xtd::basic_string< char_t > &directory, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that file not exists.
Definition directory_valid.h:218
static void does_not_exist(const xtd::basic_string< char_t > &directory, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that file not exists.
Definition directory_valid.h:232
static void exists(const xtd::basic_string< char_t > &directory, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that directory exists.
Definition directory_valid.h:331
static void exists(const xtd::basic_string< char_t > &directory, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that directory exists.
Definition directory_valid.h:317
Contains xtd::tunit::directory_assert class.
#define tunit_export_
Define shared library export.
Definition tunit_export.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::tunit::valid class.