source: trunk/third/mozilla/htmlparser/public/nsITokenizer.h @ 20014

Revision 20014, 4.2 KB checked in by rbasch, 21 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r20013, which included commits to RCS files with non-trunk default branches.
Line 
1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* ***** BEGIN LICENSE BLOCK *****
3 * Version: NPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Netscape Public License
6 * Version 1.1 (the "License"); you may not use this file except in
7 * compliance with the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/NPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 *
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the NPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the NPL, the GPL or the LGPL.
36 *
37 * ***** END LICENSE BLOCK ***** */
38
39
40/**
41 * MODULE NOTES:
42 * @update  gess 4/1/98
43 *
44 */
45
46#ifndef __NSITOKENIZER__
47#define __NSITOKENIZER__
48
49#include "nsISupports.h"
50#include "prtypes.h"
51
52class CToken;
53class nsScanner;
54class nsDeque;
55class nsTokenAllocator;
56
57#define NS_ITOKENIZER_IID      \
58  {0xe4238ddc, 0x9eb6,  0x11d2, {0xba, 0xa5, 0x0,     0x10, 0x4b, 0x98, 0x3f, 0xd4 }}
59
60/**
61 * This interface is used as a callback to objects interested
62 * in observing the token stream created from the parse process.
63 */
64class nsITokenObserver {
65public:
66  virtual PRBool  operator()(CToken* aToken)=0;
67};
68
69/***************************************************************
70  Notes:
71 ***************************************************************/
72
73
74class nsITokenizer : public nsISupports {
75public:
76  NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITOKENIZER_IID)
77
78  NS_IMETHOD                     WillTokenize(PRBool aIsFinalChunk,nsTokenAllocator* aTokenAllocator)=0;
79  NS_IMETHOD                     ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens)=0;
80  NS_IMETHOD                     DidTokenize(PRBool aIsFinalChunk)=0;
81 
82  NS_IMETHOD_(CToken*)           PushTokenFront(CToken* aToken)=0;
83  NS_IMETHOD_(CToken*)           PushToken(CToken* aToken)=0;
84  NS_IMETHOD_(CToken*)           PopToken(void)=0;
85  NS_IMETHOD_(CToken*)           PeekToken(void)=0;
86  NS_IMETHOD_(CToken*)           GetTokenAt(PRInt32 anIndex)=0;
87  NS_IMETHOD_(PRInt32)           GetCount(void)=0;
88  NS_IMETHOD_(nsTokenAllocator*) GetTokenAllocator(void)=0;
89  NS_IMETHOD_(void)              PrependTokens(nsDeque& aDeque)=0;
90  NS_IMETHOD                     CopyState(nsITokenizer* aTokenizer) = 0;
91 
92};
93
94#define NS_DECL_NSITOKENIZER \
95  NS_IMETHOD                     WillTokenize(PRBool aIsFinalChunk,nsTokenAllocator* aTokenAllocator);\
96  NS_IMETHOD                     ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens);\
97  NS_IMETHOD                     DidTokenize(PRBool aIsFinalChunk);\
98  NS_IMETHOD_(CToken*)           PushTokenFront(CToken* aToken);\
99  NS_IMETHOD_(CToken*)           PushToken(CToken* aToken);\
100  NS_IMETHOD_(CToken*)           PopToken(void);\
101  NS_IMETHOD_(CToken*)           PeekToken(void);\
102  NS_IMETHOD_(CToken*)           GetTokenAt(PRInt32 anIndex);\
103  NS_IMETHOD_(PRInt32)           GetCount(void);\
104  NS_IMETHOD_(nsTokenAllocator*) GetTokenAllocator(void);\
105  NS_IMETHOD_(void)              PrependTokens(nsDeque& aDeque);\
106  NS_IMETHOD                     CopyState(nsITokenizer* aTokenizer);
107
108
109#endif
Note: See TracBrowser for help on using the repository browser.