Use std::map/set instead of C arrays

These types come with a find() method and avoids having to use helper functions to get the begin/end of the array (for linear search).
This commit is contained in:
Allan Odgaard
2012-09-20 01:22:10 +02:00
parent a9ba549cda
commit ebab500ba3
18 changed files with 78 additions and 88 deletions

View File

@@ -362,8 +362,8 @@ OAK_DEBUG_VAR(HTMLOutput_JSShellCommand);
+ (BOOL)isKeyExcludedFromWebScript:(char const*)name
{
D(DBF_HTMLOutput_JSShellCommand, bug("%s\n", name););
static std::string const PublicProperties[] = { "outputString", "errorString", "onreadoutput", "onreaderror" };
return !oak::contains(beginof(PublicProperties), endof(PublicProperties), name);
static std::set<std::string> const PublicProperties = { "outputString", "errorString", "onreadoutput", "onreaderror" };
return PublicProperties.find(name) == PublicProperties.end();
}
+ (NSString*)webScriptNameForKey:(char const*)name
@@ -374,8 +374,8 @@ OAK_DEBUG_VAR(HTMLOutput_JSShellCommand);
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
{
D(DBF_HTMLOutput_JSShellCommand, bug("%s\n", (char const*)aSelector););
static std::string const PublicMethods[] = { "cancelCommand", "writeToInput:", "closeInput" };
return !oak::contains(beginof(PublicMethods), endof(PublicMethods), (char const*)aSelector);
static std::set<SEL> const PublicMethods = { @selector(cancelCommand), @selector(writeToInput:), @selector(closeInput) };
return PublicMethods.find(aSelector) == PublicMethods.end();
}
+ (NSString*)webScriptNameForSelector:(SEL)aSelector