CPP01 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
FileReplacer クラス

A class that handles replacing occurrences of a string within a file. [詳解]

#include <FileReplacer.hpp>

FileReplacer 連携図
Collaboration graph

公開メンバ関数

 FileReplacer ()
 Default constructor for the FileReplacer class.
 
 FileReplacer (const std::string &filename, const std::string &s1, const std::string &s2)
 Parameterized constructor for the FileReplacer class.
 
 FileReplacer (const FileReplacer &other)
 Copy constructor for the FileReplacer class.
 
FileReplaceroperator= (const FileReplacer &other)
 Copy assignment operator for the FileReplacer class.
 
 ~FileReplacer ()
 Destructor for the FileReplacer class.
 
const std::stringgetFileName () const
 Gets the filename.
 
const std::stringgetS1 () const
 Gets the string to find (s1).
 
const std::stringgetS2 () const
 Gets the string to replace with (s2).
 
void processFile ()
 Processes the input file and performs the string replacement.
 

詳解

A class that handles replacing occurrences of a string within a file.

FileReplacer.hpp29 行目に定義があります。

構築子と解体子

◆ FileReplacer() [1/3]

FileReplacer::FileReplacer ( )

Default constructor for the FileReplacer class.

Initializes filename, s1, and s2 to empty strings.

FileReplacer.cpp26 行目に定義があります。

◆ FileReplacer() [2/3]

FileReplacer::FileReplacer ( const std::string filename,
const std::string s1,
const std::string s2 
)

Parameterized constructor for the FileReplacer class.

Initializes the FileReplacer with the given filename, string to find (s1), and string to replace (s2).

引数
filenameThe name of the file to process.
s1The string to find and replace.
s2The string to replace occurrences of s1 with.

FileReplacer.cpp38 行目に定義があります。

◆ FileReplacer() [3/3]

FileReplacer::FileReplacer ( const FileReplacer other)

Copy constructor for the FileReplacer class.

Creates a new FileReplacer object as a copy of another.

引数
otherThe FileReplacer object to copy.

FileReplacer.cpp48 行目に定義があります。

◆ ~FileReplacer()

FileReplacer::~FileReplacer ( )

Destructor for the FileReplacer class.

FileReplacer.cpp70 行目に定義があります。

関数詳解

◆ getFileName()

const std::string & FileReplacer::getFileName ( ) const

Gets the filename.

戻り値
A constant reference to the filename.

FileReplacer.cpp77 行目に定義があります。

◆ getS1()

const std::string & FileReplacer::getS1 ( ) const

Gets the string to find (s1).

戻り値
A constant reference to s1.

FileReplacer.cpp84 行目に定義があります。

◆ getS2()

const std::string & FileReplacer::getS2 ( ) const

Gets the string to replace with (s2).

戻り値
A constant reference to s2.

FileReplacer.cpp91 行目に定義があります。

◆ operator=()

FileReplacer & FileReplacer::operator= ( const FileReplacer other)

Copy assignment operator for the FileReplacer class.

Assigns the state of one FileReplacer object to another.

引数
otherThe FileReplacer object to assign from.
戻り値
A reference to the current FileReplacer object.

FileReplacer.cpp58 行目に定義があります。

◆ processFile()

void FileReplacer::processFile ( )

Processes the input file and performs the string replacement.

Processes the input file, replacing occurrences of s1 with s2, and writes the result to a new file with the ".replace" extension.

Throws std::runtime_error if the input or output file cannot be opened, or if s1 is empty.

FileReplacer.cpp100 行目に定義があります。


このクラス詳解は次のファイルから抽出されました: