\hypertarget{class_ogre_1_1_c_preprocessor}{}\doxysection{Ogre\+::C\+Preprocessor Class Reference}
\label{class_ogre_1_1_c_preprocessor}\index{Ogre::CPreprocessor@{Ogre::CPreprocessor}}


This is a simplistic C/\+C++-\/like preprocessor.  




{\ttfamily \#include $<$Ogre\+G\+L\+S\+L\+Preprocessor.\+h$>$}

\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{class_ogre_1_1_c_preprocessor_a70001f3fef03cc20b5142e67702c3b3f}{C\+Preprocessor}} ()
\begin{DoxyCompactList}\small\item\em Create an empty preprocessor object. \end{DoxyCompactList}\item 
virtual \mbox{\hyperlink{class_ogre_1_1_c_preprocessor_a2b7c3b1a3208a27b36e87eee69464508}{$\sim$\+C\+Preprocessor}} ()
\begin{DoxyCompactList}\small\item\em Destroy the preprocessor object. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{class_ogre_1_1_c_preprocessor_a3026667d0f447d89bcac3fd8c6007a00}{Define}} (const char $\ast$i\+Macro\+Name, size\+\_\+t i\+Macro\+Name\+Len, const char $\ast$i\+Macro\+Value, size\+\_\+t i\+Macro\+Value\+Len)
\begin{DoxyCompactList}\small\item\em Define a macro without parameters. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{class_ogre_1_1_c_preprocessor_a70c0a271d5ea9dcf93d13f9c08318458}{Define}} (const char $\ast$i\+Macro\+Name, size\+\_\+t i\+Macro\+Name\+Len, long i\+Macro\+Value)
\begin{DoxyCompactList}\small\item\em Define a numerical macro. \end{DoxyCompactList}\item 
char $\ast$ \mbox{\hyperlink{class_ogre_1_1_c_preprocessor_ac9c8ca6c8013a5217275e35e9727052d}{Parse}} (const char $\ast$i\+Source, size\+\_\+t i\+Length, size\+\_\+t \&o\+Length)
\begin{DoxyCompactList}\small\item\em Parse the input string and return a newly-\/allocated output string. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_ogre_1_1_c_preprocessor_a3849848c4223928aea432f66184d541e}{Undef}} (const char $\ast$i\+Macro\+Name, size\+\_\+t i\+Macro\+Name\+Len)
\begin{DoxyCompactList}\small\item\em Undefine a macro. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Friends}
\begin{DoxyCompactItemize}
\item 
class \mbox{\hyperlink{class_ogre_1_1_c_preprocessor_ae5a6f539ddabca71928dd965f2211434}{C\+Preprocessor\+::\+Macro}}
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
This is a simplistic C/\+C++-\/like preprocessor. 

It takes an non-\/zero-\/terminated string on input and outputs a non-\/zero-\/terminated string buffer.

This preprocessor was designed specifically for \mbox{\hyperlink{namespace_ogre_1_1_g_l_s_l}{G\+L\+SL}} shaders, so if you want to use it for other purposes you might want to check if the feature set it provides is enough for you.

