@Elm.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /******************************************************************************/
  2. /******************************************************************************/
  3. class Elm
  4. {
  5. enum FLAG // !! these enums are saved !!
  6. {
  7. IMPORTING =1<<0,
  8. OPENED =1<<1,
  9. REMOVED =1<<2,
  10. NO_PUBLISH =1<<3,
  11. FINAL_REMOVED =1<<4,
  12. FINAL_NO_PUBLISH=1<<5,
  13. DATA =1<<7, // used only in IO
  14. };
  15. ELM_TYPE type;
  16. byte flag; // FLAG
  17. int file_size; // game file size, -1=unknown !! this is not saved !!
  18. UID id, // id of the element
  19. parent_id; // id of the parent
  20. Str name; // name of the element
  21. TimeStamp //create_time, // time when the element was created
  22. name_time, // time when the element was named or renamed
  23. parent_time, // time when the element was attached to the parent
  24. removed_time, // time when the element was removed or restored
  25. no_publish_time; // time when the element had NO_PUBLISH changed
  26. ElmData *data;
  27. ~Elm();
  28. Elm& copyParams(C Elm &src, bool set_parent=true); // copy parameters from 'src', 'type' must be already specified, doesn't copy ID
  29. void operator=(C Elm &src);
  30. Elm(C Elm &src);
  31. // get
  32. bool importing ()C; Elm& importing (bool on);
  33. bool opened ()C; Elm& opened (bool on);
  34. bool removed ()C; Elm& removed (bool on); // this checks only if this element is removed, it doesn't check the parents
  35. bool publish ()C; Elm& publish (bool on); // this checks only if this element is publish, it doesn't check the parents
  36. bool noPublish ()C; Elm& noPublish (bool on); // this checks only if this element is no publish, it doesn't check the parents
  37. bool finalRemoved ()C; Elm& finalRemoved (bool on);
  38. bool finalExists ()C; Elm& finalExists (bool on);
  39. bool finalPublish ()C; Elm& finalPublish (bool on); // this includes 'finalExists' as well !!
  40. bool finalNoPublish()C; Elm& finalNoPublish(bool on); // this includes 'finalRemoved' as well !!
  41. C Str& srcFile ()C;
  42. bool initialized ()C;
  43. void resetFinal();
  44. Elm& setRemoved ( bool removed , C TimeStamp &time=TimeStamp().getUTC());
  45. Elm& setNoPublish( bool no_publish, C TimeStamp &time=TimeStamp().getUTC());
  46. Elm& setName (C Str &name , C TimeStamp &time=TimeStamp().getUTC());
  47. Elm& setParent (C UID &parent_id , C TimeStamp &time=TimeStamp().getUTC());
  48. Elm& setParent (C Elm *parent , C TimeStamp &time=TimeStamp().getUTC());
  49. Elm& setSrcFile (C Str &src_file , C TimeStamp &time=TimeStamp().getUTC());
  50. ElmObjClass * objClassData(); C ElmObjClass * objClassData()C;
  51. ElmObj * objData(); C ElmObj * objData()C;
  52. ElmMesh * meshData(); C ElmMesh * meshData()C;
  53. ElmMaterial * mtrlData(); C ElmMaterial * mtrlData()C;
  54. ElmWaterMtrl * waterMtrlData(); C ElmWaterMtrl * waterMtrlData()C;
  55. ElmPhysMtrl * physMtrlData(); C ElmPhysMtrl * physMtrlData()C;
  56. ElmSkel * skelData(); C ElmSkel * skelData()C;
  57. ElmPhys * physData(); C ElmPhys * physData()C;
  58. ElmAnim * animData(); C ElmAnim * animData()C;
  59. ElmPanelImage* panelImageData(); C ElmPanelImage* panelImageData()C;
  60. ElmEnv * envData(); C ElmEnv * envData()C;
  61. ElmWorld * worldData(); C ElmWorld * worldData()C;
  62. ElmMiniMap * miniMapData(); C ElmMiniMap * miniMapData()C;
  63. ElmEnum * enumData(); C ElmEnum * enumData()C;
  64. ElmImage * imageData(); C ElmImage * imageData()C;
  65. ElmImageAtlas* imageAtlasData(); C ElmImageAtlas* imageAtlasData()C;
  66. ElmIconSetts * iconSettsData(); C ElmIconSetts * iconSettsData()C;
  67. ElmIcon * iconData(); C ElmIcon * iconData()C;
  68. ElmFont * fontData(); C ElmFont * fontData()C;
  69. ElmTextStyle * textStyleData(); C ElmTextStyle * textStyleData()C;
  70. ElmPanel * panelData(); C ElmPanel * panelData()C;
  71. ElmGuiSkin * guiSkinData(); C ElmGuiSkin * guiSkinData()C;
  72. ElmGui * guiData(); C ElmGui * guiData()C;
  73. ElmSound * soundData(); C ElmSound * soundData()C;
  74. ElmVideo * videoData(); C ElmVideo * videoData()C;
  75. ElmFile * fileData(); C ElmFile * fileData()C;
  76. ElmCode * codeData(); C ElmCode * codeData()C;
  77. ElmApp * appData(); C ElmApp * appData()C;
  78. ElmData * Data();
  79. bool newerFile(C Elm &src)C; // if 'this' has newer file than 'src'
  80. bool newerData(C Elm &src)C; // if 'this' has any data newer than 'src'
  81. uint syncData(C Elm &src);
  82. // io
  83. bool save(File &f, bool network, bool skip_name_data)C;
  84. bool load(File &f, bool network, bool skip_name_data);
  85. void save(TextNode &node)C;
  86. bool load(C TextNode &node, Str &error); // assumes that 'error' doesn't need to be cleared at start, and 'T.id' was already set
  87. void compressNew(File &f)C;
  88. void decompressNew(File &f);
  89. void compressData(File &f)C;
  90. bool decompressData(File &f);
  91. public:
  92. Elm();
  93. };
  94. /******************************************************************************/
  95. /******************************************************************************/
  96. /******************************************************************************/