\hypertarget{io_8h}{}\doxysection{kblib/io.h File Reference} \label{io_8h}\index{kblib/io.h@{kblib/io.h}} Provides I/O utilities. {\ttfamily \#include \char`\"{}fakestd.\+h\char`\"{}}\newline {\ttfamily \#include \char`\"{}traits.\+h\char`\"{}}\newline {\ttfamily \#include $<$fstream$>$}\newline {\ttfamily \#include $<$functional$>$}\newline {\ttfamily \#include $<$string$>$}\newline {\ttfamily \#include $<$vector$>$}\newline {\ttfamily \#include $<$cstdio$>$}\newline {\ttfamily \#include $<$filesystem$>$}\newline {\ttfamily \#include $<$optional$>$}\newline {\ttfamily \#include $<$iostream$>$}\newline Include dependency graph for io.\+h\+:\nopagebreak \begin{figure}[H] \begin{center} \leavevmode \includegraphics[width=350pt]{io_8h__incl} \end{center} \end{figure} This graph shows which files directly or indirectly include this file\+:\nopagebreak \begin{figure}[H] \begin{center} \leavevmode \includegraphics[width=254pt]{io_8h__dep__incl} \end{center} \end{figure} \doxysubsection*{Classes} \begin{DoxyCompactItemize} \item struct \mbox{\hyperlink{structkblib_1_1get__manip}{kblib\+::get\+\_\+manip$<$ F $>$}} \begin{DoxyCompactList}\small\item\em A helper class for wrapping stream manipulators. \end{DoxyCompactList}\item struct \mbox{\hyperlink{structkblib_1_1unicode__widen}{kblib\+::unicode\+\_\+widen$<$ T, U $>$}} \item struct \mbox{\hyperlink{structkblib_1_1unicode__widen_3_01char16__t_00_01char32__t_01_4}{kblib\+::unicode\+\_\+widen$<$ char16\+\_\+t, char32\+\_\+t $>$}} \item class \mbox{\hyperlink{classkblib_1_1detail__io_1_1basic__teestreambuf}{kblib\+::detail\+\_\+io\+::basic\+\_\+teestreambuf$<$ SB1\+\_\+t, SB2\+\_\+t $>$}} \item class \mbox{\hyperlink{classkblib_1_1basic__teestream}{kblib\+::basic\+\_\+teestream$<$ Stream\+A, Stream\+B $>$}} \item struct \mbox{\hyperlink{structkblib_1_1file__deleter}{kblib\+::file\+\_\+deleter$<$ F, D, P $>$}} \end{DoxyCompactItemize} \doxysubsection*{Namespaces} \begin{DoxyCompactItemize} \item namespace \mbox{\hyperlink{namespacekblib}{kblib}} \begin{DoxyCompactList}\small\item\em The main namespace in which all entities from kblib are defined. \end{DoxyCompactList}\item namespace \mbox{\hyperlink{namespacedetail__io}{detail\+\_\+io}} \item namespace \mbox{\hyperlink{namespacekblib_1_1detail__io}{kblib\+::detail\+\_\+io}} \end{DoxyCompactItemize} \doxysubsection*{Macros} \begin{DoxyCompactItemize} \item \#define \mbox{\hyperlink{io_8h_a47ec10d8c001b6c6d05b8c88c9dbe554}{IF\+\_\+\+CONSTEXPR}}~constexpr \end{DoxyCompactItemize} \doxysubsection*{Typedefs} \begin{DoxyCompactItemize} \item {\footnotesize template$<$typename Stream $>$ }\\using \mbox{\hyperlink{namespacekblib_1_1detail__io_ad0190242f4659f25605551c9c011c3ad}{kblib\+::detail\+\_\+io\+::buf\+\_\+for}} = std\+::remove\+\_\+pointer\+\_\+t$<$ decltype(std\+::declval$<$ Stream \& $>$().rdbuf())$>$ \end{DoxyCompactItemize} \doxysubsection*{Functions} \begin{DoxyCompactItemize} \item {\footnotesize template$<$typename D = std\+::string, typename std\+::enable\+\_\+if\+\_\+t$<$ is\+\_\+contiguous\+\_\+v$<$ D $>$, int $>$ = 0$>$ }\\auto \mbox{\hyperlink{namespacekblib_a629b6bb6b53b02c3ae0129ddc128eb5c}{kblib\+::get\+\_\+contents}} (std\+::istream \&in, D \&out) -\/$>$ auto \item {\footnotesize template$<$typename D = std\+::string, typename string $>$ }\\auto \mbox{\hyperlink{namespacekblib_a842d755850ee1a876ee0587931a7bd16}{kblib\+::get\+\_\+file\+\_\+contents}} (const string \&filename) -\/$>$ std\+::optional$<$ D $>$ \begin{DoxyCompactList}\small\item\em Read the entire contents of a file into a container, such as std\+::string or std\+::vector$<$char$>$. Note that it will be most efficient to read into contiguous containers, as opposed to non-\/contiguous containers. \end{DoxyCompactList}\item {\footnotesize template$<$typename D = std\+::string, typename string $>$ }\\auto \mbox{\hyperlink{namespacekblib_a28d32b32bd6bbd28e27a80c236d46cd2}{kblib\+::try\+\_\+get\+\_\+file\+\_\+contents}} (const string \&filename) -\/$>$ D \begin{DoxyCompactList}\small\item\em Read the entire contents of a file into a container, such as std\+::string or std\+::vector$<$char$>$. Note that it will be most efficient to read into contiguous containers, as opposed to non-\/contiguous containers. \end{DoxyCompactList}\item auto \mbox{\hyperlink{namespacekblib_a8ec120cbc5e4f7c1624f07e48660b7f9}{kblib\+::getline}} (std\+::istream \&is) -\/$>$ std\+::string \begin{DoxyCompactList}\small\item\em By-\/value std\+::getline wrapper. \end{DoxyCompactList}\item auto \mbox{\hyperlink{namespacekblib_a09ae80b5cc20a7bcb10eda5d227c5b22}{kblib\+::eat\+\_\+word}} (std\+::istream \&is) -\/$>$ std\+::istream \& \begin{DoxyCompactList}\small\item\em Consume all non-\/spaces to first break, then eat that, too. \end{DoxyCompactList}\item std\+::istream \& \mbox{\hyperlink{namespacekblib_a892c5cf646b0bd6fbe72caa7cd6afa3a}{kblib\+::eat\+\_\+space}} (std\+::istream \&is) \begin{DoxyCompactList}\small\item\em Eat spaces, don\textquotesingle{}t eat an extra. \end{DoxyCompactList}\item {\footnotesize template$<$typename CharT , typename Traits $>$ }\\auto \mbox{\hyperlink{namespacekblib_a1c69e2ede07e021b4a480b78496912e2}{kblib\+::nl}} (std\+::basic\+\_\+istream$<$ CharT, Traits $>$ \&is) -\/$>$ std\+::basic\+\_\+istream$<$ CharT, Traits $>$ \& \begin{DoxyCompactList}\small\item\em Read in spaces until the end of the line is found. \end{DoxyCompactList}\item {\footnotesize template$<$typename CharT $>$ }\\auto \mbox{\hyperlink{namespacekblib_a667a06da2b3ec8f82f8a22aee03e46d7}{kblib\+::unformatted\+\_\+expect}} (CharT c) -\/$>$ auto \begin{DoxyCompactList}\small\item\em Read a character from an input stream only if it equals c. Acts as an Unformatted\+Input\+Operation, that is, it will not ignore any leading whitespace. \end{DoxyCompactList}\item {\footnotesize template$<$typename CharT $>$ }\\auto \mbox{\hyperlink{namespacekblib_a92cc98441a6881da833d69dad234f8be}{kblib\+::expect}} (CharT c) -\/$>$ auto \begin{DoxyCompactList}\small\item\em Read a character from an input stream only if it equals c. Acts as a Formatted\+Input\+Operation, that is, leading whitespace is ignored. \end{DoxyCompactList}\item {\footnotesize template$<$typename CharT , typename... O, template$<$ typename, typename... $>$ class string$>$ }\\auto \mbox{\hyperlink{namespacekblib_ab094fc53f62f0f36e6f68eb3a4e70d5b}{kblib\+::get\+\_\+line}} (string$<$ CharT, O... $>$ \&str) -\/$>$ auto \begin{DoxyCompactList}\small\item\em Read a whole line into a std\+::basic\+\_\+string-\/like class template. \end{DoxyCompactList}\item {\footnotesize template$<$typename CharT , typename... O, template$<$ typename, typename... $>$ class string$>$ }\\auto \mbox{\hyperlink{namespacekblib_a6ceffff6280ce849da581b3d46ce495b}{kblib\+::get\+\_\+line}} (string$<$ CharT, O... $>$ \&str, CharT delim) -\/$>$ auto \begin{DoxyCompactList}\small\item\em Read a delimited string into a std\+::basic\+\_\+string-\/like class template. \end{DoxyCompactList}\item {\footnotesize template$<$typename F , typename CharT , typename Tr $>$ }\\std\+::basic\+\_\+istream$<$ CharT, Tr $>$ \& \mbox{\hyperlink{namespacekblib_af2086a9685efdca3d6b066f16a4fa4df}{kblib\+::operator$>$$>$}} (std\+::basic\+\_\+istream$<$ CharT, Tr $>$ \&is, get\+\_\+manip$<$ F $>$ func) \begin{DoxyCompactList}\small\item\em Actually calls the manipulator. \end{DoxyCompactList}\item {\footnotesize template$<$typename F , typename CharT , typename Tr $>$ }\\std\+::basic\+\_\+ostream$<$ CharT, Tr $>$ \& \mbox{\hyperlink{namespacekblib_a13dd6e6d415d913d810092d9b575fd6b}{kblib\+::operator$<$$<$}} (std\+::basic\+\_\+ostream$<$ CharT, Tr $>$ \&is, get\+\_\+manip$<$ F $>$ func) \begin{DoxyCompactList}\small\item\em Actually calls the manipulator. \end{DoxyCompactList}\item {\footnotesize template$<$typename StreamA , typename StreamB $>$ }\\auto \mbox{\hyperlink{namespacekblib_a5731c616c6080a1e7b8f2155e76373df}{kblib\+::tee}} (StreamA \&a, StreamB \&b) -\/$>$ basic\+\_\+teestream$<$ StreamA, StreamB $>$ \item {\footnotesize template$<$typename File = std\+::fstream$>$ }\\auto \mbox{\hyperlink{namespacekblib_af0e8f19112bf1c9749dbc740205a500e}{kblib\+::scoped\+\_\+file}} (const std\+::filesystem\+::path \&path, std\+::ios\+\_\+base\+::openmode mode=std\+::ios\+\_\+base\+::in$\vert$std\+::ios\+\_\+base\+::out) \item {\footnotesize template$<$typename File = std\+::fstream$>$ }\\auto \mbox{\hyperlink{namespacekblib_aa2ab36dcd40fe0308a4df9359b90fb6f}{kblib\+::tmpfile}} (const std\+::filesystem\+::path \&path, std\+::ios\+\_\+base\+::openmode mode=std\+::ios\+\_\+base\+::in$\vert$std\+::ios\+\_\+base\+::out) \end{DoxyCompactItemize} \doxysubsection{Detailed Description} Provides I/O utilities. \begin{DoxyAuthor}{Author} killerbee \end{DoxyAuthor} \begin{DoxyDate}{Date} 2019-\/2021 \end{DoxyDate} \begin{DoxyCopyright}{Copyright} GNU General Public Licence v3.\+0 \end{DoxyCopyright} Definition in file \mbox{\hyperlink{io_8h_source}{io.\+h}}. \doxysubsection{Macro Definition Documentation} \mbox{\Hypertarget{io_8h_a47ec10d8c001b6c6d05b8c88c9dbe554}\label{io_8h_a47ec10d8c001b6c6d05b8c88c9dbe554}} \index{io.h@{io.h}!IF\_CONSTEXPR@{IF\_CONSTEXPR}} \index{IF\_CONSTEXPR@{IF\_CONSTEXPR}!io.h@{io.h}} \doxysubsubsection{\texorpdfstring{IF\_CONSTEXPR}{IF\_CONSTEXPR}} {\footnotesize\ttfamily \#define IF\+\_\+\+CONSTEXPR~constexpr}