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
BigIntegerParser.h
1// Copyright (C)2023 Smiling Cat Entertainment, LTD. All Rights Reserved.
2
3#pragma once
4#include "Inline.h"
5#include "BigInteger.h"
6
7namespace Duke::BigNumbers
8{
13 {
14 public:
22 static FBigInteger ParseInvariantDecimal(const FString& string);
23
31 static FBigInteger ParseInvariantHexadecimal(const FString& string);
32
41 static bool TryParseInvariantDecimal(const FString& string, FBigInteger& result);
42
52 static bool TryParseInvariantDecimal(const TCHAR*& buffer, const TCHAR* bufferEnd, FBigInteger& result);
53
62 static bool TryParseInvariantHexadecimal(const FString& string, FBigInteger& result);
63
73 static bool TryParseInvariantHexadecimal(const TCHAR*& buffer, const TCHAR* bufferEnd, FBigInteger& result);
74 private:
75 static bool ParseSign(const TCHAR*& buffer);
76 static bool TryParseDecimalDigit(const TCHAR*& buffer, uint64& digit);
77 static bool TryParseHexadecimalDigit(const TCHAR*& buffer, uint32& digit);
78 static bool ParseRepeatStart(const TCHAR*& buffer);
79 static bool ParseRepeatEnd(const TCHAR*& buffer);
80 static bool TryParseRepeatParameters(const TCHAR*& buffer, const TCHAR* bufferEnd, int32& repeatCount, TCHAR& operation, uint64& operand);
81 static bool TryParseRepeatOperation(const TCHAR*& buffer, TCHAR& operation);
82 static bool TryParseRepeatOperand(const TCHAR*& buffer, const TCHAR* bufferEnd, uint64& operand);
83 static void ShiftResultAndAdd(uint64 valueToAdd, int32 powerToShift, FBigInteger& workingResult);
84 static void MultiplyResultAndAdd(uint64 valueToAdd, uint64 valueToMultiply, FBigInteger& workingResult);
85 static uint64 ApplyOperation(TCHAR operation, uint64 operand, int32 decDigitWithinCount, uint64 pow10Result, uint64 nonadecaDigit);
86 };
87
88// If conditional inlining is ON, include inlinable functions here.
89#if DBN_INLINE_ENABLED
90#include "BigIntegerParser.inl"
91#endif
92
93}
Definition: BigIntegerParser.h:13
static bool TryParseInvariantHexadecimal(const FString &string, FBigInteger &result)
Definition: BigIntegerParser.inl:35
static FBigInteger ParseInvariantDecimal(const FString &string)
Definition: BigIntegerParser.inl:6
static bool TryParseInvariantDecimal(const TCHAR *&buffer, const TCHAR *bufferEnd, FBigInteger &result)
static FBigInteger ParseInvariantHexadecimal(const FString &string)
Definition: BigIntegerParser.inl:17
static bool TryParseInvariantDecimal(const FString &string, FBigInteger &result)
Definition: BigIntegerParser.inl:28
static bool TryParseInvariantHexadecimal(const TCHAR *&buffer, const TCHAR *bufferEnd, FBigInteger &result)
Definition: BigInteger.h:50