limal
Url.hpp
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | |
3 | _ _ _ _ __ _ |
4 | | | | | | \_/ | / \ | | |
5 | | | | | | |_| | / /\ \ | | |
6 | | |__ | | | | | | / ____ \ | |__ |
7 | |____||_| |_| |_|/ / \ \|____| |
8 | |
9 | core library |
10 | |
11 | (C) SUSE Linux Products GmbH |
12 \----------------------------------------------------------------------/
13 
14  File: Url.hpp
15 
16  Author: Marius Tomaschewski
17  Maintainer: Marius Tomaschewski
18 
19 /-*/
24 #ifndef LIMAL_URL_HPP
25 #define LIMAL_URL_HPP
26 
27 #include <limal/config.h>
28 #include <limal/UrlBase.hpp>
29 
30 
31 // -------------------------------------------------------------------
32 namespace LIMAL_NAMESPACE
33 {
34 namespace url
35 {
36 
96 class Url
97 {
98 public:
103 
108 
109 
110  ~Url();
111  Url();
112 
123  Url(const Url &url);
124 
125 
136  Url(const limal::url::UrlRef &url);
137 
138 
149  Url(const blocxx::String &urlString);
150 
151 
152  // -----------------
170  static url::UrlRef
171  parseUrl(const blocxx::String &urlString);
172 
173 
174  // -----------------
186  Url&
187  operator = (const blocxx::String &urlString);
188 
189 
200  Url&
201  operator = (const Url &url);
202 
203 
204  // -----------------
209  blocxx::StringArray
210  getKnownSchemes() const;
211 
212 
227  bool
228  isValidScheme(const blocxx::String &scheme) const;
229 
230 
240  bool
241  isValid() const;
242 
243 
244  // -----------------
252  blocxx::String
253  toString() const;
254 
267  blocxx::String
268  toString(const ViewOptions &opts) const;
269 
279  blocxx::String
280  toCompleteString() const;
281 
282 
283  // -----------------
288  blocxx::String
289  getScheme() const;
290 
291 
292  // -----------------
302  blocxx::String
303  getAuthority() const;
304 
312  blocxx::String
313  getUsername(EEncoding eflag = limal::url::E_DECODED) const;
314 
322  blocxx::String
323  getPassword(EEncoding eflag = limal::url::E_DECODED) const;
324 
337  blocxx::String
338  getHost(EEncoding eflag = limal::url::E_DECODED) const;
339 
344  blocxx::String
345  getPort() const;
346 
347 
348  // -----------------
358  blocxx::String
359  getPathData() const;
360 
369  blocxx::String
370  getPathName(EEncoding eflag = limal::url::E_DECODED) const;
371 
376  blocxx::String
377  getPathParams() const;
378 
391  blocxx::StringArray
392  getPathParamsArray() const;
393 
414  getPathParamsMap(EEncoding eflag = limal::url::E_DECODED) const;
415 
432  blocxx::String
433  getPathParam(const blocxx::String &param,
434  EEncoding eflag = limal::url::E_DECODED) const;
435 
436 
437  // -----------------
447  blocxx::String
448  getQueryString() const;
449 
463  blocxx::StringArray
464  getQueryStringArray() const;
465 
485  getQueryStringMap(EEncoding eflag = limal::url::E_DECODED) const;
486 
503  blocxx::String
504  getQueryParam(const blocxx::String &param,
505  EEncoding eflag = limal::url::E_DECODED) const;
506 
507 
508  // -----------------
516  blocxx::String
517  getFragment(EEncoding eflag = limal::url::E_DECODED) const;
518 
519 
520  // -----------------
527  void
528  setScheme(const blocxx::String &scheme);
529 
530 
531  // -----------------
545  void
546  setAuthority(const blocxx::String &authority);
547 
557  void
558  setUsername(const blocxx::String &user,
560 
570  void
571  setPassword(const blocxx::String &pass,
573 
594  void
595  setHost(const blocxx::String &host,
597 
605  void
606  setPort(const blocxx::String &port);
607 
608 
609  // -----------------
620  void
621  setPathData(const blocxx::String &pathdata);
622 
630  void
631  setPathName(const blocxx::String &path,
633 
640  void
641  setPathParams(const blocxx::String &params);
642 
649  void
650  setPathParamsArray(const blocxx::StringArray &parray);
651 
658  void
659  setPathParamsMap(const limal::url::ParamMap &pmap);
660 
670  void
671  setPathParam(const blocxx::String &param, const blocxx::String &value);
672 
673 
674  // -----------------
681  void
682  setQueryString(const blocxx::String &querystr);
683 
690  void
691  setQueryStringArray(const blocxx::StringArray &qarray);
692 
699  void
700  setQueryStringMap(const limal::url::ParamMap &qmap);
701 
711  void
712  setQueryParam(const blocxx::String &param, const blocxx::String &value);
713 
714 
715  // -----------------
723  void
724  setFragment(const blocxx::String &fragment,
726 
727 
728  // -----------------
738  getViewOptions() const;
739 
748  void
749  setViewOptions(const ViewOptions &vopts);
750 
757  friend std::ostream &
758  operator<<(std::ostream &os, const Url &url);
759 
760 private:
762 };
763 
764 
765 // -------------------------------------------------------------------
766 } // End url namespace
767 } // End of LIMAL_NAMESPACE
768 #endif // LIMAL_URLUTILS_HPP
769 // vim: set ts=8 sts=8 sw=8 ai noet: