#include <IdentifierUtil.h>
Public Types | |
enum | Match { equalMatch, equivalentMatch, noMatch } |
Static Public Member Functions | |
static Match | compare (const char *n1, const char *n2) |
static void | checkInvalid (const char *name) |
Generates a BAD_PARAM exception if name is not a valid IDL identifier. |
Definition at line 45 of file IdentifierUtil.h.
|
Definition at line 49 of file IdentifierUtil.h. 00049 { 00050 equalMatch, 00051 equivalentMatch, 00052 noMatch 00053 };
|
|
Generates a BAD_PARAM exception if name is not a valid IDL identifier. Valid identifiers match this Regex: [a-zA-Z][_a-zA-Z0-9]* Definition at line 70 of file IdentifierUtil.h. References IFELSE_OMNIORB4. 00071 { 00072 // Should not be testing NULL pointers. 00073 assert(name); 00074 00075 bool valid =bool( name[0] ); // string not empty 00076 00077 if(valid) 00078 { 00079 for(int i=0; name[i]; ++i) 00080 { 00081 char c =tolower(name[i]); 00082 if( ('a'<=c && c<='z') || 00083 (i>0 && 00084 ( ('0'<=c && c<='9') || 00085 c=='_' 00086 ) ) ) 00087 { 00088 continue; // still valid 00089 } 00090 valid=false; 00091 break; 00092 } 00093 } 00094 00095 if(!valid) 00096 { 00097 throw CORBA::BAD_PARAM( 00098 IFELSE_OMNIORB4(omni::BAD_PARAM_InvalidName,15), 00099 CORBA::COMPLETED_NO 00100 ); 00101 } 00102 }
|
|
Definition at line 55 of file IdentifierUtil.h. References equalMatch, equivalentMatch, and noMatch. 00056 { 00057 if(!n1 || !n2) 00058 return noMatch; 00059 else if(0==strcmp(n1,n2)) 00060 return equalMatch; 00061 else if(0==strcasecmp(n1,n2)) 00062 return equivalentMatch; 00063 else 00064 return noMatch; 00065 }
|