1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
//
// DO NOT EDIT.  THIS FILE IS GENERATED FROM ../../../dist/idl/nsIDocumentEncoder.idl
//


/// `interface nsIDocumentEncoderNodeFixup : nsISupports`
///


// The actual type definition for the interface. This struct has methods
// declared on it which will call through its vtable. You never want to pass
// this type around by value, always pass it behind a reference.

#[repr(C)]
pub struct nsIDocumentEncoderNodeFixup {
    vtable: *const nsIDocumentEncoderNodeFixupVTable,

    /// This field is a phantomdata to ensure that the VTable type and any
    /// struct containing it is not safe to send across threads, as XPCOM is
    /// generally not threadsafe.
    ///
    /// XPCOM interfaces in general are not safe to send across threads.
    __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
}

// Implementing XpCom for an interface exposes its IID, which allows for easy
// use of the `.query_interface<T>` helper method. This also defines that
// method for nsIDocumentEncoderNodeFixup.
unsafe impl XpCom for nsIDocumentEncoderNodeFixup {
    const IID: nsIID = nsID(0x3d9371d8, 0xa2ad, 0x403e,
        [0x8b, 0x0e, 0x88, 0x85, 0xad, 0x35, 0x62, 0xe3]);
}

// We need to implement the RefCounted trait so we can be used with `RefPtr`.
// This trait teaches `RefPtr` how to manage our memory.
unsafe impl RefCounted for nsIDocumentEncoderNodeFixup {
    #[inline]
    unsafe fn addref(&self) {
        self.AddRef();
    }
    #[inline]
    unsafe fn release(&self) {
        self.Release();
    }
}

// This trait is implemented on all types which can be coerced to from nsIDocumentEncoderNodeFixup.
// It is used in the implementation of `fn coerce<T>`. We hide it from the
// documentation, because it clutters it up a lot.
#[doc(hidden)]
pub trait nsIDocumentEncoderNodeFixupCoerce {
    /// Cheaply cast a value of this type from a `nsIDocumentEncoderNodeFixup`.
    fn coerce_from(v: &nsIDocumentEncoderNodeFixup) -> &Self;
}

// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIDocumentEncoderNodeFixupCoerce for nsIDocumentEncoderNodeFixup {
    #[inline]
    fn coerce_from(v: &nsIDocumentEncoderNodeFixup) -> &Self {
        v
    }
}

impl nsIDocumentEncoderNodeFixup {
    /// Cast this `nsIDocumentEncoderNodeFixup` to one of its base interfaces.
    #[inline]
    pub fn coerce<T: nsIDocumentEncoderNodeFixupCoerce>(&self) -> &T {
        T::coerce_from(self)
    }
}

// Every interface struct type implements `Deref` to its base interface. This
// causes methods on the base interfaces to be directly avaliable on the
// object. For example, you can call `.AddRef` or `.QueryInterface` directly
// on any interface which inherits from `nsISupports`.
impl ::std::ops::Deref for nsIDocumentEncoderNodeFixup {
    type Target = nsISupports;
    #[inline]
    fn deref(&self) -> &nsISupports {
        unsafe {
            ::std::mem::transmute(self)
        }
    }
}

// Ensure we can use .coerce() to cast to our base types as well. Any type which
// our base interface can coerce from should be coercable from us as well.
impl<T: nsISupportsCoerce> nsIDocumentEncoderNodeFixupCoerce for T {
    #[inline]
    fn coerce_from(v: &nsIDocumentEncoderNodeFixup) -> &Self {
        T::coerce_from(v)
    }
}

// This struct represents the interface's VTable. A pointer to a statically
// allocated version of this struct is at the beginning of every nsIDocumentEncoderNodeFixup
// object. It contains one pointer field for each method in the interface. In
// the case where we can't generate a binding for a method, we include a void
// pointer.
#[doc(hidden)]
#[repr(C)]
pub struct nsIDocumentEncoderNodeFixupVTable {
    /// We need to include the members from the base interface's vtable at the start
    /// of the VTable definition.
    pub __base: nsISupportsVTable,

    /* nsIDOMNode fixupNode (in nsIDOMNode aNode, out boolean aSerializeCloneKids); */
    pub FixupNode: unsafe extern "system" fn (this: *const nsIDocumentEncoderNodeFixup, aNode: *const nsIDOMNode, aSerializeCloneKids: *mut bool, _retval: *mut *const nsIDOMNode) -> nsresult,
}


