CPP04 1.0
|
Represents a source for learning and creating Materias. [詳解]
#include <MateriaSource.hpp>
公開メンバ関数 | |
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. | |
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. | |
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 AMateria * | createMateria (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. | |
![]() | |
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.hpp の 40 行目に定義があります。
MateriaSource::MateriaSource | ( | ) |
Default constructor for MateriaSource. Initializes the learning count to zero and sets all learned Materia slots to NULL.
MateriaSource.cpp の 32 行目に定義があります。
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.
other | The MateriaSource object to copy from. |
MateriaSource.cpp の 44 行目に定義があります。
|
virtual |
Destroys the MateriaSource object. Deallocates all dynamically allocated AMateria
objects that were learned and stored by this source to prevent memory leaks.
MateriaSource.cpp の 83 行目に定義があります。
|
virtual |
Creates a new Materia based on a learned type. Returns a new instance (a clone) of a previously learned Materia.
type | The string type of the Materia to create (e.g., "ice", "cure"). |
AMateria
object of the specified type, or NULL
if the type is unknown. IMateriaSourceを実装しています。
MateriaSource.cpp の 118 行目に定義があります。
|
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.
materia | A pointer to the AMateria object to be learned as a template. |
IMateriaSourceを実装しています。
MateriaSource.cpp の 97 行目に定義があります。
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.
other | The MateriaSource object to assign from. |
MateriaSource.cpp の 62 行目に定義があります。