0
|
1 /**
|
|
2 * Palantir - A Lightweight, RESTful DICOM Store
|
|
3 * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
|
|
4 * Belgium
|
|
5 *
|
|
6 * This program is free software: you can redistribute it and/or
|
|
7 * modify it under the terms of the GNU General Public License as
|
|
8 * published by the Free Software Foundation, either version 3 of the
|
|
9 * License, or (at your option) any later version.
|
|
10 *
|
|
11 * This program is distributed in the hope that it will be useful, but
|
|
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14 * General Public License for more details.
|
|
15 *
|
|
16 * You should have received a copy of the GNU General Public License
|
|
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
18 **/
|
|
19
|
|
20
|
|
21 #pragma once
|
|
22
|
|
23 #include <stdint.h>
|
|
24 #include <vector>
|
|
25 #include <string>
|
|
26
|
|
27 namespace Palantir
|
|
28 {
|
|
29 typedef std::vector<std::string> UriComponents;
|
|
30
|
|
31 namespace Toolbox
|
|
32 {
|
|
33 void ServerBarrier();
|
|
34
|
|
35 void ToUpperCase(std::string& s);
|
|
36
|
|
37 void ToLowerCase(std::string& s);
|
|
38
|
|
39 void ReadFile(std::string& content,
|
|
40 const std::string& path);
|
|
41
|
|
42 void Sleep(uint32_t seconds);
|
|
43
|
|
44 void USleep(uint64_t microSeconds);
|
|
45
|
|
46 void RemoveFile(const std::string& path);
|
|
47
|
|
48 void SplitUriComponents(UriComponents& components,
|
|
49 const std::string& uri);
|
|
50
|
|
51 bool IsChildUri(const UriComponents& baseUri,
|
|
52 const UriComponents& testedUri);
|
|
53
|
|
54 std::string AutodetectMimeType(const std::string& path);
|
|
55
|
|
56 std::string FlattenUri(const UriComponents& components,
|
|
57 size_t fromLevel = 0);
|
|
58
|
|
59 uint64_t GetFileSize(const std::string& path);
|
|
60 }
|
|
61 }
|