39extern CGV_API std::string
find_data_file(
const std::string& file_name,
const std::string& strategy,
const std::string& sub_directory =
"",
const std::string& master_path =
"");
49extern CGV_API
int std_query(
const std::string& text,
const std::string& answers,
int default_answer);
52extern CGV_API std::string
std_ask_dir(
const std::string& text,
const std::string& path);
62 std::string(*
ask_dir)(
const std::string& text,
const std::string& path);
65 void (*
_message)(
const std::string&) = 0,
66 int (*
_query)(
const std::string&,
const std::string&,
int) = 0,
67 std::string(*
_ask_dir)(
const std::string&,
const std::string&) = 0
84 const std::string& url,
const std::string& cache_strategy,
const std::string& producer,
85 const std::string& sub_directory =
"",
const std::string& master_path =
"", user_feedback uf = user_feedback());
94extern CGV_API FILE*
open_data_file(
const std::string& file_name,
const char* mode);
97extern CGV_API
bool read_data_file(
const std::string& file_name, std::string& content,
bool ascii);
100extern CGV_API
unsigned int data_file_size(
const std::string& file_name);
103extern CGV_API
unsigned int find_file_offset(
const std::string& file_name,
const char* data,
unsigned int data_size);
108#include <cgv/config/lib_end.h>
complete implementation of method actions that only call one method when entering a node
std::string std_ask_dir(const std::string &text, const std::string &path)
std::cout and std::cin based implementation of the ask_dir function for third argument to the user_fe...
std::string find_or_download_data_file(const std::string &file_name, const std::string &find_strategy, const std::string &url, const std::string &cache_strategy, const std::string &producer, const std::string &sub_directory, const std::string &master_path, user_feedback uf)
same as find_data_file() but in case file is not found, it is downloaded from the provided url and st...
void stderr_message(const std::string &text)
std::cerr based implementation of the message function for first argument to the user_feedback constr...
int std_query(const std::string &text, const std::string &answers, int default_answer)
std::cout and std::cin based implementation of the query function for second argument to the user_fee...
unsigned int find_file_offset(const std::string &file_name, const char *data, unsigned int data_size)
find the offset of the given data block in the given file
void pop_file_parent()
pop the latestly pushed parent path from the parent path stack.
void push_file_parent(const std::string &path_or_file_name)
extract a valid path from the given argument and push it onto the stack of parent paths....
std::vector< std::string > & ref_parent_file_stack()
return a reference to the data path list, which is constructed from the environment variable CGV_DATA
bool read_data_file(const std::string &file_name, std::string &content, bool ascii)
read ascii file into a string
std::vector< std::string > & ref_data_path_list()
return a reference to the data path list, which is constructed from the environment variable CGV_DATA
FILE * open_data_file(const std::string &file_name, const char *mode)
open a file with fopen supporting resource files, that have the prefix "res://"
std::string find_data_file(const std::string &file_name, const std::string &strategy, const std::string &sub_directory, const std::string &master_path)
Find a file with the given strategy and return the file name extended by the necessary path.
unsigned int data_file_size(const std::string &file_name)
return the file size of a given file with support for resource files, that have the prefix "res://"
void stdout_message(const std::string &text)
std::cout based implementation of the message function for first argument to the user_feedback constr...
function pointers implementing user feedback functionality of find_or_download_data_file() function
void(* message)(const std::string &text)
pointer to function that shows a text message to user
int(* query)(const std::string &text, const std::string &answers, int default_answer)
pointer to function that shows a text query and asks for an answer
user_feedback(void(*_message)(const std::string &)=0, int(*_query)(const std::string &, const std::string &, int)=0, std::string(*_ask_dir)(const std::string &, const std::string &)=0)
default construction results in no user feedback
std::string(* ask_dir)(const std::string &text, const std::string &path)
pointer to function that opens a directory save dialog