Mercurial > hg > orthanc-wsi
comparison Resources/Orthanc/StoneToolbox.cpp @ 320:196d0e18afa0
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 16 Oct 2024 14:58:02 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
319:9ce06c06c984 | 320:196d0e18afa0 |
---|---|
1 /** | |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium | |
6 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium | |
7 * | |
8 * This program is free software: you can redistribute it and/or | |
9 * modify it under the terms of the GNU Lesser General Public License | |
10 * as published by the Free Software Foundation, either version 3 of | |
11 * the License, or (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * Lesser General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU Lesser General Public | |
19 * License along with this program. If not, see | |
20 * <http://www.gnu.org/licenses/>. | |
21 **/ | |
22 | |
23 | |
24 #include "StoneToolbox.h" | |
25 | |
26 namespace OrthancStone | |
27 { | |
28 namespace StoneToolbox | |
29 { | |
30 std::string JoinUrl(const std::string& base, | |
31 const std::string& path) | |
32 { | |
33 size_t end = base.size(); | |
34 while (end > 0 && | |
35 base[end - 1] == '/') | |
36 { | |
37 end--; | |
38 } | |
39 | |
40 size_t start = 0; | |
41 while (start < path.size() && | |
42 path[start] == '/') | |
43 { | |
44 start++; | |
45 } | |
46 | |
47 return base.substr(0, end) + "/" + path.substr(start); | |
48 } | |
49 } | |
50 } |