Permalink
Browse files

Remove enum defined in system header.

Since the system header (getopt.h) define these identifiers as macros, it would cause a compiler error (incase the header was included, which it might be due to pre-compiled headers).
  • Loading branch information...
1 parent a516836 commit 4a903e02ae45f1924cbc91e983ae4bd77858eb2e @sorbits sorbits committed Jul 30, 2012
Showing with 5 additions and 4 deletions.
  1. +1 −1 OptionParser.h
  2. +4 −3 OptionParser.mm
View
@@ -9,7 +9,7 @@
struct option_t
{
std::string short_option, long_option;
- enum { no_argument, optional_argument, required_argument } argument;
+ int argument;
enum type_t { none, string, integer, plist } type;
char *description;
};
View
@@ -5,6 +5,7 @@
#import <map>
#import <string>
+#import <getopt.h>
#import "OptionParser.h"
#import "Dialog2.h"
@@ -183,10 +184,10 @@ id create_type (std::string const& str, option_t::type_t const& type, NSString**
{
NSString* key = [NSString stringWithUTF8String:it->second->long_option.c_str()];
- token_t const& val = tokenizer.get(it->second->argument != option_t::no_argument);
+ token_t const& val = tokenizer.get(it->second->argument != no_argument);
if(val.type == token_t::value)
{
- if(it->second->argument != option_t::no_argument)
+ if(it->second->argument != no_argument)
{
NSString* err = nil;
if(id value = create_type(val.word, it->second->type, &err))
@@ -195,7 +196,7 @@ id create_type (std::string const& str, option_t::type_t const& type, NSString**
}
else asprintf(&error, "no argument allowed after %s, found %s", t.word.c_str(), val.word.c_str());
}
- else if(it->second->argument == option_t::required_argument)
+ else if(it->second->argument == required_argument)
{
asprintf(&error, "required argument for option %s is missing", t.word.c_str());
}

0 comments on commit 4a903e0

Please sign in to comment.