5 #ifndef ICE_UTIL_OPTIONS_H
6 #define ICE_UTIL_OPTIONS_H
17 namespace IceUtilInternal
24 APIException(
const char*,
int, const ::std::string&);
25 #ifndef ICE_CPP11_COMPILER
26 virtual ~APIException() throw();
28 virtual ::std::string ice_id()
const;
29 virtual void ice_print(std::ostream&)
const;
30 #ifndef ICE_CPP11_MAPPING
31 virtual APIException* ice_clone()
const;
37 ICE_API ::std::ostream&
operator<<(::std::ostream&,
const APIException&);
43 BadOptException(
const char*,
int, const ::std::string&);
44 #ifndef ICE_CPP11_COMPILER
45 virtual ~BadOptException() throw();
47 virtual ::std::string ice_id()
const;
48 virtual void ice_print(std::ostream&)
const;
50 #ifndef ICE_CPP11_MAPPING
51 virtual BadOptException* ice_clone()
const;
57 ICE_API ::std::ostream&
operator<<(::std::ostream&,
const BadOptException&);
63 enum LengthType { ShortOpt, LongOpt };
64 enum RepeatType { Repeat, NoRepeat };
65 enum ArgType { NeedArg, NoArg };
68 void addOpt(const ::std::string&, const ::std::string& =
"",
69 ArgType = NoArg, ::std::string =
"", RepeatType = NoRepeat);
71 typedef ::std::vector< ::std::string> StringVector;
73 static StringVector split(const ::std::string&);
74 StringVector parse(
const StringVector&);
75 StringVector parse(
int,
const char*
const []);
76 bool isSet(const ::std::string&)
const;
77 ::std::string optArg(const ::std::string&)
const;
78 StringVector argVec(const ::std::string&)
const;
99 ::std::vector< ::std::string> vals;
103 typedef ::std::map< ::std::string, ODPtr> ValidOpts;
104 typedef ::std::map< ::std::string, OValPtr> Opts;
105 typedef ::std::map< ::std::string, OVecPtr> ROpts;
106 typedef ::std::map< ::std::string, ::std::string> Synonyms;
108 void addValidOpt(const ::std::string&, const ::std::string&, ArgType, const ::std::string&, RepeatType);
109 ValidOpts::iterator checkOpt(const ::std::string&, LengthType);
110 void setOpt(const ::std::string&, const ::std::string&, const ::std::string&, RepeatType);
111 void setNonRepeatingOpt(const ::std::string&, const ::std::string&);
112 void setRepeatingOpt(const ::std::string&, const ::std::string&);
113 ValidOpts::const_iterator checkOptIsValid(const ::std::string&)
const;
114 ValidOpts::const_iterator checkOptHasArg(const ::std::string&)
const;
115 void updateSynonyms(const ::std::string&, const ::std::string&);
116 ::std::string getSynonym(const ::std::string&)
const;
118 ValidOpts _validOpts;
127 Options(
const Options&);
128 void operator=(
const Options&);
130 static void checkArgs(const ::std::string&, const ::std::string&,
bool, const ::std::string&);