\hypertarget{a00773_source}{}\doxysection{AAX\+\_\+\+CNumber\+Display\+Delegate.\+h}
\label{a00773_source}\index{AAX\_CNumberDisplayDelegate.h@{AAX\_CNumberDisplayDelegate.h}}
\mbox{\hyperlink{a00773}{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\ 2013-\/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\_CNUMBERDISPLAYDELEGATE\_H}}
\DoxyCodeLine{00023\ \textcolor{preprocessor}{\#define\ AAX\_CNUMBERDISPLAYDELEGATE\_H}}
\DoxyCodeLine{00024\ }
\DoxyCodeLine{00025\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00467}{AAX\_IDisplayDelegate.h}}"{}}}
\DoxyCodeLine{00026\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00413}{AAX\_CString.h}}"{}}}
\DoxyCodeLine{00027\ }
\DoxyCodeLine{00028\ }
\DoxyCodeLine{00038\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ u\textcolor{keywordtype}{int}32\_t\ Precision=2,\ u\textcolor{keywordtype}{int}32\_t\ SpaceAfter=0>}
\DoxyCodeLine{00039\ \textcolor{keyword}{class\ }\mbox{\hyperlink{a01865}{AAX\_CNumberDisplayDelegate}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{a02221}{AAX\_IDisplayDelegate}}<T>}
\DoxyCodeLine{00040\ \{}
\DoxyCodeLine{00041\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00042\ \ \ \ \ \textcolor{comment}{//Virtual\ Overrides}}
\DoxyCodeLine{00043\ \ \ \ \ \mbox{\hyperlink{a01865}{AAX\_CNumberDisplayDelegate}}*\ \ \ \mbox{\hyperlink{a01865_ab92a0973a7ed56034aa269c760d6b935}{Clone}}()\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00044\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01865_a260439b47a0890a008f7984958e11662}{ValueToString}}(T\ value,\ \mbox{\hyperlink{a01933}{AAX\_CString}}*\ valueString)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00045\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01865_a260439b47a0890a008f7984958e11662}{ValueToString}}(T\ value,\ int32\_t\ maxNumChars,\ \mbox{\hyperlink{a01933}{AAX\_CString}}*\ valueString)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00046\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01865_ad7fba7856368f7ffe4398e6efd65dfa5}{StringToValue}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a01933}{AAX\_CString}}\&\ valueString,\ T*\ value)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00047\ \};}
\DoxyCodeLine{00048\ }
\DoxyCodeLine{00049\ }
\DoxyCodeLine{00050\ }
\DoxyCodeLine{00051\ }
\DoxyCodeLine{00052\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ u\textcolor{keywordtype}{int}32\_t\ Precision,\ u\textcolor{keywordtype}{int}32\_t\ SpaceAfter>}
\DoxyCodeLine{00053\ \mbox{\hyperlink{a01865}{AAX\_CNumberDisplayDelegate<T,Precision,SpaceAfter>}}*\ \ \ \ \ \ \ \mbox{\hyperlink{a01865_ab92a0973a7ed56034aa269c760d6b935}{AAX\_CNumberDisplayDelegate<T,Precision,SpaceAfter>::Clone}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00054\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00055\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{a01865}{AAX\_CNumberDisplayDelegate}}(*\textcolor{keyword}{this});}
\DoxyCodeLine{00056\ \}}
\DoxyCodeLine{00057\ }
\DoxyCodeLine{00058\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ u\textcolor{keywordtype}{int}32\_t\ Precision,\ u\textcolor{keywordtype}{int}32\_t\ SpaceAfter>}
\DoxyCodeLine{00059\ \textcolor{keywordtype}{bool}\ \ \ \ \mbox{\hyperlink{a01865_a260439b47a0890a008f7984958e11662}{AAX\_CNumberDisplayDelegate<T,Precision,SpaceAfter>::ValueToString}}(T\ value,\ \mbox{\hyperlink{a01933}{AAX\_CString}}*\ valueString)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00060\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00061\ \ \ \ \ valueString-\/>\mbox{\hyperlink{a01933_a866d456c7cad181d1feda559a0ca3d07}{Clear}}();}
\DoxyCodeLine{00062\ \ \ \ \ valueString-\/>\mbox{\hyperlink{a01933_afa3a7dbecce9b739320e9a2ec4619194}{AppendNumber}}(value,\ Precision);}
\DoxyCodeLine{00063\ \ \ \ \ \textcolor{keywordflow}{if}\ (SpaceAfter\ !=\ 0)}
\DoxyCodeLine{00064\ \ \ \ \ \ \ \ \ valueString-\/>\mbox{\hyperlink{a01933_ac3aa81a641264098a440a4857be62091}{Append}}(\textcolor{stringliteral}{"{}\ "{}});\ \ \ \ \ \textcolor{comment}{//Added\ a\ space\ after\ the\ number\ for\ easier\ display\ of\ units.}}
\DoxyCodeLine{00065\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00066\ \}}
\DoxyCodeLine{00067\ }
\DoxyCodeLine{00068\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ u\textcolor{keywordtype}{int}32\_t\ Precision,\ u\textcolor{keywordtype}{int}32\_t\ SpaceAfter>}
\DoxyCodeLine{00069\ \textcolor{keywordtype}{bool}\ \ \ \ \mbox{\hyperlink{a01865_a260439b47a0890a008f7984958e11662}{AAX\_CNumberDisplayDelegate<T,Precision,SpaceAfter>::ValueToString}}(T\ value,\ int32\_t\ maxNumChars,\ \mbox{\hyperlink{a01933}{AAX\_CString}}*\ valueString)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00070\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00071\ \ \ \ \ valueString-\/>\mbox{\hyperlink{a01933_a866d456c7cad181d1feda559a0ca3d07}{Clear}}();}
\DoxyCodeLine{00072\ \ \ \ \ valueString-\/>\mbox{\hyperlink{a01933_afa3a7dbecce9b739320e9a2ec4619194}{AppendNumber}}(value,\ Precision);}
\DoxyCodeLine{00073\ \ \ \ \ uint32\_t\ strlen\ =\ valueString-\/>\mbox{\hyperlink{a01933_a34ccfa250b53a721417f32d4a74bfed6}{Length}}();}
\DoxyCodeLine{00074\ \ \ \ \ \textcolor{keyword}{const}\ uint32\_t\ maxNumCharsUnsigned\ =\ (0\ <=\ maxNumChars)\ ?\ \textcolor{keyword}{static\_cast<}uint32\_t\textcolor{keyword}{>}(maxNumChars)\ :\ 0;}
\DoxyCodeLine{00075\ \ \ \ \ \textcolor{keywordflow}{if}\ (strlen\ >\ maxNumCharsUnsigned)}
\DoxyCodeLine{00076\ \ \ \ \ \{}
\DoxyCodeLine{00077\ \ \ \ \ \ \ \ \ valueString-\/>\mbox{\hyperlink{a01933_a8b31ded2ef83e2a4e32e547dded7f5bd}{Erase}}(maxNumCharsUnsigned,\ strlen-\/maxNumCharsUnsigned);}
\DoxyCodeLine{00078\ \ \ \ \ \ \ \ \ strlen\ =\ valueString-\/>\mbox{\hyperlink{a01933_a34ccfa250b53a721417f32d4a74bfed6}{Length}}();}
\DoxyCodeLine{00079\ \ \ \ \ \}}
\DoxyCodeLine{00080\ \ \ \ \ }
\DoxyCodeLine{00081\ \ \ \ \ \textcolor{keywordflow}{if}\ (\ 0\ <\ maxNumCharsUnsigned\ \&\&\ strlen\ ==\ maxNumCharsUnsigned\ \&\&\ (*valueString)[maxNumCharsUnsigned-\/1]\ ==\ \textcolor{charliteral}{'.'})\ \ \textcolor{comment}{//<DMT>\ Edge\ case\ when\ the\ decimal\ point\ is\ the\ last\ character,\ we\ probably\ shouldn't\ show\ it.}}
\DoxyCodeLine{00082\ \ \ \ \ \{}
\DoxyCodeLine{00083\ \ \ \ \ \ \ \ \ valueString-\/>\mbox{\hyperlink{a01933_a8b31ded2ef83e2a4e32e547dded7f5bd}{Erase}}(maxNumCharsUnsigned-\/1,\ 1);}
\DoxyCodeLine{00084\ \ \ \ \ \ \ \ \ strlen\ =\ valueString-\/>\mbox{\hyperlink{a01933_a34ccfa250b53a721417f32d4a74bfed6}{Length}}();}
\DoxyCodeLine{00085\ \ \ \ \ \}}
\DoxyCodeLine{00086\ }
\DoxyCodeLine{00087\ \ \ \ \ \textcolor{keywordflow}{if}\ ((SpaceAfter\ !=\ 0)\ \&\&\ (maxNumCharsUnsigned\ >\ strlen)\ \&\&\ (maxNumCharsUnsigned-\/strlen\ >\ 2))\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//<DMT>\ Kind\ of\ a\ random\ threshold\ for\ dropping\ the\ space\ after,\ but\ seems\ reasonable\ for\ our\ control\ surfaces.\ \ (allows\ dB\ and\ Unit\ prefixes)}}
\DoxyCodeLine{00088\ \ \ \ \ \ \ \ \ valueString-\/>\mbox{\hyperlink{a01933_ac3aa81a641264098a440a4857be62091}{Append}}(\textcolor{stringliteral}{"{}\ "{}});\ \ \ \ \ \textcolor{comment}{//Added\ a\ space\ after\ the\ number\ for\ easier\ display\ of\ units.}}
\DoxyCodeLine{00089\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00090\ \}}
\DoxyCodeLine{00091\ }
\DoxyCodeLine{00092\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ u\textcolor{keywordtype}{int}32\_t\ Precision,\ u\textcolor{keywordtype}{int}32\_t\ SpaceAfter>}
\DoxyCodeLine{00093\ \textcolor{keywordtype}{bool}\ \ \ \ \mbox{\hyperlink{a01865_ad7fba7856368f7ffe4398e6efd65dfa5}{AAX\_CNumberDisplayDelegate<T,Precision,SpaceAfter>::StringToValue}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a01933}{AAX\_CString}}\&\ valueString,\ T*\ value)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00094\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00095\ \ \ \ \ \textcolor{keywordtype}{double}\ dValue;}
\DoxyCodeLine{00096\ \ \ \ \ \textcolor{keywordflow}{if}\ (valueString.\mbox{\hyperlink{a01933_a6dc9a81e486621fd5e3ea56df137f3d7}{ToDouble}}(\&dValue))}
\DoxyCodeLine{00097\ \ \ \ \ \{}
\DoxyCodeLine{00098\ \ \ \ \ \ \ \ \ *value\ =\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}\ (dValue);}
\DoxyCodeLine{00099\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};\ \ \ \ }
\DoxyCodeLine{00100\ \ \ \ \ \}}
\DoxyCodeLine{00101\ \ \ \ \ *value\ =\ 0;}
\DoxyCodeLine{00102\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00103\ \}}
\DoxyCodeLine{00104\ }
\DoxyCodeLine{00105\ }
\DoxyCodeLine{00106\ }
\DoxyCodeLine{00107\ }
\DoxyCodeLine{00108\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//AAX\_CNUMBERDISPLAYDELEGATE\_H}}

\end{DoxyCode}
