[sword-cvs] sword/include url.h,1.3,1.4
sword at www.crosswire.org
sword at www.crosswire.org
Sat Jul 17 05:20:52 MST 2004
Committed by: scribe
Update of /cvs/core/sword/include
In directory www:/tmp/cvs-serv29324/include
Modified Files:
url.h
Log Message:
Joachim, I combined your utilweb.cpp and url, and made the changes we discussed
on IRC. Let me know if you have any objections.
Index: url.h
===================================================================
RCS file: /cvs/core/sword/include/url.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- url.h 15 Jul 2004 13:51:54 -0000 1.3
+++ url.h 17 Jul 2004 12:20:50 -0000 1.4
@@ -32,28 +32,29 @@
//
class URL {
public:
+typedef std::map<SWBuf, SWBuf> ParameterMap;
/** Constructor.
* @param url The url string which should be parsed into protocol, hostname, path and paramters
*/
- URL ( const char* url );
+ URL(const char *url);
/** Get the protocol.
* @return The protocol, e.g. "http" for an url like "http://www.crosswire.org/index.jsp?page=help"
*/
- const char* const getProtocol() const;
+ const char *getProtocol() const;
/** Get the hostname
* @return The hostname, e.g. "www.crosswire.org" for an url like "http://www.crosswire.org/index.jsp?page=help"
*/
- const char* const getHostName() const;
+ const char *getHostName() const;
/** Get the path
* @return The path, e.g. "/index.jsp" for an url like "http://www.crosswire.org/index.jsp?page=help"
*/
- const char* const getPath() const;
+ const char *getPath() const;
/** All available paramters
* @return The map which contains the parameters and their values
*/
- std::map< sword::SWBuf, sword::SWBuf > getParameters() const;
+ const ParameterMap &getParameters() const;
/**
* Returns the value of an URL parameter. For the URL "http://www.crosswire.org/index.jsp?page=test&user=nobody" the value of the parameter "page" would be "test".
@@ -61,19 +62,20 @@
* @param name The name of the paramter.
* @return The value of the given paramter of an empty string if the name could not be found in the list of available paramters
*/
- const char* const getParamterValue (const char* const name);
+ const char *getParamterValue(const char *name) const;
+ static const char *encode(const char *urlText);
private:
/** Parse
* Parse the URL into protocol, hostname, path, page and paramters
*/
- void parse ();
+ void parse();
- SWBuf m_url;
- SWBuf m_protocol;
- SWBuf m_hostname;
- SWBuf m_path;
- std::map< SWBuf, SWBuf > m_parameterMap;
+ SWBuf url;
+ SWBuf protocol;
+ SWBuf hostname;
+ SWBuf path;
+ ParameterMap parameterMap;
};
SWORD_NAMESPACE_END
More information about the sword-cvs
mailing list