\hypertarget{a00422_source}{}\doxysection{AAX\+\_\+\+CString\+Display\+Delegate.\+h}
\label{a00422_source}\index{AAX\_CStringDisplayDelegate.h@{AAX\_CStringDisplayDelegate.h}}
\mbox{\hyperlink{a00422}{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\ Avid\ Technology,\ Inc.}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *\ \ All\ rights\ reserved.}}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ \ CONFIDENTIAL:\ this\ document\ contains\ confidential\ information\ of\ Avid.\ Do}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ \ not\ disclose\ to\ any\ third\ party.\ Use\ of\ the\ information\ contained\ in\ this}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ *\ \ document\ is\ subject\ to\ an\ Avid\ SDK\ license.}}
\DoxyCodeLine{00010\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00011\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00012\ }
\DoxyCodeLine{00019\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00020\ }
\DoxyCodeLine{00021\ }
\DoxyCodeLine{00022\ \textcolor{preprocessor}{\#ifndef\ AAX\_CSTRINGDISPLAYDELEGATE\_H}}
\DoxyCodeLine{00023\ \textcolor{preprocessor}{\#define\ AAX\_CSTRINGDISPLAYDELEGATE\_H}}
\DoxyCodeLine{00024\ }
\DoxyCodeLine{00025\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00467}{AAX\_IDisplayDelegate.h}}"{}}}
\DoxyCodeLine{00026\ \textcolor{preprocessor}{\#include\ <sstream>}}
\DoxyCodeLine{00027\ \textcolor{preprocessor}{\#include\ <map>}}
\DoxyCodeLine{00028\ }
\DoxyCodeLine{00029\ }
\DoxyCodeLine{00042\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00043\ \textcolor{keyword}{class\ }\mbox{\hyperlink{a01949}{AAX\_CStringDisplayDelegate}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{a02221}{AAX\_IDisplayDelegate}}<T>}
\DoxyCodeLine{00044\ \{}
\DoxyCodeLine{00045\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00057\ \ \ \ \ \mbox{\hyperlink{a01949}{AAX\_CStringDisplayDelegate}}(\textcolor{keyword}{const}\ std::map<T,AAX\_CString>\&\ stringMap);}
\DoxyCodeLine{00058\ \ \ \ \ }
\DoxyCodeLine{00059\ \ \ \ \ \textcolor{comment}{//Virtual\ Overrides}}
\DoxyCodeLine{00060\ \ \ \ \ \mbox{\hyperlink{a01949}{AAX\_CStringDisplayDelegate<T>}}*\ \mbox{\hyperlink{a01949_a011fc2e134ffa0469ee995232922bcb2}{Clone}}()\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00061\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01949_a96ae6bc68f2a2df5224539b4b07f914b}{ValueToString}}(T\ value,\ \mbox{\hyperlink{a01933}{AAX\_CString}}*\ valueString)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00062\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01949_a96ae6bc68f2a2df5224539b4b07f914b}{ValueToString}}(T\ value,\ int32\_t\ maxNumChars,\ \mbox{\hyperlink{a01933}{AAX\_CString}}*\ valueString)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00063\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01949_a465943be762c4c273eb19f2272800ed0}{StringToValue}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a01933}{AAX\_CString}}\&\ valueString,\ T*\ value)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00064\ \ \ \ \ }
\DoxyCodeLine{00065\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00066\ \ \ \ \ std::map<T,\ AAX\_CString>\ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{a01949_aba142c61f06272adbaed051751d96123}{mStringMap}};}
\DoxyCodeLine{00067\ \ \ \ \ std::map<AAX\_CString,\ T>\ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{a01949_a388606665c60b57c16152b0424c54e2e}{mInverseStringMap}};}
\DoxyCodeLine{00068\ \};}
\DoxyCodeLine{00069\ }
\DoxyCodeLine{00070\ }
\DoxyCodeLine{00071\ }
\DoxyCodeLine{00072\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00073\ \mbox{\hyperlink{a01949_a675d5d95e04e023b0650c621ddaf4972}{AAX\_CStringDisplayDelegate<T>::AAX\_CStringDisplayDelegate}}(\textcolor{keyword}{const}\ std::map<T,AAX\_CString>\&\ stringMap)\ \ :}
\DoxyCodeLine{00074\ \ \ \ \ \mbox{\hyperlink{a02221}{AAX\_IDisplayDelegate}}<T>(),}
\DoxyCodeLine{00075\ \ \ \ \ mStringMap(stringMap),}
\DoxyCodeLine{00076\ \ \ \ \ mInverseStringMap()}
\DoxyCodeLine{00077\ \{}
\DoxyCodeLine{00078\ \ \ \ \ \textcolor{comment}{//Construct\ an\ inverse\ string\ map\ from\ our\ already\ copied\ internal\ copy\ of\ the\ string\ map.}}
\DoxyCodeLine{00079\ \ \ \ \ \textcolor{comment}{//This\ inverse\ map\ is\ used\ for\ stringToValue\ conversion.}}
\DoxyCodeLine{00080\ \ \ \ \ \textcolor{keyword}{typename}\ std::map<T,AAX\_CString>::iterator\ valueStringIterator\ =\ \mbox{\hyperlink{a01949_aba142c61f06272adbaed051751d96123}{mStringMap}}.begin();}
\DoxyCodeLine{00081\ \ \ \ \ \textcolor{keywordflow}{while}\ (\ valueStringIterator\ !=\ \mbox{\hyperlink{a01949_aba142c61f06272adbaed051751d96123}{mStringMap}}.end()\ )}
\DoxyCodeLine{00082\ \ \ \ \ \{}
\DoxyCodeLine{00083\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{a01949_a388606665c60b57c16152b0424c54e2e}{mInverseStringMap}}.insert(std::pair<AAX\_CString,\ T>(valueStringIterator-\/>second,\ valueStringIterator-\/>first));}
\DoxyCodeLine{00084\ \ \ \ \ \ \ \ \ valueStringIterator++;}
\DoxyCodeLine{00085\ \ \ \ \ \}}
\DoxyCodeLine{00086\ \}}
\DoxyCodeLine{00087\ }
\DoxyCodeLine{00088\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00089\ \mbox{\hyperlink{a01949}{AAX\_CStringDisplayDelegate<T>}}*\ \ \ \ \ \mbox{\hyperlink{a01949_a011fc2e134ffa0469ee995232922bcb2}{AAX\_CStringDisplayDelegate<T>::Clone}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00090\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00091\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{a01949}{AAX\_CStringDisplayDelegate}}(*\textcolor{keyword}{this});}
\DoxyCodeLine{00092\ \}}
\DoxyCodeLine{00093\ }
\DoxyCodeLine{00094\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00095\ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01949_a96ae6bc68f2a2df5224539b4b07f914b}{AAX\_CStringDisplayDelegate<T>::ValueToString}}(T\ value,\ \mbox{\hyperlink{a01933}{AAX\_CString}}*\ valueString)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00096\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00097\ \ \ \ \ \textcolor{keyword}{typename}\ std::map<T,AAX\_CString>::const\_iterator\ mapPairIterator\ =\ mStringMap.find(value);}
\DoxyCodeLine{00098\ \ \ \ \ \textcolor{keywordflow}{if}(\ mapPairIterator\ !=\ mStringMap.end()\ )\ }
\DoxyCodeLine{00099\ \ \ \ \ \{}
\DoxyCodeLine{00100\ \ \ \ \ \ \ \ \ *valueString\ =\ mapPairIterator-\/>second;}
\DoxyCodeLine{00101\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00102\ \ \ \ \ \}}
\DoxyCodeLine{00103\ \ \ \ \ *valueString\ =\ \mbox{\hyperlink{a01933}{AAX\_CString}}(\textcolor{stringliteral}{"{}String\ Not\ Found"{}});}
\DoxyCodeLine{00104\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00105\ \}}
\DoxyCodeLine{00106\ }
\DoxyCodeLine{00107\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00108\ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01949_a96ae6bc68f2a2df5224539b4b07f914b}{AAX\_CStringDisplayDelegate<T>::ValueToString}}(T\ value,\ int32\_t\ \textcolor{comment}{/*maxNumChars*/},\ \mbox{\hyperlink{a01933}{AAX\_CString}}*\ valueString)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00109\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00110\ \ \ \ \ \textcolor{comment}{//\ First,\ get\ the\ full\ length\ string.}}
\DoxyCodeLine{00111\ \ \ \ \ \textcolor{keywordtype}{bool}\ result\ =\ this-\/>ValueToString(value,\ valueString);}
\DoxyCodeLine{00112\ \ \ \ \ }
\DoxyCodeLine{00113\ \ \ \ \ \textcolor{comment}{//<DMT>\ TODO:\ Shorten\ the\ string\ based\ on\ the\ number\ of\ characters...\ \ }}
\DoxyCodeLine{00114\ \ \ \ \ }
\DoxyCodeLine{00115\ \ \ \ \ \textcolor{keywordflow}{return}\ result;}
\DoxyCodeLine{00116\ \}}
\DoxyCodeLine{00117\ }
\DoxyCodeLine{00118\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00119\ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01949_a465943be762c4c273eb19f2272800ed0}{AAX\_CStringDisplayDelegate<T>::StringToValue}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a01933}{AAX\_CString}}\&\ valueString,\ T*\ value)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00120\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00121\ \ \ \ \ \textcolor{keyword}{typename}\ std::map<AAX\_CString,\ T>::const\_iterator\ mapPairIterator\ =\ mInverseStringMap.find(valueString);}
\DoxyCodeLine{00122\ \ \ \ \ \textcolor{keywordflow}{if}(\ mapPairIterator\ !=\ mInverseStringMap.end()\ )\ }
\DoxyCodeLine{00123\ \ \ \ \ \{}
\DoxyCodeLine{00124\ \ \ \ \ \ \ \ \ *value\ =\ mapPairIterator-\/>second;}
\DoxyCodeLine{00125\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00126\ \ \ \ \ \}}
\DoxyCodeLine{00127\ \ \ \ \ *value\ =\ 0;}
\DoxyCodeLine{00128\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00129\ \}}
\DoxyCodeLine{00130\ }
\DoxyCodeLine{00131\ }
\DoxyCodeLine{00132\ }
\DoxyCodeLine{00133\ }
\DoxyCodeLine{00134\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//AAX\_CSTRINGDISPLAYDELEGATE\_H}}

\end{DoxyCode}