// The implementations of the function wrappers which are exposed to rust code.
// Call these methods rather than manually calling through the VTable struct.
impl nsIDocumentEncoderNodeFixup {

    /// ```text
    /// /**
    ///    * Create a fixed up version of a node. This method is called before
    ///    * each node in a document is about to be persisted. The implementor
    ///    * may return a new node with fixed up attributes or null. If null is
    ///    * returned the node should be used as-is.
    ///    * @param aNode Node to fixup.
    ///    * @param [OUT] aSerializeCloneKids True if the document encoder should
    ///    * apply recursive serialization to the children of the fixed up node
    ///    * instead of the children of the original node.
    ///    * @return The resulting fixed up node.
    ///    */
    /// ```
    ///

    /// `nsIDOMNode fixupNode (in nsIDOMNode aNode, out boolean aSerializeCloneKids);`
    #[inline]
    pub unsafe fn FixupNode(&self, aNode: *const nsIDOMNode, aSerializeCloneKids: *mut bool, _retval: *mut *const nsIDOMNode) -> nsresult {
        ((*self.vtable).FixupNode)(self, aNode, aSerializeCloneKids, _retval)
    }


}


/// `interface nsIDocumentEncoder : nsISupports`
///


// The actual type definition for the interface. This struct has methods
// declared on it which will call through its vtable. You never want to pass
// this type around by value, always pass it behind a reference.

#[repr(C)]
pub struct nsIDocumentEncoder {
    vtable: *const nsIDocumentEncoderVTable,

    /// This field is a phantomdata to ensure that the VTable type and any
    /// struct containing it is not safe to send across threads, as XPCOM is
    /// generally not threadsafe.
    ///
    /// XPCOM interfaces in general are not safe to send across threads.
    __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
}

// Implementing XpCom for an interface exposes its IID, which allows for easy
// use of the `.query_interface<T>` helper method. This also defines that
// method for nsIDocumentEncoder.
unsafe impl XpCom for nsIDocumentEncoder {
    const IID: nsIID = nsID(0x21f112df, 0xd96f, 0x47da,
        [0xbf, 0xcb, 0x53, 0x31, 0x27, 0x30, 0x03, 0xd1]);
}

// We need to implement the RefCounted trait so we can be used with `RefPtr`.
// This trait teaches `RefPtr` how to manage our memory.
unsafe impl RefCounted for nsIDocumentEncoder {
    #[inline]
    unsafe fn addref(&self) {
        self.AddRef();
    }
    #[inline]
    unsafe fn release(&self) {
        self.Release();
    }
}

// This trait is implemented on all types which can be coerced to from nsIDocumentEncoder.
// It is used in the implementation of `fn coerce<T>`. We hide it from the
// documentation, because it clutters it up a lot.
#[doc(hidden)]
pub trait nsIDocumentEncoderCoerce {
    /// Cheaply cast a value of this type from a `nsIDocumentEncoder`.
    fn coerce_from(v: &nsIDocumentEncoder) -> &Self;
}

// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIDocumentEncoderCoerce for nsIDocumentEncoder {
    #[inline]
    fn coerce_from(v: &nsIDocumentEncoder) -> &Self {
        v
    }
}

impl nsIDocumentEncoder {
    /// Cast this `nsIDocumentEncoder` to one of its base interfaces.
    #[inline]
    pub fn coerce<T: nsIDocumentEncoderCoerce>(&self) -> &T {
        T::coerce_from(self)
    }
}

// Every interface struct type implements `Deref` to its base interface. This
// causes methods on the base interfaces to be directly avaliable on the
// object. For example, you can call `.AddRef` or `.QueryInterface` directly
// on any interface which inherits from `nsISupports`.
impl ::std::ops::Deref for nsIDocumentEncoder {
    type Target = nsISupports;
    #[inline]
    fn deref(&self) -> &nsISupports {
        unsafe {
            ::std::mem::transmute(self)
        }
    }
}

// Ensure we can use .coerce() to cast to our base types as well. Any type which
// our base interface can coerce from should be coercable from us as well.
impl<T: nsISupportsCoerce> nsIDocumentEncoderCoerce for T {
    #[inline]
    fn coerce_from(v: &nsIDocumentEncoder) -> &Self {
        T::coerce_from(v)
    }
}

