Freeciv21
Develop your civilization from humble roots to a global empire
inputfile.h File Reference
#include "support.h"
#include <QString>
+ Include dependency graph for inputfile.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define INF_TOK_FIRST   INF_TOK_SECTION_NAME
 

Typedefs

using datafilename_fn_t = QString(*)(const QString &filename)
 

Enumerations

enum  inf_token_type {
  INF_TOK_SECTION_NAME , INF_TOK_ENTRY_NAME , INF_TOK_EOL , INF_TOK_TABLE_START ,
  INF_TOK_TABLE_END , INF_TOK_COMMA , INF_TOK_VALUE , INF_TOK_LAST
}
 

Functions

struct inputfileinf_from_file (const QString &filename, datafilename_fn_t datafn)
 Open the file, and return an allocated, initialized structure. More...
 
struct inputfileinf_from_stream (QIODevice *stream, datafilename_fn_t datafn)
 Open the stream, and return an allocated, initialized structure. More...
 
void inf_close (struct inputfile *inf)
 Close the file and free associated memory, included any partially recursed included files, and the memory allocated for 'inf' itself. More...
 
bool inf_at_eof (struct inputfile *inf)
 Return TRUE if current pos is at end of file. More...
 
QString inf_token (struct inputfile *inf, enum inf_token_type type)
 Returns token of given type from given inputfile. More...
 
int inf_discard_tokens (struct inputfile *inf, enum inf_token_type type)
 Read as many tokens of specified type as possible, discarding the results; returns number of such tokens read and discarded. More...
 
QString inf_log_str (struct inputfile *inf, const char *message,...) fc__attribute((__format__(__printf__
 

Macro Definition Documentation

◆ INF_TOK_FIRST

#define INF_TOK_FIRST   INF_TOK_SECTION_NAME

Definition at line 46 of file inputfile.h.

Typedef Documentation

◆ datafilename_fn_t

using datafilename_fn_t = QString (*)(const QString &filename)

Definition at line 27 of file inputfile.h.

Enumeration Type Documentation

◆ inf_token_type

Enumerator
INF_TOK_SECTION_NAME 
INF_TOK_ENTRY_NAME 
INF_TOK_EOL 
INF_TOK_TABLE_START 
INF_TOK_TABLE_END 
INF_TOK_COMMA 
INF_TOK_VALUE 
INF_TOK_LAST 

Definition at line 36 of file inputfile.h.

Function Documentation

◆ inf_at_eof()

bool inf_at_eof ( struct inputfile inf)

Return TRUE if current pos is at end of file.

Definition at line 323 of file inputfile.cpp.

Referenced by inf_log_str(), and secfile_from_input_file().

◆ inf_close()

void inf_close ( struct inputfile inf)

Close the file and free associated memory, included any partially recursed included files, and the memory allocated for 'inf' itself.

Should only be used on an actually open inputfile. After this, the pointer should not be used.

Definition at line 285 of file inputfile.cpp.

Referenced by secfile_from_input_file().

◆ inf_discard_tokens()

int inf_discard_tokens ( struct inputfile inf,
enum inf_token_type  type 
)

Read as many tokens of specified type as possible, discarding the results; returns number of such tokens read and discarded.

Definition at line 563 of file inputfile.cpp.

Referenced by secfile_from_input_file().

◆ inf_from_file()

struct inputfile* inf_from_file ( const QString &  filename,
datafilename_fn_t  datafn 
)

Open the file, and return an allocated, initialized structure.

Returns nullptr if the file could not be opened.

Definition at line 202 of file inputfile.cpp.

Referenced by check_include(), and secfile_load_section().

◆ inf_from_stream()

struct inputfile* inf_from_stream ( QIODevice *  stream,
datafilename_fn_t  datafn 
)

Open the stream, and return an allocated, initialized structure.

Returns nullptr if the file could not be opened.

Definition at line 225 of file inputfile.cpp.

Referenced by inf_from_file(), and secfile_from_stream().

◆ inf_log_str()

QString inf_log_str ( struct inputfile inf,
const char *  message,
  ... 
)

◆ inf_token()

QString inf_token ( struct inputfile inf,
enum inf_token_type  type 
)

Returns token of given type from given inputfile.

Definition at line 536 of file inputfile.cpp.

Referenced by inf_discard_tokens(), and secfile_from_input_file().