/usr/include/d/gtkd-3/glib/ScannerG.d is in libgtkd-3-dev 3.7.5-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | /*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
module glib.ScannerG;
private import glib.ConstructionException;
private import glib.Str;
private import glib.c.functions;
public import glib.c.types;
public import gtkc.glibtypes;
/**
* The data structure representing a lexical scanner.
*
* You should set @input_name after creating the scanner, since
* it is used by the default message handler when displaying
* warnings and errors. If you are scanning a file, the filename
* would be a good choice.
*
* The @user_data and @max_parse_errors fields are not used.
* If you need to associate extra data with the scanner you
* can place them here.
*
* If you want to use your own message handler you can set the
* @msg_handler field. The type of the message handler function
* is declared by #GScannerMsgFunc.
*/
public class ScannerG
{
/** the main Gtk struct */
protected GScanner* gScanner;
protected bool ownedRef;
/** Get the main Gtk struct */
public GScanner* getScannerGStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gScanner;
}
/** the main Gtk struct as a void* */
protected void* getStruct()
{
return cast(void*)gScanner;
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GScanner* gScanner, bool ownedRef = false)
{
this.gScanner = gScanner;
this.ownedRef = ownedRef;
}
/**
* Returns the current line in the input stream (counting
* from 1). This is the line of the last token parsed via
* g_scanner_get_next_token().
*
* Returns: the current line
*/
public uint curLine()
{
return g_scanner_cur_line(gScanner);
}
/**
* Returns the current position in the current line (counting
* from 0). This is the position of the last token parsed via
* g_scanner_get_next_token().
*
* Returns: the current position on the line
*/
public uint curPosition()
{
return g_scanner_cur_position(gScanner);
}
/**
* Gets the current token type. This is simply the @token
* field in the #GScanner structure.
*
* Returns: the current token type
*/
public GTokenType curToken()
{
return g_scanner_cur_token(gScanner);
}
/**
* Gets the current token value. This is simply the @value
* field in the #GScanner structure.
*
* Returns: the current token value
*/
public GTokenValue curValue()
{
return g_scanner_cur_value(gScanner);
}
/**
* Frees all memory used by the #GScanner.
*/
public void destroy()
{
g_scanner_destroy(gScanner);
}
/**
* Returns %TRUE if the scanner has reached the end of
* the file or text buffer.
*
* Returns: %TRUE if the scanner has reached the end of
* the file or text buffer
*/
public bool eof()
{
return g_scanner_eof(gScanner) != 0;
}
/**
* Parses the next token just like g_scanner_peek_next_token()
* and also removes it from the input stream. The token data is
* placed in the @token, @value, @line, and @position fields of
* the #GScanner structure.
*
* Returns: the type of the token
*/
public GTokenType getNextToken()
{
return g_scanner_get_next_token(gScanner);
}
/**
* Prepares to scan a file.
*
* Params:
* inputFd = a file descriptor
*/
public void inputFile(int inputFd)
{
g_scanner_input_file(gScanner, inputFd);
}
/**
* Prepares to scan a text buffer.
*
* Params:
* text = the text buffer to scan
* textLen = the length of the text buffer
*/
public void inputText(string text, uint textLen)
{
g_scanner_input_text(gScanner, Str.toStringz(text), textLen);
}
/**
* Looks up a symbol in the current scope and return its value.
* If the symbol is not bound in the current scope, %NULL is
* returned.
*
* Params:
* symbol = the symbol to look up
*
* Returns: the value of @symbol in the current scope, or %NULL
* if @symbol is not bound in the current scope
*/
public void* lookupSymbol(string symbol)
{
return g_scanner_lookup_symbol(gScanner, Str.toStringz(symbol));
}
/**
* Parses the next token, without removing it from the input stream.
* The token data is placed in the @next_token, @next_value, @next_line,
* and @next_position fields of the #GScanner structure.
*
* Note that, while the token is not removed from the input stream
* (i.e. the next call to g_scanner_get_next_token() will return the
* same token), it will not be reevaluated. This can lead to surprising
* results when changing scope or the scanner configuration after peeking
* the next token. Getting the next token after switching the scope or
* configuration will return whatever was peeked before, regardless of
* any symbols that may have been added or removed in the new scope.
*
* Returns: the type of the token
*/
public GTokenType peekNextToken()
{
return g_scanner_peek_next_token(gScanner);
}
/**
* Adds a symbol to the given scope.
*
* Params:
* scopeId = the scope id
* symbol = the symbol to add
* value = the value of the symbol
*/
public void scopeAddSymbol(uint scopeId, string symbol, void* value)
{
g_scanner_scope_add_symbol(gScanner, scopeId, Str.toStringz(symbol), value);
}
/**
* Calls the given function for each of the symbol/value pairs
* in the given scope of the #GScanner. The function is passed
* the symbol and value of each pair, and the given @user_data
* parameter.
*
* Params:
* scopeId = the scope id
* func = the function to call for each symbol/value pair
* userData = user data to pass to the function
*/
public void scopeForeachSymbol(uint scopeId, GHFunc func, void* userData)
{
g_scanner_scope_foreach_symbol(gScanner, scopeId, func, userData);
}
/**
* Looks up a symbol in a scope and return its value. If the
* symbol is not bound in the scope, %NULL is returned.
*
* Params:
* scopeId = the scope id
* symbol = the symbol to look up
*
* Returns: the value of @symbol in the given scope, or %NULL
* if @symbol is not bound in the given scope.
*/
public void* scopeLookupSymbol(uint scopeId, string symbol)
{
return g_scanner_scope_lookup_symbol(gScanner, scopeId, Str.toStringz(symbol));
}
/**
* Removes a symbol from a scope.
*
* Params:
* scopeId = the scope id
* symbol = the symbol to remove
*/
public void scopeRemoveSymbol(uint scopeId, string symbol)
{
g_scanner_scope_remove_symbol(gScanner, scopeId, Str.toStringz(symbol));
}
/**
* Sets the current scope.
*
* Params:
* scopeId = the new scope id
*
* Returns: the old scope id
*/
public uint setScope(uint scopeId)
{
return g_scanner_set_scope(gScanner, scopeId);
}
/**
* Rewinds the filedescriptor to the current buffer position
* and blows the file read ahead buffer. This is useful for
* third party uses of the scanners filedescriptor, which hooks
* onto the current scanning position.
*/
public void syncFileOffset()
{
g_scanner_sync_file_offset(gScanner);
}
/**
* Outputs a message through the scanner's msg_handler,
* resulting from an unexpected token in the input stream.
* Note that you should not call g_scanner_peek_next_token()
* followed by g_scanner_unexp_token() without an intermediate
* call to g_scanner_get_next_token(), as g_scanner_unexp_token()
* evaluates the scanner's current token (not the peeked token)
* to construct part of the message.
*
* Params:
* expectedToken = the expected token
* identifierSpec = a string describing how the scanner's user
* refers to identifiers (%NULL defaults to "identifier").
* This is used if @expected_token is %G_TOKEN_IDENTIFIER or
* %G_TOKEN_IDENTIFIER_NULL.
* symbolSpec = a string describing how the scanner's user refers
* to symbols (%NULL defaults to "symbol"). This is used if
* @expected_token is %G_TOKEN_SYMBOL or any token value greater
* than %G_TOKEN_LAST.
* symbolName = the name of the symbol, if the scanner's current
* token is a symbol.
* message = a message string to output at the end of the
* warning/error, or %NULL.
* isError = if %TRUE it is output as an error. If %FALSE it is
* output as a warning.
*/
public void unexpToken(GTokenType expectedToken, string identifierSpec, string symbolSpec, string symbolName, string message, int isError)
{
g_scanner_unexp_token(gScanner, expectedToken, Str.toStringz(identifierSpec), Str.toStringz(symbolSpec), Str.toStringz(symbolName), Str.toStringz(message), isError);
}
/**
* Creates a new #GScanner.
*
* The @config_templ structure specifies the initial settings
* of the scanner, which are copied into the #GScanner
* @config field. If you pass %NULL then the default settings
* are used.
*
* Params:
* configTempl = the initial scanner settings
*
* Returns: the new #GScanner
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this(GScannerConfig* configTempl)
{
auto p = g_scanner_new(configTempl);
if(p is null)
{
throw new ConstructionException("null returned by new");
}
this(cast(GScanner*) p);
}
}
|