diff options
Diffstat (limited to 'core/string/ustring.h')
-rw-r--r-- | core/string/ustring.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/string/ustring.h b/core/string/ustring.h index 0fb72fccd2..fa904c8200 100644 --- a/core/string/ustring.h +++ b/core/string/ustring.h @@ -265,6 +265,9 @@ public: signed char nocasecmp_to(const String &p_str) const; signed char naturalcasecmp_to(const String &p_str) const; signed char naturalnocasecmp_to(const String &p_str) const; + // Special sorting for file names. Names starting with `_` are put before all others except those starting with `.`, otherwise natural comparison is used. + signed char filecasecmp_to(const String &p_str) const; + signed char filenocasecmp_to(const String &p_str) const; const char32_t *get_data() const; /* standard size stuff */ @@ -499,6 +502,12 @@ struct NaturalNoCaseComparator { } }; +struct FileNoCaseComparator { + bool operator()(const String &p_a, const String &p_b) const { + return p_a.filenocasecmp_to(p_b) < 0; + } +}; + template <typename L, typename R> _FORCE_INLINE_ bool is_str_less(const L *l_ptr, const R *r_ptr) { while (true) { |