A collection of Naming Utility methods.
More...
#include <NamingUtilities.h>
A collection of Naming Utility methods.
Definition at line 36 of file NamingUtilities.h.
◆ NamingUtilities() [1/2]
| Amino::NamingUtilities::NamingUtilities |
( |
| ) |
|
|
delete |
◆ NamingUtilities() [2/2]
◆ getLegalName()
| static bool Amino::NamingUtilities::getLegalName |
( |
StringView const & |
name, |
|
|
String & |
legalName |
|
) |
| |
|
static |
Convert a string to a legal name by removing invalid characters. See legalize for conversion details.
- Parameters
-
| [in] | name | The name to legalize |
| [out] | legalName | The output legalized name |
- Returns
- Returns true if the legalized name is different than the original name, false otherwise.
◆ isLegalName()
| static bool Amino::NamingUtilities::isLegalName |
( |
StringView const & |
name | ) |
|
|
static |
Check if a name is legal.
This method will check if a name requires clean up using the rules listed in getLegalName.
- Parameters
-
| [in] | name | The name to check |
- Returns
- Returns true if the name is legal, false otherwise
◆ legalize()
| static bool Amino::NamingUtilities::legalize |
( |
String & |
name | ) |
|
|
static |
Convert a string to a legal name by removing invalid characters.
This method will clean up any illegal characters from a name to make it usable by external packages and also by the compiler back-end. The cleaning rules are:
- Valid characters are a-z A-Z 0-9 _ (excluding spaces).
- If the input name is empty (which is not a legal name), the output name is a single underscore (i.e. "" becomes "_").
- Invalid characters at the start of the name are dropped: "+++abc" becomes "abc".
- If the first valid character is a digit then an underscore is inserted as the leading character: "012" becomes "_012".
- Invalid characters in the rest of the name are replaced with underscore.
- Leading underscores and illegal characters are removed leaving one underscore. If the leading underscore that is left after the removal is followed by A-Z then this character is changed to lower case: "___ABC" becomes "_aBC".
- Parameters
-
| [in,out] | name | The name to legalize |
- Returns
- Returns true if the legalized name is different than the original name, false otherwise.
◆ operator=()