PageRenderTime 82ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llinventory/llinventorytype.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 95 lines | 39 code | 11 blank | 45 comment | 0 complexity | c5bb88471d69994f73a6716857f5d67c MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llinventorytype.h
  3. * @brief Inventory item type, more specific than an asset type.
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LLINVENTORYTYPE_H
  27. #define LLINVENTORYTYPE_H
  28. #include "llassettype.h"
  29. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  30. // Class LLInventoryType
  31. //
  32. // Class used to encapsulate operations around inventory type.
  33. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. class LLInventoryType
  35. {
  36. public:
  37. enum EType
  38. {
  39. IT_TEXTURE = 0,
  40. IT_SOUND = 1,
  41. IT_CALLINGCARD = 2,
  42. IT_LANDMARK = 3,
  43. //IT_SCRIPT = 4,
  44. //IT_CLOTHING = 5,
  45. IT_OBJECT = 6,
  46. IT_NOTECARD = 7,
  47. IT_CATEGORY = 8,
  48. IT_ROOT_CATEGORY = 9,
  49. IT_LSL = 10,
  50. //IT_LSL_BYTECODE = 11,
  51. //IT_TEXTURE_TGA = 12,
  52. //IT_BODYPART = 13,
  53. //IT_TRASH = 14,
  54. IT_SNAPSHOT = 15,
  55. //IT_LOST_AND_FOUND = 16,
  56. IT_ATTACHMENT = 17,
  57. IT_WEARABLE = 18,
  58. IT_ANIMATION = 19,
  59. IT_GESTURE = 20,
  60. IT_MESH = 22,
  61. IT_WIDGET = 23,
  62. IT_COUNT = 24,
  63. IT_NONE = -1
  64. };
  65. // machine transation between type and strings
  66. static EType lookup(const std::string& name);
  67. static const std::string &lookup(EType type);
  68. // translation from a type to a human readable form.
  69. static const std::string &lookupHumanReadable(EType type);
  70. // return the default inventory for the given asset type.
  71. static EType defaultForAssetType(LLAssetType::EType asset_type);
  72. // true if this type cannot have restricted permissions.
  73. static bool cannotRestrictPermissions(EType type);
  74. private:
  75. // don't instantiate or derive one of these objects
  76. LLInventoryType( void );
  77. ~LLInventoryType( void );
  78. };
  79. // helper function that returns true if inventory type and asset type
  80. // are potentially compatible. For example, an attachment must be an
  81. // object, but a wearable can be a bodypart or clothing asset.
  82. bool inventory_and_asset_types_match(LLInventoryType::EType inventory_type,
  83. LLAssetType::EType asset_type);
  84. #endif