Duke's Big Numbers 1.0
C++ and Blueprint libraries for performing math, analysis, and formatting with really large numbers (>10e308).
Loading...
Searching...
No Matches
SIUnitsGroupLabeler.h
1// Copyright (C)2023 Smiling Cat Entertainment, LTD. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6
7#include "Inline.h"
8#include "GroupLabeler.h"
9
10#include "SIUnitsGroupLabeler.generated.h"
11
15UENUM(BlueprintType)
16enum class ESIUnitsMode : uint8
17{
18 Name UMETA(DisplayName = "Name (kilo, mega, etc.)"),
19 Abbreviation UMETA(DisplayName = "Abbreviation (k, M, etc.)"),
20};
21
25UCLASS(Blueprintable)
26class DUKESBIGNUMBERS_API USIUnitsGroupLabeler : public UGroupLabeler
27{
28 GENERATED_BODY()
29
30public:
36
41 static FString GetSINameGroupLabel(int32 powerOfTen);
42
47 static int AppendSINameGroupLabel(int32 powerOfTen, FString& string);
48
53 static FString GetSISymbolGroupLabel(int32 powerOfTen);
54
59 static int AppendSISymbolGroupLabel(int32 powerOfTen, FString& string);
60
66 static USIUnitsGroupLabeler* GetDefaultSIName();
67
73 static USIUnitsGroupLabeler* GetDefaultSISymbol();
74
82 UFUNCTION(BlueprintPure, BlueprintInternalUseOnly, Category = "String|BigInteger")
83 const UGroupLabeler* GetOverflowGroupLabeler() const;
84
92 UFUNCTION(BlueprintCallable, BlueprintInternalUseOnly, Category = "String|BigInteger")
93 void SetOverflowGroupLabeler(const UGroupLabeler* value);
94
100 UFUNCTION(BlueprintPure, BlueprintInternalUseOnly, Category = "String|BigInteger")
101 ESIUnitsMode const GetSIUnitsMode() const;
102
108 UFUNCTION(BlueprintCallable, BlueprintInternalUseOnly, Category = "String|BigInteger")
109 void SetSIUnitsMode(ESIUnitsMode value);
110
115 int OnAppendGroupLabel(int32 powerOfTen, FString& string) const override;
116
117private:
118 static void CreateDefaultSIName();
119 static void CreateDefaultSISymbol();
120
121 int BuildGroupLabel(int32 powerOfTen, ESIUnitsMode mode, FString& string) const;
122 void SetDefaults();
123
128 UPROPERTY(BlueprintGetter = GetOverflowGroupLabeler, BlueprintSetter = SetOverflowGroupLabeler, Category = "String|BigInteger")
129 const UGroupLabeler* OverflowGroupLabeler;
130
134 UPROPERTY(BlueprintGetter = GetSIUnitsMode, BlueprintSetter = SetSIUnitsMode, Category = "String|BigInteger")
135 ESIUnitsMode SIUnitsMode;
136
137
138 static USIUnitsGroupLabeler* defaultSINameInstance;
139 static USIUnitsGroupLabeler* defaultSISymbolInstance;
140 static const TCHAR* unitNames[48];
141
142};
143
144// If conditional inlining is ON, include inlinable functions here.
145#if DBN_INLINE_ENABLED
146#include "SIUnitsGroupLabeler.inl"
147#endif
Definition: GroupLabeler.h:19
Definition: SIUnitsGroupLabeler.h:27
int OnAppendGroupLabel(int32 powerOfTen, FString &string) const override