diff options
Diffstat (limited to 'src/classlibnative/bcltype/number.h')
-rw-r--r-- | src/classlibnative/bcltype/number.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/classlibnative/bcltype/number.h b/src/classlibnative/bcltype/number.h new file mode 100644 index 0000000000..ba0b3cb49d --- /dev/null +++ b/src/classlibnative/bcltype/number.h @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// +// +// File: Number.h +// + +// + +#ifndef _NUMBER_H_ +#define _NUMBER_H_ + +#include <pshpack1.h> + +#define NUMBER_MAXDIGITS 50 + +#ifndef FEATURE_BCL_FORMATTING +enum PAL_NUMBERType { + PALNUMBERTYPE_INT = 1, // PAL_IntToNumber + PALNUMBERTYPE_INT64 = 2, // PAL_Int64ToNumber + PALNUMBERTYPE_UINT = 3, // PAL_UIntToNumber + PALNUMBERTYPE_UINT64 = 4, // PAL_UInt64ToNumber + PALNUMBERTYPE_DOUBLE = 5, // PAL_DoubleToNumber +}; +#endif + +struct NUMBER { + int precision; + int scale; + int sign; + wchar_t digits[NUMBER_MAXDIGITS + 1]; + wchar_t* allDigits; +#ifndef FEATURE_BCL_FORMATTING + PAL_NUMBERHolder palNumber; + PAL_NUMBERType palNumberType; +#endif + NUMBER() : precision(0), scale(0), sign(0), allDigits(NULL) {} +}; + +class COMNumber +{ +public: + static FCDECL3_VII(Object*, FormatDecimal, DECIMAL value, StringObject* formatUNSAFE, NumberFormatInfo* numfmtUNSAFE); + static FCDECL3_VII(Object*, FormatDouble, double value, StringObject* formatUNSAFE, NumberFormatInfo* numfmtUNSAFE); + static FCDECL3_VII(Object*, FormatSingle, float value, StringObject* formatUNSAFE, NumberFormatInfo* numfmtUNSAFE); + static FCDECL3(Object*, FormatInt32, INT32 value, StringObject* formatUNSAFE, NumberFormatInfo* numfmtUNSAFE); + static FCDECL3(Object*, FormatUInt32, UINT32 value, StringObject* formatUNSAFE, NumberFormatInfo* numfmtUNSAFE); + static FCDECL3_VII(Object*, FormatInt64, INT64 value, StringObject* formatUNSAFE, NumberFormatInfo* numfmtUNSAFE); + static FCDECL3_VII(Object*, FormatUInt64, UINT64 value, StringObject* formatUNSAFE, NumberFormatInfo* numfmtUNSAFE); +#if !defined(FEATURE_CORECLR) + static FCDECL4(Object*, FormatNumberBuffer, BYTE* number, StringObject* formatUNSAFE, NumberFormatInfo* numfmtUNSAFE, __in_z wchar_t* allDigits); +#endif // !FEATURE_CORECLR + static FCDECL2(FC_BOOL_RET, NumberBufferToDecimal, BYTE* number, DECIMAL* value); + static FCDECL2(FC_BOOL_RET, NumberBufferToDouble, BYTE* number, double* value); + + static wchar_t* Int32ToDecChars(__in wchar_t* p, unsigned int value, int digits); +}; + +#include <poppack.h> + +#endif // _NUMBER_H_ |