/* THIS FILE IS AUTOGENERATED FROM KeyAlgorithm.webidl BY Codegen.py - DO NOT EDIT */

#ifndef mozilla_dom_KeyAlgorithmBinding_h
#define mozilla_dom_KeyAlgorithmBinding_h

#include "KeyAlgorithmBinding.h"
#include "js/RootingAPI.h"
#include "jspubtd.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/TypedArray.h"

namespace mozilla {
namespace dom {

struct AesKeyAlgorithmAtoms;
struct DhKeyAlgorithmAtoms;
struct EcKeyAlgorithmAtoms;
struct HmacKeyAlgorithmAtoms;
struct KeyAlgorithm;
struct KeyAlgorithmAtoms;
struct NativePropertyHooks;
class ProtoAndIfaceCache;
struct RsaHashedKeyAlgorithmAtoms;

} // namespace dom
} // namespace mozilla

namespace mozilla {
namespace dom {

struct KeyAlgorithm : public DictionaryBase
{
  nsString mName;

  KeyAlgorithm();

  explicit inline KeyAlgorithm(const FastDictionaryInitializer& )
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline KeyAlgorithm(const KeyAlgorithm& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const KeyAlgorithm& aOther);

private:
  static bool
  InitIds(JSContext* cx, KeyAlgorithmAtoms* atomsCache);
};

namespace binding_detail {
struct FastKeyAlgorithm : public KeyAlgorithm
{
  inline FastKeyAlgorithm()
    : KeyAlgorithm(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct AesKeyAlgorithm : public KeyAlgorithm
{
  uint16_t mLength;

  AesKeyAlgorithm();

  explicit inline AesKeyAlgorithm(const FastDictionaryInitializer& )
    : KeyAlgorithm(FastDictionaryInitializer())
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline AesKeyAlgorithm(const AesKeyAlgorithm& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const AesKeyAlgorithm& aOther);

private:
  static bool
  InitIds(JSContext* cx, AesKeyAlgorithmAtoms* atomsCache);
};

namespace binding_detail {
struct FastAesKeyAlgorithm : public AesKeyAlgorithm
{
  inline FastAesKeyAlgorithm()
    : AesKeyAlgorithm(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct DhKeyAlgorithm : public KeyAlgorithm
{
  Uint8Array mGenerator;
  Uint8Array mPrime;

  DhKeyAlgorithm();

  explicit inline DhKeyAlgorithm(const FastDictionaryInitializer& )
    : KeyAlgorithm(FastDictionaryInitializer())
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

private:
  DhKeyAlgorithm(const DhKeyAlgorithm&) = delete;
  void operator=(const DhKeyAlgorithm) = delete;

  static bool
  InitIds(JSContext* cx, DhKeyAlgorithmAtoms* atomsCache);

public:
  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);
};

namespace binding_detail {
struct FastDhKeyAlgorithm : public DhKeyAlgorithm
{
  inline FastDhKeyAlgorithm()
    : DhKeyAlgorithm(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct EcKeyAlgorithm : public KeyAlgorithm
{
  nsString mNamedCurve;

  EcKeyAlgorithm();

  explicit inline EcKeyAlgorithm(const FastDictionaryInitializer& )
    : KeyAlgorithm(FastDictionaryInitializer())
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline EcKeyAlgorithm(const EcKeyAlgorithm& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const EcKeyAlgorithm& aOther);

private:
  static bool
  InitIds(JSContext* cx, EcKeyAlgorithmAtoms* atomsCache);
};

namespace binding_detail {
struct FastEcKeyAlgorithm : public EcKeyAlgorithm
{
  inline FastEcKeyAlgorithm()
    : EcKeyAlgorithm(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct HmacKeyAlgorithm : public KeyAlgorithm
{
  KeyAlgorithm mHash;
  uint32_t mLength;

  HmacKeyAlgorithm();

  explicit inline HmacKeyAlgorithm(const FastDictionaryInitializer& )
    : KeyAlgorithm(FastDictionaryInitializer()),
      mHash(FastDictionaryInitializer())
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline HmacKeyAlgorithm(const HmacKeyAlgorithm& aOther)
    : mHash(FastDictionaryInitializer())
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const HmacKeyAlgorithm& aOther);

private:
  static bool
  InitIds(JSContext* cx, HmacKeyAlgorithmAtoms* atomsCache);
};

namespace binding_detail {
struct FastHmacKeyAlgorithm : public HmacKeyAlgorithm
{
  inline FastHmacKeyAlgorithm()
    : HmacKeyAlgorithm(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct RsaHashedKeyAlgorithm : public KeyAlgorithm
{
  KeyAlgorithm mHash;
  uint16_t mModulusLength;
  Uint8Array mPublicExponent;

  RsaHashedKeyAlgorithm();

  explicit inline RsaHashedKeyAlgorithm(const FastDictionaryInitializer& )
    : KeyAlgorithm(FastDictionaryInitializer()),
      mHash(FastDictionaryInitializer())
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

private:
  RsaHashedKeyAlgorithm(const RsaHashedKeyAlgorithm&) = delete;
  void operator=(const RsaHashedKeyAlgorithm) = delete;

  static bool
  InitIds(JSContext* cx, RsaHashedKeyAlgorithmAtoms* atomsCache);

public:
  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);
};

namespace binding_detail {
struct FastRsaHashedKeyAlgorithm : public RsaHashedKeyAlgorithm
{
  inline FastRsaHashedKeyAlgorithm()
    : RsaHashedKeyAlgorithm(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


} // namespace dom
} // namespace mozilla

#endif // mozilla_dom_KeyAlgorithmBinding_h
