utils.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef UTILS_H
  2. #define UTILS_H
  3. #include <vector>
  4. #include <iostream>
  5. #include "RtMidi.h"
  6. #include <json/json.h>
  7. #include "error.h"
  8. typedef std::vector<unsigned char> MidiRawMessage;
  9. std::string str(int x, const char* format="%d");
  10. std::string str(const MidiRawMessage& x);
  11. bool start_with(const std::string& s1, const std::string& s2, bool ignoreCase=false);
  12. Json::Value json_parse_file(const std::string& filename);
  13. class Fs {
  14. public:
  15. static bool is_file(const std::string&);
  16. static bool is_dir(const std::string&);
  17. static bool is_file_exists(const std::string&, int);
  18. static bool exists(const std::string&);
  19. static bool remove(const std::string&);
  20. };
  21. class Args
  22. {
  23. public:
  24. Args(int ac, char** argv);
  25. virtual ~Args(){}
  26. std::string config_file;
  27. std::string pad_file;
  28. std::string override_app_dir;
  29. std::string override_pad_dir;
  30. bool continue_app;
  31. bool use_stdin;
  32. bool use_pipe;
  33. std::string use_pipe_filename;
  34. bool use_socket;
  35. int use_socket_port;
  36. bool keep_alive;
  37. };
  38. #endif // UTILS_H