// This struct represents the interface's VTable. A pointer to a statically
// allocated version of this struct is at the beginning of every nsIDocumentEncoder
// object. It contains one pointer field for each method in the interface. In
// the case where we can't generate a binding for a method, we include a void
// pointer.
#[doc(hidden)]
#[repr(C)]
pub struct nsIDocumentEncoderVTable {
    /// We need to include the members from the base interface's vtable at the start
    /// of the VTable definition.
    pub __base: nsISupportsVTable,

    /* void init (in nsIDOMDocument aDocument, in AString aMimeType, in unsigned long aFlags); */
    pub Init: unsafe extern "system" fn (this: *const nsIDocumentEncoder, aDocument: *const nsIDOMDocument, aMimeType: &::nsstring::nsAString, aFlags: libc::uint32_t) -> nsresult,

    /* [noscript] void nativeInit (in nsIDocumentPtr aDocument, in AString aMimeType, in unsigned long aFlags); */
    /// Unable to generate binding because `native type nsIDocument is unsupported`
    pub NativeInit: *const ::libc::c_void,

    /* void setSelection (in nsISelection aSelection); */
    pub SetSelection: unsafe extern "system" fn (this: *const nsIDocumentEncoder, aSelection: *const nsISelection) -> nsresult,

    /* void setRange (in nsIDOMRange aRange); */
    pub SetRange: unsafe extern "system" fn (this: *const nsIDocumentEncoder, aRange: *const nsIDOMRange) -> nsresult,

    /* void setNode (in nsIDOMNode aNode); */
    pub SetNode: unsafe extern "system" fn (this: *const nsIDocumentEncoder, aNode: *const nsIDOMNode) -> nsresult,

    /* [noscript] void setNativeNode (in nsINodePtr aNode); */
    /// Unable to generate binding because `native type nsINode is unsupported`
    pub SetNativeNode: *const ::libc::c_void,

    /* void setContainerNode (in nsIDOMNode aContainer); */
    pub SetContainerNode: unsafe extern "system" fn (this: *const nsIDocumentEncoder, aContainer: *const nsIDOMNode) -> nsresult,

    /* [noscript] void setNativeContainerNode (in nsINodePtr aContainer); */
    /// Unable to generate binding because `native type nsINode is unsupported`
    pub SetNativeContainerNode: *const ::libc::c_void,

    /* void setCharset (in ACString aCharset); */
    pub SetCharset: unsafe extern "system" fn (this: *const nsIDocumentEncoder, aCharset: &::nsstring::nsACString) -> nsresult,

    /* void setWrapColumn (in unsigned long aWrapColumn); */
    pub SetWrapColumn: unsafe extern "system" fn (this: *const nsIDocumentEncoder, aWrapColumn: libc::uint32_t) -> nsresult,

    /* readonly attribute AString mimeType; */
    pub GetMimeType: unsafe extern "system" fn (this: *const nsIDocumentEncoder, aMimeType: &mut ::nsstring::nsAString) -> nsresult,

    /* void encodeToStream (in nsIOutputStream aStream); */
    pub EncodeToStream: unsafe extern "system" fn (this: *const nsIDocumentEncoder, aStream: *const nsIOutputStream) -> nsresult,

    /* AString encodeToString (); */
    pub EncodeToString: unsafe extern "system" fn (this: *const nsIDocumentEncoder, _retval: &mut ::nsstring::nsAString) -> nsresult,

    /* AString encodeToStringWithContext (out AString aContextString, out AString aInfoString); */
    pub EncodeToStringWithContext: unsafe extern "system" fn (this: *const nsIDocumentEncoder, aContextString: &mut ::nsstring::nsAString, aInfoString: &mut ::nsstring::nsAString, _retval: &mut ::nsstring::nsAString) -> nsresult,

    /* AString encodeToStringWithMaxLength (in unsigned long aMaxLength); */
    pub EncodeToStringWithMaxLength: unsafe extern "system" fn (this: *const nsIDocumentEncoder, aMaxLength: libc::uint32_t, _retval: &mut ::nsstring::nsAString) -> nsresult,

    /* void setNodeFixup (in nsIDocumentEncoderNodeFixup aFixup); */
    pub SetNodeFixup: unsafe extern "system" fn (this: *const nsIDocumentEncoder, aFixup: *const nsIDocumentEncoderNodeFixup) -> nsresult,
}


