Use underscores instead of spaces for all internal names. And renamed some script functions at the same time.

* cannocial_name_form now outputs "_", where it used to use " "
* this simplifies reflectio and scripting code, because now C++ names are also MSE internal names
* added 'caption' property to fields. This is used instead of the name in NativeLookEditor, since the latter will now contain underscores.
* renamed text related script functions for consistency, since we were touching that part of the code anyway.
This commit is contained in:
Twan van Laarhoven
2020-04-22 23:33:06 +02:00
parent be4bb8d8ed
commit 713a9e4a40
33 changed files with 240 additions and 197 deletions
+10 -4
View File
@@ -160,11 +160,14 @@ String capitalize(const String&);
String capitalize_sentence(const String&);
/// Convert a field name to canonical form
/** - lower case and ' ' instead of '_'.
* - non alphanumeric characters are droped
* - "camalCase" is converted to words "camel case" (TODO)
/** - converts ' ' to '_'
*/
String canonical_name_form(const String&);
/// Undo canonical_name_form: replace '_' by ' '
String uncanonical_name_form(const String&);
/// Convert a field name to a string that can be shown to the user
String name_to_caption(const String&);
/// Returns the singular form of a string
/** Used for reflection, for example "vector<T> apples" is written with keys
@@ -209,7 +212,10 @@ bool is_substr_i(const String& str, size_t pos, const String& cmp);
/// Case insensitive string search, returns String::npos if not found
size_t find_i(const String& heystack, const String& needle);
/// Compare two strings for equality, b may contain '_' where a contains ' '
/// Compare two strings for equality, a may contain '_' where b contains ' '
/** canoncial_name_compare(a,b) == (cannocial_name_form(a) == b)
* b should already be in cannonical name form
*/
bool canonical_name_compare(const String& a, const Char* b);
// ----------------------------------------------------------------------------- : Regular expressions