LCOV - code coverage report
Current view: top level - intl/unicharutil - nsSaveAsCharset.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 22 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #include "nsSaveAsCharset.h"
       8             : 
       9             : using namespace mozilla;
      10             : 
      11             : //
      12             : // nsISupports methods
      13             : //
      14           0 : NS_IMPL_ISUPPORTS(nsSaveAsCharset, nsISaveAsCharset)
      15             : 
      16             : //
      17             : // nsSaveAsCharset
      18             : //
      19           0 : nsSaveAsCharset::nsSaveAsCharset()
      20             : {
      21           0 : }
      22             : 
      23           0 : nsSaveAsCharset::~nsSaveAsCharset()
      24             : {
      25           0 : }
      26             : 
      27             : NS_IMETHODIMP
      28           0 : nsSaveAsCharset::Init(const nsACString& aCharset, uint32_t aIgnored, uint32_t aAlsoIgnored)
      29             : {
      30           0 :   mEncoding = Encoding::ForLabelNoReplacement(aCharset);
      31           0 :   if (!mEncoding) {
      32           0 :     return NS_ERROR_DOM_ENCODING_NOT_SUPPORTED_ERR;
      33             :   }
      34           0 :   return NS_OK;
      35             : }
      36             : 
      37             : NS_IMETHODIMP
      38           0 : nsSaveAsCharset::Convert(const nsAString& aIn, nsACString& aOut)
      39             : {
      40           0 :   if (!mEncoding) {
      41           0 :     return NS_ERROR_DOM_ENCODING_NOT_SUPPORTED_ERR;
      42             :   }
      43             :   nsresult rv;
      44             :   const Encoding* ignored;
      45           0 :   Tie(rv, ignored) = mEncoding->Encode(aIn, aOut);
      46           0 :   if (NS_FAILED(rv)) {
      47           0 :     return rv;
      48             :   }
      49           0 :   return NS_OK;
      50             : }
      51             : 
      52             : NS_IMETHODIMP
      53           0 : nsSaveAsCharset::GetCharset(nsACString& aCharset)
      54             : {
      55           0 :   if (!mEncoding) {
      56           0 :     aCharset.Truncate();
      57             :   } else {
      58           0 :     mEncoding->Name(aCharset);
      59             :   }
      60           0 :   return NS_OK;
      61             : }

Generated by: LCOV version 1.13