\hypertarget{a00785_source}{}\doxysection{AAX\+\_\+\+CNumber\+Display\+Delegate.\+h}
\label{a00785_source}\index{AAX\_CNumberDisplayDelegate.h@{AAX\_CNumberDisplayDelegate.h}}
\mbox{\hyperlink{a00785}{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-\/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\_CNUMBERDISPLAYDELEGATE\_H}}
\DoxyCodeLine{00036\ \textcolor{preprocessor}{\#define\ AAX\_CNUMBERDISPLAYDELEGATE\_H}}
\DoxyCodeLine{00037\ }
\DoxyCodeLine{00038\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00476}{AAX\_IDisplayDelegate.h}}"{}}}
\DoxyCodeLine{00039\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00416}{AAX\_CString.h}}"{}}}
\DoxyCodeLine{00040\ }
\DoxyCodeLine{00041\ }
\DoxyCodeLine{00051\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ u\textcolor{keywordtype}{int}32\_t\ Precision=2,\ u\textcolor{keywordtype}{int}32\_t\ SpaceAfter=0>}
\DoxyCodeLine{00052\ \textcolor{keyword}{class\ }\mbox{\hyperlink{a01878}{AAX\_CNumberDisplayDelegate}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{a02242}{AAX\_IDisplayDelegate}}<T>}
\DoxyCodeLine{00053\ \{}
\DoxyCodeLine{00054\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00055\ \ \ \ \ \textcolor{comment}{//Virtual\ Overrides}}
\DoxyCodeLine{00056\ \ \ \ \ \mbox{\hyperlink{a01878}{AAX\_CNumberDisplayDelegate}}*\ \ \ \mbox{\hyperlink{a01878_ab92a0973a7ed56034aa269c760d6b935}{Clone}}()\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00057\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01878_a260439b47a0890a008f7984958e11662}{ValueToString}}(T\ value,\ \mbox{\hyperlink{a01946}{AAX\_CString}}*\ valueString)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00058\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01878_a260439b47a0890a008f7984958e11662}{ValueToString}}(T\ value,\ int32\_t\ maxNumChars,\ \mbox{\hyperlink{a01946}{AAX\_CString}}*\ valueString)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00059\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \mbox{\hyperlink{a01878_ad7fba7856368f7ffe4398e6efd65dfa5}{StringToValue}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a01946}{AAX\_CString}}\&\ valueString,\ T*\ value)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00060\ \};}
\DoxyCodeLine{00061\ }
\DoxyCodeLine{00062\ }
\DoxyCodeLine{00063\ }
\DoxyCodeLine{00064\ }
\DoxyCodeLine{00065\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ u\textcolor{keywordtype}{int}32\_t\ Precision,\ u\textcolor{keywordtype}{int}32\_t\ SpaceAfter>}
\DoxyCodeLine{00066\ \mbox{\hyperlink{a01878}{AAX\_CNumberDisplayDelegate<T,Precision,SpaceAfter>}}*\ \ \ \ \ \ \ \mbox{\hyperlink{a01878_ab92a0973a7ed56034aa269c760d6b935}{AAX\_CNumberDisplayDelegate<T,Precision,SpaceAfter>::Clone}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00067\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00068\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{a01878}{AAX\_CNumberDisplayDelegate}}(*\textcolor{keyword}{this});}
\DoxyCodeLine{00069\ \}}
\DoxyCodeLine{00070\ }
\DoxyCodeLine{00071\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ u\textcolor{keywordtype}{int}32\_t\ Precision,\ u\textcolor{keywordtype}{int}32\_t\ SpaceAfter>}
\DoxyCodeLine{00072\ \textcolor{keywordtype}{bool}\ \ \ \ \mbox{\hyperlink{a01878_a260439b47a0890a008f7984958e11662}{AAX\_CNumberDisplayDelegate<T,Precision,SpaceAfter>::ValueToString}}(T\ value,\ \mbox{\hyperlink{a01946}{AAX\_CString}}*\ valueString)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00073\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00074\ \ \ \ \ valueString-\/>\mbox{\hyperlink{a01946_a866d456c7cad181d1feda559a0ca3d07}{Clear}}();}
\DoxyCodeLine{00075\ \ \ \ \ valueString-\/>\mbox{\hyperlink{a01946_afa3a7dbecce9b739320e9a2ec4619194}{AppendNumber}}(value,\ Precision);}
\DoxyCodeLine{00076\ \ \ \ \ \textcolor{keywordflow}{if}\ (SpaceAfter\ !=\ 0)}
\DoxyCodeLine{00077\ \ \ \ \ \ \ \ \ valueString-\/>\mbox{\hyperlink{a01946_ac3aa81a641264098a440a4857be62091}{Append}}(\textcolor{stringliteral}{"{}\ "{}});\ \ \ \ \ \textcolor{comment}{//Added\ a\ space\ after\ the\ number\ for\ easier\ display\ of\ units.}}
\DoxyCodeLine{00078\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00079\ \}}
\DoxyCodeLine{00080\ }
\DoxyCodeLine{00081\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ u\textcolor{keywordtype}{int}32\_t\ Precision,\ u\textcolor{keywordtype}{int}32\_t\ SpaceAfter>}
\DoxyCodeLine{00082\ \textcolor{keywordtype}{bool}\ \ \ \ \mbox{\hyperlink{a01878_a260439b47a0890a008f7984958e11662}{AAX\_CNumberDisplayDelegate<T,Precision,SpaceAfter>::ValueToString}}(T\ value,\ int32\_t\ maxNumChars,\ \mbox{\hyperlink{a01946}{AAX\_CString}}*\ valueString)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00083\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00084\ \ \ \ \ valueString-\/>\mbox{\hyperlink{a01946_a866d456c7cad181d1feda559a0ca3d07}{Clear}}();}
\DoxyCodeLine{00085\ \ \ \ \ valueString-\/>\mbox{\hyperlink{a01946_afa3a7dbecce9b739320e9a2ec4619194}{AppendNumber}}(value,\ Precision);}
\DoxyCodeLine{00086\ \ \ \ \ uint32\_t\ strlen\ =\ valueString-\/>\mbox{\hyperlink{a01946_a34ccfa250b53a721417f32d4a74bfed6}{Length}}();}
\DoxyCodeLine{00087\ \ \ \ \ \textcolor{keyword}{const}\ uint32\_t\ maxNumCharsUnsigned\ =\ (0\ <=\ maxNumChars)\ ?\ \textcolor{keyword}{static\_cast<}uint32\_t\textcolor{keyword}{>}(maxNumChars)\ :\ 0;}
\DoxyCodeLine{00088\ \ \ \ \ \textcolor{keywordflow}{if}\ (strlen\ >\ maxNumCharsUnsigned)}
\DoxyCodeLine{00089\ \ \ \ \ \{}
\DoxyCodeLine{00090\ \ \ \ \ \ \ \ \ valueString-\/>\mbox{\hyperlink{a01946_a8b31ded2ef83e2a4e32e547dded7f5bd}{Erase}}(maxNumCharsUnsigned,\ strlen-\/maxNumCharsUnsigned);}
\DoxyCodeLine{00091\ \ \ \ \ \ \ \ \ strlen\ =\ valueString-\/>\mbox{\hyperlink{a01946_a34ccfa250b53a721417f32d4a74bfed6}{Length}}();}
\DoxyCodeLine{00092\ \ \ \ \ \}}
\DoxyCodeLine{00093\ \ \ \ \ }
\DoxyCodeLine{00094\ \ \ \ \ \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{00095\ \ \ \ \ \{}
\DoxyCodeLine{00096\ \ \ \ \ \ \ \ \ valueString-\/>\mbox{\hyperlink{a01946_a8b31ded2ef83e2a4e32e547dded7f5bd}{Erase}}(maxNumCharsUnsigned-\/1,\ 1);}
\DoxyCodeLine{00097\ \ \ \ \ \ \ \ \ strlen\ =\ valueString-\/>\mbox{\hyperlink{a01946_a34ccfa250b53a721417f32d4a74bfed6}{Length}}();}
\DoxyCodeLine{00098\ \ \ \ \ \}}
\DoxyCodeLine{00099\ }
\DoxyCodeLine{00100\ \ \ \ \ \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{00101\ \ \ \ \ \ \ \ \ valueString-\/>\mbox{\hyperlink{a01946_ac3aa81a641264098a440a4857be62091}{Append}}(\textcolor{stringliteral}{"{}\ "{}});\ \ \ \ \ \textcolor{comment}{//Added\ a\ space\ after\ the\ number\ for\ easier\ display\ of\ units.}}
\DoxyCodeLine{00102\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00103\ \}}
\DoxyCodeLine{00104\ }
\DoxyCodeLine{00105\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ u\textcolor{keywordtype}{int}32\_t\ Precision,\ u\textcolor{keywordtype}{int}32\_t\ SpaceAfter>}
\DoxyCodeLine{00106\ \textcolor{keywordtype}{bool}\ \ \ \ \mbox{\hyperlink{a01878_ad7fba7856368f7ffe4398e6efd65dfa5}{AAX\_CNumberDisplayDelegate<T,Precision,SpaceAfter>::StringToValue}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a01946}{AAX\_CString}}\&\ valueString,\ T*\ value)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00107\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00108\ \ \ \ \ \textcolor{keywordtype}{double}\ dValue;}
\DoxyCodeLine{00109\ \ \ \ \ \textcolor{keywordflow}{if}\ (valueString.\mbox{\hyperlink{a01946_a6dc9a81e486621fd5e3ea56df137f3d7}{ToDouble}}(\&dValue))}
\DoxyCodeLine{00110\ \ \ \ \ \{}
\DoxyCodeLine{00111\ \ \ \ \ \ \ \ \ *value\ =\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}\ (dValue);}
\DoxyCodeLine{00112\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};\ \ \ \ }
\DoxyCodeLine{00113\ \ \ \ \ \}}
\DoxyCodeLine{00114\ \ \ \ \ *value\ =\ 0;}
\DoxyCodeLine{00115\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00116\ \}}
\DoxyCodeLine{00117\ }
\DoxyCodeLine{00118\ }
\DoxyCodeLine{00119\ }
\DoxyCodeLine{00120\ }
\DoxyCodeLine{00121\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//AAX\_CNUMBERDISPLAYDELEGATE\_H}}

\end{DoxyCode}
