00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _NPT_URI_H_
00011 #define _NPT_URI_H_
00012
00013
00014
00015
00016 #include "NptStrings.h"
00017
00018
00019
00020
00021 class NPT_Uri {
00022 public:
00023
00024 typedef enum {
00025 SCHEME_ID_UNKNOWN,
00026 SCHEME_ID_HTTP
00027 } SchemeId;
00028
00029
00030 static const char* const PathCharsToEncode;
00031 static const char* const QueryCharsToEncode;
00032 static const char* const UnsafeCharsToEncode;
00033
00034
00035 static NPT_String Encode(const char* uri, const char* chars, bool encode_percents=true);
00036 static NPT_String Decode(const char* uri);
00037 static SchemeId ParseScheme(const NPT_String& scheme);
00038
00039
00040 NPT_Uri() : m_SchemeId(SCHEME_ID_UNKNOWN) {}
00041 virtual ~NPT_Uri() {}
00042 const NPT_String& GetScheme() const {
00043 return m_Scheme;
00044 }
00045 void SetScheme(const char* scheme);
00046 NPT_Result SetSchemeFromUri(const char* uri);
00047 SchemeId GetSchemeId() const {
00048 return m_SchemeId;
00049 }
00050
00051 protected:
00052
00053 NPT_String m_Scheme;
00054 SchemeId m_SchemeId;
00055 };
00056
00057 #endif // _NPT_URI_H_