/indra/newview/llslurl.h

https://bitbucket.org/lindenlab/viewer-beta/ · C Header · 108 lines · 64 code · 16 blank · 28 comment · 6 complexity · 0a9c463918c1317c649d9c910c5d62ba MD5 · raw file

  1. /**
  2. * @file llslurl.h
  3. * @brief Handles "SLURL fragments" like Ahern/123/45 for
  4. * startup processing, login screen, prefs, etc.
  5. *
  6. * $LicenseInfo:firstyear=2010&license=viewerlgpl$
  7. * Second Life Viewer Source Code
  8. * Copyright (C) 2010, Linden Research, Inc.
  9. *
  10. * This library is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU Lesser General Public
  12. * License as published by the Free Software Foundation;
  13. * version 2.1 of the License only.
  14. *
  15. * This library is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * Lesser General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public
  21. * License along with this library; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. *
  24. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  25. * $/LicenseInfo$
  26. */
  27. #ifndef LLSLURL_H
  28. #define LLSLURL_H
  29. #include "llstring.h"
  30. // represents a location in a grid
  31. class LLSLURL
  32. {
  33. public:
  34. static const char* SLURL_HTTPS_SCHEME;
  35. static const char* SLURL_HTTP_SCHEME;
  36. static const char* SLURL_SL_SCHEME;
  37. static const char* SLURL_SECONDLIFE_SCHEME;
  38. static const char* SLURL_SECONDLIFE_PATH;
  39. static const char* SLURL_COM;
  40. static const char* WWW_SLURL_COM;
  41. static const char* SECONDLIFE_COM;
  42. static const char* MAPS_SECONDLIFE_COM;
  43. static const char* SLURL_X_GRID_LOCATION_INFO_SCHEME;
  44. static LLSLURL START_LOCATION;
  45. static const char* SIM_LOCATION_HOME;
  46. static const char* SIM_LOCATION_LAST;
  47. static const char* SLURL_APP_PATH;
  48. static const char* SLURL_REGION_PATH;
  49. enum SLURL_TYPE {
  50. INVALID,
  51. LOCATION,
  52. HOME_LOCATION,
  53. LAST_LOCATION,
  54. APP,
  55. HELP
  56. };
  57. LLSLURL(): mType(INVALID) { }
  58. LLSLURL(const std::string& slurl);
  59. LLSLURL(const std::string& grid, const std::string& region);
  60. LLSLURL(const std::string& region, const LLVector3& position);
  61. LLSLURL(const std::string& grid, const std::string& region, const LLVector3& position);
  62. LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position);
  63. LLSLURL(const std::string& region, const LLVector3d& global_position);
  64. LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb);
  65. SLURL_TYPE getType() const { return mType; }
  66. std::string getSLURLString() const;
  67. std::string getLoginString() const;
  68. std::string getLocationString() const;
  69. std::string getGrid() const { return mGrid; }
  70. std::string getRegion() const { return mRegion; }
  71. LLVector3 getPosition() const { return mPosition; }
  72. std::string getAppCmd() const { return mAppCmd; }
  73. std::string getAppQuery() const { return mAppQuery; }
  74. LLSD getAppQueryMap() const { return mAppQueryMap; }
  75. LLSD getAppPath() const { return mAppPath; }
  76. bool isValid() const { return mType != INVALID; }
  77. bool isSpatial() const { return (mType == LAST_LOCATION) || (mType == HOME_LOCATION) || (mType == LOCATION); }
  78. bool operator==(const LLSLURL& rhs);
  79. bool operator!=(const LLSLURL&rhs);
  80. std::string asString() const ;
  81. protected:
  82. SLURL_TYPE mType;
  83. // used for Apps and Help
  84. std::string mAppCmd;
  85. LLSD mAppPath;
  86. LLSD mAppQueryMap;
  87. std::string mAppQuery;
  88. std::string mGrid; // reference to grid manager grid
  89. std::string mRegion;
  90. LLVector3 mPosition;
  91. };
  92. #endif // LLSLURL_H