text: //
  // Created by healingbrew on 7/22/2019.
  //
  
  #ifndef LIBXIV_MACRO_H
  #define LIBXIV_MACRO_H
  
  #include <libxiv/libxiv.h>
  #include <string>
  #include <vector>
  #include <fstream>
  
  namespace LIBXIV {
      using namespace std;
  
      enum MacroBookLineType : uint8_t {
          Title = 'T',
          Icon = 'I',
          Key = 'K',
          Line = 'L'
      };
  
      struct MacroBookEntry {
          string* Title = new string();
          string* Icon = new string();
          string* Key = new string();
          vector<string*>* Lines = new vector<string*>();
      };
  
      class LIBXIV_EXPORT MacroBook {
      public:
          vector<MacroBookEntry*>* Entries;
  
          explicit MacroBook(ifstream& stream);
           ~MacroBook();
  
          void Save(ofstream& stream);
  
      private:
          const char* DEFAULT_ICON = "00101D1";
          const char* DEFAULT_KEY = "000";
          const uint8_t XOR_VALUE = 0x73;
          const uint16_t XOR_VALUE_16 = 0x7373;
          const uint8_t MAX_LENGTH = 0xB5;
          const uint8_t ENTRY_SIZE = 0xF;
  
          void Sanitize(MacroBookEntry *entry);
  
          void SaveEntry(ofstream& stream, string text, MacroBookLineType Type);
      };
  }
  
  #endif //LIBXIV_MACRO_H
  