#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <map>
#include <list>
#include <sys/stat.h>
#include <unistd.h>
#include <exception>
#include "exceptions.h"
#include "utils.h"
Include dependency graph for utils.cc:
Go to the source code of this file.
Functions | |
static void | switch_slashes (string &name) |
static bool | base_to_uppercase (string &str, int count) |
int | stat (const std::string &file_name, struct stat *buf) |
void | store_system_paths () |
void | reset_system_paths () |
void | add_system_path (const string &key, const string &value) |
void | clone_system_path (const string &new_key, const string &old_key) |
void | clear_system_path (const string &key) |
bool | is_system_path_defined (const string &path) |
string | get_system_path (const string &path) |
void | to_uppercase (string &str) |
string | to_uppercase (const std::string &str) |
bool | U7open (std::ifstream &in, const char *fname, bool is_text) |
bool | U7open (std::ofstream &out, const char *fname, bool is_text) |
std::FILE * | U7open (const char *fname, const char *mode) |
void | U7remove (const char *fname) |
bool | U7exists (const char *fname) |
int | U7mkdir (const char *dirname, int mode) |
int | U7chdir (const char *dirname) |
void | U7copy (const char *src, const char *dest) |
int | Log2 (uint32 n) |
char * | newstrdup (const char *s) |
Variables | |
static std::map< string, string > | path_map |
static std::map< string, string > | stored_path_map |
void add_system_path | ( | const string & | key, | |
const string & | value | |||
) |
Definition at line 82 of file utils.cc.
References clear_system_path(), and path_map.
Referenced by exult_main(), get_game_paths(), and ExultStudio::set_game_path().
Here is the call graph for this function:
static bool base_to_uppercase | ( | string & | str, | |
int | count | |||
) | [static] |
void clear_system_path | ( | const string & | key | ) |
Definition at line 100 of file utils.cc.
References path_map.
Referenced by add_system_path(), clone_system_path(), and Game::create_game().
void clone_system_path | ( | const string & | new_key, | |
const string & | old_key | |||
) |
Definition at line 91 of file utils.cc.
References clear_system_path(), is_system_path_defined(), and path_map.
Referenced by Game::create_game().
Here is the call graph for this function:
string get_system_path | ( | const string & | path | ) |
Definition at line 119 of file utils.cc.
References is_system_path_defined(), path_map, and switch_slashes().
Referenced by add_to_tree(), ExultStudio::compile(), crc32_syspath(), Game::create_game(), Shape_chooser::edit_shape(), exult_main(), SI_Game::is_installed(), BG_Game::is_installed(), Vga_file::load(), ExultStudio::new_shape_file(), MyMidiPlayer::start_track(), U7exists(), U7ListFiles(), U7mkdir(), U7open(), and U7remove().
Here is the call graph for this function:
bool is_system_path_defined | ( | const string & | path | ) |
Definition at line 110 of file utils.cc.
References path_map.
Referenced by clone_system_path(), Game::create_game(), Game_map::get_ifix_objects(), get_system_path(), Shapes_vga_file::init(), Game_map::init(), Game_window::init_files(), Game_window::init_gamedat(), Palette::load(), Mouse::Mouse(), ExultStudio::new_shape_file(), Shapes_vga_file::read_info(), Game_window::reload_usecode(), Usecode_internal::Usecode_internal(), and Shapes_vga_file::write_info().
int Log2 | ( | uint32 | n | ) |
char* newstrdup | ( | const char * | s | ) |
Definition at line 640 of file utils.cc.
Referenced by Game_window::get_game_identity(), Get_token(), Usecode_value::operator=(), Game_window::read_save_names(), Read_text_msg_file(), Game_window::save_gamedat(), ExultStudio::save_shape_window(), and Usecode_value::Usecode_value().
void reset_system_paths | ( | ) |
Definition at line 77 of file utils.cc.
References path_map, and stored_path_map.
Referenced by Init().
int stat | ( | const std::string & | file_name, | |
struct stat * | buf | |||
) | [inline] |
Definition at line 62 of file utils.cc.
Referenced by Shape_chooser::check_editing_files(), Shape_chooser::export_png(), U7exists(), and U7remove().
void store_system_paths | ( | ) |
Definition at line 72 of file utils.cc.
References path_map, and stored_path_map.
Referenced by Init().
static void switch_slashes | ( | string & | name | ) | [static] |
string to_uppercase | ( | const std::string & | str | ) |
Definition at line 216 of file utils.cc.
References s, and to_uppercase().
Here is the call graph for this function:
void to_uppercase | ( | string & | str | ) |
Definition at line 204 of file utils.cc.
Referenced by Game::create_game(), exult_main(), get_game_paths(), Image_window::get_scaler_for_name(), Object_sfx::get_shape_sfx(), KeyBinder::ParseLine(), MyMidiPlayer::start_track(), and to_uppercase().
int U7chdir | ( | const char * | dirname | ) |
Definition at line 559 of file utils.cc.
References switch_slashes().
Here is the call graph for this function:
void U7copy | ( | const char * | src, | |
const char * | dest | |||
) |
Definition at line 578 of file utils.cc.
References U7open().
Referenced by ExultStudio::create_new_game().
Here is the call graph for this function:
bool U7exists | ( | const char * | fname | ) |
Definition at line 490 of file utils.cc.
Referenced by add_to_tree(), Audio::can_sfx(), ExultStudio::compile(), ExultStudio::connect_to_server(), Create(), Shape_file_set::create(), ExultStudio::create_new_game(), Shape_chooser::export_frame(), Palette_edit::export_palette(), exult_main(), ExultStudio::ExultStudio(), get_game_paths(), Game_map::get_ifix_objects(), Shapes_vga_file::init(), Fonts_vga_file::init(), Game_map::init(), Init(), Game_window::init_files(), Game_window::init_gamedat(), Audio::Init_sfx(), SI_Game::is_installed(), BG_Game::is_installed(), Vga_file::load(), Shape_manager::load(), Mouse::Mouse(), Game_window::reload_usecode(), ExultStudio::set_game_path(), Shape_group_file::Shape_group_file(), Game::show_menu(), U7exists(), Update(), Usecode_internal::Usecode_internal(), and Game_window::write_saveinfo().
int U7mkdir | ( | const char * | dirname, | |
int | mode | |||
) |
Definition at line 524 of file utils.cc.
References get_system_path().
Referenced by Game::create_game(), ExultStudio::create_new_game(), Shape_chooser::edit_shape(), get_game_paths(), Game_window::restore_gamedat(), ExultStudio::set_game_path(), and Game_map::write_static().
Here is the call graph for this function:
std::FILE* U7open | ( | const char * | fname, | |
const char * | mode | |||
) |
Definition at line 431 of file utils.cc.
References base_to_uppercase(), and get_system_path().
Here is the call graph for this function:
bool U7open | ( | std::ofstream & | out, | |
const char * | fname, | |||
bool | is_text | |||
) |
bool U7open | ( | std::ifstream & | in, | |
const char * | fname, | |||
bool | is_text | |||
) |
Definition at line 314 of file utils.cc.
Referenced by Create(), Shape_file_set::create(), Create_file(), Flex_file_info::Flex_file_info(), Flex_file_info::flush(), get_file_size(), Game_window::get_game_identity(), Game_map::get_ifix_objects(), Game_map::get_ireg_objects(), Game_window::get_saveinfo(), Flex::IndexFlexFile(), IFF::IndexIFFFile(), Table::IndexTableFile(), Game_map::init(), Game_window::init_files(), Game_window::init_gamedat(), Flex::is_flex(), Vga_file::load(), Shape_file::load(), KeyBinder::LoadFromFile(), main(), ucxtInit::opcodes(), Audio::playfile(), playfli::playfli(), Usecode_internal::read(), Keyring::read(), Game_window::read_gwin(), Game_window::read_npcs(), Game_window::read_save_names(), Game_window::read_schedules(), Game_window::reload_usecode(), Game_window::restore_gamedat(), U7object::retrieve(), Flex_file_info::revert(), Game_window::revert_schedules(), Game_window::save_gamedat(), Savefile(), Segment_file::Segment_file(), SI_Game::show_credits(), BG_Game::show_credits(), MyMidiPlayer::start_track(), U7copy(), U7open2(), Usecode_internal::UI_run_endgame(), Update(), Usecode_internal::Usecode_internal(), Usecode_internal::write(), Keyring::write(), Shape_group_file::write(), XMIDIEventList::Write(), Configuration::write_back(), Image_file_info::write_file(), Write_flex(), Game_window::write_gwin(), Game_map::write_ifix_objects(), Shapes_vga_file::write_info(), Game_map::write_ireg(), Game_map::write_ireg_objects(), Game_window::write_npcs(), Write_palettes(), Game_window::write_saveinfo(), Game_window::write_schedules(), ExultStudio::write_shape_info(), and Game_map::write_static().
void U7remove | ( | const char * | fname | ) |
Definition at line 457 of file utils.cc.
References base_to_uppercase(), get_system_path(), Ucscript::remove, and stat().
Referenced by Newfile_gump::delete_file(), and Game_window::restore_gamedat().
Here is the call graph for this function:
std::map<string, string> path_map [static] |
Definition at line 69 of file utils.cc.
Referenced by add_system_path(), clear_system_path(), clone_system_path(), get_system_path(), is_system_path_defined(), reset_system_paths(), and store_system_paths().
std::map<string, string> stored_path_map [static] |
Definition at line 70 of file utils.cc.
Referenced by reset_system_paths(), and store_system_paths().