M2File.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #ifndef M2Datei_H
  2. #define M2Datei_H
  3. #include "Array.h"
  4. namespace Framework
  5. {
  6. class Model2DData; //! Model2D.h
  7. class Text; //! Text.h
  8. //! This class manages the framework's own file format for 2D model data.
  9. //! Multiple 2D model data can be stored in one file.
  10. class M2Datei : public virtual ReferenceCounter
  11. {
  12. private:
  13. Text* pfad;
  14. RCArray<Text>* modelName;
  15. Array<__int64>* modelPos;
  16. public:
  17. //! Constructor
  18. DLLEXPORT M2Datei();
  19. //! Constructor
  20. //! \param pfad The path to the file
  21. DLLEXPORT M2Datei(const char* pfad);
  22. //! Constructor
  23. //! \param pfad The path to the file
  24. DLLEXPORT M2Datei(Text* pfad);
  25. //! Destructor
  26. DLLEXPORT ~M2Datei();
  27. //! Sets the path to the file
  28. //! \param pfad Path to the file
  29. DLLEXPORT void setPfad(const char* pfad);
  30. //! Sets a pointer to the path to the file
  31. //! \param pfad Pointer to the path to the file
  32. DLLEXPORT void setPfadZ(Text* pfad);
  33. //! Reads basic information from the file needed for its usage
  34. DLLEXPORT void leseDaten();
  35. //! Saves 2D model data to the file
  36. //! \param zMdr A pointer to the data to save without increased
  37. //! reference counter \param name The name under which the data should
  38. //! be stored in the file \return 1 if the model was saved.
  39. //! 0 if an error occurred during saving
  40. DLLEXPORT bool saveModel(Model2DData* zMdr, Text* name);
  41. //! Saves 2D model data to the file
  42. //! \param zMdr A pointer to the data to save without increased
  43. //! reference counter \param name The name under which the data should
  44. //! be stored in the file \return 1 if the model was saved.
  45. //! 0 if an error occurred during saving
  46. DLLEXPORT bool saveModel(Model2DData* zMdr, const char* name);
  47. //! Deletes a 2D model from the file
  48. //! \param name The name of the model
  49. //! \return 1 if the model was deleted. 0 if the model was not
  50. //! found or an error occurred during saving
  51. DLLEXPORT bool removeModel(Text* name);
  52. //! Deletes a 2D model from the file
  53. //! \param name The name of the model
  54. //! \return 1 if the model was deleted. 0 if the model was not
  55. //! found or an error occurred during saving
  56. DLLEXPORT bool removeModel(const char* name);
  57. //! Loads a 2D model from the file
  58. //! \param name The name of the model to load
  59. //! \return The loaded data
  60. DLLEXPORT Model2DData* ladeModel(Text* name) const;
  61. //! Loads a 2D model from the file
  62. //! \param name The name of the model to load
  63. //! \return The loaded data
  64. DLLEXPORT Model2DData* ladeModel(const char* name) const;
  65. //! Checks whether a specific 2D model exists in the file
  66. //! \param name The name of the 2D model to search for
  67. //! \return 1 if the model was found. 0 otherwise
  68. DLLEXPORT bool hatModel(const char* name) const;
  69. //! Returns the number of stored models
  70. DLLEXPORT int getModelAnzahl() const;
  71. //! Returns the name of a specific model
  72. //! \param i The index of the model
  73. //! \return A pointer to the name of the model without increased
  74. //! reference counter
  75. DLLEXPORT Text* zModelName(int i) const;
  76. };
  77. } // namespace Framework
  78. #endif