netwerk/streamconv/public/mozITXTToHTMLConv.idl

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

michael@0 1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 /**
michael@0 7 Description: Currently only functions to enhance plain text with HTML tags.
michael@0 8 <p>
michael@0 9 Wrapper class for various parsing routines, that convert plain text to HTML.
michael@0 10 They try to recognize cites, URLs, plain text formattting like *bold* etc.
michael@0 11 See <http://www.bucksch.org/1/projects/mozilla/16507/> for a description.
michael@0 12 */
michael@0 13
michael@0 14 #include "nsIStreamConverter.idl"
michael@0 15
michael@0 16 %{C++
michael@0 17 // {77c0e42a-1dd2-11b2-8ebf-edc6606f2f4b}
michael@0 18 #define MOZITXTTOHTMLCONV_CID \
michael@0 19 { 0x77c0e42a, 0x1dd2, 0x11b2, \
michael@0 20 { 0x8e, 0xbf, 0xed, 0xc6, 0x60, 0x6f, 0x2f, 0x4b } }
michael@0 21
michael@0 22 #define MOZ_TXTTOHTMLCONV_CONTRACTID \
michael@0 23 "@mozilla.org/txttohtmlconv;1"
michael@0 24
michael@0 25 %}
michael@0 26
michael@0 27 [scriptable, uuid(77c0e42a-1dd2-11b2-8ebf-edc6606f2f4b)]
michael@0 28 interface mozITXTToHTMLConv : nsIStreamConverter {
michael@0 29 const unsigned long kEntities = 0; // just convert < & > to &lt; &amp; and &gt;
michael@0 30 const unsigned long kURLs = 1 << 1;
michael@0 31 const unsigned long kGlyphSubstitution = 1 << 2; // Smilies, &reg; etc.
michael@0 32 const unsigned long kStructPhrase = 1 << 3; // E.g. *bold* -> <strong>
michael@0 33
michael@0 34 /**
michael@0 35 @param text: plain text to scan. May be a line, paragraph (recommended)
michael@0 36 or just a substring.<p>
michael@0 37 Must be non-escaped, pure unicode.<p>
michael@0 38 <em>Note:</em> ScanTXT(a, o) + ScanTXT(b, o) may be !=
michael@0 39 Scan(a + b, o)
michael@0 40 @param whattodo: Bitfield describing the modes of operation
michael@0 41 @result "<", ">" and "&" are escaped and HTML tags are inserted where
michael@0 42 appropriate.
michael@0 43 */
michael@0 44 wstring scanTXT(in wstring text, in unsigned long whattodo);
michael@0 45
michael@0 46 /**
michael@0 47 Adds additional formatting to user edited text, that the user was too lazy
michael@0 48 or "unknowledged" (DELETEME: is that a word?) to make.
michael@0 49 <p>
michael@0 50 <em>Note:</em> Don't use kGlyphSubstitution with this function. This option
michael@0 51 generates tags, that are unuseable for UAs other than Mozilla. This would
michael@0 52 be a data loss bug.
michael@0 53
michael@0 54 @param text: HTML source to scan. May be a line, paragraph (recommended)
michael@0 55 or just a substring.<p>
michael@0 56 Must be correct HTML. "<", ">" and "&" must be escaped,
michael@0 57 other chars must be pure unicode.<p>
michael@0 58 <em>Note:</em> ScanTXT(a, o) + ScanTXT(b, o) may be !=
michael@0 59 Scan(a + b, o)
michael@0 60 @param whattodo: Bitfield describing the modes of operation
michael@0 61 @result Additional HTML tags are inserted where appropriate.
michael@0 62 */
michael@0 63 wstring scanHTML(in wstring text, in unsigned long whattodo);
michael@0 64
michael@0 65 /**
michael@0 66 @param line: line in original msg, possibly starting starting with
michael@0 67 txt quote tags like ">"
michael@0 68 @param logLineStart: pos in line, where the real content (logical line)
michael@0 69 begins, i.e. pos after all txt quote tags.
michael@0 70 E.g. position of "t" in "> > text".
michael@0 71 Initial value must be 0, unless line is not real line.
michael@0 72 @return Cite Level, i.e. number of txt quote tags found, i.e. number of
michael@0 73 nested quotes.
michael@0 74 */
michael@0 75 unsigned long citeLevelTXT(in wstring line,
michael@0 76 out unsigned long logLineStart);
michael@0 77
michael@0 78 /**
michael@0 79 @param a wide string to scan for the presence of a URL.
michael@0 80 @param aLength --> the length of the buffer to be scanned
michael@0 81 @param aPos --> the position in the buffer to start scanning for a url
michael@0 82
michael@0 83 aStartPos --> index into the start of a url (-1 if no url found)
michael@0 84 aEndPos --> index of the last character in the url (-1 if no url found)
michael@0 85 */
michael@0 86
michael@0 87 void findURLInPlaintext(in wstring text, in long aLength, in long aPos, out long aStartPos, out long aEndPos);
michael@0 88 };

mercurial