C++ Utilities: io/misc.h Source File

C++ Utilities 5.34.0 Useful C++ classes and routines such as argument parser, IO and conversion utilities

Loading...
Searching...
No Matches
misc.h
Go to the documentation of this file.
1#ifndef IOUTILITIES_MISC_H
2#define IOUTILITIES_MISC_H
3
4#include "../global.h"
5
6#include <string>
7#include <string_view>
8
9namespace CppUtilities {
10
11 CPP_UTILITIES_EXPORT std::string readFile(const std::string &path, std::string::size_type maxSize = std::string::npos);
12#ifdef CPP_UTILITIES_IOMISC_STRING_VIEW
13 CPP_UTILITIES_EXPORT std::string readFile(std::string_view path, std::string_view::size_type maxSize = std::string_view::npos);
14#endif
15 CPP_UTILITIES_EXPORT void writeFile(std::string_view path, std::string_view contents);
16} // namespace CppUtilities
17
18#endif // IOUTILITIES_MISC_H
global.h
CPP_UTILITIES_EXPORT
#define CPP_UTILITIES_EXPORT
Marks the symbol to be exported by the c++utilities library.
Definition global.h:14
CppUtilities
Contains all utilities provided by the c++utilities library.
Definition argumentparser.h:18
CppUtilities::readFile
CPP_UTILITIES_EXPORT std::string readFile(const std::string &path, std::string::size_type maxSize=std::string::npos)
Reads all contents of the specified file in a single call.
Definition misc.cpp:17
CppUtilities::writeFile
CPP_UTILITIES_EXPORT void writeFile(std::string_view path, std::string_view contents)
Writes all contents to the specified file in a single call.
Definition misc.cpp:58