\hypertarget{a00749_source}{}\doxysection{AAX\+\_\+\+CPercent\+Display\+Delegate\+Decorator.\+h}
\label{a00749_source}\index{AAX\_CPercentDisplayDelegateDecorator.h@{AAX\_CPercentDisplayDelegateDecorator.h}}
\mbox{\hyperlink{a00749}{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}{\#pragma\ once}}
\DoxyCodeLine{00023\ }
\DoxyCodeLine{00024\ \textcolor{preprocessor}{\#ifndef\ AAX\_CPERCENTDISPLAYDELEGATEDECORATOR\_H}}
\DoxyCodeLine{00025\ \textcolor{preprocessor}{\#define\ AAX\_CPERCENTDISPLAYDELEGATEDECORATOR\_H}}
\DoxyCodeLine{00026\ }
\DoxyCodeLine{00027\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00539}{AAX\_IDisplayDelegateDecorator.h}}"{}}}
\DoxyCodeLine{00028\ }
\DoxyCodeLine{00029\ \textcolor{preprocessor}{\#include\ <cmath>}}
\DoxyCodeLine{00030\ }
\DoxyCodeLine{00031\ }
\DoxyCodeLine{00054\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00055\ \textcolor{keyword}{class\ }\mbox{\hyperlink{a01905}{AAX\_CPercentDisplayDelegateDecorator}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{a02225}{AAX\_IDisplayDelegateDecorator}}<T>}
\DoxyCodeLine{00056\ \{}
\DoxyCodeLine{00057\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00058\ \ \ \ \ \mbox{\hyperlink{a01905}{AAX\_CPercentDisplayDelegateDecorator}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a02221}{AAX\_IDisplayDelegate<T>}}\&\ displayDelegate);}
\DoxyCodeLine{00059\ \ \ \ \ }
\DoxyCodeLine{00060\ \ \ \ \ \textcolor{comment}{//Virtual\ Overrides}}
\DoxyCodeLine{00061\ \ \ \ \ \mbox{\hyperlink{a01905}{AAX\_CPercentDisplayDelegateDecorator<T>}}*\ \mbox{\hyperlink{a01905_affe52efa34c969895f75b067e875dafb}{Clone}}()\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00062\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01905_a06407f0b1287891bf658bc4e4166e2e4}{ValueToString}}(T\ value,\ \mbox{\hyperlink{a01933}{AAX\_CString}}*\ valueString)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00063\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01905_a06407f0b1287891bf658bc4e4166e2e4}{ValueToString}}(T\ value,\ int32\_t\ maxNumChars,\ \mbox{\hyperlink{a01933}{AAX\_CString}}*\ valueString)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00064\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01905_a702a4dea21a72dc8edf6b91b5a5bf5e5}{StringToValue}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a01933}{AAX\_CString}}\&\ valueString,\ T*\ value)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00065\ \};}
\DoxyCodeLine{00066\ }
\DoxyCodeLine{00067\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00068\ \mbox{\hyperlink{a01905_ab1a468a7025667b8cecbf2fc6f4f7d21}{AAX\_CPercentDisplayDelegateDecorator<T>::AAX\_CPercentDisplayDelegateDecorator}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a02221}{AAX\_IDisplayDelegate<T>}}\&\ displayDelegate)\ \ :}
\DoxyCodeLine{00069\ \ \ \ \ \mbox{\hyperlink{a02225}{AAX\_IDisplayDelegateDecorator}}<T>(displayDelegate)}
\DoxyCodeLine{00070\ \{}
\DoxyCodeLine{00071\ \}}
\DoxyCodeLine{00072\ }
\DoxyCodeLine{00073\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00074\ \mbox{\hyperlink{a01905}{AAX\_CPercentDisplayDelegateDecorator<T>}}*\ \mbox{\hyperlink{a01905_affe52efa34c969895f75b067e875dafb}{AAX\_CPercentDisplayDelegateDecorator<T>::Clone}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00075\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00076\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{a01905}{AAX\_CPercentDisplayDelegateDecorator}}(*\textcolor{keyword}{this});}
\DoxyCodeLine{00077\ \}}
\DoxyCodeLine{00078\ }
\DoxyCodeLine{00079\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00080\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{a01905_a06407f0b1287891bf658bc4e4166e2e4}{AAX\_CPercentDisplayDelegateDecorator<T>::ValueToString}}(T\ value,\ \mbox{\hyperlink{a01933}{AAX\_CString}}*\ valueString)\textcolor{keyword}{\ const\ }}
\DoxyCodeLine{00081\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00082\ \ \ \ \ value\ *=\ 100;}
\DoxyCodeLine{00083\ \ \ \ \ \textcolor{keywordtype}{bool}\ succeeded\ =\ \mbox{\hyperlink{a02225_ada5780cfa332ac7946bf95aa65ae96f5}{AAX\_IDisplayDelegateDecorator<T>::ValueToString}}(value,\ valueString);}
\DoxyCodeLine{00084\ \ \ \ \ *valueString\ +=\ \mbox{\hyperlink{a01933}{AAX\_CString}}(\textcolor{stringliteral}{"{}\%"{}});}
\DoxyCodeLine{00085\ \ \ \ \ \textcolor{keywordflow}{return}\ succeeded;}
\DoxyCodeLine{00086\ \}}
\DoxyCodeLine{00087\ }
\DoxyCodeLine{00088\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00089\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{a01905_a06407f0b1287891bf658bc4e4166e2e4}{AAX\_CPercentDisplayDelegateDecorator<T>::ValueToString}}(T\ value,\ int32\_t\ maxNumChars,\ \mbox{\hyperlink{a01933}{AAX\_CString}}*\ valueString)\textcolor{keyword}{\ const\ }}
\DoxyCodeLine{00090\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00091\ \ \ \ \ value\ *=\ 100;}
\DoxyCodeLine{00092\ \ \ \ \ \textcolor{keywordtype}{bool}\ succeeded\ =\ \mbox{\hyperlink{a02225_ada5780cfa332ac7946bf95aa65ae96f5}{AAX\_IDisplayDelegateDecorator<T>::ValueToString}}(value,\ maxNumChars-\/1,\ valueString);\ \ \ \ \ \textcolor{comment}{//<DMT>\ \ Make\ room\ for\ percentage\ symbol.}}
\DoxyCodeLine{00093\ \ \ \ \ *valueString\ +=\ \mbox{\hyperlink{a01933}{AAX\_CString}}(\textcolor{stringliteral}{"{}\%"{}});}
\DoxyCodeLine{00094\ \ \ \ \ \textcolor{keywordflow}{return}\ succeeded;}
\DoxyCodeLine{00095\ \}}
\DoxyCodeLine{00096\ }
\DoxyCodeLine{00097\ }
\DoxyCodeLine{00098\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00099\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{a01905_a702a4dea21a72dc8edf6b91b5a5bf5e5}{AAX\_CPercentDisplayDelegateDecorator<T>::StringToValue}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a01933}{AAX\_CString}}\&\ valueString,\ T*\ value)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00100\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00101\ \ \ \ \ \textcolor{comment}{//Just\ call\ through\ if\ there\ is\ obviously\ no\ unit\ string.}}
\DoxyCodeLine{00102\ \ \ \ \ \textcolor{keywordflow}{if}\ (valueString.\mbox{\hyperlink{a01933_a34ccfa250b53a721417f32d4a74bfed6}{Length}}()\ <=\ 2)}
\DoxyCodeLine{00103\ \ \ \ \ \{}
\DoxyCodeLine{00104\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ success\ =\ \mbox{\hyperlink{a02225_a18d19293f3eca619cb5bb7f1ffde1a8d}{AAX\_IDisplayDelegateDecorator<T>::StringToValue}}(valueString,\ value);}
\DoxyCodeLine{00105\ \ \ \ \ \ \ \ \ *value\ /=\ 100.0f;}
\DoxyCodeLine{00106\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ success;}
\DoxyCodeLine{00107\ \ \ \ \ \}}
\DoxyCodeLine{00108\ }
\DoxyCodeLine{00109\ \ \ \ \ \textcolor{comment}{//Just\ call\ through\ if\ the\ end\ of\ this\ string\ does\ not\ match\ the\ unit\ string.\ \ \ }}
\DoxyCodeLine{00110\ \ \ \ \ \mbox{\hyperlink{a01933}{AAX\_CString}}\ unitSubString;}
\DoxyCodeLine{00111\ \ \ \ \ valueString.\mbox{\hyperlink{a01933_a35132df5b9f73bc2ddbfd673f4a5d22a}{SubString}}(valueString.\mbox{\hyperlink{a01933_a34ccfa250b53a721417f32d4a74bfed6}{Length}}()\ -\/\ 1,\ 1,\ \&unitSubString);}
\DoxyCodeLine{00112\ \ \ \ \ \textcolor{keywordflow}{if}\ (unitSubString\ !=\ \mbox{\hyperlink{a01933}{AAX\_CString}}(\textcolor{stringliteral}{"{}\%"{}}))}
\DoxyCodeLine{00113\ \ \ \ \ \{}
\DoxyCodeLine{00114\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ success\ =\ \mbox{\hyperlink{a02225_a18d19293f3eca619cb5bb7f1ffde1a8d}{AAX\_IDisplayDelegateDecorator<T>::StringToValue}}(valueString,\ value);}
\DoxyCodeLine{00115\ \ \ \ \ \ \ \ \ *value\ /=\ 100.0f;}
\DoxyCodeLine{00116\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ success;}
\DoxyCodeLine{00117\ \ \ \ \ \}}
\DoxyCodeLine{00118\ }
\DoxyCodeLine{00119\ \ \ \ \ \textcolor{comment}{//Call\ through\ with\ the\ stripped\ down\ value\ string.\ \ }}
\DoxyCodeLine{00120\ \ \ \ \ \mbox{\hyperlink{a01933}{AAX\_CString}}\ valueSubString;}
\DoxyCodeLine{00121\ \ \ \ \ valueString.\mbox{\hyperlink{a01933_a35132df5b9f73bc2ddbfd673f4a5d22a}{SubString}}(0,\ valueString.\mbox{\hyperlink{a01933_a34ccfa250b53a721417f32d4a74bfed6}{Length}}()\ -\/\ 1,\ \&valueSubString);}
\DoxyCodeLine{00122\ \ \ \ \ \textcolor{keywordtype}{bool}\ success\ =\ \mbox{\hyperlink{a02225_a18d19293f3eca619cb5bb7f1ffde1a8d}{AAX\_IDisplayDelegateDecorator<T>::StringToValue}}(valueSubString,\ value);}
\DoxyCodeLine{00123\ \ \ \ \ *value\ /=\ 100.0f;}
\DoxyCodeLine{00124\ \ \ \ \ \textcolor{keywordflow}{return}\ success;}
\DoxyCodeLine{00125\ \}}
\DoxyCodeLine{00126\ }
\DoxyCodeLine{00127\ }
\DoxyCodeLine{00128\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00129\ }

\end{DoxyCode}
