Merge pull request #26166 from ksooo/improve-plugin-ctx-menus
[xbmc.git] / xbmc / utils / HttpHeader.h
blobb1e6a3ce19022491898a275291306ab5c90db1a9
1 /*
2 * Copyright (C) 2005-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.
7 */
9 #pragma once
11 #include <string>
12 #include <utility>
13 #include <vector>
15 class CHttpHeader
17 public:
18 typedef std::pair<std::string, std::string> HeaderParamValue;
19 typedef std::vector<HeaderParamValue> HeaderParams;
20 typedef HeaderParams::iterator HeaderParamsIter;
22 CHttpHeader();
23 ~CHttpHeader();
25 void Parse(const std::string& strData);
26 void AddParam(const std::string& param, const std::string& value, const bool overwrite = false);
28 std::string GetValue(const std::string& strParam) const;
29 std::vector<std::string> GetValues(std::string strParam) const;
31 std::string GetHeader(void) const;
33 std::string GetMimeType(void) const;
34 std::string GetCharset(void) const;
35 inline const std::string& GetProtoLine() const { return m_protoLine; }
37 inline bool IsHeaderDone(void) const
38 { return m_headerdone; }
40 void Clear();
42 protected:
43 std::string GetValueRaw(const std::string& strParam) const;
44 bool ParseLine(const std::string& headerLine);
46 HeaderParams m_params;
47 std::string m_protoLine;
48 bool m_headerdone;
49 std::string m_lastHeaderLine;
50 static const char* const m_whitespaceChars;