\hypertarget{a00761_source}{}\doxysection{AAX\+\_\+\+CPercent\+Display\+Delegate\+Decorator.\+h}
\label{a00761_source}\index{AAX\_CPercentDisplayDelegateDecorator.h@{AAX\_CPercentDisplayDelegateDecorator.h}}
\mbox{\hyperlink{a00761}{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}{\#pragma\ once}}
\DoxyCodeLine{00036\ }
\DoxyCodeLine{00037\ \textcolor{preprocessor}{\#ifndef\ AAX\_CPERCENTDISPLAYDELEGATEDECORATOR\_H}}
\DoxyCodeLine{00038\ \textcolor{preprocessor}{\#define\ AAX\_CPERCENTDISPLAYDELEGATEDECORATOR\_H}}
\DoxyCodeLine{00039\ }
\DoxyCodeLine{00040\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00548}{AAX\_IDisplayDelegateDecorator.h}}"{}}}
\DoxyCodeLine{00041\ }
\DoxyCodeLine{00042\ \textcolor{preprocessor}{\#include\ <cmath>}}
\DoxyCodeLine{00043\ }
\DoxyCodeLine{00044\ }
\DoxyCodeLine{00067\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00068\ \textcolor{keyword}{class\ }\mbox{\hyperlink{a01918}{AAX\_CPercentDisplayDelegateDecorator}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{a02246}{AAX\_IDisplayDelegateDecorator}}<T>}
\DoxyCodeLine{00069\ \{}
\DoxyCodeLine{00070\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00071\ \ \ \ \ \mbox{\hyperlink{a01918}{AAX\_CPercentDisplayDelegateDecorator}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a02242}{AAX\_IDisplayDelegate<T>}}\&\ displayDelegate);}
\DoxyCodeLine{00072\ \ \ \ \ }
\DoxyCodeLine{00073\ \ \ \ \ \textcolor{comment}{//Virtual\ Overrides}}
\DoxyCodeLine{00074\ \ \ \ \ \mbox{\hyperlink{a01918}{AAX\_CPercentDisplayDelegateDecorator<T>}}*\ \mbox{\hyperlink{a01918_affe52efa34c969895f75b067e875dafb}{Clone}}()\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00075\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01918_a06407f0b1287891bf658bc4e4166e2e4}{ValueToString}}(T\ value,\ \mbox{\hyperlink{a01946}{AAX\_CString}}*\ valueString)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00076\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01918_a06407f0b1287891bf658bc4e4166e2e4}{ValueToString}}(T\ value,\ int32\_t\ maxNumChars,\ \mbox{\hyperlink{a01946}{AAX\_CString}}*\ valueString)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00077\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01918_a702a4dea21a72dc8edf6b91b5a5bf5e5}{StringToValue}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a01946}{AAX\_CString}}\&\ valueString,\ T*\ value)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00078\ \};}
\DoxyCodeLine{00079\ }
\DoxyCodeLine{00080\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00081\ \mbox{\hyperlink{a01918_ab1a468a7025667b8cecbf2fc6f4f7d21}{AAX\_CPercentDisplayDelegateDecorator<T>::AAX\_CPercentDisplayDelegateDecorator}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a02242}{AAX\_IDisplayDelegate<T>}}\&\ displayDelegate)\ \ :}
\DoxyCodeLine{00082\ \ \ \ \ \mbox{\hyperlink{a02246}{AAX\_IDisplayDelegateDecorator}}<T>(displayDelegate)}
\DoxyCodeLine{00083\ \{}
\DoxyCodeLine{00084\ \}}
\DoxyCodeLine{00085\ }
\DoxyCodeLine{00086\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00087\ \mbox{\hyperlink{a01918}{AAX\_CPercentDisplayDelegateDecorator<T>}}*\ \mbox{\hyperlink{a01918_affe52efa34c969895f75b067e875dafb}{AAX\_CPercentDisplayDelegateDecorator<T>::Clone}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00088\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00089\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{a01918}{AAX\_CPercentDisplayDelegateDecorator}}(*\textcolor{keyword}{this});}
\DoxyCodeLine{00090\ \}}
\DoxyCodeLine{00091\ }
\DoxyCodeLine{00092\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00093\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{a01918_a06407f0b1287891bf658bc4e4166e2e4}{AAX\_CPercentDisplayDelegateDecorator<T>::ValueToString}}(T\ value,\ \mbox{\hyperlink{a01946}{AAX\_CString}}*\ valueString)\textcolor{keyword}{\ const\ }}
\DoxyCodeLine{00094\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00095\ \ \ \ \ value\ *=\ 100;}
\DoxyCodeLine{00096\ \ \ \ \ \textcolor{keywordtype}{bool}\ succeeded\ =\ \mbox{\hyperlink{a02246_ada5780cfa332ac7946bf95aa65ae96f5}{AAX\_IDisplayDelegateDecorator<T>::ValueToString}}(value,\ valueString);}
\DoxyCodeLine{00097\ \ \ \ \ *valueString\ +=\ \mbox{\hyperlink{a01946}{AAX\_CString}}(\textcolor{stringliteral}{"{}\%"{}});}
\DoxyCodeLine{00098\ \ \ \ \ \textcolor{keywordflow}{return}\ succeeded;}
\DoxyCodeLine{00099\ \}}
\DoxyCodeLine{00100\ }
\DoxyCodeLine{00101\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00102\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{a01918_a06407f0b1287891bf658bc4e4166e2e4}{AAX\_CPercentDisplayDelegateDecorator<T>::ValueToString}}(T\ value,\ int32\_t\ maxNumChars,\ \mbox{\hyperlink{a01946}{AAX\_CString}}*\ valueString)\textcolor{keyword}{\ const\ }}
\DoxyCodeLine{00103\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00104\ \ \ \ \ value\ *=\ 100;}
\DoxyCodeLine{00105\ \ \ \ \ \textcolor{keywordtype}{bool}\ succeeded\ =\ \mbox{\hyperlink{a02246_ada5780cfa332ac7946bf95aa65ae96f5}{AAX\_IDisplayDelegateDecorator<T>::ValueToString}}(value,\ maxNumChars-\/1,\ valueString);\ \ \ \ \ \textcolor{comment}{//<DMT>\ \ Make\ room\ for\ percentage\ symbol.}}
\DoxyCodeLine{00106\ \ \ \ \ *valueString\ +=\ \mbox{\hyperlink{a01946}{AAX\_CString}}(\textcolor{stringliteral}{"{}\%"{}});}
\DoxyCodeLine{00107\ \ \ \ \ \textcolor{keywordflow}{return}\ succeeded;}
\DoxyCodeLine{00108\ \}}
\DoxyCodeLine{00109\ }
\DoxyCodeLine{00110\ }
\DoxyCodeLine{00111\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00112\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{a01918_a702a4dea21a72dc8edf6b91b5a5bf5e5}{AAX\_CPercentDisplayDelegateDecorator<T>::StringToValue}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a01946}{AAX\_CString}}\&\ valueString,\ T*\ value)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00113\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00114\ \ \ \ \ \textcolor{comment}{//Just\ call\ through\ if\ there\ is\ obviously\ no\ unit\ string.}}
\DoxyCodeLine{00115\ \ \ \ \ \textcolor{keywordflow}{if}\ (valueString.\mbox{\hyperlink{a01946_a34ccfa250b53a721417f32d4a74bfed6}{Length}}()\ <=\ 2)}
\DoxyCodeLine{00116\ \ \ \ \ \{}
\DoxyCodeLine{00117\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ success\ =\ \mbox{\hyperlink{a02246_a18d19293f3eca619cb5bb7f1ffde1a8d}{AAX\_IDisplayDelegateDecorator<T>::StringToValue}}(valueString,\ value);}
\DoxyCodeLine{00118\ \ \ \ \ \ \ \ \ *value\ /=\ 100.0f;}
\DoxyCodeLine{00119\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ success;}
\DoxyCodeLine{00120\ \ \ \ \ \}}
\DoxyCodeLine{00121\ }
\DoxyCodeLine{00122\ \ \ \ \ \textcolor{comment}{//Just\ call\ through\ if\ the\ end\ of\ this\ string\ does\ not\ match\ the\ unit\ string.\ \ \ }}
\DoxyCodeLine{00123\ \ \ \ \ \mbox{\hyperlink{a01946}{AAX\_CString}}\ unitSubString;}
\DoxyCodeLine{00124\ \ \ \ \ valueString.\mbox{\hyperlink{a01946_a35132df5b9f73bc2ddbfd673f4a5d22a}{SubString}}(valueString.\mbox{\hyperlink{a01946_a34ccfa250b53a721417f32d4a74bfed6}{Length}}()\ -\/\ 1,\ 1,\ \&unitSubString);}
\DoxyCodeLine{00125\ \ \ \ \ \textcolor{keywordflow}{if}\ (unitSubString\ !=\ \mbox{\hyperlink{a01946}{AAX\_CString}}(\textcolor{stringliteral}{"{}\%"{}}))}
\DoxyCodeLine{00126\ \ \ \ \ \{}
\DoxyCodeLine{00127\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ success\ =\ \mbox{\hyperlink{a02246_a18d19293f3eca619cb5bb7f1ffde1a8d}{AAX\_IDisplayDelegateDecorator<T>::StringToValue}}(valueString,\ value);}
\DoxyCodeLine{00128\ \ \ \ \ \ \ \ \ *value\ /=\ 100.0f;}
\DoxyCodeLine{00129\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ success;}
\DoxyCodeLine{00130\ \ \ \ \ \}}
\DoxyCodeLine{00131\ }
\DoxyCodeLine{00132\ \ \ \ \ \textcolor{comment}{//Call\ through\ with\ the\ stripped\ down\ value\ string.\ \ }}
\DoxyCodeLine{00133\ \ \ \ \ \mbox{\hyperlink{a01946}{AAX\_CString}}\ valueSubString;}
\DoxyCodeLine{00134\ \ \ \ \ valueString.\mbox{\hyperlink{a01946_a35132df5b9f73bc2ddbfd673f4a5d22a}{SubString}}(0,\ valueString.\mbox{\hyperlink{a01946_a34ccfa250b53a721417f32d4a74bfed6}{Length}}()\ -\/\ 1,\ \&valueSubString);}
\DoxyCodeLine{00135\ \ \ \ \ \textcolor{keywordtype}{bool}\ success\ =\ \mbox{\hyperlink{a02246_a18d19293f3eca619cb5bb7f1ffde1a8d}{AAX\_IDisplayDelegateDecorator<T>::StringToValue}}(valueSubString,\ value);}
\DoxyCodeLine{00136\ \ \ \ \ *value\ /=\ 100.0f;}
\DoxyCodeLine{00137\ \ \ \ \ \textcolor{keywordflow}{return}\ success;}
\DoxyCodeLine{00138\ \}}
\DoxyCodeLine{00139\ }
\DoxyCodeLine{00140\ }
\DoxyCodeLine{00141\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00142\ }

\end{DoxyCode}
