CPP01 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
FileReplacer.hpp
[詳解]
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* FileReplacer.hpp :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2025/04/18 15:28:48 by kamitsui #+# #+# */
9/* Updated: 2025/04/23 01:43:13 by kamitsui ### ########.fr */
10/* */
11/* ************************************************************************** */
12
18#ifndef FILEREPLACER_HPP
19#define FILEREPLACER_HPP
20
21#include <fstream>
22#include <iostream>
23#include <stdexcept>
24#include <string>
25
30 private:
31 std::string filename;
32 std::string s1;
33 std::string s2;
34
35 public:
40
44 FileReplacer(const std::string &filename, const std::string &s1, const std::string &s2);
45
49 FileReplacer(const FileReplacer &other);
50
54 FileReplacer &operator=(const FileReplacer &other);
55
60
64 const std::string &getFileName() const;
65
69 const std::string &getS1() const;
70
74 const std::string &getS2() const;
75
79 void processFile();
80};
81
82#endif
A class that handles replacing occurrences of a string within a file.
FileReplacer()
Default constructor for the FileReplacer class.
void processFile()
Processes the input file and performs the string replacement.
FileReplacer & operator=(const FileReplacer &other)
Copy assignment operator for the FileReplacer class.
const std::string & getS1() const
Gets the string to find (s1).
~FileReplacer()
Destructor for the FileReplacer class.
const std::string & getFileName() const
Gets the filename.
const std::string & getS2() const
Gets the string to replace with (s2).