CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
standard_format.h
1
3#pragma once
4
5#include <system/object.h>
6#include <system/string.h>
7#include <system/convert.h>
8#include <system/exceptions.h>
9#include <cstdint>
10
11namespace System {
12namespace Buffers {
13
19class StandardFormat : public ::System::Details::BoxableObjectBase
20{
21 RTTI_INFO_VALUE_TYPE(StandardFormat)
22
23public:
26 static constexpr uint8_t NoPrecision = 0xFF;
27
30 static constexpr char_t DefaultFormatSymbol = u'\0';
31
33 static constexpr uint8_t s_maxPrecision = 99;
34
35private:
37 static constexpr uint8_t DefaultPrecision = NoPrecision;
38
39public:
41 StandardFormat() noexcept : m_format(DefaultFormatSymbol), m_precision(DefaultPrecision) {}
42
45 ASPOSECPP_SHARED_API explicit StandardFormat(char_t symbol);
46
52 ASPOSECPP_SHARED_API StandardFormat(char_t symbol, uint8_t precision);
53
56 bool get_IsDefault() const noexcept
57 {
58 return m_format == DefaultFormatSymbol;
59 }
60
63 char_t get_Format() const noexcept
64 {
65 return m_format;
66 }
67
70 uint8_t get_Precision() const noexcept
71 {
72 return m_precision;
73 }
74
78 ASPOSECPP_SHARED_API bool Equals(const StandardFormat& other) const noexcept;
79
82 ASPOSECPP_SHARED_API int32_t GetHashCode() const noexcept;
83
88 ASPOSECPP_SHARED_API String ToString() const;
93 friend bool operator ==(const StandardFormat& left, const StandardFormat& right) noexcept
94 {
95 return left.Equals(right);
96 }
97
102 friend bool operator !=(const StandardFormat& left, const StandardFormat& right) noexcept
103 {
104 return !(left == right);
105 }
106
107private:
108 char_t m_format;
109 uint8_t m_precision;
110};
111
112} // namespace Buffers
113} // namespace System
114
Represents a standard format specifier with an optional precision. It wraps a format symbol (a single...
Definition: standard_format.h:20
static constexpr uint8_t NoPrecision
The maximum precision value that can be specified. A precision of this value means "no explicit preci...
Definition: standard_format.h:26
bool get_IsDefault() const noexcept
Determines whether this instance represents the default format.
Definition: standard_format.h:56
static constexpr uint8_t s_maxPrecision
The maximum allowed precision value (inclusive) for a non-default format.
Definition: standard_format.h:33
String ToString() const
Returns a string representation of the current StandardFormat. Default format instances are represent...
char_t get_Format() const noexcept
Gets the standard format symbol.
Definition: standard_format.h:63
StandardFormat(char_t symbol, uint8_t precision)
Constructs a StandardFormat with the specified format symbol and precision.
StandardFormat() noexcept
Constructs a default StandardFormat that represents the default format.
Definition: standard_format.h:41
static constexpr char_t DefaultFormatSymbol
The symbol used to represent the default format. An instance whose Format equals this value (and whos...
Definition: standard_format.h:30
StandardFormat(char_t symbol)
Constructs a StandardFormat with the specified format symbol and no precision.
int32_t GetHashCode() const noexcept
Returns a hash code for the current StandardFormat.
friend bool operator!=(const StandardFormat &left, const StandardFormat &right) noexcept
Determines whether the two specified instances are not equal.
Definition: standard_format.h:102
bool Equals(const StandardFormat &other) const noexcept
Determines whether the current instance is equal to the specified one.
uint8_t get_Precision() const noexcept
Gets the precision (number of digits) for this format, or NoPrecision if none.
Definition: standard_format.h:70
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:126
bool Equals(const String &str, System::StringComparison comparison_type) const
String equality comparison. Several modes provided by StringComparison enumeration are supported.
Definition: db_command.h:9