// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #include "ExpressionCommandInterface.h" #include "Header Files/IHistoryDisplay.h" namespace CalculationManager { struct HISTORYITEMVECTOR { std::shared_ptr>> spTokens; std::shared_ptr>> spCommands; std::wstring expression; std::wstring result; }; struct HISTORYITEM { HISTORYITEMVECTOR historyItemVector; }; class CalculatorHistory : public IHistoryDisplay { public: CalculatorHistory(const size_t maxSize); unsigned int AddToHistory( _In_ std::shared_ptr>> const& spTokens, _In_ std::shared_ptr>> const& spCommands, std::wstring_view result); std::vector> const& GetHistory(); std::shared_ptr const& GetHistoryItem(unsigned int uIdx); void ClearHistory(); unsigned int AddItem(_In_ std::shared_ptr const& spHistoryItem); bool RemoveItem(unsigned int uIdx); size_t MaxHistorySize() const { return m_maxHistorySize; } private: std::vector> m_historyItems; const size_t m_maxHistorySize; }; }