Here\textquotesingle{}s a list of supported features\+:
\begin{DoxyItemize}
\item Fast memory allocation-\/less operation (mostly).
\item Line continuation (backslash-\/newline) is swallowed.
\item Line numeration is fully preserved by inserting empty lines where required. This is crucial if, say, \mbox{\hyperlink{namespace_ogre_1_1_g_l_s_l}{G\+L\+SL}} compiler reports you an error with a line number.
\item {\ttfamily \#define\+:} Parametrized and non-\/parametrized macros. Invoking a macro with less arguments than it takes assignes empty values to missing arguments.
\item {\ttfamily \#undef\+:} Forget defined macros
\item {\ttfamily \#ifdef} / {\ttfamily \#ifndef} / {\ttfamily \#else} / {\ttfamily \#endif\+:} Conditional suppression of parts of code.
\item {\ttfamily \#if\+:} Supports numeric expression of any complexity, also supports the defined() pseudo-\/function. 
\end{DoxyItemize}

\doxysubsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{class_ogre_1_1_c_preprocessor_a70001f3fef03cc20b5142e67702c3b3f}\label{class_ogre_1_1_c_preprocessor_a70001f3fef03cc20b5142e67702c3b3f}} 
\index{Ogre::CPreprocessor@{Ogre::CPreprocessor}!CPreprocessor@{CPreprocessor}}
\index{CPreprocessor@{CPreprocessor}!Ogre::CPreprocessor@{Ogre::CPreprocessor}}
\doxysubsubsection{\texorpdfstring{CPreprocessor()}{CPreprocessor()}}
{\footnotesize\ttfamily Ogre\+::\+C\+Preprocessor\+::\+C\+Preprocessor (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Create an empty preprocessor object. 

\mbox{\Hypertarget{class_ogre_1_1_c_preprocessor_a2b7c3b1a3208a27b36e87eee69464508}\label{class_ogre_1_1_c_preprocessor_a2b7c3b1a3208a27b36e87eee69464508}} 
\index{Ogre::CPreprocessor@{Ogre::CPreprocessor}!````~CPreprocessor@{$\sim$CPreprocessor}}
\index{````~CPreprocessor@{$\sim$CPreprocessor}!Ogre::CPreprocessor@{Ogre::CPreprocessor}}
\doxysubsubsection{\texorpdfstring{$\sim$CPreprocessor()}{~CPreprocessor()}}
{\footnotesize\ttfamily virtual Ogre\+::\+C\+Preprocessor\+::$\sim$\+C\+Preprocessor (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Destroy the preprocessor object. 



\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{class_ogre_1_1_c_preprocessor_a3026667d0f447d89bcac3fd8c6007a00}\label{class_ogre_1_1_c_preprocessor_a3026667d0f447d89bcac3fd8c6007a00}} 
\index{Ogre::CPreprocessor@{Ogre::CPreprocessor}!Define@{Define}}
\index{Define@{Define}!Ogre::CPreprocessor@{Ogre::CPreprocessor}}
\doxysubsubsection{\texorpdfstring{Define()}{Define()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily void Ogre\+::\+C\+Preprocessor\+::\+Define (\begin{DoxyParamCaption}\item[{const char $\ast$}]{i\+Macro\+Name,  }\item[{size\+\_\+t}]{i\+Macro\+Name\+Len,  }\item[{const char $\ast$}]{i\+Macro\+Value,  }\item[{size\+\_\+t}]{i\+Macro\+Value\+Len }\end{DoxyParamCaption})}



Define a macro without parameters. 


\begin{DoxyParams}{Parameters}
{\em i\+Macro\+Name} & The name of the defined macro \\
\hline
{\em i\+Macro\+Name\+Len} & The length of the name of the defined macro \\
\hline
{\em i\+Macro\+Value} & The value of the defined macro \\
\hline
{\em i\+Macro\+Value\+Len} & The length of the value of the defined macro \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{class_ogre_1_1_c_preprocessor_a70c0a271d5ea9dcf93d13f9c08318458}\label{class_ogre_1_1_c_preprocessor_a70c0a271d5ea9dcf93d13f9c08318458}} 
\index{Ogre::CPreprocessor@{Ogre::CPreprocessor}!Define@{Define}}
\index{Define@{Define}!Ogre::CPreprocessor@{Ogre::CPreprocessor}}
\doxysubsubsection{\texorpdfstring{Define()}{Define()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily void Ogre\+::\+C\+Preprocessor\+::\+Define (\begin{DoxyParamCaption}\item[{const char $\ast$}]{i\+Macro\+Name,  }\item[{size\+\_\+t}]{i\+Macro\+Name\+Len,  }\item[{long}]{i\+Macro\+Value }\end{DoxyParamCaption})}



Define a numerical macro. 


\begin{DoxyParams}{Parameters}
{\em i\+Macro\+Name} & The name of the defined macro \\
\hline
{\em i\+Macro\+Name\+Len} & The length of the name of the defined macro \\
\hline
{\em i\+Macro\+Value} & The value of the defined macro \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{class_ogre_1_1_c_preprocessor_a3849848c4223928aea432f66184d541e}\label{class_ogre_1_1_c_preprocessor_a3849848c4223928aea432f66184d541e}} 
\index{Ogre::CPreprocessor@{Ogre::CPreprocessor}!Undef@{Undef}}
\index{Undef@{Undef}!Ogre::CPreprocessor@{Ogre::CPreprocessor}}
\doxysubsubsection{\texorpdfstring{Undef()}{Undef()}}
{\footnotesize\ttfamily bool Ogre\+::\+C\+Preprocessor\+::\+Undef (\begin{DoxyParamCaption}\item[{const char $\ast$}]{i\+Macro\+Name,  }\item[{size\+\_\+t}]{i\+Macro\+Name\+Len }\end{DoxyParamCaption})}



Undefine a macro. 


\begin{DoxyParams}{Parameters}
{\em i\+Macro\+Name} & The name of the macro to undefine \\
\hline
{\em i\+Macro\+Name\+Len} & The length of the name of the macro to undefine \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if the macro has been undefined, false if macro doesn\textquotesingle{}t exist 
\end{DoxyReturn}
\mbox{\Hypertarget{class_ogre_1_1_c_preprocessor_ac9c8ca6c8013a5217275e35e9727052d}\label{class_ogre_1_1_c_preprocessor_ac9c8ca6c8013a5217275e35e9727052d}} 
\index{Ogre::CPreprocessor@{Ogre::CPreprocessor}!Parse@{Parse}}
\index{Parse@{Parse}!Ogre::CPreprocessor@{Ogre::CPreprocessor}}
\doxysubsubsection{\texorpdfstring{Parse()}{Parse()}}
{\footnotesize\ttfamily char$\ast$ Ogre\+::\+C\+Preprocessor\+::\+Parse (\begin{DoxyParamCaption}\item[{const char $\ast$}]{i\+Source,  }\item[{size\+\_\+t}]{i\+Length,  }\item[{size\+\_\+t \&}]{o\+Length }\end{DoxyParamCaption})}



Parse the input string and return a newly-\/allocated output string. 

\begin{DoxyNote}{Note}
The returned preprocessed string is N\+OT zero-\/terminated (just like the input string). 
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em i\+Source} & The source text \\
\hline
{\em i\+Length} & The length of the source text in characters \\
\hline
{\em o\+Length} & The length of the output string. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The output from preprocessor, allocated with malloc(). The parser can actually allocate more than needed for performance reasons, but this should not be a problem unless you will want to store the returned pointer for long time in which case you might want to realloc() it. If an error has been encountered, the function returns N\+U\+LL. In some cases the function may return an unallocated address that\textquotesingle{}s {\itshape inside} the source buffer. You must free() the result string only if the returned address is not inside the source text. 
\end{DoxyReturn}


\doxysubsection{Friends And Related Function Documentation}
\mbox{\Hypertarget{class_ogre_1_1_c_preprocessor_ae5a6f539ddabca71928dd965f2211434}\label{class_ogre_1_1_c_preprocessor_ae5a6f539ddabca71928dd965f2211434}} 
\index{Ogre::CPreprocessor@{Ogre::CPreprocessor}!CPreprocessor::Macro@{CPreprocessor::Macro}}
\index{CPreprocessor::Macro@{CPreprocessor::Macro}!Ogre::CPreprocessor@{Ogre::CPreprocessor}}
\doxysubsubsection{\texorpdfstring{CPreprocessor::Macro}{CPreprocessor::Macro}}
{\footnotesize\ttfamily friend class C\+Preprocessor\+::\+Macro\hspace{0.3cm}{\ttfamily [friend]}}



The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{_ogre_g_l_s_l_preprocessor_8h}{Ogre\+G\+L\+S\+L\+Preprocessor.\+h}}\end{DoxyCompactItemize}
