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

Represents a source for learning and creating Materias. [詳解]

#include <MateriaSource.hpp>

MateriaSource の継承関係図
Inheritance graph
MateriaSource 連携図
Collaboration graph

公開メンバ関数

 MateriaSource ()
 Default constructor for MateriaSource. Initializes the learning count to zero and sets all learned Materia slots to NULL.
 
 MateriaSource (const MateriaSource &other)
 Copy constructor for MateriaSource. Performs a deep copy of all learned Materias from another MateriaSource. Each Materia in the 'other' source is cloned and stored independently.
 
MateriaSourceoperator= (const MateriaSource &other)
 Copy assignment operator for MateriaSource. Assigns values from another MateriaSource object, ensuring a deep copy of learned Materias. It first deallocates any currently learned Materias to prevent leaks, then clones and stores Materias from the 'other' source.
 
virtual ~MateriaSource ()
 Destroys the MateriaSource object. Deallocates all dynamically allocated AMateria objects that were learned and stored by this source to prevent memory leaks.
 
virtual void learnMateria (AMateria *materia)
 Learns a Materia template for later creation. The MateriaSource makes a deep copy of the passed Materia and stores it. If the source's learning slots are full, the passed Materia is deleted to prevent leaks.
 
virtual AMateriacreateMateria (std::string const &type) const
 Creates a new Materia based on a learned type. Returns a new instance (a clone) of a previously learned Materia.
 
- 基底クラス IMateriaSource に属する継承公開メンバ関数
virtual ~IMateriaSource ()
 Virtual destructor for the IMateriaSource interface. Ensures proper cleanup of derived class objects when deleted through an IMateriaSource pointer. It has an empty implementation here as it's an interface.
 

詳解

Represents a source for learning and creating Materias.

The MateriaSource class is a concrete implementation of the IMateriaSource interface. It maintains a limited capacity (4 slots) to store cloned templates of AMateria types. Characters can then request new Materias from this source by specifying their type. It's designed with proper Orthodox Canonical Class Form to manage its dynamically allocated learned Materias.

MateriaSource.hpp40 行目に定義があります。

構築子と解体子

◆ MateriaSource() [1/2]

MateriaSource::MateriaSource ( )

Default constructor for MateriaSource. Initializes the learning count to zero and sets all learned Materia slots to NULL.

MateriaSource.cpp32 行目に定義があります。

◆ MateriaSource() [2/2]

MateriaSource::MateriaSource ( const MateriaSource other)

Copy constructor for MateriaSource. Performs a deep copy of all learned Materias from another MateriaSource. Each Materia in the 'other' source is cloned and stored independently.

引数
otherThe MateriaSource object to copy from.

MateriaSource.cpp44 行目に定義があります。

◆ ~MateriaSource()

MateriaSource::~MateriaSource ( )
virtual

Destroys the MateriaSource object. Deallocates all dynamically allocated AMateria objects that were learned and stored by this source to prevent memory leaks.

MateriaSource.cpp83 行目に定義があります。

関数詳解

◆ createMateria()

AMateria * MateriaSource::createMateria ( std::string const &  type) const
virtual

Creates a new Materia based on a learned type. Returns a new instance (a clone) of a previously learned Materia.

引数
typeThe string type of the Materia to create (e.g., "ice", "cure").
戻り値
A pointer to a newly created AMateria object of the specified type, or NULL if the type is unknown.

IMateriaSourceを実装しています。

MateriaSource.cpp118 行目に定義があります。

◆ learnMateria()

void MateriaSource::learnMateria ( AMateria materia)
virtual

Learns a Materia template for later creation. The MateriaSource makes a deep copy of the passed Materia and stores it. If the source's learning slots are full, the passed Materia is deleted to prevent leaks.

引数
materiaA pointer to the AMateria object to be learned as a template.

IMateriaSourceを実装しています。

MateriaSource.cpp97 行目に定義があります。

◆ operator=()

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

Copy assignment operator for MateriaSource. Assigns values from another MateriaSource object, ensuring a deep copy of learned Materias. It first deallocates any currently learned Materias to prevent leaks, then clones and stores Materias from the 'other' source.

引数
otherThe MateriaSource object to assign from.
戻り値
A reference to the assigned MateriaSource object.

MateriaSource.cpp62 行目に定義があります。


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