[sword-cvs] sword/include url.h,1.4,1.5

sword at www.crosswire.org sword at www.crosswire.org
Sat Jul 17 09:28:06 MST 2004


Committed by: joachim

Update of /cvs/core/sword/include
In directory www:/tmp/cvs-serv31887/include

Modified Files:
	url.h 
Log Message:
test case fixes

Index: url.h
===================================================================
RCS file: /cvs/core/sword/include/url.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- url.h	17 Jul 2004 12:20:50 -0000	1.4
+++ url.h	17 Jul 2004 16:28:04 -0000	1.5
@@ -27,12 +27,13 @@
 
 SWORD_NAMESPACE_START
 
-// Class URL
-// The URL class provides an interface to work on the data of an URL like "http://www.crosswire.org/index.jsp?page=test&user=nobody"
-// 
+/** URL provides URL parsing
+ * The URL class provides an interface to work on the data of an URL like "http://www.crosswire.org/index.jsp?page=test&user=nobody"
+ */
 class URL {
 public:
-typedef std::map<SWBuf, SWBuf> ParameterMap;
+	typedef std::map<SWBuf, SWBuf> ParameterMap;
+	
 	/** Constructor.
 	 * @param url The url string which should be parsed into protocol, hostname, path and paramters
 	 */
@@ -63,15 +64,23 @@
 	 * @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 *getParamterValue(const char *name) const;
-		
+	
+	/** Encodes and URL
+	* Encodes a string into a valid URL, e.g. changes http://www.crosswire.org/test.jsp?force=1&help=1 into
+	* http://www.crosswire.org/test.jsp?force=1&amp;help=1
+	* This function works on the data of the buf parameter.
+	*
+	* WARNING: It doesn't check if the URL is encoded already, so http://www.crosswire.org/test.jsp?force=1&amp;help=1 becomes http://www.crosswire.org/test.jsp?force=1&amp;amp;help=1
+	*/
 	static const char *encode(const char *urlText);
+	
 private:
 	/** Parse
 	 * Parse the URL into protocol, hostname, path, page and paramters
 	 */
 	void parse();
 		
-	SWBuf url;	
+	SWBuf url;
 	SWBuf protocol;
 	SWBuf hostname;
 	SWBuf path;



More information about the sword-cvs mailing list