// The implementations of the function wrappers which are exposed to rust code.
// Call these methods rather than manually calling through the VTable struct.
impl nsIDocumentEncoder {
    /// ```text
    /// /**
    ///    * Output only the selection (as opposed to the whole document).
    ///    */
    /// ```
    ///

    pub const OutputSelectionOnly: i64 = 1;

    /// ```text
    /// /** Plaintext output: Convert html to plaintext that looks like the html.
    ///     * Implies wrap (except inside <pre>), since html wraps.
    ///     * HTML, XHTML and XML output: do prettyprinting, ignoring existing formatting.
    ///     * XML output : it doesn't implicitly wrap
    ///     */
    /// ```
    ///

    pub const OutputFormatted: i64 = 2;

    /// ```text
    /// /** Don't do prettyprinting. Don't do any wrapping that's not in the existing
    ///    * HTML/XML source. This option overrides OutputFormatted if both are set.
    ///    * HTML/XHTML output: If neither are set, there won't be prettyprinting too, but
    ///    * long lines will be wrapped.
    ///    * Supported also in XML and Plaintext output.
    ///    * @note This option does not affect entity conversion.
    ///    */
    /// ```
    ///

    pub const OutputRaw: i64 = 4;

    /// ```text
    /// /**
    ///    * Do not print html head tags.
    ///    * XHTML/HTML output only.
    ///    */
    /// ```
    ///

    pub const OutputBodyOnly: i64 = 8;

    /// ```text
    /// /**
    ///    * Output as though the content is preformatted
    ///    * (e.g. maybe it's wrapped in a PRE or PRE_WRAP style tag)
    ///    * Plaintext output only.
    ///    * XXXbz How does this interact with
    ///    * OutputFormatted/OutputRaw/OutputPreformatted/OutputFormatFlowed?
    ///    */
    /// ```
    ///

    pub const OutputPreformatted: i64 = 16;

    /// ```text
    /// /**
    ///    * Wrap even if we're not doing formatted output (e.g. for text fields).
    ///    * Supported in XML, XHTML, HTML and Plaintext output.
    ///    * Set implicitly in HTML/XHTML output when no OutputRaw.
    ///    * Ignored when OutputRaw.
    ///    * XXXLJ: set implicitly in HTML/XHTML output, to keep compatible behaviors
    ///    *        for old callers of this interface
    ///    * XXXbz How does this interact with OutputFormatFlowed?
    ///    */
    /// ```
    ///

    pub const OutputWrap: i64 = 32;

    /// ```text
    /// /**
    ///    * Output for format flowed (RFC 2646). This is used when converting
    ///    * to text for mail sending. This differs just slightly
    ///    * but in an important way from normal formatted, and that is that
    ///    * lines are space stuffed. This can't (correctly) be done later.
    ///    * PlainText output only.
    ///    * XXXbz How does this interact with
    ///    * OutputFormatted/OutputRaw/OutputPreformatted/OutputWrap?
    ///    */
    /// ```
    ///

    pub const OutputFormatFlowed: i64 = 64;

    /// ```text
    /// /**
    ///    * Convert links, image src, and script src to absolute URLs when possible.
    ///    * XHTML/HTML output only.
    ///    */
    /// ```
    ///

    pub const OutputAbsoluteLinks: i64 = 128;

    /// ```text
    /// /**
    ///    * LineBreak processing: if this flag is set than CR line breaks will
    ///    * be written. If neither this nor OutputLFLineBreak is set, then we
    ///    * will use platform line breaks. The combination of the two flags will
    ///    * cause CRLF line breaks to be written.
    ///    */
    /// ```
    ///

    pub const OutputCRLineBreak: i64 = 512;

    /// ```text
    /// /**
    ///    * LineBreak processing: if this flag is set than LF line breaks will
    ///    * be written. If neither this nor OutputCRLineBreak is set, then we
    ///    * will use platform line breaks. The combination of the two flags will
    ///    * cause CRLF line breaks to be written.
    ///    */
    /// ```
    ///

    pub const OutputLFLineBreak: i64 = 1024;

    /// ```text
    /// /**
    ///    * Output the content of noscript elements (only for serializing
        ///    * to plaintext).
    ///    */
    /// ```
    ///

    pub const OutputNoScriptContent: i64 = 2048;

