mirror of
https://github.com/Halofreak1990/XFXFramework
synced 2024-12-26 13:49:34 +01:00
Added Is* methods to Double
Updated CultureInfo Added MidpointRounding_t enum Updated file comments
This commit is contained in:
parent
39ba6d598e
commit
940e173334
@ -36,6 +36,9 @@ namespace System
|
||||
int CompareTo(const Double other) const;
|
||||
bool Equals(const Double other) const;
|
||||
int GetHashCode() const;
|
||||
static bool IsNaN(const Double& d);
|
||||
static bool IsNegativeInfinity(const Double& d);
|
||||
static bool IsPositiveInfinity(const Double& d);
|
||||
static const Type& GetType();
|
||||
const String ToString() const;
|
||||
static const String ToString(const double value);
|
||||
|
@ -1,10 +1,12 @@
|
||||
/****************************************************************
|
||||
* Enums.h *
|
||||
* Defines enumerations used in the System namespace *
|
||||
* *
|
||||
* Enumerations are defined inside structs to prevent *
|
||||
* namespace pollution, and easier distinction. *
|
||||
****************************************************************/
|
||||
/*****************************************************************************
|
||||
* Enums.h *
|
||||
* Defines enumerations used in the System namespace *
|
||||
* *
|
||||
* Enumerations are defined inside structs to prevent *
|
||||
* namespace pollution, and easier distinction. *
|
||||
* *
|
||||
* Copyright (c) XFX Team. All rights reserved. *
|
||||
*****************************************************************************/
|
||||
#ifndef _SYSTEM_ENUMS_
|
||||
#define _SYSTEM_ENUMS_
|
||||
|
||||
@ -37,6 +39,22 @@ namespace System
|
||||
};
|
||||
};
|
||||
|
||||
// Specifies how mathematical rounding methods should process a number that is midway between two numbers.
|
||||
struct MidpointRounding
|
||||
{
|
||||
enum type
|
||||
{
|
||||
/**
|
||||
* When a number is halfway between two others, it is rounded toward the nearest even number.
|
||||
*/
|
||||
ToEven,
|
||||
/**
|
||||
* When a number is halfway between two others, it is rounded toward the nearest number that is away from zero.
|
||||
*/
|
||||
AwayFromZero
|
||||
};
|
||||
};
|
||||
|
||||
// Identifies the operating system, or platform, supported by an assembly.
|
||||
struct PlatformID
|
||||
{
|
||||
@ -160,6 +178,7 @@ namespace System
|
||||
|
||||
typedef DateTimeKind::type DateTimeKind_t;
|
||||
typedef DayOfWeek::type DayOfWeek_t;
|
||||
typedef MidpointRounding::type MidpointRounding_t;
|
||||
typedef PlatformID::type PlatformID_t;
|
||||
typedef StringComparison::type StringComparison_t;
|
||||
typedef StringSplitOptions::type StringSplitOptions_t;
|
||||
|
@ -2,14 +2,29 @@
|
||||
#ifndef _SYSTEM_GLOBALIZATION_CULTUREINFO_
|
||||
#define _SYSTEM_GLOBALIZATION_CULTUREINFO_
|
||||
|
||||
#include <System/Interfaces.h>
|
||||
|
||||
namespace System
|
||||
{
|
||||
class String;
|
||||
|
||||
namespace Globalization
|
||||
{
|
||||
class CultureInfo
|
||||
/**
|
||||
* Provides information about a specific culture (called a "locale" for unmanaged code development). The information includes the names for the culture, the writing system, the calendar used, and formatting for dates and sort strings.
|
||||
*/
|
||||
class CultureInfo : public IFormatProvider, public Object
|
||||
{
|
||||
public:
|
||||
static const CultureInfo InvariantCulture;
|
||||
|
||||
CultureInfo(int culture);
|
||||
CultureInfo(int culture, bool useUserOverride);
|
||||
CultureInfo(const String& name);
|
||||
CultureInfo(const String& name, bool useUserOverride);
|
||||
|
||||
void ClearCacheData();
|
||||
bool Equals(Object const * const obj) const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -39,9 +39,9 @@ extern "C" int strcasecmp(const char * s1, const char * s2);
|
||||
|
||||
namespace System
|
||||
{
|
||||
static unsigned long long rawNaND = 0x7ff8000000000000ULL;
|
||||
static unsigned long long rawPosInfD = 0x7ff0000000000000ULL;
|
||||
static unsigned long long rawNegInfD = 0xfff0000000000000ULL;
|
||||
static ulong rawNaND = 0x7ff8000000000000ULL;
|
||||
static ulong rawPosInfD = 0x7ff0000000000000ULL;
|
||||
static ulong rawNegInfD = 0xfff0000000000000ULL;
|
||||
|
||||
const double Double::Epsilon = 4.94066e-324;
|
||||
const double Double::MaxValue = 1.79769e+308;
|
||||
@ -92,6 +92,21 @@ namespace System
|
||||
return DoubleTypeInfo;
|
||||
}
|
||||
|
||||
bool Double::IsNaN(const Double& d)
|
||||
{
|
||||
return (d != d);
|
||||
}
|
||||
|
||||
bool Double::IsNegativeInfinity(const Double& d)
|
||||
{
|
||||
return (d < 0.0 && (double)d == NegativeInfinity);
|
||||
}
|
||||
|
||||
bool Double::IsPositiveInfinity(const Double& d)
|
||||
{
|
||||
return (d > 0.0 && (double)d == PositiveInfinity);
|
||||
}
|
||||
|
||||
bool Double::TryParse(const String& str, out double* result)
|
||||
{
|
||||
sassert(!String::IsNullOrEmpty(str), String::Format("str; %s", FrameworkResources::ArgumentNull_Generic));
|
||||
|
Loading…
x
Reference in New Issue
Block a user