llsdmessagereader.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /**
  2. * @file llsdmessagereader.h
  3. * @brief LLSDMessageReader class Declaration
  4. *
  5. * $LicenseInfo:firstyear=2007&license=viewergpl$
  6. *
  7. * Copyright (c) 2007-2009, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_LLSDMESSAGEREADER_H
  33. #define LL_LLSDMESSAGEREADER_H
  34. #include "llmessagereader.h"
  35. #include "llsd.h"
  36. #include <map>
  37. class LLMessageTemplate;
  38. class LLMsgData;
  39. class LLSDMessageReader final : public LLMessageReader
  40. {
  41. public:
  42. LLSDMessageReader();
  43. /** All get* methods expect pointers to canonical strings. */
  44. void getBinaryData(const char* block, const char* var, void* datap,
  45. S32 size, S32 blocknum = 0,
  46. S32 max_size = S32_MAX) override;
  47. void getBool(const char* block, const char* var, bool& data,
  48. S32 blocknum = 0) override;
  49. void getS8(const char* block, const char* var, S8& data,
  50. S32 blocknum = 0) override;
  51. void getU8(const char* block, const char* var, U8& data,
  52. S32 blocknum = 0) override;
  53. void getS16(const char* block, const char* var, S16& data,
  54. S32 blocknum = 0) override;
  55. void getU16(const char* block, const char* var, U16& data,
  56. S32 blocknum = 0) override;
  57. void getS32(const char* block, const char* var, S32& data,
  58. S32 blocknum = 0) override;
  59. void getF32(const char* block, const char* var, F32& data,
  60. S32 blocknum = 0) override;
  61. void getU32(const char* block, const char* var, U32& data,
  62. S32 blocknum = 0) override;
  63. void getU64(const char* block, const char* var, U64& data,
  64. S32 blocknum = 0) override;
  65. void getF64(const char* block, const char* var, F64& data,
  66. S32 blocknum = 0) override;
  67. void getVector3(const char* block, const char* var, LLVector3& vec,
  68. S32 blocknum = 0) override;
  69. void getVector4(const char* block, const char* var, LLVector4& vec,
  70. S32 blocknum = 0) override;
  71. void getVector3d(const char* block, const char* var, LLVector3d& vec,
  72. S32 blocknum = 0) override;
  73. void getQuat(const char* block, const char* var, LLQuaternion& q,
  74. S32 blocknum = 0) override;
  75. void getUUID(const char* block, const char* var, LLUUID& uuid,
  76. S32 blocknum = 0) override;
  77. void getIPAddr(const char* block, const char* var, U32& ip,
  78. S32 blocknum = 0) override;
  79. void getIPPort(const char* block, const char* var, U16& port,
  80. S32 blocknum = 0) override;
  81. void getString(const char* block, const char* var, S32 buffer_size,
  82. char* buffer, S32 blocknum = 0) override;
  83. void getString(const char* block, const char* var, std::string& outstr,
  84. S32 blocknum = 0) override;
  85. S32 getNumberOfBlocks(const char* blockname) override;
  86. S32 getSize(const char* blockname, const char* varname) override;
  87. S32 getSize(const char* blockname, S32 blocknum,
  88. const char* varname) override;
  89. void clearMessage() override;
  90. const char* getMessageName() const override;
  91. S32 getMessageSize() const override;
  92. void copyToBuilder(LLMessageBuilder&) const override;
  93. /** Expects a pointer to a canonical name string */
  94. void setMessage(const char* name, const LLSD& msg);
  95. private:
  96. const char* mMessageName; // Canonical (prehashed) string.
  97. LLSD mMessage;
  98. };
  99. #endif // LL_LLSDMESSAGEREADER_H