CPP09 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
BitcoinExchange.hpp
[詳解]
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* BitcoinExchange.hpp :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2025/08/28 19:14:40 by kamitsui #+# #+# */
9/* Updated: 2025/08/28 19:18:46 by kamitsui ### ########.fr */
10/* */
11/* ************************************************************************** */
12
17#ifndef BITCOINEXCHANGE_HPP
18#define BITCOINEXCHANGE_HPP
19
20#include <cstdlib>
21#include <fstream>
22#include <iostream>
23#include <map>
24#include <sstream>
25#include <stdexcept>
26#include <string>
27
37 private:
44 std::map<std::string, double> _exchangeRates;
45
46 // Orthodox Canonical Form: コピーを禁止するためにprivateで宣言
48 BitcoinExchange &operator=(const BitcoinExchange &rhs);
49
50 // --- Private Helper Methods ---
51
57 bool isValidDate(const std::string &dateStr) const;
58
65 bool isValidValue(const std::string &valueStr, double &value) const;
66
72 std::string trim(const std::string &str) const;
73
74 public:
83
89 void loadDatabase(const std::string &filename);
90
96 void processInputFile(const std::string &filename);
97};
98
99#endif // BITCOINEXCHANGE_HPP
ビットコインの価格データベースを管理し、入力ファイルに基づいて価値を計算するクラス。
void processInputFile(const std::string &filename)
指定された入力ファイルを処理し、各行のビットコインの価値を計算して出力します。
BitcoinExchange()
デフォルトコンストラクタ。
void loadDatabase(const std::string &filename)
CSV形式のデータベースファイルを読み込み、為替レートを内部マップに格納します。
~BitcoinExchange()
デストラクタ。