mirror of
https://github.com/Relintai/uml_generator.git
synced 2025-03-14 18:48:53 +01:00
Add an another example.
This commit is contained in:
parent
6bb14cb660
commit
c246ce0671
@ -1,17 +1,19 @@
|
|||||||
|
|
||||||
base_class Object
|
class Object
|
||||||
base_class Reference
|
inherit
|
||||||
|
class Reference
|
||||||
|
inherit
|
||||||
class Directory
|
class Directory
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Error open_dir(const String &path, bool skip_specials = true);
|
Error open_dir(const String &path, bool skip_specials = true);
|
||||||
Error open_dir(const char *path, bool skip_specials = true);
|
Error open_dir(const char *path, bool skip_specials = true);
|
||||||
void close_dir();
|
void close_dir();
|
||||||
|
--
|
||||||
bool has_next();
|
bool has_next();
|
||||||
bool read();
|
bool read();
|
||||||
bool next();
|
bool next();
|
||||||
|
--
|
||||||
bool current_is_ok();
|
bool current_is_ok();
|
||||||
String current_get_name();
|
String current_get_name();
|
||||||
String current_get_path();
|
String current_get_path();
|
||||||
@ -22,20 +24,21 @@ public:
|
|||||||
bool current_is_file();
|
bool current_is_file();
|
||||||
bool current_is_dir();
|
bool current_is_dir();
|
||||||
bool current_is_special_dir();
|
bool current_is_special_dir();
|
||||||
|
--
|
||||||
String read_file(const String &path);
|
String read_file(const String &path);
|
||||||
Error read_file_into(const String &path, String *str);
|
Error read_file_into(const String &path, String *str);
|
||||||
Vector<uint8_t> read_file_bin(const String &path);
|
Vector<uint8_t> read_file_bin(const String &path);
|
||||||
Error read_file_into_bin(const String &path, Vector<uint8_t> *data);
|
Error read_file_into_bin(const String &path, Vector<uint8_t> *data);
|
||||||
|
--
|
||||||
Error write_file(const String &path, const String &str);
|
Error write_file(const String &path, const String &str);
|
||||||
Error write_file_bin(const String &path, const Vector<uint8_t> &data);
|
Error write_file_bin(const String &path, const Vector<uint8_t> &data);
|
||||||
|
--
|
||||||
bool is_dir_open();
|
bool is_dir_open();
|
||||||
bool is_dir_closed();
|
bool is_dir_closed();
|
||||||
|
--
|
||||||
Directory();
|
Directory();
|
||||||
virtual ~Directory();
|
virtual ~Directory();
|
||||||
|
--
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _skip_specials;
|
bool _skip_specials;
|
||||||
|
43
project/examples/file_cache.umlg
Normal file
43
project/examples/file_cache.umlg
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
|
||||||
|
class Object
|
||||||
|
inherit
|
||||||
|
|
||||||
|
class FileCache
|
||||||
|
public:
|
||||||
|
String wwwroot;
|
||||||
|
int cache_invalidation_time;
|
||||||
|
--
|
||||||
|
void wwwroot_register_file(const String &file_path);
|
||||||
|
void wwwroot_deregister_file(const String &file_path);
|
||||||
|
bool wwwroot_has_file(const String &file_path);
|
||||||
|
void wwwroot_refresh_cache();
|
||||||
|
void wwwroot_evaluate_dir(const char *path, const bool should_exist = true);
|
||||||
|
--
|
||||||
|
bool get_cached_body(const String &path, String *body);
|
||||||
|
void set_cached_body(const String &path, const String &body);
|
||||||
|
--
|
||||||
|
void clear();
|
||||||
|
--
|
||||||
|
FileCache(bool singleton = false);
|
||||||
|
virtual ~FileCache();
|
||||||
|
--
|
||||||
|
static FileCache *get_singleton();
|
||||||
|
--
|
||||||
|
std::set<String> registered_files;
|
||||||
|
--
|
||||||
|
protected:
|
||||||
|
|
||||||
|
RWLock _lock;
|
||||||
|
std::map<String, CacheEntry *> cache_map;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static FileCache *_instance;
|
||||||
|
|
||||||
|
|
||||||
|
new_column
|
||||||
|
|
||||||
|
struct CacheEntry
|
||||||
|
int64_t timestamp;
|
||||||
|
String body;
|
||||||
|
|
||||||
|
CacheEntry();
|
@ -12,7 +12,7 @@ public:
|
|||||||
char get(const int index);
|
char get(const int index);
|
||||||
const char get(const int index) const;
|
const char get(const int index) const;
|
||||||
void set(const int index, const char value);
|
void set(const int index, const char value);
|
||||||
|
--
|
||||||
int size() const;
|
int size() const;
|
||||||
int capacity() const;
|
int capacity() const;
|
||||||
void ensure_capacity(const int capacity);
|
void ensure_capacity(const int capacity);
|
||||||
@ -27,74 +27,74 @@ public:
|
|||||||
String substr_index(const int start_index, const int end_index) const;
|
String substr_index(const int start_index, const int end_index) const;
|
||||||
bool contains(const char val) const;
|
bool contains(const char val) const;
|
||||||
bool contains(const String &val) const;
|
bool contains(const String &val) const;
|
||||||
|
--
|
||||||
bool is_word_at(const int index, const char *str) const;
|
bool is_word_at(const int index, const char *str) const;
|
||||||
bool is_word_at(const int index, const String &val) const;
|
bool is_word_at(const int index, const String &val) const;
|
||||||
|
--
|
||||||
void replace_from(const int start_index, const int length, const String &with);
|
void replace_from(const int start_index, const int length, const String &with);
|
||||||
void replace(const String &find_str, const String &with);
|
void replace(const String &find_str, const String &with);
|
||||||
void replace(const String &find_str, const String &with, const int count);
|
void replace(const String &find_str, const String &with, const int count);
|
||||||
|
--
|
||||||
int compare(const String &other) const;
|
int compare(const String &other) const;
|
||||||
|
--
|
||||||
int first_difference_index(const String &other) const;
|
int first_difference_index(const String &other) const;
|
||||||
|
--
|
||||||
void to_lower();
|
void to_lower();
|
||||||
String as_lower() const;
|
String as_lower() const;
|
||||||
|
--
|
||||||
void trim();
|
void trim();
|
||||||
void trim_beginning();
|
void trim_beginning();
|
||||||
void trim_end();
|
void trim_end();
|
||||||
|
--
|
||||||
bool ends_with(const char c) const;
|
bool ends_with(const char c) const;
|
||||||
bool ends_with(const String &str) const;
|
bool ends_with(const String &str) const;
|
||||||
|
--
|
||||||
bool starts_with(const char c) const;
|
bool starts_with(const char c) const;
|
||||||
bool starts_with(const String &str) const;
|
bool starts_with(const String &str) const;
|
||||||
|
--
|
||||||
int get_slice_count(const char splitter) const;
|
int get_slice_count(const char splitter) const;
|
||||||
int get_slice_count(const String &splitter) const;
|
int get_slice_count(const String &splitter) const;
|
||||||
String get_slice(const char splitter, int index);
|
String get_slice(const char splitter, int index);
|
||||||
String get_slice(const String &splitter, int index);
|
String get_slice(const String &splitter, int index);
|
||||||
|
--
|
||||||
Vector<String> split(const char splitter) const;
|
Vector<String> split(const char splitter) const;
|
||||||
Vector<String> split(const String &splitter) const;
|
Vector<String> split(const String &splitter) const;
|
||||||
|
--
|
||||||
uint8_t read_uint8_bytes_at(int &index, bool advance_index = true);
|
uint8_t read_uint8_bytes_at(int &index, bool advance_index = true);
|
||||||
uint16_t read_uint16_bytes_at(int &index, bool advance_index = true);
|
uint16_t read_uint16_bytes_at(int &index, bool advance_index = true);
|
||||||
uint32_t read_uint32_bytes_at(int &index, bool advance_index = true);
|
uint32_t read_uint32_bytes_at(int &index, bool advance_index = true);
|
||||||
uint64_t read_uint64_bytes_at(int &index, bool advance_index = true);
|
uint64_t read_uint64_bytes_at(int &index, bool advance_index = true);
|
||||||
|
--
|
||||||
int8_t read_int8_bytes_at(int &index, bool advance_index = true);
|
int8_t read_int8_bytes_at(int &index, bool advance_index = true);
|
||||||
int16_t read_int16_bytes_at(int &index, bool advance_index = true);
|
int16_t read_int16_bytes_at(int &index, bool advance_index = true);
|
||||||
int32_t read_int32_bytes_at(int &index, bool advance_index = true);
|
int32_t read_int32_bytes_at(int &index, bool advance_index = true);
|
||||||
int64_t read_int64_bytes_at(int &index, bool advance_index = true);
|
int64_t read_int64_bytes_at(int &index, bool advance_index = true);
|
||||||
|
--
|
||||||
void append_uint8_bytes(const uint8_t val);
|
void append_uint8_bytes(const uint8_t val);
|
||||||
void append_uint16_bytes(const uint16_t val);
|
void append_uint16_bytes(const uint16_t val);
|
||||||
void append_uint32_bytes(const uint32_t val);
|
void append_uint32_bytes(const uint32_t val);
|
||||||
void append_uint64_bytes(const uint64_t val);
|
void append_uint64_bytes(const uint64_t val);
|
||||||
|
--
|
||||||
void append_int8_bytes(const int8_t val);
|
void append_int8_bytes(const int8_t val);
|
||||||
void append_int16_bytes(const int16_t val);
|
void append_int16_bytes(const int16_t val);
|
||||||
void append_int32_bytes(const int32_t val);
|
void append_int32_bytes(const int32_t val);
|
||||||
void append_int64_bytes(const int64_t val);
|
void append_int64_bytes(const int64_t val);
|
||||||
|
--
|
||||||
float read_float_bytes_at(int &index, bool advance_index = true);
|
float read_float_bytes_at(int &index, bool advance_index = true);
|
||||||
void append_float_bytes(const float val);
|
void append_float_bytes(const float val);
|
||||||
double read_double_bytes_at(int &index, bool advance_index = true);
|
double read_double_bytes_at(int &index, bool advance_index = true);
|
||||||
void append_double_bytes(const double val);
|
void append_double_bytes(const double val);
|
||||||
|
--
|
||||||
void append_str(const char *str);
|
void append_str(const char *str);
|
||||||
void append_str(const wchar_t *str);
|
void append_str(const wchar_t *str);
|
||||||
void append_str(const String &other);
|
void append_str(const String &other);
|
||||||
void append_str(const std::string &str);
|
void append_str(const std::string &str);
|
||||||
void append_str(const String &other, const int from);
|
void append_str(const String &other, const int from);
|
||||||
void append_str(const std::string &str, const int from);
|
void append_str(const std::string &str, const int from);
|
||||||
|
--
|
||||||
void append_repeat(const char *str, const int times);
|
void append_repeat(const char *str, const int times);
|
||||||
void append_repeat(const String &other, const int times);
|
void append_repeat(const String &other, const int times);
|
||||||
|
--
|
||||||
void append_path(const char *path);
|
void append_path(const char *path);
|
||||||
void append_path(const String &path);
|
void append_path(const String &path);
|
||||||
void path_clean_end_slash();
|
void path_clean_end_slash();
|
||||||
@ -103,26 +103,26 @@ public:
|
|||||||
String path_get_last_segment() const;
|
String path_get_last_segment() const;
|
||||||
String path_get_prev_dir() const;
|
String path_get_prev_dir() const;
|
||||||
String file_get_extension() const;
|
String file_get_extension() const;
|
||||||
|
--
|
||||||
void to_html_special_chars();
|
void to_html_special_chars();
|
||||||
void from_html_special_chars();
|
void from_html_special_chars();
|
||||||
void newline_to_br();
|
void newline_to_br();
|
||||||
|
--
|
||||||
bool to_bool() const;
|
bool to_bool() const;
|
||||||
float to_float() const;
|
float to_float() const;
|
||||||
double to_double() const;
|
double to_double() const;
|
||||||
int to_int() const;
|
int to_int() const;
|
||||||
|
--
|
||||||
bool is_bool() const;
|
bool is_bool() const;
|
||||||
bool is_numeric() const;
|
bool is_numeric() const;
|
||||||
bool is_int() const;
|
bool is_int() const;
|
||||||
bool is_uint() const;
|
bool is_uint() const;
|
||||||
bool is_zero() const;
|
bool is_zero() const;
|
||||||
|
--
|
||||||
uint32_t to_uint() const;
|
uint32_t to_uint() const;
|
||||||
std::string to_string() const;
|
std::string to_string() const;
|
||||||
void print() const;
|
void print() const;
|
||||||
|
--
|
||||||
void append(const char *str);
|
void append(const char *str);
|
||||||
void append(const wchar_t *str);
|
void append(const wchar_t *str);
|
||||||
void append(const String &other);
|
void append(const String &other);
|
||||||
@ -134,82 +134,82 @@ public:
|
|||||||
void append(const float num);
|
void append(const float num);
|
||||||
void append(const double num);
|
void append(const double num);
|
||||||
void append(const Variant &variant);
|
void append(const Variant &variant);
|
||||||
|
--
|
||||||
static String bool_num(bool val);
|
static String bool_num(bool val);
|
||||||
static String bool_str(bool val);
|
static String bool_str(bool val);
|
||||||
|
--
|
||||||
static String num(double p_num, int p_decimals = -1);
|
static String num(double p_num, int p_decimals = -1);
|
||||||
static String num_scientific(double p_num);
|
static String num_scientific(double p_num);
|
||||||
static String num_real(double p_num, bool p_trailing = true);
|
static String num_real(double p_num, bool p_trailing = true);
|
||||||
static String num_int64(int64_t p_num, int base = 10, bool capitalize_hex = false);
|
static String num_int64(int64_t p_num, int base = 10, bool capitalize_hex = false);
|
||||||
static String num_uint64(uint64_t p_num, int base = 10, bool capitalize_hex = false);
|
static String num_uint64(uint64_t p_num, int base = 10, bool capitalize_hex = false);
|
||||||
static String chr(char32_t p_char);
|
static String chr(char32_t p_char);
|
||||||
|
--
|
||||||
String ascii(bool p_allow_extended = false) const;
|
String ascii(bool p_allow_extended = false) const;
|
||||||
String utf8() const;
|
String utf8() const;
|
||||||
bool parse_utf8(const char *p_utf8, int p_len = -1); // return true on error
|
bool parse_utf8(const char *p_utf8, int p_len = -1); // return true on error
|
||||||
static String utf8(const char *p_utf8, int p_len = -1);
|
static String utf8(const char *p_utf8, int p_len = -1);
|
||||||
|
--
|
||||||
static uint32_t hash(const wchar_t *p_cstr, int p_len); /* hash the string */
|
static uint32_t hash(const wchar_t *p_cstr, int p_len); /* hash the string */
|
||||||
static uint32_t hash(const wchar_t *p_cstr); /* hash the string */
|
static uint32_t hash(const wchar_t *p_cstr); /* hash the string */
|
||||||
static uint32_t hash(const char *p_cstr, int p_len); /* hash the string */
|
static uint32_t hash(const char *p_cstr, int p_len); /* hash the string */
|
||||||
static uint32_t hash(const char *p_cstr); /* hash the string */
|
static uint32_t hash(const char *p_cstr); /* hash the string */
|
||||||
uint32_t hash() const; /* hash the string */
|
uint32_t hash() const; /* hash the string */
|
||||||
uint64_t hash64() const; /* hash the string */
|
uint64_t hash64() const; /* hash the string */
|
||||||
|
--
|
||||||
char *c_str();
|
char *c_str();
|
||||||
const char *c_str() const;
|
const char *c_str() const;
|
||||||
|
--
|
||||||
char *dataw();
|
char *dataw();
|
||||||
const char *data() const;
|
const char *data() const;
|
||||||
|
--
|
||||||
const char operator[](const int index) const;
|
const char operator[](const int index) const;
|
||||||
char &operator[](const int index);
|
char &operator[](const int index);
|
||||||
|
--
|
||||||
String &operator+=(const String &b);
|
String &operator+=(const String &b);
|
||||||
String &operator+=(const char chr);
|
String &operator+=(const char chr);
|
||||||
String &operator+=(const char *p_c_str);
|
String &operator+=(const char *p_c_str);
|
||||||
String &operator+=(const std::string &b);
|
String &operator+=(const std::string &b);
|
||||||
|
--
|
||||||
friend String operator+(String lhs, const String &rhs);
|
friend String operator+(String lhs, const String &rhs);
|
||||||
friend String operator+(String lhs, const char *rhs);
|
friend String operator+(String lhs, const char *rhs);
|
||||||
friend String operator+(String lhs, const char rhs);
|
friend String operator+(String lhs, const char rhs);
|
||||||
friend String operator+(String lhs, const std::string &rhs);
|
friend String operator+(String lhs, const std::string &rhs);
|
||||||
|
--
|
||||||
friend bool operator==(const String &a, const String &b);
|
friend bool operator==(const String &a, const String &b);
|
||||||
friend bool operator!=(const String &a, const String &b);
|
friend bool operator!=(const String &a, const String &b);
|
||||||
|
--
|
||||||
friend bool operator==(const String &a, const char *b);
|
friend bool operator==(const String &a, const char *b);
|
||||||
friend bool operator!=(const String &a, const char *b);
|
friend bool operator!=(const String &a, const char *b);
|
||||||
|
--
|
||||||
friend bool operator==(const char *b, const String &a);
|
friend bool operator==(const char *b, const String &a);
|
||||||
friend bool operator!=(const char *b, const String &a);
|
friend bool operator!=(const char *b, const String &a);
|
||||||
|
--
|
||||||
friend bool operator==(const String &a, const wchar_t *b);
|
friend bool operator==(const String &a, const wchar_t *b);
|
||||||
friend bool operator!=(const String &a, const wchar_t *b);
|
friend bool operator!=(const String &a, const wchar_t *b);
|
||||||
|
--
|
||||||
friend bool operator==(const wchar_t *b, const String &a);
|
friend bool operator==(const wchar_t *b, const String &a);
|
||||||
friend bool operator!=(const wchar_t *b, const String &a);
|
friend bool operator!=(const wchar_t *b, const String &a);
|
||||||
|
--
|
||||||
friend bool operator==(const String &a, std::string &b);
|
friend bool operator==(const String &a, std::string &b);
|
||||||
friend bool operator!=(const String &a, std::string &b);
|
friend bool operator!=(const String &a, std::string &b);
|
||||||
|
--
|
||||||
friend bool operator==(std::string &b, const String &a);
|
friend bool operator==(std::string &b, const String &a);
|
||||||
friend bool operator!=(std::string &b, const String &a);
|
friend bool operator!=(std::string &b, const String &a);
|
||||||
|
--
|
||||||
friend bool operator<(const String &a, const String &b);
|
friend bool operator<(const String &a, const String &b);
|
||||||
friend bool operator>(const String &a, const String &b);
|
friend bool operator>(const String &a, const String &b);
|
||||||
friend bool operator<=(const String &a, const String &b);
|
friend bool operator<=(const String &a, const String &b);
|
||||||
friend bool operator>=(const String &a, const String &b);
|
friend bool operator>=(const String &a, const String &b);
|
||||||
|
--
|
||||||
operator std::string() { return to_string(); }
|
operator std::string() { return to_string(); }
|
||||||
operator std::string() const { return to_string(); }
|
operator std::string() const { return to_string(); }
|
||||||
|
--
|
||||||
String &operator=(const String &other);
|
String &operator=(const String &other);
|
||||||
String &operator=(const std::string &other);
|
String &operator=(const std::string &other);
|
||||||
String &operator=(const char *other);
|
String &operator=(const char *other);
|
||||||
String &operator=(const wchar_t *other);
|
String &operator=(const wchar_t *other);
|
||||||
|
--
|
||||||
String();
|
String();
|
||||||
String(const String &other);
|
String(const String &other);
|
||||||
String(const String &other, const int grow_by);
|
String(const String &other, const int grow_by);
|
||||||
@ -220,7 +220,7 @@ public:
|
|||||||
String(const int prealloc, const int grow_by);
|
String(const int prealloc, const int grow_by);
|
||||||
String(const std::string &str);
|
String(const std::string &str);
|
||||||
~String();
|
~String();
|
||||||
|
--
|
||||||
private:
|
private:
|
||||||
char *_data;
|
char *_data;
|
||||||
int _actual_size;
|
int _actual_size;
|
||||||
|
Loading…
Reference in New Issue
Block a user