llurlsimstring.h

Go to the documentation of this file.
00001 
00032 #ifndef LLSIMURLSTRING_H
00033 #define LLSIMURLSTRING_H
00034 
00035 #include "llstring.h"
00036 
00037 class LLURLSimString
00038 {
00039 public:
00040         enum { NOT_SET=0, NOT_PARSED=1, PARSE_OK=2, PARSE_FAIL=-1 };
00041 
00042         static void setString(const LLString& url);
00043                 // Accepts all sorts of fragments:
00044                 //   secondlife://RegionName/1/2/
00045                 //   sl://RegionName/1/2/3/
00046                 //   //Ahern/123/45/
00047                 //   Ahern
00048 
00049         static bool parse();
00050                 // Returns true if we have an URL fragment in the static instance
00051                 // (and it parsed correctly, which is basically always because
00052                 // any bare region string is a valid fragment).
00053 
00054         static bool parse(const LLString& sim_string, std::string *region_name, S32 *x, S32 *y, S32 *z);
00055                 // Parse a sim string "Ahern/1/2" and return location data,
00056                 // doesn't affect static instance.
00057 
00058         static std::string getURL();
00059                 // Get the canonical URL secondlife://RegionName/123/45/6/
00060         
00061         static std::string unescapeRegionName(std::string region_name);
00062                 // Does URL unescaping, in particular %20 -> space
00063 
00064         LLURLSimString() : mX(128), mY(128), mZ(0), mParseState(NOT_PARSED) {}
00065 
00066 private:
00067         static S32 parseGridIdx(const LLString& in_string, S32 idx0, S32* res, S32 max);
00068 
00069 public:
00070         static LLURLSimString sInstance;
00071         static LLString sLocationStringHome;
00072         static LLString sLocationStringLast;
00073 
00074 public:
00075         LLString mSimString; // "name/x/y/z"
00076         LLString mSimName;
00077         S32 mX,mY,mZ;
00078         S32 mParseState;
00079 };
00080 
00081 #endif

Generated on Thu Jul 1 06:09:24 2010 for Second Life Viewer by  doxygen 1.4.7