QGearsHRCFileSerializer.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. -----------------------------------------------------------------------------
  3. The MIT License (MIT)
  4. Copyright (c) 2013-08-10 Tobias Peters <tobias.peters@kreativeffekt.at>
  5. Permission is hereby granted, free of charge, to any person obtaining a copy
  6. of this software and associated documentation files (the "Software"), to deal
  7. in the Software without restriction, including without limitation the rights
  8. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. copies of the Software, and to permit persons to whom the Software is
  10. furnished to do so, subject to the following conditions:
  11. The above copyright notice and this permission notice shall be included in
  12. all copies or substantial portions of the Software.
  13. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. THE SOFTWARE.
  20. -----------------------------------------------------------------------------
  21. */
  22. #ifndef __QGearsHRCFileSerializer_H__
  23. #define __QGearsHRCFileSerializer_H__
  24. #include "QGearsHRCFile.h"
  25. #include "QGearsSerializer.h"
  26. namespace QGears
  27. {
  28. class HRCFileSerializer : public Serializer
  29. {
  30. public:
  31. HRCFileSerializer();
  32. virtual ~HRCFileSerializer();
  33. virtual void importHRCFile( Ogre::DataStreamPtr &stream, HRCFile* pDest );
  34. protected:
  35. static const String TAG_COMMENT;
  36. static const String TAG_VERSION;
  37. static const String TAG_NAME;
  38. static const String TAG_BONE_COUNT;
  39. typedef std::vector<String> Block;
  40. typedef HRCFile::Bone Bone;
  41. virtual void readFileHeader( Ogre::DataStreamPtr &stream );
  42. virtual void readBlock( Ogre::DataStreamPtr &stream, Block& pDest );
  43. virtual void readObject( Ogre::DataStreamPtr &stream, Bone &pDest );
  44. template<typename ValueType>
  45. void readVector( Ogre::DataStreamPtr &stream
  46. ,std::vector<ValueType> &pDest
  47. ,size_t count );
  48. struct Header
  49. {
  50. long version;
  51. long bone_count;
  52. String name;
  53. };
  54. private:
  55. Header m_header;
  56. };
  57. }
  58. #endif // __QGearsHRCFileSerializer_H__