tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsMIMEHeaderParamImpl.h (1730B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #include "nsIMIMEHeaderParam.h"
      7 
      8 #ifndef __nsmimeheaderparamimpl_h___
      9 #  define __nsmimeheaderparamimpl_h___
     10 class nsMIMEHeaderParamImpl : public nsIMIMEHeaderParam {
     11 public:
     12  NS_DECL_ISUPPORTS
     13  NS_DECL_NSIMIMEHEADERPARAM
     14 
     15  nsMIMEHeaderParamImpl() = default;
     16 
     17  /**
     18   * Identical to calling
     19   * GetParameterHTTP(aHeaderVal, aParameterName, ""_ns, false,
     20   * nullptr, aResult) See nsIMIMEHeaderParam.idl for more information.
     21   */
     22  static nsresult GetParameterHTTP(const nsACString& aHeaderVal,
     23                                   const char* aParamName, nsAString& aResult);
     24 
     25 private:
     26  virtual ~nsMIMEHeaderParamImpl() = default;
     27  enum ParamDecoding { MIME_FIELD_ENCODING = 1, HTTP_FIELD_ENCODING };
     28 
     29  static nsresult DoGetParameter(const nsACString& aHeaderVal,
     30                                 const char* aParamName,
     31                                 ParamDecoding aDecoding,
     32                                 const nsACString& aFallbackCharset,
     33                                 bool aTryLocaleCharset, char** aLang,
     34                                 nsAString& aResult);
     35 
     36  static nsresult DoParameterInternal(const nsACString& aHeaderVal,
     37                                      const char* aParamName,
     38                                      ParamDecoding aDecoding, char** aCharset,
     39                                      char** aLang, char** aResult);
     40 
     41  static bool ContainsTrailingCharPastNull(const nsACString& aVal);
     42 };
     43 
     44 #endif