mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-24 15:05:19 -07:00
Fix declarations of functions
* Move function to anonymuous namespaces where needed * Explicitly name inheritance type * Add missing include * Drop `#pragma once` from .cpp files
This commit is contained in:
parent
29c362657b
commit
6a2a441913
7 changed files with 28 additions and 31 deletions
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "Header Files/CalcEngine.h"
|
#include "Header Files/CalcEngine.h"
|
||||||
|
#include "Header Files/CalcUtils.h"
|
||||||
|
|
||||||
bool IsOpInRange(WPARAM op, uint32_t x, uint32_t y)
|
bool IsOpInRange(WPARAM op, uint32_t x, uint32_t y)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#pragma once
|
|
||||||
#include "Header Files/CalcEngine.h"
|
#include "Header Files/CalcEngine.h"
|
||||||
#include "Command.h"
|
#include "Command.h"
|
||||||
#include "CalculatorVector.h"
|
#include "CalculatorVector.h"
|
||||||
|
@ -14,6 +13,16 @@ constexpr int ASCII_0 = 48;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace CalcEngine;
|
using namespace CalcEngine;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
void IFT(HRESULT hr)
|
||||||
|
{
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
CalcException exception(hr);
|
||||||
|
throw(exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
void CHistoryCollector::ReinitHistory()
|
void CHistoryCollector::ReinitHistory()
|
||||||
{
|
{
|
||||||
m_lastOpStartIndex = -1;
|
m_lastOpStartIndex = -1;
|
||||||
|
|
|
@ -30,24 +30,26 @@ using namespace CalcEngine;
|
||||||
//
|
//
|
||||||
// returns a virtual number for precedence for the operator. We expect binary operator only, otherwise the lowest number
|
// returns a virtual number for precedence for the operator. We expect binary operator only, otherwise the lowest number
|
||||||
// 0 is returned. Higher the number, higher the precedence of the operator.
|
// 0 is returned. Higher the number, higher the precedence of the operator.
|
||||||
INT NPrecedenceOfOp(int nopCode)
|
namespace {
|
||||||
{
|
INT NPrecedenceOfOp(int nopCode)
|
||||||
static BYTE rgbPrec[] = { 0,0, IDC_OR,0, IDC_XOR,0, IDC_AND,1,
|
{
|
||||||
IDC_ADD,2, IDC_SUB,2, IDC_RSHF,3, IDC_LSHF,3,
|
static BYTE rgbPrec[] = { 0,0, IDC_OR,0, IDC_XOR,0, IDC_AND,1,
|
||||||
IDC_MOD,3, IDC_DIV,3, IDC_MUL,3, IDC_PWR,4, IDC_ROOT, 4 };
|
IDC_ADD,2, IDC_SUB,2, IDC_RSHF,3, IDC_LSHF,3,
|
||||||
int iPrec;
|
IDC_MOD,3, IDC_DIV,3, IDC_MUL,3, IDC_PWR,4, IDC_ROOT, 4 };
|
||||||
|
int iPrec;
|
||||||
|
|
||||||
iPrec = 0;
|
|
||||||
while ((iPrec < ARRAYSIZE(rgbPrec)) && (nopCode != rgbPrec[iPrec]))
|
|
||||||
{
|
|
||||||
iPrec += 2;
|
|
||||||
}
|
|
||||||
if (iPrec >= ARRAYSIZE(rgbPrec))
|
|
||||||
{
|
|
||||||
iPrec = 0;
|
iPrec = 0;
|
||||||
}
|
while ((iPrec < ARRAYSIZE(rgbPrec)) && (nopCode != rgbPrec[iPrec]))
|
||||||
return rgbPrec[iPrec + 1];
|
{
|
||||||
|
iPrec += 2;
|
||||||
|
}
|
||||||
|
if (iPrec >= ARRAYSIZE(rgbPrec))
|
||||||
|
{
|
||||||
|
iPrec = 0;
|
||||||
|
}
|
||||||
|
return rgbPrec[iPrec + 1];
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// HandleErrorCommand
|
// HandleErrorCommand
|
||||||
|
|
|
@ -15,12 +15,3 @@ public:
|
||||||
private:
|
private:
|
||||||
HRESULT m_hr;
|
HRESULT m_hr;
|
||||||
};
|
};
|
||||||
|
|
||||||
void IFT(HRESULT hr)
|
|
||||||
{
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
CalcException exception(hr);
|
|
||||||
throw(exception);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "AppResourceProvider.h"
|
#include "AppResourceProvider.h"
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "TraceLogger.h"
|
#include "TraceLogger.h"
|
||||||
#include "NetworkManager.h"
|
#include "NetworkManager.h"
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "CurrencyHttpClient.h"
|
#include "CurrencyHttpClient.h"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue