mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
Include <memory> in calc.cpp to resolve the missing std::make_unique calls and bump C++ standard to 14
Change DEFAULT_GPR_STR and DEFAULT_NUMBER_STR in calc.cpp to be const (and not constexpr) since 'length' is not a constexpr function according to Clang BYTE and ARRAYSIZE macro Replace constexpr declarations in scidisp.cpp with const since char_traits::length is not a constexpr function in Clang Define SCODE_CODE in winerror_cross_platform.h Add #pragma once and included <string> in EngineStrings.h Include <array> in CalcEngine.h
This commit is contained in:
parent
14c00f46c7
commit
cd4052879a
7 changed files with 19 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 2.6)
|
cmake_minimum_required(VERSION 2.6)
|
||||||
project(calculator)
|
project(calculator)
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
|
@ -8,9 +8,11 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Header Files/CalcEngine.h"
|
#include "Header Files/CalcEngine.h"
|
||||||
|
|
||||||
#include "CalculatorResource.h"
|
#include "CalculatorResource.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace CalcEngine;
|
using namespace CalcEngine;
|
||||||
|
|
||||||
|
@ -24,8 +26,8 @@ static constexpr int32_t DEFAULT_RADIX = 10;
|
||||||
|
|
||||||
static constexpr wchar_t DEFAULT_DEC_SEPARATOR = L'.';
|
static constexpr wchar_t DEFAULT_DEC_SEPARATOR = L'.';
|
||||||
static constexpr wchar_t DEFAULT_GRP_SEPARATOR = L',';
|
static constexpr wchar_t DEFAULT_GRP_SEPARATOR = L',';
|
||||||
static constexpr wstring_view DEFAULT_GRP_STR = L"3;0";
|
static const wstring_view DEFAULT_GRP_STR = L"3;0";
|
||||||
static constexpr wstring_view DEFAULT_NUMBER_STR = L"0";
|
static const wstring_view DEFAULT_NUMBER_STR = L"0";
|
||||||
|
|
||||||
// Read strings for keys, errors, trig types, etc.
|
// Read strings for keys, errors, trig types, etc.
|
||||||
// These will be copied from the resources to local memory.
|
// These will be copied from the resources to local memory.
|
||||||
|
|
|
@ -26,8 +26,8 @@ using namespace CalcEngine;
|
||||||
|
|
||||||
constexpr int MAX_EXPONENT = 4;
|
constexpr int MAX_EXPONENT = 4;
|
||||||
constexpr uint32_t MAX_GROUPING_SIZE = 16;
|
constexpr uint32_t MAX_GROUPING_SIZE = 16;
|
||||||
constexpr wstring_view c_decPreSepStr = L"[+-]?(\\d*)[";
|
const wstring_view c_decPreSepStr = L"[+-]?(\\d*)[";
|
||||||
constexpr wstring_view c_decPostSepStr = L"]?(\\d*)(?:e[+-]?(\\d*))?$";
|
const wstring_view c_decPostSepStr = L"]?(\\d*)(?:e[+-]?(\\d*))?$";
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************\
|
/****************************************************************************\
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
#include "Rational.h"
|
#include "Rational.h"
|
||||||
#include "RationalMath.h"
|
#include "RationalMath.h"
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
// The following are NOT real exports of CalcEngine, but for forward declarations
|
// The following are NOT real exports of CalcEngine, but for forward declarations
|
||||||
// The real exports follows later
|
// The real exports follows later
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,11 @@
|
||||||
* Created: 13-Feb-2008
|
* Created: 13-Feb-2008
|
||||||
*
|
*
|
||||||
\****************************************************************************/
|
\****************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#define IDS_FIRSTENGSTR IDS_ENGINESTR_FIRST
|
#define IDS_FIRSTENGSTR IDS_ENGINESTR_FIRST
|
||||||
|
|
||||||
#define IDS_DECIMAL 4
|
#define IDS_DECIMAL 4
|
||||||
|
|
|
@ -6,6 +6,7 @@ typedef uint64_t ULONGLONG;
|
||||||
typedef int INT;
|
typedef int INT;
|
||||||
typedef char CHAR;
|
typedef char CHAR;
|
||||||
typedef long LONG;
|
typedef long LONG;
|
||||||
|
typedef unsigned char BYTE;
|
||||||
typedef unsigned int UINT_PTR;
|
typedef unsigned int UINT_PTR;
|
||||||
typedef unsigned long ULONG_PTR;
|
typedef unsigned long ULONG_PTR;
|
||||||
typedef unsigned int ULONG32;
|
typedef unsigned int ULONG32;
|
||||||
|
@ -21,3 +22,5 @@ typedef ULONG_PTR DWORD_PTR;
|
||||||
#define HIWORD(dw) ((WORD)((((DWORD_PTR)(dw)) >> 16) & 0xffff))
|
#define HIWORD(dw) ((WORD)((((DWORD_PTR)(dw)) >> 16) & 0xffff))
|
||||||
#define LODWORD(qw) ((DWORD)(qw))
|
#define LODWORD(qw) ((DWORD)(qw))
|
||||||
#define HIDWORD(qw) ((DWORD)(((qw) >> 32) & 0xffffffff))
|
#define HIDWORD(qw) ((DWORD)(((qw) >> 32) & 0xffffffff))
|
||||||
|
|
||||||
|
#define ARRAYSIZE(a) (sizeof(a) / sizeof(*a))
|
||||||
|
|
|
@ -16,3 +16,4 @@ typedef int32_t HRESULT;
|
||||||
|
|
||||||
#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)
|
#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)
|
||||||
#define FAILED(hr) (((HRESULT)(hr)) < 0)
|
#define FAILED(hr) (((HRESULT)(hr)) < 0)
|
||||||
|
#define SCODE_CODE(sc) ((sc) & 0xFFFF)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue