Maddie Slockbower 366774622b Implemented Shader Function
- Updated License to GPL v3.0
- Added New Math Nodes
- Prototype Rendering Code for Debugging Functions
2024-11-03 12:57:12 -05:00

89 lines
9.5 KiB
TeX

\doxysection{optional.\+h}
\hypertarget{optional_8h_source}{}\label{optional_8h_source}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{//\ =====================================================================================================================}}
\DoxyCodeLine{00002\ \textcolor{comment}{//\ \ open-\/cpp-\/utils,\ an\ open-\/source\ cpp\ library\ with\ data\ structures\ that\ extend\ the\ STL.}}
\DoxyCodeLine{00003\ \textcolor{comment}{//\ \ Copyright\ (C)\ 2024\ \ Medusa\ Slockbower}}
\DoxyCodeLine{00004\ \textcolor{comment}{//}}
\DoxyCodeLine{00005\ \textcolor{comment}{//\ \ This\ program\ is\ free\ software:\ you\ can\ redistribute\ it\ and/or\ modify}}
\DoxyCodeLine{00006\ \textcolor{comment}{//\ \ it\ under\ the\ terms\ of\ the\ GNU\ General\ Public\ License\ as\ published\ by}}
\DoxyCodeLine{00007\ \textcolor{comment}{//\ \ the\ Free\ Software\ Foundation,\ either\ version\ 3\ of\ the\ License,\ or}}
\DoxyCodeLine{00008\ \textcolor{comment}{//\ \ (at\ your\ option)\ any\ later\ version.}}
\DoxyCodeLine{00009\ \textcolor{comment}{//}}
\DoxyCodeLine{00010\ \textcolor{comment}{//\ \ This\ program\ is\ distributed\ in\ the\ hope\ that\ it\ will\ be\ useful,}}
\DoxyCodeLine{00011\ \textcolor{comment}{//\ \ but\ WITHOUT\ ANY\ WARRANTY;\ without\ even\ the\ implied\ warranty\ of}}
\DoxyCodeLine{00012\ \textcolor{comment}{//\ \ MERCHANTABILITY\ or\ FITNESS\ FOR\ A\ PARTICULAR\ PURPOSE.\ \ See\ the}}
\DoxyCodeLine{00013\ \textcolor{comment}{//\ \ GNU\ General\ Public\ License\ for\ more\ details.}}
\DoxyCodeLine{00014\ \textcolor{comment}{//}}
\DoxyCodeLine{00015\ \textcolor{comment}{//\ \ You\ should\ have\ received\ a\ copy\ of\ the\ GNU\ General\ Public\ License}}
\DoxyCodeLine{00016\ \textcolor{comment}{//\ \ along\ with\ this\ program.\ \ If\ not,\ see\ <https://www.gnu.org/licenses/>.}}
\DoxyCodeLine{00017\ \textcolor{comment}{//\ =====================================================================================================================}}
\DoxyCodeLine{00018\ }
\DoxyCodeLine{00019\ \textcolor{preprocessor}{\#ifndef\ OPEN\_CPP\_UTILS\_OPTIONAL\_H}}
\DoxyCodeLine{00020\ \textcolor{preprocessor}{\#define\ OPEN\_CPP\_UTILS\_OPTIONAL\_H}}
\DoxyCodeLine{00021\ }
\DoxyCodeLine{00022\ \textcolor{preprocessor}{\#include\ <assert.h>}}
\DoxyCodeLine{00023\ }
\DoxyCodeLine{00024\ \textcolor{keyword}{namespace\ }open\_cpp\_utils}
\DoxyCodeLine{00025\ \{}
\DoxyCodeLine{00026\ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00027\ \ \ \ \ \textcolor{keyword}{class\ }\mbox{\hyperlink{classopen__cpp__utils_1_1optional}{optional}}}
\DoxyCodeLine{00028\ \ \ \ \ \{}
\DoxyCodeLine{00029\ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{00030\ \ \ \ \ \ \ \ \ \textcolor{keyword}{using\ }value\_type\ =\ T;}
\DoxyCodeLine{00031\ }
\DoxyCodeLine{00032\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classopen__cpp__utils_1_1optional}{optional}}()\ :\ valid\_(\textcolor{keyword}{false})\ \{\ \}}
\DoxyCodeLine{00033\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classopen__cpp__utils_1_1optional}{optional}}(\textcolor{keyword}{const}\ value\_type\&\ data)\ :\ data\_(data),\ valid\_(\textcolor{keyword}{true})\ \{\ \}}
\DoxyCodeLine{00034\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classopen__cpp__utils_1_1optional}{optional}}(value\_type\&\&\ data)\ :\ data\_(data),\ valid\_(\textcolor{keyword}{true})\ \{\ \}}
\DoxyCodeLine{00035\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classopen__cpp__utils_1_1optional}{optional}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classopen__cpp__utils_1_1optional}{optional}}\&\ other)\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00036\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classopen__cpp__utils_1_1optional}{optional}}(\mbox{\hyperlink{classopen__cpp__utils_1_1optional}{optional}}\&\&\ other)\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00037\ }
\DoxyCodeLine{00038\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classopen__cpp__utils_1_1optional}{optional}}\&\ operator=(\textcolor{keyword}{const}\ \mbox{\hyperlink{classopen__cpp__utils_1_1optional}{optional}}\&\ other)\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00039\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classopen__cpp__utils_1_1optional}{optional}}\&\ operator=(\mbox{\hyperlink{classopen__cpp__utils_1_1optional}{optional}}\&\&\ other)\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00040\ }
\DoxyCodeLine{00041\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classopen__cpp__utils_1_1optional}{optional}}\&\ operator=(\textcolor{keyword}{const}\ value\_type\&\ data)\ \{\ data\_\ =\ data;\ valid\_\ =\ \textcolor{keyword}{true};\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00042\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classopen__cpp__utils_1_1optional}{optional}}\&\ operator=(value\_type\&\&\ data)\ \{\ data\_\ =\ data;\ valid\_\ =\ \textcolor{keyword}{true};\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00043\ }
\DoxyCodeLine{00044\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ operator==(\textcolor{keyword}{const}\ \mbox{\hyperlink{classopen__cpp__utils_1_1optional}{optional}}\&\ b)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00045\ \textcolor{keyword}{\ \ \ \ \ \ \ \ }\{}
\DoxyCodeLine{00046\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(not(valid\_\ ||\ b.valid\_))\ \textcolor{keywordflow}{return}\ valid\_\ ==\ b.valid\_;}
\DoxyCodeLine{00047\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ data\_\ ==\ b.data\_;}
\DoxyCodeLine{00048\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00049\ }
\DoxyCodeLine{00050\ \ \ \ \ \ \ \ \ value\_type\&\ operator+=(\textcolor{keyword}{const}\ value\_type\&\ data)\ \{\ assert(valid\_);\ data\_\ +=\ data;\ \textcolor{keywordflow}{return}\ data\_;\ \}}
\DoxyCodeLine{00051\ \ \ \ \ \ \ \ \ value\_type\&\ operator-\/=(\textcolor{keyword}{const}\ value\_type\&\ data)\ \{\ assert(valid\_);\ data\_\ +=\ data;\ \textcolor{keywordflow}{return}\ data\_;\ \}}
\DoxyCodeLine{00052\ \ \ \ \ \ \ \ \ value\_type\&\ operator*=(\textcolor{keyword}{const}\ value\_type\&\ data)\ \{\ assert(valid\_);\ data\_\ +=\ data;\ \textcolor{keywordflow}{return}\ data\_;\ \}}
\DoxyCodeLine{00053\ \ \ \ \ \ \ \ \ value\_type\&\ operator/=(\textcolor{keyword}{const}\ value\_type\&\ data)\ \{\ assert(valid\_);\ data\_\ +=\ data;\ \textcolor{keywordflow}{return}\ data\_;\ \}}
\DoxyCodeLine{00054\ \ \ \ \ \ \ \ \ value\_type\&\ operator\%=(\textcolor{keyword}{const}\ value\_type\&\ data)\ \{\ assert(valid\_);\ data\_\ +=\ data;\ \textcolor{keywordflow}{return}\ data\_;\ \}}
\DoxyCodeLine{00055\ }
\DoxyCodeLine{00056\ \ \ \ \ \ \ \ \ value\_type\&\ operator<<=(\textcolor{keyword}{const}\ value\_type\&\ data)\ \{\ assert(valid\_);\ data\_\ <<=\ data;\ \textcolor{keywordflow}{return}\ data\_;\ \}}
\DoxyCodeLine{00057\ \ \ \ \ \ \ \ \ value\_type\&\ operator>>=(\textcolor{keyword}{const}\ value\_type\&\ data)\ \{\ assert(valid\_);\ data\_\ >>=\ data;\ \textcolor{keywordflow}{return}\ data\_;\ \}}
\DoxyCodeLine{00058\ \ \ \ \ \ \ \ \ value\_type\&\ operator|=(\textcolor{keyword}{const}\ value\_type\&\ data)\ \ \{\ assert(valid\_);\ data\_\ |=\ data;\ \ \textcolor{keywordflow}{return}\ data\_;\ \}}
\DoxyCodeLine{00059\ \ \ \ \ \ \ \ \ value\_type\&\ operator\&=(\textcolor{keyword}{const}\ value\_type\&\ data)\ \ \{\ assert(valid\_);\ data\_\ \&=\ data;\ \ \textcolor{keywordflow}{return}\ data\_;\ \}}
\DoxyCodeLine{00060\ \ \ \ \ \ \ \ \ value\_type\&\ operator\string^=(\textcolor{keyword}{const}\ value\_type\&\ data)\ \ \{\ assert(valid\_);\ data\_\ \string^=\ data;\ \ \textcolor{keywordflow}{return}\ data\_;\ \}}
\DoxyCodeLine{00061\ }
\DoxyCodeLine{00062\ \ \ \ \ \ \ \ \ [[nodiscard]]\ \textcolor{keywordtype}{bool}\ operator()()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ valid\_;\ \}}
\DoxyCodeLine{00063\ }
\DoxyCodeLine{00064\ \ \ \ \ \ \ \ \ \textcolor{keyword}{operator}\ value\_type()\textcolor{keyword}{\ const\ }\{\ assert(valid\_);\ \textcolor{keywordflow}{return}\ data\_;\ \}}
\DoxyCodeLine{00065\ }
\DoxyCodeLine{00066\ \ \ \ \ \ \ \ \ \textcolor{keyword}{operator}\ \ \ \ \ \ \ value\_type\&()\ \ \ \ \ \ \ \{\ assert(valid\_);\ \textcolor{keywordflow}{return}\ data\_;\ \}}
\DoxyCodeLine{00067\ \ \ \ \ \ \ \ \ \textcolor{keyword}{operator}\ \textcolor{keyword}{const}\ value\_type\&()\ \textcolor{keyword}{const}\ \{\ assert(valid\_);\ \textcolor{keywordflow}{return}\ data\_;\ \}}
\DoxyCodeLine{00068\ }
\DoxyCodeLine{00069\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ value\_type*\ operator-\/>()\ \ \ \ \ \ \ \{\ assert(valid\_);\ \textcolor{keywordflow}{return}\ \&data\_;\ \}}
\DoxyCodeLine{00070\ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ value\_type*\ operator-\/>()\textcolor{keyword}{\ const\ }\{\ assert(valid\_);\ \textcolor{keywordflow}{return}\ \&data\_;\ \}}
\DoxyCodeLine{00071\ }
\DoxyCodeLine{00072\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ value\_type\&\ operator*()\ \ \ \ \ \ \ \ \{\ assert(valid\_);\ \textcolor{keywordflow}{return}\ data\_;\ \}}
\DoxyCodeLine{00073\ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ value\_type\&\ operator*()\textcolor{keyword}{\ const\ \ }\{\ assert(valid\_);\ \textcolor{keywordflow}{return}\ data\_;\ \}}
\DoxyCodeLine{00074\ }
\DoxyCodeLine{00075\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ reset()\ \{\ valid\_\ =\ \textcolor{keyword}{false};\ \}}
\DoxyCodeLine{00076\ }
\DoxyCodeLine{00077\ \ \ \ \ \textcolor{keyword}{private}:}
\DoxyCodeLine{00078\ \ \ \ \ \ \ \ \ value\_type\ data\_;}
\DoxyCodeLine{00079\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ valid\_;}
\DoxyCodeLine{00080\ \ \ \ \ \};}
\DoxyCodeLine{00081\ \}}
\DoxyCodeLine{00082\ }
\DoxyCodeLine{00083\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ OPEN\_CPP\_UTILS\_OPTIONAL\_H}}
\end{DoxyCode}