intl/chardet/public/nsICharsetDetector.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/chardet/public/nsICharsetDetector.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +/* -*- Mode: C; tab-width: 4; 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 nsICharsetDetector_h__
    1.10 +#define nsICharsetDetector_h__
    1.11 +
    1.12 +#include "nsISupports.h"
    1.13 +
    1.14 +class nsICharsetDetectionObserver;
    1.15 +
    1.16 +// {12BB8F14-2389-11d3-B3BF-00805F8A6670}
    1.17 +#define NS_ICHARSETDETECTOR_IID \
    1.18 +{ 0x12bb8f14, 0x2389, 0x11d3, { 0xb3, 0xbf, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } }
    1.19 +
    1.20 +#define NS_CHARSET_DETECTOR_CONTRACTID_BASE "@mozilla.org/intl/charsetdetect;1?type="
    1.21 +#define NS_CHARSET_DETECTOR_CATEGORY "charset-detectors"
    1.22 + 
    1.23 +class nsICharsetDetector : public nsISupports {
    1.24 +public:  
    1.25 +  NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICHARSETDETECTOR_IID)
    1.26 +
    1.27 +  /* 
    1.28 +     Setup the observer so it know how to notify the answer
    1.29 +   */
    1.30 +  NS_IMETHOD Init(nsICharsetDetectionObserver* observer) = 0;
    1.31 +
    1.32 +  /*
    1.33 +     Feed a block of bytes to the detector.
    1.34 +     It will call the Notify function of the nsICharsetObserver if it find out
    1.35 +     the answer. 
    1.36 +     aBytesArray - array of bytes
    1.37 +     aLen        - length of aBytesArray
    1.38 +     oDontFeedMe - return true if the detector do not need the following block
    1.39 +                          false it need more bytes. 
    1.40 +                   This is used to enhance performance
    1.41 +   */
    1.42 +  NS_IMETHOD DoIt(const char* aBytesArray, uint32_t aLen, bool* oDontFeedMe) = 0;
    1.43 +
    1.44 +  /*
    1.45 +     It also tell the detector the last chance the make a decision
    1.46 +   */
    1.47 +  NS_IMETHOD Done() = 0;
    1.48 +
    1.49 +};
    1.50 +
    1.51 +NS_DEFINE_STATIC_IID_ACCESSOR(nsICharsetDetector,
    1.52 +                              NS_ICHARSETDETECTOR_IID)
    1.53 +
    1.54 +#endif /* nsICharsetDetector_h__ */

mercurial