    /// ```text
    /// /**
    ///    * Output the content of noframes elements (only for serializing
        ///    * to plaintext). (Used only internally in the plain text serializer;
        ///    * ignored if passed by the caller.)
    ///    */
    /// ```
    ///

    pub const OutputNoFramesContent: i64 = 4096;

    /// ```text
    /// /**
    ///    * Don't allow any formatting nodes (e.g. <br>, <b>) inside a <pre>.
    ///    * This is used primarily by mail. XHTML/HTML output only.
    ///    */
    /// ```
    ///

    pub const OutputNoFormattingInPre: i64 = 8192;

    /// ```text
    /// /**
    ///    * Encode entities when outputting to a string.
    ///    * E.g. If set, we'll output &nbsp; if clear, we'll output 0xa0.
    ///    * The basic set is just &nbsp; &amp; &lt; &gt; &quot; for interoperability
    ///    * with older products that don't support &alpha; and friends.
    ///    * HTML output only.
    ///    */
    /// ```
    ///

    pub const OutputEncodeBasicEntities: i64 = 16384;

    /// ```text
    /// /**
    ///    * Normally &nbsp; is replaced with a space character when
    ///    * encoding data as plain text, set this flag if that's
    ///    * not desired.
    ///    * Plaintext output only.
    ///    */
    /// ```
    ///

    pub const OutputPersistNBSP: i64 = 131072;

    /// ```text
    /// /**
    ///    * Normally when serializing the whole document using the HTML or
    ///    * XHTML serializer, the encoding declaration is rewritten to match.
    ///    * This flag suppresses that behavior.
    ///    */
    /// ```
    ///

    pub const OutputDontRewriteEncodingDeclaration: i64 = 262144;

    /// ```text
    /// /**
    ///    * When using the HTML or XHTML serializer, skip elements that are not
    ///    * visible when this flag is set.  Elements are not visible when they
    ///    * have CSS style display:none or visibility:collapse, for example.
    ///    */
    /// ```
    ///

    pub const SkipInvisibleContent: i64 = 524288;

    /// ```text
    /// /**
    ///    * Output for delsp=yes (RFC 3676). This is used with OutputFormatFlowed
    ///    * when converting to text for mail sending.
    ///    * PlainText output only.
    ///    */
    /// ```
    ///

    pub const OutputFormatDelSp: i64 = 1048576;

    /// ```text
    /// /**
    ///    * Drop <br> elements considered "invisible" by the editor. OutputPreformatted
    ///    * implies this flag.
    ///    */
    /// ```
    ///

    pub const OutputDropInvisibleBreak: i64 = 2097152;

    /// ```text
    /// /**
    ///    * Don't check for _moz_dirty attributes when deciding whether to
    ///    * pretty-print if this flag is set (bug 599983).
    ///    */
    /// ```
    ///

    pub const OutputIgnoreMozDirty: i64 = 4194304;

    /// ```text
    /// /**
    ///    * Output the content of non-text elements as the placehodler character
    ///    * U+FFFC (OBJECT REPLACEMENT CHARACTER, only for serializing to plaintext).
    ///    */
    /// ```
    ///

    pub const OutputNonTextContentAsPlaceholder: i64 = 8388608;

    /// ```text
    /// /**
    ///    * Don't Strip ending spaces from a line (only for serializing to plaintext).
    ///    */
    /// ```
    ///

    pub const OutputDontRemoveLineEndingSpaces: i64 = 16777216;

    /// ```text
    /// /**
    ///    * Serialize in a way that is suitable for copying a plaintext version of the
    ///    * document to the clipboard.  This can for example cause line endings to be
    ///    * injected at preformatted block element boundaries.
    ///    */
    /// ```
    ///

    pub const OutputForPlainTextClipboardCopy: i64 = 33554432;

    /// ```text
    /// /**
    ///    * Include ruby annotations and ruby parentheses in the output.
    ///    * PlainText output only.
    ///    */
    /// ```
    ///

    pub const OutputRubyAnnotation: i64 = 67108864;

    /// ```text
    /// /**
    ///    * Disallow breaking of long character strings. This is important
    ///    * for serializing e-mail which contains CJK strings. These must
    ///    * not be broken just as "normal" longs strings aren't broken.
    ///    */
    /// ```
    ///

    pub const OutputDisallowLineBreaking: i64 = 134217728;

