00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _uri_h
00018 #define _uri_h
00019
00020 #include <string.h>
00021 #include <spl/types.h>
00022 #include <spl/Debug.h>
00023 #include <spl/collection/Association.h>
00024 #include <spl/collection/Hashtable.h>
00025 #include <spl/Memory.h>
00026 #include <spl/String.h>
00027 #include <spl/collection/Vector.h>
00028
00034 class Uri : public IMemoryValidate, public IHashable
00035 {
00036 protected:
00037 String m_protocol;
00038 String m_server;
00039 int m_port;
00040 String m_path;
00041 String m_filename;
00042 String m_fileext;
00043
00044 Vector<Association<String, String> > m_args;
00045 Hashtable<String, String> m_argIdx;
00046
00047 public:
00048 Uri( );
00049 Uri( const Uri& uri );
00050 Uri( const String& cpuri );
00051 virtual ~Uri();
00052
00053 Uri& operator =(const Uri& uri);
00054
00055 inline String& Protocol() { return m_protocol; }
00056 inline String& Host() { return m_server; }
00057 inline int& Port() { return m_port; }
00058 inline String& Path() { return m_path; }
00059 inline String& Filename() { return m_filename; }
00060 inline String& FileExt() { return m_fileext; }
00061
00062 inline const Vector<Association<String, String> >& Args() { return m_args; }
00063
00064 inline bool HasArg(const String& argname) const { return m_argIdx.ContainsKey(argname); }
00065
00066 inline String& GetArg(const String& argname) { return m_argIdx.GetRef(argname); }
00067
00068 void Parse( const String& uri );
00069
00070 virtual int32 HashCode() const;
00071
00072 StringPtr AbsolutePath() const;
00073 StringPtr ToString() const;
00074
00075 #ifdef DEBUG
00076 void ValidateMem() const;
00077 void CheckMem() const;
00078 #endif
00079 };
00080
00083 #endif