1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
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 : * Alternatively, the contents of this file may be used under the terms of
25 : * either of the GNU General Public License Version 2 or later (the "GPL"),
26 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 : * in which case the provisions of the GPL or the LGPL are applicable instead
28 : * of those above. If you wish to allow use of your version of this file only
29 : * under the terms of either the GPL or the LGPL, and not to allow others to
30 : * use your version of this file under the terms of the MPL, indicate your
31 : * decision by deleting the provisions above and replace them with the notice
32 : * and other provisions required by the GPL or the LGPL. If you do not delete
33 : * the provisions above, a recipient may use your version of this file under
34 : * the terms of any one of the MPL, the GPL or the LGPL.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 :
38 :
39 : /**
40 : * MODULE NOTES:
41 : * @update gess 4/1/98
42 : *
43 : */
44 :
45 : #ifndef __NSITOKENIZER__
46 : #define __NSITOKENIZER__
47 :
48 : #include "nsISupports.h"
49 : #include "prtypes.h"
50 :
51 : class CToken;
52 : class nsScanner;
53 : class nsDeque;
54 : class nsTokenAllocator;
55 :
56 : #define NS_ITOKENIZER_IID \
57 : {0xe4238ddc, 0x9eb6, 0x11d2, {0xba, 0xa5, 0x0, 0x10, 0x4b, 0x98, 0x3f, 0xd4 }}
58 :
59 :
60 : /***************************************************************
61 : Notes:
62 : ***************************************************************/
63 :
64 :
65 3342 : class nsITokenizer : public nsISupports {
66 : public:
67 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_ITOKENIZER_IID)
68 :
69 : NS_IMETHOD WillTokenize(bool aIsFinalChunk,nsTokenAllocator* aTokenAllocator)=0;
70 : NS_IMETHOD ConsumeToken(nsScanner& aScanner,bool& aFlushTokens)=0;
71 : NS_IMETHOD DidTokenize(bool aIsFinalChunk)=0;
72 :
73 : NS_IMETHOD_(CToken*) PushTokenFront(CToken* aToken)=0;
74 : NS_IMETHOD_(CToken*) PushToken(CToken* aToken)=0;
75 : NS_IMETHOD_(CToken*) PopToken(void)=0;
76 : NS_IMETHOD_(CToken*) PeekToken(void)=0;
77 : NS_IMETHOD_(CToken*) GetTokenAt(PRInt32 anIndex)=0;
78 : NS_IMETHOD_(PRInt32) GetCount(void)=0;
79 : NS_IMETHOD_(nsTokenAllocator*) GetTokenAllocator(void)=0;
80 : NS_IMETHOD_(void) PrependTokens(nsDeque& aDeque)=0;
81 : NS_IMETHOD CopyState(nsITokenizer* aTokenizer)=0;
82 :
83 : };
84 :
85 : NS_DEFINE_STATIC_IID_ACCESSOR(nsITokenizer, NS_ITOKENIZER_IID)
86 :
87 : #define NS_DECL_NSITOKENIZER \
88 : NS_IMETHOD WillTokenize(bool aIsFinalChunk,nsTokenAllocator* aTokenAllocator);\
89 : NS_IMETHOD ConsumeToken(nsScanner& aScanner,bool& aFlushTokens);\
90 : NS_IMETHOD DidTokenize(bool aIsFinalChunk);\
91 : NS_IMETHOD_(CToken*) PushTokenFront(CToken* aToken);\
92 : NS_IMETHOD_(CToken*) PushToken(CToken* aToken);\
93 : NS_IMETHOD_(CToken*) PopToken(void);\
94 : NS_IMETHOD_(CToken*) PeekToken(void);\
95 : NS_IMETHOD_(CToken*) GetTokenAt(PRInt32 anIndex);\
96 : NS_IMETHOD_(PRInt32) GetCount(void);\
97 : NS_IMETHOD_(nsTokenAllocator*) GetTokenAllocator(void);\
98 : NS_IMETHOD_(void) PrependTokens(nsDeque& aDeque);\
99 : NS_IMETHOD CopyState(nsITokenizer* aTokenizer);
100 :
101 :
102 : #endif
|