xbmc
DbUrl.h
1 /*
2  * Copyright (C) 2012-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "URL.h"
12 #include "utils/UrlOptions.h"
13 
14 #include <string>
15 
16 class CVariant;
17 
19 {
20 public:
21  CDbUrl();
22  ~CDbUrl() override;
23 
24  bool IsValid() const { return m_valid; }
25  void Reset();
26 
27  std::string ToString() const;
28  bool FromString(const std::string &dbUrl);
29 
30  const std::string& GetType() const { return m_type; }
31  void AppendPath(const std::string &subPath);
32 
33  using CUrlOptions::HasOption;
34  using CUrlOptions::GetOptions;
35  using CUrlOptions::GetOptionsString;
36 
37  void AddOption(const std::string &key, const char *value) override;
38  void AddOption(const std::string &key, const std::string &value) override;
39  void AddOption(const std::string &key, int value) override;
40  void AddOption(const std::string &key, float value) override;
41  void AddOption(const std::string &key, double value) override;
42  void AddOption(const std::string &key, bool value) override;
43  void AddOptions(const std::string &options) override;
44  void RemoveOption(const std::string &key) override;
45 
46 protected:
47  virtual bool parse() = 0;
48  virtual bool validateOption(const std::string &key, const CVariant &value);
49 
50  CURL m_url;
51  std::string m_type;
52 
53 private:
54  void updateOptions();
55 
56  bool m_valid;
57 };
Definition: URL.h:20
Definition: Variant.h:29
Definition: UrlOptions.h:16
Definition: DbUrl.h:18