2 * Copyright (C) 2012-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "utils/URIUtils.h"
18 CDbUrl::~CDbUrl() = default;
28 std::string
CDbUrl::ToString() const
36 bool CDbUrl::FromString(const std::string
&dbUrl
)
49 void CDbUrl::AppendPath(const std::string
&subPath
)
51 if (!m_valid
|| subPath
.empty())
54 m_url
.SetFileName(URIUtils::AddFileToFolder(m_url
.GetFileName(), subPath
));
57 void CDbUrl::AddOption(const std::string
&key
, const char *value
)
59 if (!validateOption(key
, value
))
62 CUrlOptions::AddOption(key
, value
);
66 void CDbUrl::AddOption(const std::string
&key
, const std::string
&value
)
68 if (!validateOption(key
, value
))
71 CUrlOptions::AddOption(key
, value
);
75 void CDbUrl::AddOption(const std::string
&key
, int value
)
77 if (!validateOption(key
, value
))
80 CUrlOptions::AddOption(key
, value
);
84 void CDbUrl::AddOption(const std::string
&key
, float value
)
86 if (!validateOption(key
, value
))
89 CUrlOptions::AddOption(key
, value
);
93 void CDbUrl::AddOption(const std::string
&key
, double value
)
95 if (!validateOption(key
, value
))
98 CUrlOptions::AddOption(key
, value
);
102 void CDbUrl::AddOption(const std::string
&key
, bool value
)
104 if (!validateOption(key
, value
))
107 CUrlOptions::AddOption(key
, value
);
111 void CDbUrl::AddOptions(const std::string
&options
)
113 CUrlOptions::AddOptions(options
);
117 void CDbUrl::RemoveOption(const std::string
&key
)
119 CUrlOptions::RemoveOption(key
);
123 bool CDbUrl::validateOption(const std::string
&key
, const CVariant
&value
)
128 void CDbUrl::updateOptions()
130 // Update the options string in the CURL object
131 std::string options
= GetOptionsString();
132 if (!options
.empty())
133 options
= "?" + options
;
135 m_url
.SetOptions(options
);