0
|
1 /**
|
|
2 * Orthanc - A Lightweight, RESTful DICOM Store
|
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
|
|
4 * Department, University Hospital of Liege, Belgium
|
|
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
|
|
6 *
|
|
7 * This program is free software: you can redistribute it and/or
|
|
8 * modify it under the terms of the GNU Affero General Public License
|
|
9 * as published by the Free Software Foundation, either version 3 of
|
|
10 * the License, or (at your option) any later version.
|
|
11 *
|
|
12 * This program is distributed in the hope that it will be useful, but
|
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
15 * Affero General Public License for more details.
|
|
16 *
|
|
17 * You should have received a copy of the GNU Affero General Public License
|
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
19 **/
|
|
20
|
|
21
|
|
22 #include "Integer64Value.h"
|
|
23
|
|
24 #include "BinaryStringValue.h"
|
|
25 #include "FileValue.h"
|
|
26 #include "NullValue.h"
|
|
27 #include "Utf8StringValue.h"
|
|
28
|
|
29 #include <Core/OrthancException.h>
|
|
30
|
|
31 #include <boost/lexical_cast.hpp>
|
|
32
|
|
33 namespace OrthancDatabases
|
|
34 {
|
|
35 IValue* Integer64Value::Convert(ValueType target) const
|
|
36 {
|
|
37 std::string s = boost::lexical_cast<std::string>(value_);
|
|
38
|
|
39 switch (target)
|
|
40 {
|
|
41 case ValueType_Null:
|
|
42 return new NullValue;
|
|
43
|
|
44 case ValueType_BinaryString:
|
|
45 return new BinaryStringValue(s);
|
|
46
|
|
47 case ValueType_File:
|
|
48 return new FileValue(s);
|
|
49
|
|
50 case ValueType_Utf8String:
|
|
51 return new Utf8StringValue(s);
|
|
52
|
|
53 default:
|
|
54 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
|
|
55 }
|
|
56 }
|
|
57
|
|
58 std::string Integer64Value::Format() const
|
|
59 {
|
|
60 return boost::lexical_cast<std::string>(value_);
|
|
61 }
|
|
62 }
|