OpenTTD Source 20241224-master-gf74b0cf984
|
Types for Standard In/Out file operations. More...
#include "core/enum_type.hpp"
Go to the source code of this file.
Data Structures | |
class | FileHandle |
struct | FileHandle::FileDeleter |
Helper to close a FILE * with a std::unique_ptr . More... | |
Macros | |
#define | MAKE_FIOS_TYPE(abstract, detailed) ((abstract) | ((detailed) << FT_NUMBITS)) |
Construct an enum value for FiosType as a combination of an abstract and a detailed file type. | |
Enumerations | |
enum | AbstractFileType { FT_NONE , FT_SAVEGAME , FT_SCENARIO , FT_HEIGHTMAP , FT_TOWN_DATA , FT_INVALID = 7 , FT_NUMBITS = 3 , FT_MASK = (1 << FT_NUMBITS) - 1 } |
The different abstract types of files that the system knows about. More... | |
enum | DetailedFileType { DFT_OLD_GAME_FILE , DFT_GAME_FILE , DFT_HEIGHTMAP_BMP , DFT_HEIGHTMAP_PNG , DFT_TOWN_DATA_JSON , DFT_FIOS_DRIVE , DFT_FIOS_PARENT , DFT_FIOS_DIR , DFT_FIOS_DIRECT , DFT_END , DFT_INVALID = 255 } |
Kinds of files in each AbstractFileType. More... | |
enum | SaveLoadOperation { SLO_CHECK , SLO_LOAD , SLO_SAVE , SLO_INVALID } |
Operation performed on the file. More... | |
enum | FiosType { FIOS_TYPE_DRIVE = MAKE_FIOS_TYPE(FT_NONE, DFT_FIOS_DRIVE) , FIOS_TYPE_PARENT = MAKE_FIOS_TYPE(FT_NONE, DFT_FIOS_PARENT) , FIOS_TYPE_DIR = MAKE_FIOS_TYPE(FT_NONE, DFT_FIOS_DIR) , FIOS_TYPE_DIRECT = MAKE_FIOS_TYPE(FT_NONE, DFT_FIOS_DIRECT) , FIOS_TYPE_FILE = MAKE_FIOS_TYPE(FT_SAVEGAME, DFT_GAME_FILE) , FIOS_TYPE_OLDFILE = MAKE_FIOS_TYPE(FT_SAVEGAME, DFT_OLD_GAME_FILE) , FIOS_TYPE_SCENARIO = MAKE_FIOS_TYPE(FT_SCENARIO, DFT_GAME_FILE) , FIOS_TYPE_OLD_SCENARIO = MAKE_FIOS_TYPE(FT_SCENARIO, DFT_OLD_GAME_FILE) , FIOS_TYPE_PNG = MAKE_FIOS_TYPE(FT_HEIGHTMAP, DFT_HEIGHTMAP_PNG) , FIOS_TYPE_BMP = MAKE_FIOS_TYPE(FT_HEIGHTMAP, DFT_HEIGHTMAP_BMP) , FIOS_TYPE_JSON = MAKE_FIOS_TYPE(FT_TOWN_DATA, DFT_TOWN_DATA_JSON) , FIOS_TYPE_INVALID = MAKE_FIOS_TYPE(FT_INVALID, DFT_INVALID) } |
Elements of a file system that are recognized. More... | |
enum | Subdirectory { BASE_DIR , SAVE_DIR , AUTOSAVE_DIR , SCENARIO_DIR , HEIGHTMAP_DIR , OLD_GM_DIR , OLD_DATA_DIR , BASESET_DIR , NEWGRF_DIR , LANG_DIR , AI_DIR , AI_LIBRARY_DIR , GAME_DIR , GAME_LIBRARY_DIR , SCREENSHOT_DIR , SOCIAL_INTEGRATION_DIR , NUM_SUBDIRS , NO_DIRECTORY } |
The different kinds of subdirectories OpenTTD uses. More... | |
enum | Searchpath : unsigned { SP_FIRST_DIR , SP_WORKING_DIR = SP_FIRST_DIR , SP_PERSONAL_DIR , SP_SHARED_DIR , SP_BINARY_DIR , SP_INSTALLATION_DIR , SP_APPLICATION_BUNDLE_DIR , SP_AUTODOWNLOAD_DIR , SP_AUTODOWNLOAD_PERSONAL_DIR , SP_AUTODOWNLOAD_PERSONAL_DIR_XDG , NUM_SEARCHPATHS } |
Types of searchpaths OpenTTD might use. More... | |
Functions | |
AbstractFileType | GetAbstractFileType (FiosType fios_type) |
Extract the abstract file type from a FiosType. | |
DetailedFileType | GetDetailedFileType (FiosType fios_type) |
Extract the detailed file type from a FiosType. | |
Types for Standard In/Out file operations.
Definition in file fileio_type.h.
#define MAKE_FIOS_TYPE | ( | abstract, | |
detailed | |||
) | ((abstract) | ((detailed) << FT_NUMBITS)) |
Construct an enum value for FiosType as a combination of an abstract and a detailed file type.
abstract | Abstract file type (one of AbstractFileType). |
detailed | Detailed file type (one of DetailedFileType). |
Definition at line 66 of file fileio_type.h.
enum AbstractFileType |
The different abstract types of files that the system knows about.
Enumerator | |
---|---|
FT_NONE | nothing to do |
FT_SAVEGAME | old or new savegame |
FT_SCENARIO | old or new scenario |
FT_HEIGHTMAP | heightmap file |
FT_TOWN_DATA | town data file |
FT_INVALID | Invalid or unknown file type. |
FT_NUMBITS | Number of bits required for storing a AbstractFileType value. |
FT_MASK | Bitmask for extracting an abstract file type. |
Definition at line 16 of file fileio_type.h.
enum DetailedFileType |
Kinds of files in each AbstractFileType.
Enumerator | |
---|---|
DFT_OLD_GAME_FILE | Old save game or scenario file. |
DFT_GAME_FILE | Save game or scenario file. |
DFT_HEIGHTMAP_BMP | BMP file. |
DFT_HEIGHTMAP_PNG | PNG file. |
DFT_TOWN_DATA_JSON | JSON file. |
DFT_FIOS_DRIVE | A drive (letter) entry. |
DFT_FIOS_PARENT | A parent directory entry. |
DFT_FIOS_DIR | A directory entry. |
DFT_FIOS_DIRECT | Direct filename. |
DFT_END | End of this enum. Supports a compile time size check against _fios_colours in fios_gui.cpp. |
DFT_INVALID | Unknown or invalid file. |
Definition at line 29 of file fileio_type.h.
enum FiosType |
Elements of a file system that are recognized.
Values are a combination of AbstractFileType and DetailedFileType.
Definition at line 73 of file fileio_type.h.
enum SaveLoadOperation |
Operation performed on the file.
Enumerator | |
---|---|
SLO_CHECK | Load file for checking and/or preview. |
SLO_LOAD | File is being loaded. |
SLO_SAVE | File is being saved. |
SLO_INVALID | Unknown file operation. |
Definition at line 53 of file fileio_type.h.
enum Searchpath : unsigned |
Types of searchpaths OpenTTD might use.
Definition at line 139 of file fileio_type.h.
enum Subdirectory |
The different kinds of subdirectories OpenTTD uses.
Definition at line 115 of file fileio_type.h.
|
inline |
Extract the abstract file type from a FiosType.
fios_type | Type to query. |
Definition at line 97 of file fileio_type.h.
References FT_MASK.
Referenced by openttd_main(), and FileToSaveLoad::SetMode().
|
inline |
Extract the detailed file type from a FiosType.
fios_type | Type to query. |
Definition at line 107 of file fileio_type.h.
References FT_NUMBITS.
Referenced by SaveLoadWindow::DrawWidget(), SaveLoadWindow::OnClick(), openttd_main(), and FileToSaveLoad::SetMode().