1
0
mirror of https://github.com/wfjm/w11.git synced 2026-02-01 14:42:47 +00:00

RparseUrl: add Set() with default scheme handling

This commit is contained in:
Walter F.J. Mueller
2017-04-16 14:45:20 +02:00
parent 8956969480
commit 32ccbc6347
2 changed files with 24 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
// $Id: RparseUrl.cpp 686 2015-06-04 21:08:08Z mueller $
// $Id: RparseUrl.cpp 875 2017-04-15 21:58:50Z mueller $
//
// Copyright 2013-2015 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -13,6 +13,7 @@
//
// Revision History:
// Date Rev Version Comment
// 2017-04-15 875 1.1 add Set() with default scheme handling
// 2015-06-04 686 1.0.2 Set(): add check that optlist is enclosed by '|'
// 2013-02-23 492 1.0.1 add static FindScheme(); allow no or empty scheme
// 2013-02-03 481 1.0 Initial version, extracted from RlinkPort
@@ -20,7 +21,7 @@
/*!
\file
\version $Id: RparseUrl.cpp 686 2015-06-04 21:08:08Z mueller $
\version $Id: RparseUrl.cpp 875 2017-04-15 21:58:50Z mueller $
\brief Implemenation of RparseUrl.
*/
@@ -135,6 +136,20 @@ bool RparseUrl::Set(const std::string& url, const std::string& optlist,
//------------------------------------------+-----------------------------------
//! FIXME_docs
bool RparseUrl::Set(const std::string& url, const std::string& optlist,
const std::string& scheme, RerrMsg& emsg)
{
if (FindScheme(url).length() == 0 && scheme.length() > 0) {
string url1 = scheme + string(":") + url;
return Set(url1, optlist, emsg);
}
return Set(url, optlist, emsg);
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
void RparseUrl::Clear()
{
fUrl.clear();

View File

@@ -1,6 +1,6 @@
// $Id: RparseUrl.hpp 492 2013-02-24 22:14:47Z mueller $
// $Id: RparseUrl.hpp 875 2017-04-15 21:58:50Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -13,13 +13,14 @@
//
// Revision History:
// Date Rev Version Comment
// 2017-04-15 875 1.1 add Set() with default scheme handling
// 2013-02-23 492 1.0.1 add static FindScheme(); allow no or empty scheme
// 2013-02-03 481 1.0 Initial version, extracted from RlinkPort
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: RparseUrl.hpp 492 2013-02-24 22:14:47Z mueller $
\version $Id: RparseUrl.hpp 875 2017-04-15 21:58:50Z mueller $
\brief Declaration of class RparseUrl.
*/
@@ -45,6 +46,8 @@ namespace Retro {
bool Set(const std::string& url, const std::string& optlist,
RerrMsg& emsg);
bool Set(const std::string& url, const std::string& optlist,
const std::string& scheme, RerrMsg& emsg);
void SetPath(const std::string& path);
void Clear();