LCOV - code coverage report
Current view: top level - src/gui/commands - command_reorder.h (source / functions) Coverage Total Hit
Test: merged.info Lines: 85.7 % 7 6
Test Date: 2026-06-07 15:51:50 Functions: 75.0 % 4 3

            Line data    Source code
       1              : #pragma once
       2              : 
       3              : #include "audio/engine/i_audio_engine.h"
       4              : #include "gui/commands/command_base.h"
       5              : 
       6              : namespace Amplitron {
       7              : 
       8              : /**
       9              :  * @brief Command that moves an effect from one chain position to another.
      10              :  *
      11              :  * execute() calls move_effect(from, to); undo() reverses the move.
      12              :  */
      13              : class ReorderEffectCommand : public Command {
      14              :    public:
      15              :     /**
      16              :      * @brief Construct a ReorderEffectCommand.
      17              :      * @param engine  Reference to the audio engine.
      18              :      * @param from    Source index in the effect chain.
      19              :      * @param to      Destination index in the effect chain.
      20              :      */
      21            8 :     ReorderEffectCommand(IAudioEngine &engine, int from, int to)
      22            8 :         : engine_(engine), from_(from), to_(to) {}
      23              : 
      24              :     /** @brief Move the effect from source to destination index. */
      25            6 :     bool execute() override {
      26            6 :         engine_.move_effect(from_, to_);
      27            6 :         return true;
      28              :     }
      29              : 
      30              :     /** @brief Move the effect back from destination to source index. */
      31            3 :     void undo() override { engine_.move_effect(to_, from_); }
      32              : 
      33              :     /** @brief Return "Reorder Effect". */
      34            0 :     const char *description() const override { return "Reorder Effect"; }
      35              : 
      36              :     /** @brief Original source index. */
      37              :     int from() const { return from_; }
      38              : 
      39              :     /** @brief Destination index. */
      40              :     int to() const { return to_; }
      41              : 
      42              :    private:
      43              :     IAudioEngine &engine_;
      44              :     int from_;
      45              :     int to_;
      46              : };
      47              : 
      48              : }  // namespace Amplitron
        

Generated by: LCOV version 2.0-1