URI.h

Go to the documentation of this file.
00001 /*
00002  * $Id: URI.h 576 2007-12-29 02:59:38Z mindstorm2600 $
00003  *
00004  * X-VR2 
00005  * 
00006  * Copyright (C) Juan V. Guerrero 2007
00007  * 
00008  * Juan V. Guerrero <mindstorm2600@users.sourceforge.net>
00009  * 
00010  * This program is free software, distributed under the terms of
00011  * the GNU General Public License Version 2. See the LICENSE file
00012  * at the top of the source tree.
00013  */
00014 #ifndef __XVR2_NET_URI_H__
00015 #define __XVR2_NET_URI_H__
00016 #include<xvr2/String.h>
00017 #include<xvr2/Map.h>
00018 
00019 namespace xvr2 {
00020 
00021         namespace Net {
00022         
00036                 class URI : public Object {
00037                         private:
00040                                 void parse();
00041                         public:
00042                                 struct _cmpf {
00043                                         bool operator()(const String &a, const String &b){
00044                                                 return strcmp(a.toCharPtr(), b.toCharPtr()) < 0;
00045                                         }
00046                                 };
00047                                 typedef Map<String, String, _cmpf> QueryMap;
00048                                 typedef QueryMap::iterator QueryMapIterator;
00049                         protected:
00050                                 String _uri;
00051                                 String _scheme;
00052                                 String _user;
00053                                 String _password;
00054                                 String _host;
00055                                 String _query_string;
00056                                 String _param_string;
00057                                 String _fragment;
00058                                 int _port;
00059                                 String _path;
00060                                 QueryMap query;
00061                         public:
00063                                 URI();
00065                                 URI(const String &uri);
00066                                 ~URI();
00068                                 const String &scheme();
00070                                 const String &scheme() const;
00072                                 const String &host();
00074                                 const String &host() const;
00078                                 int port();
00082                                 const String &path();
00086                                 const String &path() const ;
00093                                 const String &paramString();
00100                                 const String &paramString() const;
00106                                 const String &queryString();
00112                                 const String &queryString() const;
00116                                 const String &fragment();
00120                                 const String &fragment() const;
00125                                 const String &user();
00130                                 const String &user() const;
00135                                 const String &password();
00140                                 const String &password() const;
00142                                 virtual std::string toString();
00145                                 URI &operator=(const String &uri_str);
00153                                 URI::QueryMap queryMap();
00154                 };
00155         
00156                 class URIParseException : public xvr2::ParseException {
00157                         private:
00158                         protected:
00159                         public:
00160                                 URIParseException();
00161                                 URIParseException(const std::string &_original_text, const std::string _description);
00162                                 const std::string &text();
00163                                 const std::string &text() const;
00164                 };
00165         }
00166 
00167 }
00168 
00169 #endif /*URI_H_*/

Generated on Fri Jun 20 22:55:48 2008 for X-VR2 SDK by  doxygen 1.5.5