Made appropriate limitations to classes

This commit is contained in:
2025-09-09 19:21:23 +03:00
parent 8b8c5310ae
commit 4c580f4956
2 changed files with 23 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
#ifndef CHARGE_AUDIO_BASE_H #ifndef CHARGE_AUDIO_BASE_H
#define CHARGE_AUDIO_BASE_H #define CHARGE_AUDIO_BASE_H
#include <Corrade/Containers/Containers.h> #include <Corrade/Containers/Containers.h>
#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/Pointer.h> #include <Corrade/Containers/Pointer.h>
#include <Magnum/Magnum.h> #include <Magnum/Magnum.h>
#include <Magnum/Math/Vector.h> #include <Magnum/Math/Vector.h>
@@ -20,6 +21,14 @@ class Sound {
public: public:
enum class SoundState { Idle, Playing, Paused, Finished }; enum class SoundState { Idle, Playing, Paused, Finished };
// No copying
Sound(const Sound &) = delete;
Sound &operator=(const Sound &) = delete;
// No moving
Sound(Sound &&) = delete;
Sound &operator=(Sound &&) = delete;
~Sound(); ~Sound();
void Play(); void Play();
void Pause(); void Pause();
@@ -49,6 +58,10 @@ private:
class Listener { class Listener {
public: public:
// No copying, can move
Listener(const Listener &) = delete;
Listener &operator=(const Listener &) = delete;
void SetEnabled(bool isEnabled); void SetEnabled(bool isEnabled);
const bool GetEnabled(); const bool GetEnabled();
void SetDirection(Magnum::Vector3 position); void SetDirection(Magnum::Vector3 position);
@@ -66,6 +79,15 @@ private:
class Engine { class Engine {
public: public:
Engine(); Engine();
// No copying
Engine(const Engine &) = delete;
Engine &operator=(const Engine &) = delete;
// No movement
Engine(Engine &&) = delete;
Engine &operator=(Engine &&) = delete;
~Engine(); ~Engine();
// Creating tools // Creating tools

View File

@@ -1,6 +1,7 @@
#include "ChargeAudio.hpp" #include "ChargeAudio.hpp"
#include <Corrade/Containers/Containers.h> #include <Corrade/Containers/Containers.h>
#include <Corrade/Containers/Pointer.h> #include <Corrade/Containers/Pointer.h>
#include <Corrade/Tags.h>
#include <Corrade/Utility/Debug.h> #include <Corrade/Utility/Debug.h>
#include <Magnum/Math/Vector3.h> #include <Magnum/Math/Vector3.h>