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 #ifndef nsDOMSerializer_h_ 8 #define nsDOMSerializer_h_ 9 10 #include "mozilla/dom/NonRefcountedDOMObject.h" 11 #include "mozilla/dom/XMLSerializerBinding.h" 12 13 class nsINode; 14 class nsIOutputStream; 15 16 namespace mozilla { 17 class ErrorResult; 18 } 19 20 class nsDOMSerializer final : public mozilla::dom::NonRefcountedDOMObject { 21 public: 22 nsDOMSerializer(); 23 24 // WebIDL API Constructor(const mozilla::dom::GlobalObject & aOwner)25 static nsDOMSerializer* Constructor( 26 const mozilla::dom::GlobalObject& aOwner) { 27 return new nsDOMSerializer(); 28 } 29 30 void SerializeToString(nsINode& aRoot, nsAString& aStr, 31 mozilla::ErrorResult& rv); 32 33 void SerializeToStream(nsINode& aRoot, nsIOutputStream* aStream, 34 const nsAString& aCharset, mozilla::ErrorResult& aRv); 35 WrapObject(JSContext * aCx,JS::Handle<JSObject * > aGivenProto,JS::MutableHandle<JSObject * > aReflector)36 bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto, 37 JS::MutableHandle<JSObject*> aReflector) { 38 return mozilla::dom::XMLSerializer_Binding::Wrap(aCx, this, aGivenProto, 39 aReflector); 40 } 41 }; 42 43 #endif 44