Update ooo320-m1
[ooovba.git] / autodoc / source / parser / inc / tokens / parseinc.hxx
blobc249f5007aa248dcb236cda2477c05fb6bcb9d1a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: parseinc.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef ADC_PARSEINC_HXX
32 #define ADC_PARSEINC_HXX
35 #include <tools/tkpchars.hxx>
37 inline char
38 jumpOver( CharacterSource & io_rText,
39 char in_c )
41 char cNext;
42 for ( cNext = io_rText.CurChar();
43 cNext == in_c;
44 cNext = io_rText.MoveOn() )
45 { }
47 return cNext;
50 inline char
51 jumpTo( CharacterSource & io_rText,
52 char in_c )
54 char cNext;
55 for ( cNext = io_rText.CurChar();
56 cNext != in_c AND cNext != 0;
57 cNext = io_rText.MoveOn() )
58 { }
60 return cNext;
63 inline char
64 jumpTo( CharacterSource & io_rText,
65 char in_c1,
66 char in_c2 )
68 char cNext;
69 for ( cNext = io_rText.CurChar();
70 cNext != in_c1 AND cNext != in_c2 AND cNext != 0;
71 cNext = io_rText.MoveOn() )
72 { }
74 return cNext;
77 inline char
78 jumpTo( CharacterSource & io_rText,
79 char in_c1,
80 char in_c2,
81 char in_c3 )
83 char cNext;
84 for ( cNext = io_rText.CurChar();
85 cNext != in_c1 AND cNext != in_c2 AND cNext != in_c3 AND cNext != 0;
86 cNext = io_rText.MoveOn() )
87 { }
89 return cNext;
92 inline char
93 jumpTo( CharacterSource & io_rText,
94 char in_c1,
95 char in_c2,
96 char in_c3,
97 char in_c4 )
99 char cNext;
100 for ( cNext = io_rText.CurChar();
101 cNext != in_c1 AND cNext != in_c2 AND cNext != in_c3
102 AND cNext != in_c4 AND cNext != 0;
103 cNext = io_rText.MoveOn() )
106 return cNext;
109 inline char
110 jumpOverWhite(CharacterSource & io_rText)
112 char cNext;
113 for ( cNext = io_rText.CurChar();
114 static_cast<UINT8>(cNext) < 33
115 AND cNext != 0 AND cNext != 13 AND cNext != 10;
116 cNext = io_rText.MoveOn() )
119 return cNext;
122 inline char
123 jumpToWhite(CharacterSource & io_rText)
125 char cNext;
126 for ( cNext = io_rText.CurChar();
127 static_cast<UINT8>(cNext) > 32;
128 cNext = io_rText.MoveOn() )
131 return cNext;
134 inline char
135 jumpToEol(CharacterSource & io_rText, int & o_rCount_BackslashedLineBreaks )
137 o_rCount_BackslashedLineBreaks = 0;
138 char cNext;
139 for ( cNext = io_rText.CurChar();
140 cNext != 13 AND cNext != 10 AND cNext != NULCH;
141 cNext = io_rText.MoveOn() )
143 if ( cNext == '\\')
145 cNext = io_rText.MoveOn();
146 if ( cNext == 13 )
147 io_rText.MoveOn();
148 if ( cNext == 10 )
149 ++o_rCount_BackslashedLineBreaks;
152 return cNext;
155 inline char
156 jumpToEol(CharacterSource & io_rText)
158 char cNext;
159 for ( cNext = io_rText.CurChar();
160 cNext != 13 AND cNext != 10 AND cNext != NULCH;
161 cNext = io_rText.MoveOn() )
163 if ( cNext == '\\')
164 io_rText.MoveOn();
166 return cNext;
169 inline char
170 jumpOverEol(CharacterSource & io_rText)
172 char cNext = io_rText.CurChar();
174 if (cNext == 13)
175 io_rText.MoveOn();
176 if (cNext == 10)
177 io_rText.MoveOn();
178 return cNext;
182 inline char // Finds a matching closing bracket after the opening one is passed
183 jumpToMatchingBracket( CharacterSource & io_rText,
184 char in_cBegin,
185 char in_cEnd )
187 intt nCounter = 1;
188 char cNext;
189 for ( cNext = io_rText.CurChar();
190 nCounter - (cNext == in_cEnd ? 1 : 0) > 0 AND cNext != NULCH;
191 cNext = io_rText.MoveOn() )
193 if (cNext == in_cEnd)
194 nCounter++;
195 else if (cNext == in_cBegin)
196 nCounter--;
199 return cNext;
205 #endif