2 * Copyright (C) 2012-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
22 #include "utils/URIUtils.h"
40 std::string
CDbUrl::ToString() const
48 bool CDbUrl::FromString(const std::string
&dbUrl
)
61 void CDbUrl::AppendPath(const std::string
&subPath
)
63 if (!m_valid
|| subPath
.empty())
66 m_url
.SetFileName(URIUtils::AddFileToFolder(m_url
.GetFileName(), subPath
));
69 void CDbUrl::AddOption(const std::string
&key
, const char *value
)
71 if (!validateOption(key
, value
))
74 CUrlOptions::AddOption(key
, value
);
78 void CDbUrl::AddOption(const std::string
&key
, const std::string
&value
)
80 if (!validateOption(key
, value
))
83 CUrlOptions::AddOption(key
, value
);
87 void CDbUrl::AddOption(const std::string
&key
, int value
)
89 if (!validateOption(key
, value
))
92 CUrlOptions::AddOption(key
, value
);
96 void CDbUrl::AddOption(const std::string
&key
, float value
)
98 if (!validateOption(key
, value
))
101 CUrlOptions::AddOption(key
, value
);
105 void CDbUrl::AddOption(const std::string
&key
, double value
)
107 if (!validateOption(key
, value
))
110 CUrlOptions::AddOption(key
, value
);
114 void CDbUrl::AddOption(const std::string
&key
, bool value
)
116 if (!validateOption(key
, value
))
119 CUrlOptions::AddOption(key
, value
);
123 void CDbUrl::AddOptions(const std::string
&options
)
125 CUrlOptions::AddOptions(options
);
129 void CDbUrl::RemoveOption(const std::string
&key
)
131 CUrlOptions::RemoveOption(key
);
135 bool CDbUrl::validateOption(const std::string
&key
, const CVariant
&value
)
143 void CDbUrl::updateOptions()
145 // Update the options string in the CURL object
146 std::string options
= GetOptionsString();
147 if (!options
.empty())
148 options
= "?" + options
;
150 m_url
.SetOptions(options
);