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:
fwcd 2019-03-08 15:43:52 +01:00
commit cd4052879a
7 changed files with 19 additions and 6 deletions

View file

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.6)
project(calculator)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)
add_subdirectory(src)

View file

@ -8,9 +8,11 @@
#endif
#include "Header Files/CalcEngine.h"
#include "CalculatorResource.h"
#include <memory>
#include <string_view>
using namespace std;
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_GRP_SEPARATOR = L',';
static constexpr wstring_view DEFAULT_GRP_STR = L"3;0";
static constexpr wstring_view DEFAULT_NUMBER_STR = L"0";
static const wstring_view DEFAULT_GRP_STR = L"3;0";
static const wstring_view DEFAULT_NUMBER_STR = L"0";
// Read strings for keys, errors, trig types, etc.
// These will be copied from the resources to local memory.

View file

@ -26,8 +26,8 @@ using namespace CalcEngine;
constexpr int MAX_EXPONENT = 4;
constexpr uint32_t MAX_GROUPING_SIZE = 16;
constexpr wstring_view c_decPreSepStr = L"[+-]?(\\d*)[";
constexpr wstring_view c_decPostSepStr = L"]?(\\d*)(?:e[+-]?(\\d*))?$";
const wstring_view c_decPreSepStr = L"[+-]?(\\d*)[";
const wstring_view c_decPostSepStr = L"]?(\\d*)(?:e[+-]?(\\d*))?$";
/****************************************************************************\

View file

@ -32,6 +32,8 @@
#include "Rational.h"
#include "RationalMath.h"
#include <array>
// The following are NOT real exports of CalcEngine, but for forward declarations
// The real exports follows later

View file

@ -13,6 +13,11 @@
* Created: 13-Feb-2008
*
\****************************************************************************/
#pragma once
#include <string>
#define IDS_FIRSTENGSTR IDS_ENGINESTR_FIRST
#define IDS_DECIMAL 4

View file

@ -6,6 +6,7 @@ typedef uint64_t ULONGLONG;
typedef int INT;
typedef char CHAR;
typedef long LONG;
typedef unsigned char BYTE;
typedef unsigned int UINT_PTR;
typedef unsigned long ULONG_PTR;
typedef unsigned int ULONG32;
@ -21,3 +22,5 @@ typedef ULONG_PTR DWORD_PTR;
#define HIWORD(dw) ((WORD)((((DWORD_PTR)(dw)) >> 16) & 0xffff))
#define LODWORD(qw) ((DWORD)(qw))
#define HIDWORD(qw) ((DWORD)(((qw) >> 32) & 0xffffffff))
#define ARRAYSIZE(a) (sizeof(a) / sizeof(*a))

View file

@ -16,3 +16,4 @@ typedef int32_t HRESULT;
#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)
#define FAILED(hr) (((HRESULT)(hr)) < 0)
#define SCODE_CODE(sc) ((sc) & 0xFFFF)