Skip to content
Snippets Groups Projects
Select Git revision
  • 4969220bf9289b2ed74566902611d9cd952fd705
  • master default
  • object
  • develop protected
  • private_algos
  • cuisine
  • SMOTE
  • revert-76c4cca5
  • archive protected
  • no_graphviz
  • 0.0.1
11 results

SCM.py

Blame
  • Action.hpp 1.24 KiB
    #ifndef ACTION__H
    #define ACTION__H
    
    #include <functional>
    #include <string>
    #include <vector>
    #include "Config.hpp"
    
    class Action
    {
      public :
    
      enum Type
      {
        Push,
        Pop,
        Write,
        MoveWord,
        MoveChar,
        AddLines,
        Check
      };
    
      enum Object
      {
        Buffer,
        Stack
      };
    
      private :
    
      Type type;
      std::vector<std::string> data;
    
      public :
    
      std::function<void(Config & config, Action & action)> apply;
      std::function<void(Config & config, Action & action)> undo;
      std::function<bool(const Config & config, const Action & action)> appliable;
    
      private :
    
      Action(Type type, std::function<void(Config & config, Action & action)> apply, std::function<void(Config & config, Action & action)> undo, std::function<bool(const Config & config, const Action & action)> appliable);
    
      public :
    
      static Object str2object(const std::string & s);
      static Action addLinesIfNeeded(int nbLines);
      static Action moveWordIndex(int movement);
      static Action moveCharacterIndex(int movement);
      static Action addHypothesis(const std::string & colName, std::size_t lineIndex, const std::string & hypothesis);
      static Action addHypothesisRelative(const std::string & colName, Object object, int relativeIndex, const std::string & hypothesis);
    };
    
    #endif