w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
RparseUrl.hpp
Go to the documentation of this file.
1// $Id: RparseUrl.hpp 1186 2019-07-12 17:49:59Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2013-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2019-06-07 1161 1.2 add DirName,FileName,FileStem,FileType
8// 2017-04-15 875 1.1 add Set() with default scheme handling
9// 2013-02-23 492 1.0.1 add static FindScheme(); allow no or empty scheme
10// 2013-02-03 481 1.0 Initial version, extracted from RlinkPort
11// ---------------------------------------------------------------------------
12
17#ifndef included_Retro_RparseUrl
18#define included_Retro_RparseUrl 1
19
20#include <string>
21#include <map>
22
23#include "RerrMsg.hpp"
24
25namespace Retro {
26
27 class RparseUrl {
28 public:
29 typedef std::map<std::string, std::string> omap_t;
30
31 RparseUrl();
32 virtual ~RparseUrl();
33
34 bool Set(const std::string& url, const std::string& optlist,
35 RerrMsg& emsg);
36 bool Set(const std::string& url, const std::string& optlist,
37 const std::string& scheme, RerrMsg& emsg);
38 void SetPath(const std::string& path);
39
40 void Clear();
41
42 const std::string& Url() const;
43 const std::string& Scheme() const;
44 const std::string& Path() const;
45 std::string DirName() const;
46 std::string FileName() const;
47 std::string FileStem() const;
48 std::string FileType() const;
49 const omap_t& Opts() const;
50 bool FindOpt(const std::string& name) const;
51 bool FindOpt(const std::string& name,
52 std::string& value) const;
53
54 virtual void Dump(std::ostream& os, int ind=0, const char* text=0) const;
55
56 static std::string FindScheme(const std::string& url,
57 const std::string& def = "");
58
59 protected:
60 bool AddOpt(const std::string& key, const std::string& val,
61 bool hasval, const std::string& optlist,
62 RerrMsg& emsg);
63
64 protected:
65 std::string fUrl;
66 std::string fScheme;
67 std::string fPath;
69 };
70
71} // end namespace Retro
72
73#include "RparseUrl.ipp"
74
75#endif
FIXME_docs.
Definition: RerrMsg.hpp:25
FIXME_docs.
Definition: RparseUrl.hpp:27
static std::string FindScheme(const std::string &url, const std::string &def="")
FIXME_docs.
Definition: RparseUrl.cpp:238
omap_t fOptMap
option map
Definition: RparseUrl.hpp:68
bool FindOpt(const std::string &name) const
FIXME_docs.
Definition: RparseUrl.cpp:196
bool Set(const std::string &url, const std::string &optlist, RerrMsg &emsg)
FIXME_docs.
Definition: RparseUrl.cpp:55
std::string FileName() const
FIXME_docs.
Definition: RparseUrl.cpp:165
const std::string & Scheme() const
FIXME_docs.
Definition: RparseUrl.ipp:37
const std::string & Url() const
FIXME_docs.
Definition: RparseUrl.ipp:29
bool AddOpt(const std::string &key, const std::string &val, bool hasval, const std::string &optlist, RerrMsg &emsg)
FIXME_docs.
Definition: RparseUrl.cpp:257
std::string fPath
url path part
Definition: RparseUrl.hpp:67
RparseUrl()
Default constructor.
Definition: RparseUrl.cpp:39
std::string FileType() const
FIXME_docs.
Definition: RparseUrl.cpp:185
std::string fUrl
full url given with open
Definition: RparseUrl.hpp:65
void SetPath(const std::string &path)
FIXME_docs.
Definition: RparseUrl.ipp:20
std::string DirName() const
FIXME_docs.
Definition: RparseUrl.cpp:156
std::string FileStem() const
FIXME_docs.
Definition: RparseUrl.cpp:175
const omap_t & Opts() const
FIXME_docs.
Definition: RparseUrl.ipp:53
std::map< std::string, std::string > omap_t
Definition: RparseUrl.hpp:29
virtual ~RparseUrl()
Destructor.
Definition: RparseUrl.cpp:49
std::string fScheme
url scheme part
Definition: RparseUrl.hpp:66
virtual void Dump(std::ostream &os, int ind=0, const char *text=0) const
FIXME_docs.
Definition: RparseUrl.cpp:219
const std::string & Path() const
FIXME_docs.
Definition: RparseUrl.ipp:45
void Clear()
FIXME_docs.
Definition: RparseUrl.cpp:144
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47