Package org.eclipse.cdt.core
Class CConventions
java.lang.Object
org.eclipse.cdt.core.CConventions
- Restriction:
- This interface is not intended to be extended by clients.
- Restriction:
- This class is not intended to be instantiated by clients.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isLegalIdentifier
(String name) static boolean
isValidIdentifier
(String name) static org.eclipse.core.runtime.IStatus
validateClassName
(String name) Validate the given CPP class name, either simple or qualified.static org.eclipse.core.runtime.IStatus
validateEnumName
(String name) Validate the given C++ enum name, either simple or qualified.static org.eclipse.core.runtime.IStatus
validateFieldName
(String name) Validate the given field name.static org.eclipse.core.runtime.IStatus
validateFileName
(String name) Validate the given file name.static org.eclipse.core.runtime.IStatus
validateHeaderFileName
(org.eclipse.core.resources.IProject project, String name) Validate the given header file name.static org.eclipse.core.runtime.IStatus
Deprecated.Notice that the identifier is not being checked against language keywords.static org.eclipse.core.runtime.IStatus
validateIdentifier
(String id, AbstractCLikeLanguage language) Validate the given C or C++ identifier.static org.eclipse.core.runtime.IStatus
validateIncludeName
(org.eclipse.core.resources.IProject project, String name) Validate the given include name.static org.eclipse.core.runtime.IStatus
validateMethodName
(String name) Validate the given method name.static org.eclipse.core.runtime.IStatus
validateNamespaceName
(String name) Validate the given CPP namespace name, either simple or qualified.static org.eclipse.core.runtime.IStatus
validateScopeName
(String name) Validate the given scope name.static org.eclipse.core.runtime.IStatus
validateSourceFileName
(org.eclipse.core.resources.IProject project, String name) Validate the given source file name.
-
Constructor Details
-
CConventions
public CConventions()
-
-
Method Details
-
isLegalIdentifier
-
validateClassName
Validate the given CPP class name, either simple or qualified. For example,"A::B::C"
, or"C"
.- Parameters:
name
- the name of a class- Returns:
- a status object with code
IStatus.OK
if the given name is valid as a CPP class name, a status with codeIStatus.WARNING
indicating why the given name is discouraged, otherwise a status object indicating what is wrong with the name
-
validateNamespaceName
Validate the given CPP namespace name, either simple or qualified. For example,"A::B::C"
, or"C"
.- Parameters:
name
- the name of a namespace- Returns:
- a status object with code
IStatus.OK
if the given name is valid as a CPP class name, a status with codeIStatus.WARNING
indicating why the given name is discouraged, otherwise a status object indicating what is wrong with the name
-
validateScopeName
Validate the given scope name.- Returns:
- a status object with code
IStatus.OK
if the given name is valid as a class name, otherwise a status object indicating what is wrong with the name
-
validateFieldName
Validate the given field name.Syntax of a field name corresponds to VariableDeclaratorId (JLS2 8.3). For example,
"x"
.- Parameters:
name
- the name of a field- Returns:
- a status object with code
IStatus.OK
if the given name is valid as a field name, otherwise a status object indicating what is wrong with the name
-
validateIdentifier
Deprecated.Notice that the identifier is not being checked against language keywords. Use validateIdentifier(String id, AbstractCLikeLanguage language) instead.Validate the given identifier. A valid identifier can act as a simple type name, method name or field name.- Parameters:
id
- the C identifier- Returns:
- a status object with code
IStatus.OK
if the given identifier is a valid C identifier, otherwise a status object indicating what is wrong with the identifier
-
validateIdentifier
public static org.eclipse.core.runtime.IStatus validateIdentifier(String id, AbstractCLikeLanguage language) Validate the given C or C++ identifier. The identifier must not have the same spelling as a C or C++ keyword. A valid identifier can act as a simple type name, method name or field name.- Parameters:
id
- the C identifier- Returns:
- a status object with code
IStatus.OK
if the given identifier is a valid C identifier, otherwise a status object indicating what is wrong with the identifier - Since:
- 5.3
-
validateMethodName
Validate the given method name. The special names "<init>" and "<clinit>" are not valid.The syntax for a method name is defined by Identifier of MethodDeclarator (JLS2 8.4). For example "println".
- Parameters:
name
- the name of a method- Returns:
- a status object with code
IStatus.OK
if the given name is valid as a method name, otherwise a status object indicating what is wrong with the name
-
validateIncludeName
public static org.eclipse.core.runtime.IStatus validateIncludeName(org.eclipse.core.resources.IProject project, String name) Validate the given include name.The name of an include without the surrounding double quotes or brackets For example,
stdio.h
oriostream
.- Parameters:
name
- the include declaration- Returns:
- a status object with code
IStatus.OK
if the given name is valid as an include name, otherwise a status object indicating what is wrong with the name
-
isValidIdentifier
-
validateFileName
Validate the given file name. The name must be the short file name (including the extension). It should not contain any prefix or path delimiters.- Parameters:
name
- the file name- Returns:
- a status object with code
IStatus.OK
if the given name is valid as a C/C++ file name, a status with codeIStatus.WARNING
indicating why the given name is discouraged, otherwise a status object indicating what is wrong with the name
-
validateHeaderFileName
public static org.eclipse.core.runtime.IStatus validateHeaderFileName(org.eclipse.core.resources.IProject project, String name) Validate the given header file name. The name must be the short file name (including the extension). It should not contain any prefix or path delimiters.- Parameters:
name
- the header file name- Returns:
- a status object with code
IStatus.OK
if the given name is valid as a C/C++ header file name, a status with codeIStatus.WARNING
indicating why the given name is discouraged, otherwise a status object indicating what is wrong with the name
-
validateSourceFileName
public static org.eclipse.core.runtime.IStatus validateSourceFileName(org.eclipse.core.resources.IProject project, String name) Validate the given source file name. The name must be the short file name (including the extension). It should not contain any prefix or path delimiters.- Parameters:
name
- the source file name- Returns:
- a status object with code
IStatus.OK
if the given name is valid as a C/C++ source file name, a status with codeIStatus.WARNING
indicating why the given name is discouraged, otherwise a status object indicating what is wrong with the name
-
validateEnumName
Validate the given C++ enum name, either simple or qualified. For example,"A::B::C"
, or"C"
.- Parameters:
name
- the name of a enum- Returns:
- a status object with code
IStatus.OK
if the given name is valid as a CPP enum name, a status with codeIStatus.WARNING
indicating why the given name is discouraged, otherwise a status object indicating what is wrong with the name - Since:
- 4.0
-