1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/public/nsIContentSerializer.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,75 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsIContentSerializer_h 1.10 +#define nsIContentSerializer_h 1.11 + 1.12 +#include "nsISupports.h" 1.13 + 1.14 +class nsIContent; 1.15 +class nsIDocument; 1.16 +class nsAString; 1.17 + 1.18 +namespace mozilla { 1.19 +namespace dom { 1.20 +class Element; 1.21 +} // namespace dom 1.22 +} // namespace mozilla 1.23 + 1.24 +#define NS_ICONTENTSERIALIZER_IID \ 1.25 +{ 0xb1ee32f2, 0xb8c4, 0x49b9, \ 1.26 + { 0x93, 0xdf, 0xb6, 0xfa, 0xb5, 0xd5, 0x46, 0x88 } } 1.27 + 1.28 +class nsIContentSerializer : public nsISupports { 1.29 + public: 1.30 + 1.31 + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENTSERIALIZER_IID) 1.32 + 1.33 + NS_IMETHOD Init(uint32_t flags, uint32_t aWrapColumn, 1.34 + const char* aCharSet, bool aIsCopying, 1.35 + bool aIsWholeDocument) = 0; 1.36 + 1.37 + NS_IMETHOD AppendText(nsIContent* aText, int32_t aStartOffset, 1.38 + int32_t aEndOffset, nsAString& aStr) = 0; 1.39 + 1.40 + NS_IMETHOD AppendCDATASection(nsIContent* aCDATASection, 1.41 + int32_t aStartOffset, int32_t aEndOffset, 1.42 + nsAString& aStr) = 0; 1.43 + 1.44 + NS_IMETHOD AppendProcessingInstruction(nsIContent* aPI, 1.45 + int32_t aStartOffset, 1.46 + int32_t aEndOffset, 1.47 + nsAString& aStr) = 0; 1.48 + 1.49 + NS_IMETHOD AppendComment(nsIContent* aComment, int32_t aStartOffset, 1.50 + int32_t aEndOffset, nsAString& aStr) = 0; 1.51 + 1.52 + NS_IMETHOD AppendDoctype(nsIContent *aDoctype, 1.53 + nsAString& aStr) = 0; 1.54 + 1.55 + NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement, 1.56 + mozilla::dom::Element* aOriginalElement, 1.57 + nsAString& aStr) = 0; 1.58 + 1.59 + NS_IMETHOD AppendElementEnd(mozilla::dom::Element* aElement, 1.60 + nsAString& aStr) = 0; 1.61 + 1.62 + NS_IMETHOD Flush(nsAString& aStr) = 0; 1.63 + 1.64 + /** 1.65 + * Append any items in the beginning of the document that won't be 1.66 + * serialized by other methods. XML declaration is the most likely 1.67 + * thing this method can produce. 1.68 + */ 1.69 + NS_IMETHOD AppendDocumentStart(nsIDocument *aDocument, 1.70 + nsAString& aStr) = 0; 1.71 +}; 1.72 + 1.73 +NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentSerializer, NS_ICONTENTSERIALIZER_IID) 1.74 + 1.75 +#define NS_CONTENTSERIALIZER_CONTRACTID_PREFIX \ 1.76 +"@mozilla.org/layout/contentserializer;1?mimetype=" 1.77 + 1.78 +#endif /* nsIContentSerializer_h */