summaryrefslogtreecommitdiffstats
path: root/src/lib/util/file_utilities.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/util/file_utilities.h')
-rw-r--r--src/lib/util/file_utilities.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/lib/util/file_utilities.h b/src/lib/util/file_utilities.h
new file mode 100644
index 0000000..8c34822
--- /dev/null
+++ b/src/lib/util/file_utilities.h
@@ -0,0 +1,34 @@
+// Copyright (C) 2021-2022 Internet Systems Consortium, Inc. ("ISC")
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef FILE_UTILITIES_H
+#define FILE_UTILITIES_H
+
+#include <string>
+
+namespace isc {
+namespace util {
+namespace file {
+
+/// @brief Get the content of a regular file.
+///
+/// @param file_name The file name.
+/// @return The content of the file_name file.
+/// @throw BadValue when the file can't be opened or is not a regular one.
+std::string getContent(const std::string& file_name);
+
+/// @brief Is a directory predicate.
+///
+/// @param name The file or directory name.
+/// @return True if the name points to a directory, false otherwise including
+/// if the pointed location does not exist.
+bool isDir(const std::string& name);
+
+} // namespace file
+} // namespace util
+} // namespace isc
+
+#endif // FILE_UTILITIES_H