    /// ```text
    /// /**
    ///    * Release reference of nsIDocument after using encodeTo* method to recycle
    ///    * this encoder without holding nsIDocument. To use this encoder again,
    ///    * we have to call init again.
    ///    */
    /// ```
    ///

    pub const RequiresReinitAfterOutput: i64 = 268435456;

    /// ```text
    /// /**
    ///    * Initialize with a pointer to the document and the mime type.
    ///    * @param aDocument Document to encode.
    ///    * @param aMimeType MimeType to use. May also be set by SetMimeType.
    ///    * @param aFlags Flags to use while encoding. May also be set by SetFlags.
    ///    */
    /// ```
    ///

    /// `void init (in nsIDOMDocument aDocument, in AString aMimeType, in unsigned long aFlags);`
    #[inline]
    pub unsafe fn Init(&self, aDocument: *const nsIDOMDocument, aMimeType: &::nsstring::nsAString, aFlags: libc::uint32_t) -> nsresult {
        ((*self.vtable).Init)(self, aDocument, aMimeType, aFlags)
    }



    /// `[noscript] void nativeInit (in nsIDocumentPtr aDocument, in AString aMimeType, in unsigned long aFlags);`
    const _NativeInit: () = ();

    /// ```text
    /// /**
    ///    *  If the selection is set to a non-null value, then the
    ///    *  selection is used for encoding, otherwise the entire
    ///    *  document is encoded.
    ///    * @param aSelection The selection to encode.
    ///    */
    /// ```
    ///

    /// `void setSelection (in nsISelection aSelection);`
    #[inline]
    pub unsafe fn SetSelection(&self, aSelection: *const nsISelection) -> nsresult {
        ((*self.vtable).SetSelection)(self, aSelection)
    }


    /// ```text
    /// /**
    ///    *  If the range is set to a non-null value, then the
    ///    *  range is used for encoding, otherwise the entire
    ///    *  document or selection is encoded.
    ///    * @param aRange The range to encode.
    ///    */
    /// ```
    ///

    /// `void setRange (in nsIDOMRange aRange);`
    #[inline]
    pub unsafe fn SetRange(&self, aRange: *const nsIDOMRange) -> nsresult {
        ((*self.vtable).SetRange)(self, aRange)
    }


    /// ```text
    /// /**
    ///    *  If the node is set to a non-null value, then the
    ///    *  node is used for encoding, otherwise the entire
    ///    *  document or range or selection is encoded.
    ///    * @param aNode The node to encode.
    ///    */
    /// ```
    ///

    /// `void setNode (in nsIDOMNode aNode);`
    #[inline]
    pub unsafe fn SetNode(&self, aNode: *const nsIDOMNode) -> nsresult {
        ((*self.vtable).SetNode)(self, aNode)
    }



    /// `[noscript] void setNativeNode (in nsINodePtr aNode);`
    const _SetNativeNode: () = ();

    /// ```text
    /// /**
    ///    *  If the container is set to a non-null value, then its
    ///    *  child nodes are used for encoding, otherwise the entire
    ///    *  document or range or selection or node is encoded.
    ///    *  @param aContainer The node which child nodes will be encoded.
    ///    */
    /// ```
    ///

    /// `void setContainerNode (in nsIDOMNode aContainer);`
    #[inline]
    pub unsafe fn SetContainerNode(&self, aContainer: *const nsIDOMNode) -> nsresult {
        ((*self.vtable).SetContainerNode)(self, aContainer)
    }



    /// `[noscript] void setNativeContainerNode (in nsINodePtr aContainer);`
    const _SetNativeContainerNode: () = ();

    /// ```text
    /// /**
    ///    *  Documents typically have an intrinsic character set,
    ///    *  but if no intrinsic value is found, the platform character set
    ///    *  is used. This function overrides both the intrinisc and platform
    ///    *  charset.
    ///    *  @param aCharset Overrides the both the intrinsic or platform
    ///    *  character set when encoding the document.
    ///    *
    ///    *  Possible result codes: NS_ERROR_NO_CHARSET_CONVERTER
    ///    */
    /// ```
    ///

    /// `void setCharset (in ACString aCharset);`
    #[inline]
    pub unsafe fn SetCharset(&self, aCharset: &::nsstring::nsACString) -> nsresult {
        ((*self.vtable).SetCharset)(self, aCharset)
    }


