// ---------------------------------------------------------------------------
// - UriQuery.hpp -
// - afnix:nwg module - uri query class definition -
// ---------------------------------------------------------------------------
// - This program is free software; you can redistribute it and/or modify -
// - it provided that this copyright notice is kept intact. -
// - -
// - This program is distributed in the hope that it will be useful, but -
// - without any warranty; without even the implied warranty of -
// - merchantability or fitness for a particular purpose. In no event shall -
// - the copyright holder be liable for any direct, indirect, incidental or -
// - special damages arising in any way out of the use of this software. -
// ---------------------------------------------------------------------------
// - copyright (c) 1999-2007 amaury darsch -
// ---------------------------------------------------------------------------
#ifndef AFNIX_URIQUERY_HPP
#define AFNIX_URIQUERY_HPP
#ifndef AFNIX_PLIST_HPP
#include "Plist.hpp"
#endif
namespace afnix {
/// The UriQuery class is a simple class that parses a uri query string
/// and build property list. during the parsing process, a special
/// transliteration process is done as specified by RFC 3986. This class
/// is primarily used with CGI scripts. Note that the string to parse
/// is exactly the one produced by the 'getquery' method of the Uri class.
/// @author amaury darsch
class UriQuery : public Plist {
private:
/// the query string
String d_query;
public:
/// create an empty uri query
UriQuery (void);
/// create a uri query by string
/// @param queury the string to parse
UriQuery (const String& query);
/// @return the class name
String repr (void) const;
/// reset the query
void reset (void);
/// parse a uri query by name
/// @param query the query to parse
void parse (const String& query);
/// @return the query string
String getquery (void) const;
private:
// make the copy constructor private
UriQuery (const UriQuery&);
// make the assignment operator private
UriQuery& operator = (const UriQuery&);
public:
/// create a new object in a generic way
/// @param argv the argument vector
static Object* mknew (Vector* argv);
/// @return true if the given quark is defined
bool isquark (const long quark, const bool hflg) const;
/// apply this object with a set of arguments and a quark
/// @param robj the current runnable
/// @param nset the current nameset
/// @param quark the quark to apply these arguments
/// @param argv the arguments to apply
Object* apply (Runnable* robj, Nameset* nset, const long quark,
Vector* argv);
};
}
#endif
syntax highlighted by Code2HTML, v. 0.9.1