Package ghidra.util
Class NamingUtilities
java.lang.Object
ghidra.util.NamingUtilities
Utility class with static methods for validating project file names.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Performs the inverse of the mangle method.static char
findInvalidChar
(String name) Deprecated.this method may be removed in a subsequent release due to limited use and applicability (project names and project file names have different naming restrictions).static boolean
isValidMangledName
(String name) Performs a validity check on a mangled namestatic boolean
isValidName
(String name) Deprecated.method has been deprecated due to improper and widespread use.static boolean
isValidProjectName
(String name) Tests whether the given string is a valid project name.static String
Returns a string such that all uppercase characters in the given string are replaced by the MANGLE_CHAR followed by the lowercase version of the character.
-
Field Details
-
MAX_NAME_LENGTH
public static final int MAX_NAME_LENGTHMax length for a name.- See Also:
-
-
Method Details
-
isValidName
Deprecated.method has been deprecated due to improper and widespread use. New methods includeisValidProjectName(String)
andLocalFileSystem.testValidName(String,boolean)
.Tests whether the given string is a valid. Rules:- All characters must be a letter, digit (0..9), period, hyphen, underscore or space
- May not exceed a length of 60 characters
- Parameters:
name
- name to validate- Returns:
- true if specified name is valid, else false
-
isValidProjectName
Tests whether the given string is a valid project name. Rules:- Name may not start with period
- All characters must be a letter, digit (0..9), period, hyphen, underscore or space
- May not exceed a length of 60 characters
- Parameters:
name
- name to validate- Returns:
- true if specified name is valid, else false
-
findInvalidChar
Deprecated.this method may be removed in a subsequent release due to limited use and applicability (project names and project file names have different naming restrictions).Find the invalid character in the given name.This method should only be used with
isValidName(String)
} and notisValidProjectName(String)
- Parameters:
name
- the name with an invalid character- Returns:
- the invalid character or 0 if no invalid character can be found
- See Also:
-
mangle
Returns a string such that all uppercase characters in the given string are replaced by the MANGLE_CHAR followed by the lowercase version of the character. MANGLE_CHARs are replaced by 2 MANGLE_CHARs. This method is to get around the STUPID windows problem where filenames are not case sensitive. Under Windows, Foo.exe and foo.exe represent the same filename. To fix this we mangle names first such that Foo.exe becomes _foo.exe.- Parameters:
name
- name string to be mangled- Returns:
- mangled name
-
demangle
Performs the inverse of the mangle method. A string is returned such that all characters following a MANGLE_CHAR are converted to uppercase. Two MANGLE chars in a row are replace by a single MANGLE_CHAR.- Parameters:
mangledName
- mangled name string- Returns:
- demangle name
-
isValidMangledName
Performs a validity check on a mangled name- Parameters:
name
- mangled name- Returns:
- true if name can be demangled else false
-