    /// ```text
    /// /**
    ///    *  Set a wrap column.  This may have no effect in some types of encoders.
    ///    * @param aWrapColumn Column to which to wrap.
    ///    */
    /// ```
    ///

    /// `void setWrapColumn (in unsigned long aWrapColumn);`
    #[inline]
    pub unsafe fn SetWrapColumn(&self, aWrapColumn: libc::uint32_t) -> nsresult {
        ((*self.vtable).SetWrapColumn)(self, aWrapColumn)
    }


    /// ```text
    /// /**
    ///    *  The mime type preferred by the encoder.  This piece of api was
    ///    *  added because the copy encoder may need to switch mime types on you
    ///    *  if you ask it to copy html that really represents plaintext content.
    ///    *  Call this AFTER Init() and SetSelection() have both been called.
    ///    */
    /// ```
    ///

    /// `readonly attribute AString mimeType;`
    #[inline]
    pub unsafe fn GetMimeType(&self, aMimeType: &mut ::nsstring::nsAString) -> nsresult {
        ((*self.vtable).GetMimeType)(self, aMimeType)
    }


    /// ```text
    /// /**
    ///    *  Encode the document and send the result to the nsIOutputStream.
    ///    *
    ///    *  Possible result codes are the stream errors which might have
    ///    *  been encountered.
    ///    * @param aStream Stream into which to encode.
    ///    */
    /// ```
    ///

    /// `void encodeToStream (in nsIOutputStream aStream);`
    #[inline]
    pub unsafe fn EncodeToStream(&self, aStream: *const nsIOutputStream) -> nsresult {
        ((*self.vtable).EncodeToStream)(self, aStream)
    }


    /// ```text
    /// /**
    ///    * Encode the document into a string.
    ///    *
    ///    * @return The document encoded into a string.
    ///    */
    /// ```
    ///

    /// `AString encodeToString ();`
    #[inline]
    pub unsafe fn EncodeToString(&self, _retval: &mut ::nsstring::nsAString) -> nsresult {
        ((*self.vtable).EncodeToString)(self, _retval)
    }


    /// ```text
    /// /**
    ///    * Encode the document into a string. Stores the extra context information
    ///    * into the two arguments.
    ///    * @param [OUT] aContextString The string where the parent hierarchy
    ///    *              information will be stored.
    ///    * @param [OUT] aInfoString The string where extra context info will
    ///    *              be stored.
    ///    * @return The document encoded as a string.
    ///    *
    ///    */
    /// ```
    ///

    /// `AString encodeToStringWithContext (out AString aContextString, out AString aInfoString);`
    #[inline]
    pub unsafe fn EncodeToStringWithContext(&self, aContextString: &mut ::nsstring::nsAString, aInfoString: &mut ::nsstring::nsAString, _retval: &mut ::nsstring::nsAString) -> nsresult {
        ((*self.vtable).EncodeToStringWithContext)(self, aContextString, aInfoString, _retval)
    }


    /// ```text
    /// /**
    ///    * Encode the document into a string of limited size.
    ///    * @param aMaxLength After aMaxLength characters, the encoder will stop
    ///    *                   encoding new data.
    ///    *                   Only values > 0 will be considered.
    ///    *                   The returned string may be slightly larger than
    ///    *                   aMaxLength because some serializers (eg. HTML)
    ///    *                   may need to close some tags after they stop
    ///    *                   encoding new data, or finish a line (72 columns
        ///    *                   by default for the plain text serializer).
    ///    *
    ///    * @return The document encoded into a string.
    ///    */
    /// ```
    ///

    /// `AString encodeToStringWithMaxLength (in unsigned long aMaxLength);`
    #[inline]
    pub unsafe fn EncodeToStringWithMaxLength(&self, aMaxLength: libc::uint32_t, _retval: &mut ::nsstring::nsAString) -> nsresult {
        ((*self.vtable).EncodeToStringWithMaxLength)(self, aMaxLength, _retval)
    }


    /// ```text
    /// /**
    ///    * Set the fixup object associated with node persistence.
    ///    * @param aFixup The fixup object.
    ///    */
    /// ```
    ///

    /// `void setNodeFixup (in nsIDocumentEncoderNodeFixup aFixup);`
    #[inline]
    pub unsafe fn SetNodeFixup(&self, aFixup: *const nsIDocumentEncoderNodeFixup) -> nsresult {
        ((*self.vtable).SetNodeFixup)(self, aFixup)
    }


}