resource.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
  2. /*
  3. * resource.h
  4. * Copyright (C) 2016 Fran??ois Gautrais <francois@gautrais.eu>
  5. *
  6. * histodex is free software: you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * histodex is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. * See the GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef _RESOURCE_H_
  20. #define _RESOURCE_H_
  21. #include <iostream>
  22. #include "number3d.h"
  23. #include <json/json.h>
  24. #include "data.h"
  25. #define TYPE_3D 0
  26. #define TYPE_IMAGE 1
  27. #define TYPE_AUDIO 2
  28. #define TYPE_VIDEO 3
  29. class Resource : public Data
  30. {
  31. public:
  32. Resource();
  33. Resource(Json::Value v);
  34. virtual ~Resource();
  35. const Resource& operator=(const Resource& a);
  36. const std::string& getName();
  37. const std::string& getComments();
  38. const std::string& getType();
  39. const std::string& getFile() {return m_file;}
  40. Number3d getPosition();
  41. Number3d getRotation();
  42. Number3d getScale();
  43. int getStage();
  44. const std::string& getTitle() {return m_title;}
  45. void setName(const std::string& n);
  46. void setComments(const std::string& n);
  47. void setType(const std::string& n);
  48. void setPosition(const Number3d& n);
  49. void setRotation(const Number3d& n);
  50. void setScale(const Number3d& n);
  51. void setStage(int n);
  52. void setTitle(const std::string& n) {m_title=n;}
  53. void setFile(const std::string& n) {m_file=n;}
  54. Json::Value getJson(bool genFinal=false);
  55. static Resource&
  56. cast(Data& d);
  57. void set(Json::Value& v);
  58. protected:
  59. std::string m_name;
  60. int m_stage;
  61. Number3d m_position;
  62. Number3d m_rotation;
  63. Number3d m_scale;
  64. std::string m_comments;
  65. std::string m_type;
  66. std::string m_title;
  67. std::string m_file;
  68. private:
  69. };
  70. #endif // _RESOURCE_H_