intl/uconv/nsScriptableUConv.h
author Carsten "Tomcat" Book <cbook@mozilla.com>
Wed, 28 Oct 2015 14:28:37 +0100
changeset 269997 929a872c1f15ef81d7730d366d95983b2e287602
parent 196040 4feaed7d41deb55fec4a214dba3db252a48e641b
child 363728 e155fa765af299f0e8cfb42e0a1709e5b04928b9
permissions -rw-r--r--
Backed out changeset 2284c3e8c336 (bug 1215092)

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


#ifndef __nsScriptableUConv_h_
#define __nsScriptableUConv_h_

#include "nsIScriptableUConv.h"
#include "nsCOMPtr.h"
#include "nsIUnicodeDecoder.h"
#include "nsIUnicodeEncoder.h"

class nsScriptableUnicodeConverter : public nsIScriptableUnicodeConverter
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSISCRIPTABLEUNICODECONVERTER

  nsScriptableUnicodeConverter();

protected:
  virtual ~nsScriptableUnicodeConverter();

  nsCString mCharset;
  nsCOMPtr<nsIUnicodeEncoder> mEncoder;
  nsCOMPtr<nsIUnicodeDecoder> mDecoder;
  bool mIsInternal;

  nsresult FinishWithLength(char **_retval, int32_t* aLength);
  nsresult ConvertFromUnicodeWithLength(const nsAString& aSrc,
                                        int32_t* aOutLen,
                                        char **_retval);


  nsresult InitConverter();
};

#endif