2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = glib-Lexical-Scanner.html
47 * - GHashTable* -> HashTable
48 * - GScanner* -> ScannerG
59 import tango
.io
.Stdout
; // use the tango loging?
63 private import gtkc
.glibtypes
;
65 private import gtkc
.glib
;
68 private import glib
.HashTable
;
69 private import glib
.Str
;
76 * The GScanner and its associated functions provide a general purpose
82 /** the main Gtk struct */
83 protected GScanner
* gScanner
;
86 public GScanner
* getScannerGStruct()
92 /** the main Gtk struct as a void* */
93 protected void* getStruct()
95 return cast(void*)gScanner
;
99 * Sets our main struct and passes it to the parent class
101 public this (GScanner
* gScanner
)
105 if ( gScanner
is null )
110 Stdout("struct gScanner is null on constructor").newline
;
114 printf("struct gScanner is null on constructor");
121 assert(gScanner
!is null, "struct gScanner is null on constructor");
123 this.gScanner
= gScanner
;
131 * Creates a new GScanner.
132 * The config_templ structure specifies the initial settings of the scanner,
133 * which are copied into the GScanner config field.
134 * If you pass NULL then the default settings are used.
136 * the initial scanner settings.
140 public static ScannerG
_New(GScannerConfig
* configTempl
)
142 // GScanner* g_scanner_new (const GScannerConfig *config_templ);
143 return new ScannerG( g_scanner_new(configTempl
) );
148 * Prepares to scan a file.
154 public void _InputFile(int inputFd
)
156 // void g_scanner_input_file (GScanner *scanner, gint input_fd);
157 g_scanner_input_file(gScanner
, inputFd
);
161 * Rewinds the filedescriptor to the current buffer position and blows
162 * the file read ahead buffer. This is useful for third party uses of
163 * the scanners filedescriptor, which hooks onto the current scanning
168 public void _SyncFileOffset()
170 // void g_scanner_sync_file_offset (GScanner *scanner);
171 g_scanner_sync_file_offset(gScanner
);
175 * Prepares to scan a text buffer.
179 * the text buffer to scan.
181 * the length of the text buffer.
183 public void _InputText(char[] text
, uint textLen
)
185 // void g_scanner_input_text (GScanner *scanner, const gchar *text, guint text_len);
186 g_scanner_input_text(gScanner
, Str
.toStringz(text
), textLen
);
190 * Gets the next token, without removing it from the input stream.
191 * The token data is placed in the
195 * next_position fields of the GScanner structure.
196 * Note that, while the token is not removed from the input stream (i.e.
197 * the next call to g_scanner_get_next_token() will return the same token),
198 * it will not be reevaluated. This can lead to surprising results when
199 * changing scope after peeking for the next token. Getting the next token
200 * after switching the scope will return whatever was peeked before,
201 * regardless of any symbols that may have been added or removed in the
206 * the type of the token.
208 public GTokenType
_PeekNextToken()
210 // GTokenType g_scanner_peek_next_token (GScanner *scanner);
211 return g_scanner_peek_next_token(gScanner
);
215 * Gets the next token, removing it from the input stream.
216 * The token data is placed in the
220 * position fields of the GScanner structure.
224 * the type of the token.
226 public GTokenType
_GetNextToken()
228 // GTokenType g_scanner_get_next_token (GScanner *scanner);
229 return g_scanner_get_next_token(gScanner
);
233 * Gets the current line in the input stream (counting from 1).
239 public uint _CurLine()
241 // guint g_scanner_cur_line (GScanner *scanner);
242 return g_scanner_cur_line(gScanner
);
246 * Gets the current position in the current line (counting from 0).
250 * the current position on the line.
252 public uint _CurPosition()
254 // guint g_scanner_cur_position (GScanner *scanner);
255 return g_scanner_cur_position(gScanner
);
259 * Gets the current token type.
260 * This is simply the token field in the GScanner
265 * the current token type.
267 public GTokenType
_CurToken()
269 // GTokenType g_scanner_cur_token (GScanner *scanner);
270 return g_scanner_cur_token(gScanner
);
274 * Gets the current token value.
275 * This is simply the value field in the GScanner
280 * the current token value.
282 public GTokenValue
_CurValue()
284 // GTokenValue g_scanner_cur_value (GScanner *scanner);
285 return g_scanner_cur_value(gScanner
);
289 * Returns TRUE if the scanner has reached the end of the file or text buffer.
293 * TRUE if the scanner has reached the end of the file or text buffer.
297 // gboolean g_scanner_eof (GScanner *scanner);
298 return g_scanner_eof(gScanner
);
302 * Sets the current scope.
310 public uint _SetScope(uint scopeId
)
312 // guint g_scanner_set_scope (GScanner *scanner, guint scope_id);
313 return g_scanner_set_scope(gScanner
, scopeId
);
317 * Adds a symbol to the given scope.
325 * the value of the symbol.
327 public void _ScopeAddSymbol(uint scopeId
, char[] symbol
, void* value
)
329 // void g_scanner_scope_add_symbol (GScanner *scanner, guint scope_id, const gchar *symbol, gpointer value);
330 g_scanner_scope_add_symbol(gScanner
, scopeId
, Str
.toStringz(symbol
), value
);
334 * Calls the given function for each of the symbol/value pairs in the
335 * given scope of the GScanner. The function is passed the symbol and
336 * value of each pair, and the given user_data parameter.
342 * the function to call for each symbol/value pair.
344 * user data to pass to the function.
346 public void _ScopeForeachSymbol(uint scopeId
, GHFunc func
, void* userData
)
348 // void g_scanner_scope_foreach_symbol (GScanner *scanner, guint scope_id, GHFunc func, gpointer user_data);
349 g_scanner_scope_foreach_symbol(gScanner
, scopeId
, func
, userData
);
353 * Looks up a symbol in a scope and return its value. If the
354 * symbol is not bound in the scope, NULL is returned.
360 * the symbol to look up.
362 * the value of symbol in the given scope, or NULL
363 * if symbol is not bound in the given scope.
365 public void* _ScopeLookupSymbol(uint scopeId
, char[] symbol
)
367 // gpointer g_scanner_scope_lookup_symbol (GScanner *scanner, guint scope_id, const gchar *symbol);
368 return g_scanner_scope_lookup_symbol(gScanner
, scopeId
, Str
.toStringz(symbol
));
372 * Removes a symbol from a scope.
378 * the symbol to remove.
380 public void _ScopeRemoveSymbol(uint scopeId
, char[] symbol
)
382 // void g_scanner_scope_remove_symbol (GScanner *scanner, guint scope_id, const gchar *symbol);
383 g_scanner_scope_remove_symbol(gScanner
, scopeId
, Str
.toStringz(symbol
));
389 * Looks up a symbol in the current scope and return its value. If the
390 * symbol is not bound in the current scope, NULL is returned.
394 * the symbol to look up.
396 * the value of symbol in the current scope, or NULL
397 * if symbol is not bound in the current scope.
399 public void* _LookupSymbol(char[] symbol
)
401 // gpointer g_scanner_lookup_symbol (GScanner *scanner, const gchar *symbol);
402 return g_scanner_lookup_symbol(gScanner
, Str
.toStringz(symbol
));
406 * Outputs a warning message, via the GScanner message handler.
410 * the message format. See the printf()
413 * the parameters to insert into the format string.
415 public void _Warn(char[] format
, ... )
417 // void g_scanner_warn (GScanner *scanner, const gchar *format, ...);
418 g_scanner_warn(gScanner
, Str
.toStringz(format
));
422 * Outputs an error message, via the GScanner message handler.
426 * the message format. See the printf()
429 * the parameters to insert into the format string.
431 public void _Error(char[] format
, ... )
433 // void g_scanner_error (GScanner *scanner, const gchar *format, ...);
434 g_scanner_error(gScanner
, Str
.toStringz(format
));
438 * Outputs a message through the scanner's msg_handler, resulting from an
439 * unexpected token in the input stream.
440 * Note that you should not call g_scanner_peek_next_token() followed by
441 * g_scanner_unexp_token() without an intermediate call to
442 * g_scanner_get_next_token(), as g_scanner_unexp_token() evaluates the
443 * scanner's current token (not the peeked token) to construct part
448 * the expected token.
450 * a string describing how the scanner's user refers to
451 * identifiers (NULL defaults to "identifier").
452 * This is used if expected_token is G_TOKEN_IDENTIFIER
453 * or G_TOKEN_IDENTIFIER_NULL.
455 * a string describing how the scanner's user refers to
456 * symbols (NULL defaults to "symbol").
457 * This is used if expected_token is G_TOKEN_SYMBOL or
458 * any token value greater than G_TOKEN_LAST.
460 * the name of the symbol, if the scanner's current token
463 * a message string to output at the end of the warning/error, or NULL.
465 * if TRUE it is output as an error. If FALSE it is output as a
468 public void _UnexpToken(GTokenType expectedToken
, char[] identifierSpec
, char[] symbolSpec
, char[] symbolName
, char[] message
, int isError
)
470 // void g_scanner_unexp_token (GScanner *scanner, GTokenType expected_token, const gchar *identifier_spec, const gchar *symbol_spec, const gchar *symbol_name, const gchar *message, gint is_error);
471 g_scanner_unexp_token(gScanner
, expectedToken
, Str
.toStringz(identifierSpec
), Str
.toStringz(symbolSpec
), Str
.toStringz(symbolName
), Str
.toStringz(message
), isError
);
476 * Frees all memory used by the GScanner.
480 public void _Destroy()
482 // void g_scanner_destroy (GScanner *scanner);
483 g_scanner_destroy(gScanner
);