\hypertarget{a00425_source}{}\doxysection{AAX\+\_\+\+CString\+Display\+Delegate.\+h}
\label{a00425_source}\index{AAX\_CStringDisplayDelegate.h@{AAX\_CStringDisplayDelegate.h}}
\mbox{\hyperlink{a00425}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00002\ \textcolor{comment}{/*}}
\DoxyCodeLine{00003\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ *\ \ Copyright\ 2014-\/2017,\ 2019,\ 2023-\/2024\ Avid\ Technology,\ Inc.}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *\ \ All\ rights\ reserved.}}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ \ This\ file\ is\ part\ of\ the\ Avid\ AAX\ SDK.}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00009\ \textcolor{comment}{\ *\ \ The\ AAX\ SDK\ is\ subject\ to\ commercial\ or\ open-\/source\ licensing.}}
\DoxyCodeLine{00010\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00011\ \textcolor{comment}{\ *\ \ By\ using\ the\ AAX\ SDK,\ you\ agree\ to\ the\ terms\ of\ both\ the\ Avid\ AAX\ SDK\ License}}
\DoxyCodeLine{00012\ \textcolor{comment}{\ *\ \ Agreement\ and\ Avid\ Privacy\ Policy.}}
\DoxyCodeLine{00013\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00014\ \textcolor{comment}{\ *\ \ AAX\ SDK\ License:\ https://developer.avid.com/aax}}
\DoxyCodeLine{00015\ \textcolor{comment}{\ *\ \ Privacy\ Policy:\ https://www.avid.com/legal/privacy-\/policy-\/statement}}
\DoxyCodeLine{00016\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00017\ \textcolor{comment}{\ *\ \ Or:\ You\ may\ also\ use\ this\ code\ under\ the\ terms\ of\ the\ GPL\ v3\ (see}}
\DoxyCodeLine{00018\ \textcolor{comment}{\ *\ \ www.gnu.org/licenses).}}
\DoxyCodeLine{00019\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00020\ \textcolor{comment}{\ *\ \ THE\ AAX\ SDK\ IS\ PROVIDED\ "{}AS\ IS"{}\ WITHOUT\ ANY\ WARRANTY,\ AND\ ALL\ WARRANTIES,\ WHETHER}}
\DoxyCodeLine{00021\ \textcolor{comment}{\ *\ \ EXPRESSED\ OR\ IMPLIED,\ INCLUDING\ MERCHANTABILITY\ AND\ FITNESS\ FOR\ PURPOSE,\ ARE}}
\DoxyCodeLine{00022\ \textcolor{comment}{\ *\ \ DISCLAIMED.}}
\DoxyCodeLine{00023\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00024\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00025\ }
\DoxyCodeLine{00032\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00033\ }
\DoxyCodeLine{00034\ }
\DoxyCodeLine{00035\ \textcolor{preprocessor}{\#ifndef\ AAX\_CSTRINGDISPLAYDELEGATE\_H}}
\DoxyCodeLine{00036\ \textcolor{preprocessor}{\#define\ AAX\_CSTRINGDISPLAYDELEGATE\_H}}
\DoxyCodeLine{00037\ }
\DoxyCodeLine{00038\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00476}{AAX\_IDisplayDelegate.h}}"{}}}
\DoxyCodeLine{00039\ \textcolor{preprocessor}{\#include\ <sstream>}}
\DoxyCodeLine{00040\ \textcolor{preprocessor}{\#include\ <map>}}
\DoxyCodeLine{00041\ }
\DoxyCodeLine{00042\ }
\DoxyCodeLine{00055\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00056\ \textcolor{keyword}{class\ }\mbox{\hyperlink{a01962}{AAX\_CStringDisplayDelegate}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{a02242}{AAX\_IDisplayDelegate}}<T>}
\DoxyCodeLine{00057\ \{}
\DoxyCodeLine{00058\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00070\ \ \ \ \ \mbox{\hyperlink{a01962}{AAX\_CStringDisplayDelegate}}(\textcolor{keyword}{const}\ std::map<T,AAX\_CString>\&\ stringMap);}
\DoxyCodeLine{00071\ \ \ \ \ }
\DoxyCodeLine{00072\ \ \ \ \ \textcolor{comment}{//Virtual\ Overrides}}
\DoxyCodeLine{00073\ \ \ \ \ \mbox{\hyperlink{a01962}{AAX\_CStringDisplayDelegate<T>}}*\ \mbox{\hyperlink{a01962_a011fc2e134ffa0469ee995232922bcb2}{Clone}}()\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00074\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01962_a96ae6bc68f2a2df5224539b4b07f914b}{ValueToString}}(T\ value,\ \mbox{\hyperlink{a01946}{AAX\_CString}}*\ valueString)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00075\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01962_a96ae6bc68f2a2df5224539b4b07f914b}{ValueToString}}(T\ value,\ int32\_t\ maxNumChars,\ \mbox{\hyperlink{a01946}{AAX\_CString}}*\ valueString)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00076\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01962_a465943be762c4c273eb19f2272800ed0}{StringToValue}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a01946}{AAX\_CString}}\&\ valueString,\ T*\ value)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00077\ \ \ \ \ }
\DoxyCodeLine{00078\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00079\ \ \ \ \ std::map<T,\ AAX\_CString>\ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{a01962_aba142c61f06272adbaed051751d96123}{mStringMap}};}
\DoxyCodeLine{00080\ \ \ \ \ std::map<AAX\_CString,\ T>\ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{a01962_a388606665c60b57c16152b0424c54e2e}{mInverseStringMap}};}
\DoxyCodeLine{00081\ \};}
\DoxyCodeLine{00082\ }
\DoxyCodeLine{00083\ }
\DoxyCodeLine{00084\ }
\DoxyCodeLine{00085\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00086\ \mbox{\hyperlink{a01962_a675d5d95e04e023b0650c621ddaf4972}{AAX\_CStringDisplayDelegate<T>::AAX\_CStringDisplayDelegate}}(\textcolor{keyword}{const}\ std::map<T,AAX\_CString>\&\ stringMap)\ \ :}
\DoxyCodeLine{00087\ \ \ \ \ \mbox{\hyperlink{a02242}{AAX\_IDisplayDelegate}}<T>(),}
\DoxyCodeLine{00088\ \ \ \ \ mStringMap(stringMap),}
\DoxyCodeLine{00089\ \ \ \ \ mInverseStringMap()}
\DoxyCodeLine{00090\ \{}
\DoxyCodeLine{00091\ \ \ \ \ \textcolor{comment}{//Construct\ an\ inverse\ string\ map\ from\ our\ already\ copied\ internal\ copy\ of\ the\ string\ map.}}
\DoxyCodeLine{00092\ \ \ \ \ \textcolor{comment}{//This\ inverse\ map\ is\ used\ for\ stringToValue\ conversion.}}
\DoxyCodeLine{00093\ \ \ \ \ \textcolor{keyword}{typename}\ std::map<T,AAX\_CString>::iterator\ valueStringIterator\ =\ \mbox{\hyperlink{a01962_aba142c61f06272adbaed051751d96123}{mStringMap}}.begin();}
\DoxyCodeLine{00094\ \ \ \ \ \textcolor{keywordflow}{while}\ (\ valueStringIterator\ !=\ \mbox{\hyperlink{a01962_aba142c61f06272adbaed051751d96123}{mStringMap}}.end()\ )}
\DoxyCodeLine{00095\ \ \ \ \ \{}
\DoxyCodeLine{00096\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{a01962_a388606665c60b57c16152b0424c54e2e}{mInverseStringMap}}.insert(std::pair<AAX\_CString,\ T>(valueStringIterator-\/>second,\ valueStringIterator-\/>first));}
\DoxyCodeLine{00097\ \ \ \ \ \ \ \ \ valueStringIterator++;}
\DoxyCodeLine{00098\ \ \ \ \ \}}
\DoxyCodeLine{00099\ \}}
\DoxyCodeLine{00100\ }
\DoxyCodeLine{00101\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00102\ \mbox{\hyperlink{a01962}{AAX\_CStringDisplayDelegate<T>}}*\ \ \ \ \ \mbox{\hyperlink{a01962_a011fc2e134ffa0469ee995232922bcb2}{AAX\_CStringDisplayDelegate<T>::Clone}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00103\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00104\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{a01962}{AAX\_CStringDisplayDelegate}}(*\textcolor{keyword}{this});}
\DoxyCodeLine{00105\ \}}
\DoxyCodeLine{00106\ }
\DoxyCodeLine{00107\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00108\ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01962_a96ae6bc68f2a2df5224539b4b07f914b}{AAX\_CStringDisplayDelegate<T>::ValueToString}}(T\ value,\ \mbox{\hyperlink{a01946}{AAX\_CString}}*\ valueString)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00109\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00110\ \ \ \ \ \textcolor{keyword}{typename}\ std::map<T,AAX\_CString>::const\_iterator\ mapPairIterator\ =\ mStringMap.find(value);}
\DoxyCodeLine{00111\ \ \ \ \ \textcolor{keywordflow}{if}(\ mapPairIterator\ !=\ mStringMap.end()\ )\ }
\DoxyCodeLine{00112\ \ \ \ \ \{}
\DoxyCodeLine{00113\ \ \ \ \ \ \ \ \ *valueString\ =\ mapPairIterator-\/>second;}
\DoxyCodeLine{00114\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00115\ \ \ \ \ \}}
\DoxyCodeLine{00116\ \ \ \ \ *valueString\ =\ \mbox{\hyperlink{a01946}{AAX\_CString}}(\textcolor{stringliteral}{"{}String\ Not\ Found"{}});}
\DoxyCodeLine{00117\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00118\ \}}
\DoxyCodeLine{00119\ }
\DoxyCodeLine{00120\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00121\ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01962_a96ae6bc68f2a2df5224539b4b07f914b}{AAX\_CStringDisplayDelegate<T>::ValueToString}}(T\ value,\ int32\_t\ \textcolor{comment}{/*maxNumChars*/},\ \mbox{\hyperlink{a01946}{AAX\_CString}}*\ valueString)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00122\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00123\ \ \ \ \ \textcolor{comment}{//\ First,\ get\ the\ full\ length\ string.}}
\DoxyCodeLine{00124\ \ \ \ \ \textcolor{keywordtype}{bool}\ result\ =\ this-\/>ValueToString(value,\ valueString);}
\DoxyCodeLine{00125\ \ \ \ \ }
\DoxyCodeLine{00126\ \ \ \ \ \textcolor{comment}{//<DMT>\ TODO:\ Shorten\ the\ string\ based\ on\ the\ number\ of\ characters...\ \ }}
\DoxyCodeLine{00127\ \ \ \ \ }
\DoxyCodeLine{00128\ \ \ \ \ \textcolor{keywordflow}{return}\ result;}
\DoxyCodeLine{00129\ \}}
\DoxyCodeLine{00130\ }
\DoxyCodeLine{00131\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00132\ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01962_a465943be762c4c273eb19f2272800ed0}{AAX\_CStringDisplayDelegate<T>::StringToValue}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a01946}{AAX\_CString}}\&\ valueString,\ T*\ value)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00133\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00134\ \ \ \ \ \textcolor{keyword}{typename}\ std::map<AAX\_CString,\ T>::const\_iterator\ mapPairIterator\ =\ mInverseStringMap.find(valueString);}
\DoxyCodeLine{00135\ \ \ \ \ \textcolor{keywordflow}{if}(\ mapPairIterator\ !=\ mInverseStringMap.end()\ )\ }
\DoxyCodeLine{00136\ \ \ \ \ \{}
\DoxyCodeLine{00137\ \ \ \ \ \ \ \ \ *value\ =\ mapPairIterator-\/>second;}
\DoxyCodeLine{00138\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00139\ \ \ \ \ \}}
\DoxyCodeLine{00140\ \ \ \ \ *value\ =\ 0;}
\DoxyCodeLine{00141\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00142\ \}}
\DoxyCodeLine{00143\ }
\DoxyCodeLine{00144\ }
\DoxyCodeLine{00145\ }
\DoxyCodeLine{00146\ }
\DoxyCodeLine{00147\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//AAX\_CSTRINGDISPLAYDELEGATE\_H}}

\end{DoxyCode}
