1 martin 1.48 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.49 //
|
3 martin 1.48 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.49 //
|
10 martin 1.48 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.49 //
|
17 martin 1.48 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.49 //
|
20 martin 1.48 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.49 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.48 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.49 //
|
28 martin 1.48 //////////////////////////////////////////////////////////////////////////
|
29 alagaraja 1.41 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 //////////////////////////////////////////////////////////////////////////////
|
33 david.dillard 1.44 //
34 // This file defines the classes necessary to manage commandline and
35 // configuration file options for Pegasus. It defines
|
36 alagaraja 1.41 // The OptionManager Class
37 // The Option Class - Used to define information about an option
|
38 david.dillard 1.44 // The Option Row structure - Used to define option declarations in a
|
39 kumpf 1.47 // program
|
40 alagaraja 1.41 // The optionexcptions Class
41 //
42 //////////////////////////////////////////////////////////////////////////////
43
44 #ifndef Pegasus_OptionManager_h
45 #define Pegasus_OptionManager_h
46
47 #include <Pegasus/Common/Config.h>
48 #include <Pegasus/Common/String.h>
49 #include <Pegasus/Common/ArrayInternal.h>
50 #include <Pegasus/Common/InternalException.h>
51 #include <Pegasus/Common/Linkage.h>
52 #include <Pegasus/Common/MessageLoader.h>
53
54 PEGASUS_NAMESPACE_BEGIN
55
56 class Option;
57 struct OptionRow;
|
58 kavita.gupta 1.50 struct OptionRowWithMsg;
|
59 alagaraja 1.41
60 typedef Option* OptionPtr;
61
62 // REVIEW: I seem to remember seeing another class that does something like
63 // REVIEW: this.
64
65 /** The OptionManager class manages a collection of program options.
66
67 <h4>Overview</h4>
68
69 A program option may be specified in two ways:
70
71 <ul>
|
72 kumpf 1.47 <li>In a configuration file</li>
73 <li>On the command line</li>
|
74 alagaraja 1.41 </ul>
75
76 This class provides methods for merging options from both of these
77 sources into a single collection. The following example shows how to
78 merge options from a command line into the option manager.
79
80 <pre>
|
81 kumpf 1.47 int main(int argc, char** argv)
82 {
83 OptionManager om;
|
84 alagaraja 1.41
|
85 kumpf 1.47 ...
|
86 alagaraja 1.41
|
87 kumpf 1.47 // Merge options from the command line into the option manager's
88 // option list. Remove arguments from command line.
|
89 alagaraja 1.41
|
90 kumpf 1.47 om.mergeCommandLine(argc, argv);
|
91 alagaraja 1.41
|
92 kumpf 1.47 ...
93 }
|
94 alagaraja 1.41 </pre>
95
96 Similarly, the OptionManager::mergeFile() method allows options to be
97 merged from a file.
98
99 Before options are merged into the option manager, information on each
100 option must be registered with the option manager so that the following
101 can be resolved:
102
103 <ul>
|
104 kumpf 1.47 <li>The option's name</li>
105 <li>The default value (to be used if not specified elsewhere)</li>
106 <li>Whether the option is required</li>
107 <li>The option's type (e.g., boolean, integer or string)</li>
108 <li>The domain of the option if any (set of legal values)</li>
109 <li>The name the option as it appears on the command line</li>
|
110 alagaraja 1.41 </ul>
111
112 Here is how to regsiter an option:
113
114 <pre>
|
115 kumpf 1.47 OptionManager om;
|
116 alagaraja 1.41
|
117 kumpf 1.47 Option* option = new Option("port", "80", false,
118 Option::NATURAL_NUMBER, Array<String>(), "p");
|
119 alagaraja 1.41
|
120 kumpf 1.47 om.registerOption(option);
|
121 alagaraja 1.41 </pre>
122
123 The arguments of the Option constructor are the same (and in the same
124 order) as the list just above. Notice the last argument is "p". This
125 is the name of the option argument on the command line (it would appear
126 as "-p" on the command line).
127
128 Once options have been registered, the option values may be initialized
129 using the merge methods described earlier. During merging, certain
130 validation is done using the corresponding Option instance described above.
131
132 Once options have been merged, they may obtained by calling the
133 lookupOption() method like this:
134
135 <pre>
|
136 kumpf 1.47 Option* option = om.lookupOption("port");
137 String port = option->getValue();
|
138 alagaraja 1.41 </pre>
139
140 Or the lookupValue() convenience function may be used to lookup values:
141
142 <pre>
|
143 kumpf 1.47 String value;
144 om.lookupValue("port", value);
|
145 alagaraja 1.41 </pre>
|
146 david.dillard 1.44
|
147 alagaraja 1.41 Boolean Options can easily be tested as follows:
148 <pre>
|
149 david.dillard 1.44
|
150 alagaraja 1.41 </pre>
151
152 <h4>Command Line Options</h4>
153
154 mergeCommandLine() like this:
155
156 <pre>
|
157 kumpf 1.47 om.mergeCommandLine(argc, argv);
|
158 alagaraja 1.41 </pre>
159
160 This method searches the command line for options that match the registered
161 ones. It will extract those options from the command line (argc and argv
162 will be modified accordingly).
163
164 <h4>Configuration File Otpions</h4>
165
166 Options from a configuration file may be merged by calling the mergeFile()
167 method like this:
168
169 <pre>
|
170 kumpf 1.47 om.mergeFile(fileName);
|
171 alagaraja 1.41 </pre>
172
173 This searches the file for options matching registered ones. Exceptions
174 are thrown for any unrecognized option names that are encountered.
175
176 <h4>Merge Validation</h4>
177
178 During merging, the option manager validates the following (using the
179 information optatined during option registration).
180
181 <ul>
|
182 kumpf 1.47 <li>The type of the option - whether integer, positive integer,
183 or string or whatever.</li>
184 <li>The domain of the option - whether the supplied option is a legal
185 value for that otpion</li>
186 <li>User extended validation - whether the user overriden
187 Option::isValid() returns true when the value is passed to it</li>
|
188 alagaraja 1.41 </ul>
189
190 <h4>Typcial Usage</h4>
191
192 The OptionManager is typically used in the following way. First, options
193 are registered to establish the valid set of options. Next, values are
194 merged from the various sources by calling the merge functions. Finally,
195 checkRequiredOptions() is called to see if any required option values were
196 not provided.
|
197 david.dillard 1.44
|
198 alagaraja 1.41 <h4>Option Types</h4>
|
199 david.dillard 1.44
|
200 alagaraja 1.41 The option manager allows for several types of options including:
201 <UL>
|
202 kumpf 1.47 <LI> (BOOLEAN)Simple keyword parameters (ex. -t or -h on the command
203 line). These are Boolean parameters and there are no additional
204 parameters after the keyword.
205
206 <LI> (INTEGER) Numeric parameters - (ex -port 5988). These are
207 parameters where a numeric variable follows the parameter defintion.
208
209 <LI>(WHOLE_NUMBER) Numeric parameters ATTN: Finish.
210
211 <LI> (NATURAL_NUMBER Numieric parameters - (ex ). ATTN: finish
212
213 <LI>(STRING) String Parameters - (ex. -file abd.log) These are
214 parameters that are represented by strings following the option
215 keyword. No limitations are placed on the string except that it must
216 be resolvable to a single string.
217
218 <LI> (STRING) Domain Parameters - These are parameters where there is
219 a choice of keywords from a domain of keywords. The input parameter
220 may be any one of these keywords. Thus, the domain (red blue green)
221 for the parameter "color" (-c) could be entered as -c red. The
222 difference between String interpretation and domain interpretation
223 kumpf 1.47 is the use of the domain fields in the option definition.
224
225 <LI> Mask parameters - These are parameters that define an internal
226 bit mask from a set of keywords input.
227 ATTN: Finish this definition.
|
228 alagaraja 1.41 </UL>
229 */
230
231 class PEGASUS_COMMON_LINKAGE OptionManager
232 {
233 public:
234
235 /** Constructor. */
236 OptionManager();
237
238 /** Destructor. Deletes all contained Options. */
239 ~OptionManager();
240
241 /** Registers an option. The OptionManager is responsible for disposing
|
242 kumpf 1.47 of the option; the caller must not delete this object.
|
243 alagaraja 1.41
|
244 kumpf 1.47 @param option option to be registerd.
245 @exception NullPointer exception if option argument is null.
246 @exception OMDuplicateOption if option already defined.
|
247 alagaraja 1.41 */
|
248 david.dillard 1.44 void registerOption(Option* option);
|
249 alagaraja 1.41
250 /** Provides a simple way to register several options at once using
|
251 kumpf 1.47 a declartive style table. This may also be done programmitically
252 by repeatedly calling registerOption above. See documentation for
253 OptionRow for details on how to use them.
|
254 alagaraja 1.41 */
|
255 david.dillard 1.44 void registerOptions(OptionRow* options, Uint32 numOptions);
|
256 alagaraja 1.41
|
257 kavita.gupta 1.50 /**
|
258 kumpf 1.51 Provides a simple way to register several options at once along
259 with their corresponding message keys
|
260 kavita.gupta 1.50 */
261 void registerOptions(OptionRowWithMsg* options, Uint32 numOptions);
262
|
263 alagaraja 1.41 /** Merge option values from the command line. Searches the command
|
264 kumpf 1.47 line for registered options whose names are given by the
265 Option::getCommandLineOptionName() method. Validation is performed
266 on each option value obtained by calling Option::isValid(). Valid
267 option values are set by calling Option::setValue(). The argc and
268 argv arguments are modified: the option and its argument are
269 stripped from the command line. The option and its argument have the
270 following form: -option-name argument. A space must be supplied
271 between the two. Boolean option arguments are an exception. They
272 must have the form -option. If they are present, then they are
273 taken to be true.
274
275 @param argc number of argument on the command line.
276 @param argv list of command line arguments.
277 @param abortOnErr - Optional Boolean that if true causes exception
278 if there is a parameter found that is not in the table. Defaults to
279 true
280 @exception InvalidOptionValue if validation fails.
281 @exception OMMissingCommandLineOptionArgument
|
282 alagaraja 1.41 */
283 void mergeCommandLine(int& argc, char**& argv, Boolean abortOnErr=true);
284
285 /** Merge option values from a file. Searches file for registered options
|
286 kumpf 1.47 whose names are given by the options which have been registered.
287 Validation is performed on each option value by calling
288 Option::isValid(). Valid option values are set by calling
289 Option::setValue().
290
291 @param fileName name of file to be merged.
292 @exception NoSuchFile if file cannot be opened.
293 @exception BadConfigFileOption
|
294 alagaraja 1.41 */
295 void mergeFile(const String& fileName);
296
297 /** After merging, this method is called to check for required options
|
298 kumpf 1.47 that were not merged (specified).
|
299 alagaraja 1.41
|
300 kumpf 1.47 @exception OMMissingRequiredRequiredOption
|
301 alagaraja 1.41 */
302 void checkRequiredOptions() const;
303
304 /** Lookup the option with the given name.
|
305 kumpf 1.47 @param Name provides the name of the option.
306 @return 0 if no such option.
|
307 alagaraja 1.41 */
308 const Option* lookupOption(const String& name) const;
309
310 /** Lookup value of an option.
|
311 kumpf 1.47 @param Name provides the name of the option (ex. "port")
312 @param String parameter contains the String that contains the
313 value for this parameter (in String format).
314 @return Boolean return. True if the option found.
|
315 alagaraja 1.41 */
316 Boolean lookupValue(const String& name, String& value ) const;
317
318 /** LookupIntegerValue value of an option determines if the value exists
|
319 kumpf 1.47 and converts it to integer (Uint32).
320 @param Name provides the name of the option (ex. "port")
321 @param String parameter contains the String that contains the
322 value for this parameter (in String format).
323 @return Boolean return. True if the option found.
|
324 alagaraja 1.41 */
325 Boolean lookupIntegerValue(const String& name, Uint32& value) const;
326
327
|
328 kumpf 1.47 /** isStringInOptionMask - Looks for a String value in an option.
329 This function is used to detect particular options listed in strings of
330 entries forming a STRING option. Thus, for example if the option string
331 were "abc,def,ijk" in option toy isStringInOption ("toy", "def") returns
332 true.
333 @param option name of the option in the option table
334 @param entry Entry to compare
335 @return True if the entry String is found in the option.
|
336 alagaraja 1.41 */
337 //Uint32 isStringInOptionMask (const String& option, String& entry) const;
338
339 /** optionValueEquals - Test the string value of an option.
|
340 kumpf 1.47 @param name provides the name of the option (ex. "port")
341 @param value String value for comparison.
342 @return true if the option exists and the value of the option
343 equals the input parameter value.
|
344 alagaraja 1.41 */
345 Boolean valueEquals(const String& name, const String& value) const;
346
347 /** isTrue - determines if a Boolean Option is true or false. Note
348 that this function simply tests the value for "true" string.
349 @param name - the name of the opeiton
350 @return - Returns true if the option value is true.
351 */
352 Boolean isTrue(const String& name) const;
353
354 /** Print all the options. */
355 void print() const;
356
357 /** Print the help line for all options including cmdline name, name
358 and the help string
359 */
360 void printOptionsHelp() const;
361
|
362 kumpf 1.47 /** Print Complete Help Text message including header before the options
363 help and trailer after the options help
|
364 alagaraja 1.41 */
|
365 kavita.gupta 1.50 void printOptionsHelpTxt(
|
366 kumpf 1.51 const String& header,
367 const String& trailer) const;
|
368 alagaraja 1.41
|
369 kavita.gupta 1.50 void setMessagePath(String messagePath);
|
370 alagaraja 1.41
371 private:
372
373 /** Lookup the option by its commandLineOptionName.
|
374 kumpf 1.47 @return 0 if no such option.
|
375 alagaraja 1.41 */
376 Option* _lookupOptionByCommandLineOptionName(const String& name);
377
378 Array<Option*> _options;
|
379 kumpf 1.51
|
380 kavita.gupta 1.50 String _msgPath;
|
381 alagaraja 1.41 };
382
383 //////////////////////////////////////////////////////////////////
384 // OPTION CLASS
385 //////////////////////////////////////////////////////////////////
386
387 /** The Option class is used to specify information about an Option.
388
389 See the OptionManager class for more details.
390 */
391 class PEGASUS_COMMON_LINKAGE Option
392 {
393 public:
394
395 /** Valid value types. */
396 enum Type
397 {
|
398 kumpf 1.47 // (..., -3, -2, -1, 0, 1, 2, 3, ...)
399 INTEGER,
|
400 alagaraja 1.41
|
401 kumpf 1.47 // (1, 2, 3, ...)
402 NATURAL_NUMBER,
|
403 alagaraja 1.41
|
404 kumpf 1.47 // (0, 1, 2, 3, ...)
405 WHOLE_NUMBER,
|
406 alagaraja 1.41
|
407 kumpf 1.47 // "true" or "false"
408 BOOLEAN,
|
409 alagaraja 1.41
|
410 kumpf 1.47 // Anything
411 STRING
|
412 alagaraja 1.41 };
413
414 /** Constructor.
415
|
416 kumpf 1.47 @param optionName the name of this option.
|
417 alagaraja 1.41
|
418 kumpf 1.47 @param defaultValue the default value of this option.
|
419 alagaraja 1.41
|
420 kumpf 1.47 @param required whether the value of this option is required.
|
421 alagaraja 1.41
|
422 kumpf 1.47 @param type type of the value. This is used to validate the value.
|
423 alagaraja 1.41
|
424 kumpf 1.47 @param domain list of legal value for this option. If this list
425 is empty, then no domain is enforced.
|
426 alagaraja 1.41
|
427 kumpf 1.47 @param commandLineOptionName name of the corresponding command line
428 option (which may be different from the option name).
|
429 david.dillard 1.44
|
430 kumpf 1.47 @param optionHelpMessage Text message that defines option. To be used
431 in Usage messages.
|
432 kavita.gupta 1.50
|
433 kumpf 1.51 @param messageKey Unique key for globalizing option help message. To
|
434 kavita.gupta 1.50 be used in Usage messages.
|
435 alagaraja 1.41 */
436 Option(
437 const String& optionName,
438 const String& defaultValue,
439 Boolean required,
440 Type type,
441 const Array<String>& domain = Array<String>(),
442 const String& commandLineOptionName = String(),
|
443 kavita.gupta 1.50 const String& optionHelpMessage = String(),
444 const String& messageKey = String());
|
445 alagaraja 1.41
446 Option(const Option& x);
447
448 virtual ~Option();
449
450 Option& operator=(const Option& x);
451
452 /** Accessor */
453 const String& getOptionName() const
454 {
455 return _optionName;
456 }
457
458 /** Modifier */
459 void setOptionName(const String& optionName)
460 {
461 _optionName = optionName;
462 }
463
464 /** Accessor */
465 const String& getDefaultValue() const
466 alagaraja 1.41 {
467 return _defaultValue;
468 }
469
470 /** Modifier. */
471 void setDefaultValue(const String& defaultValue)
472 {
473 _defaultValue = defaultValue;
474 }
475
476 /** Accessor
|
477 kumpf 1.47 @return - Returns string representation of value
|
478 alagaraja 1.41 */
479 const String& getValue() const
480 {
481 return _value;
482 }
483
484 /** Modifier */
485 void setValue(const String& value)
486 {
487 _value = value;
|
488 kumpf 1.47 _resolved = true;
|
489 alagaraja 1.41 }
|
490 david.dillard 1.44
|
491 alagaraja 1.41 /** Accessor */
492 Boolean getRequired() const
493 {
494 return _required;
495 }
496
497 /** Modifier */
498 void setRequired(Boolean required)
499 {
500 _required = required;
501 }
502
503 /** Accessor */
504 Type getType() const
505 {
506 return _type;
507 }
508
509 /** Modifier */
510 void setType(Type type)
511 {
512 alagaraja 1.41 _type = type;
513 }
514
515 /** Accessor */
516 const Array<String>& getDomain() const;
517
518 /** Modifier */
519 void setDomain(const Array<String>& domain);
520
521 /** Accessor */
522 const String& getCommandLineOptionName() const
523 {
524 return _commandLineOptionName;
525 }
526
527 /** Accessor */
528 const String& getOptionHelpMessage() const
529 {
|
530 kumpf 1.47 return _optionHelpMessage;
|
531 alagaraja 1.41 }
532
533 /** Modifier */
534 void setCommandLineOptionName(const String& commandLineOptionName)
535 {
536 _commandLineOptionName = commandLineOptionName;
537 }
538
|
539 kavita.gupta 1.50 /**
540 Accesor. Get the message key
541 */
542 const String& getMessageKey() const
543 {
544 return _messageKey;
545 }
|
546 alagaraja 1.41 /** Accesor. Returns true if an option value was ever obtained for
|
547 kumpf 1.47 this option.
|
548 alagaraja 1.41 */
549 Boolean isResolved() const
550 {
|
551 kumpf 1.47 return _resolved;
|
552 alagaraja 1.41 }
553
554 /** Checks to see if the given value is valid or not. This method may be
|
555 kumpf 1.47 overriden by derived classes to do special purpose validation of the
556 value. This implementation just checks the domain and type.
|
557 alagaraja 1.41 */
558 virtual Boolean isValid(const String& value) const;
559
560 private:
561 String _optionName;
562 String _defaultValue;
563 String _value;
564 Boolean _required;
565 Type _type;
566 Array<String> _domain;
567 String _commandLineOptionName;
568 String _optionHelpMessage;
|
569 kavita.gupta 1.50 String _messageKey;
|
570 alagaraja 1.41 Boolean _resolved;
571 };
572
573 ///////////////////////////////////////////////////////////////////////
574 // OptionRow
575 ///////////////////////////////////////////////////////////////////'//
576
577 /** The OptionRow provides a declarative way of defining Option objects.
578 For the declarative programming enthusiast, we provide this structure.
579 It provides a declarative way of defining options for the OptionManager
580 class. Some developers prefer this since it makes all the options visible
581 in a kind of table like structure. Here is an example of how it can be
582 used to define a port number and hostname options. We also show how to
583 register one of these option lists with an OptionManager.
584
585 <pre>
|
586 kumpf 1.47 static OptionRow options[] =
587 {
588 { "port", "80", false, Option::NATURAL_NUMBER },
589 { "hostname", "", true, Option::STRING }
590 };
|
591 alagaraja 1.41
|
592 kumpf 1.47 ...
|
593 alagaraja 1.41
|
594 kumpf 1.47 OptionManager om;
595 om.registerOptions(options, sizeof(options) / sizeof(options[0]));
|
596 alagaraja 1.41 </pre>
597
598 Recall that static memory areas are initialized with zeros so that the
599 members that are not initialized explicitly in the example above are
600 initialized implicitly with zeros (which the OptionManager used to
601 determine that they are not used).
602
603 It is possible to specify domains as well. For example, suppose we
604 want to define a "color" option that can be in the following set:
605 {"red", "green", "blue"}. Here is how to express that:
606
607 <pre>
|
608 kumpf 1.47 static const char* colors[] = { "red", "green", "blue" };
609 static const Uint32 NUM_COLORS = sizeof(colors) / sizeof(colors[0]);
|
610 alagaraja 1.41
|
611 kumpf 1.47 static OptionRow options[] =
612 {
613 { "color", "red", false, Option::STRING, colors, NUM_COLORS }
614 };
|
615 alagaraja 1.41 </pre>
|
616 david.dillard 1.44 When a domain is defined, any of the keywords in that domain are legal
617 option keywords. For example. With the domain defined above, a command
618 line or config file entry that includes -c blue sets the option "color" to
619 blue. Note that this requires a space between -c and blue.
|
620 alagaraja 1.41 */
621 struct OptionRow
622 {
623 const char* optionName;
624 const char* defaultValue;
625 int required;
626 Option::Type type;
627 char** domain;
628 Uint32 domainSize;
629 const char* commandLineOptionName;
630 const char* optionHelpMessage;
631 };
|
632 david.dillard 1.44 /* NOTE: The "required" object must be an int rather than a Boolean because
633 bool on some platforms is not defined so that we cannot use a Boolean here
634 with a static object.
|
635 alagaraja 1.41 */
|
636 david.dillard 1.44
|
637 kavita.gupta 1.50 /* Optionrow structure with messageKey for corresponding option */
638 struct OptionRowWithMsg
639 {
640 const char* optionName;
641 const char* defaultValue;
642 int required;
643 Option::Type type;
644 char** domain;
645 Uint32 domainSize;
646 const char* commandLineOptionName;
647 const char* messageKey;
648 const char* optionHelpMessage;
649 };
650
|
651 alagaraja 1.41 /** Exception class */
|
652 kumpf 1.47 class PEGASUS_COMMON_LINKAGE OMMissingCommandLineOptionArgument
653 : public Exception
|
654 alagaraja 1.41 {
655 public:
656
|
657 kumpf 1.47 OMMissingCommandLineOptionArgument(const String& optionName)
658 : Exception(MessageLoaderParms(
659 "Common.OptionManager.MISSING_CMD_LINE_OPTION",
660 "Missing command line option argument: $0",
661 optionName))
662 {
663 }
|
664 alagaraja 1.41 };
665
666 /** Exception class */
|
667 mike 1.46 class PEGASUS_COMMON_LINKAGE OMInvalidOptionValue : public Exception
|
668 alagaraja 1.41 {
669 public:
670
|
671 kumpf 1.47 OMInvalidOptionValue(const String& name, const String& value)
672 : Exception(MessageLoaderParms(
673 "Common.OptionManager.INVALID_OPTION_VALUE",
674 "Invalid option value: $0=\"$1\"",
675 name,
676 value))
677 {
678 }
|
679 alagaraja 1.41 };
680
681 /** Exception class */
|
682 mike 1.46 class PEGASUS_COMMON_LINKAGE OMDuplicateOption : public Exception
|
683 alagaraja 1.41 {
684 public:
|
685 kumpf 1.47 OMDuplicateOption(const String& name)
686 : Exception(MessageLoaderParms(
687 "Common.OptionManager.DUPLICATE_OPTION",
688 "Duplicate option: $0",
689 name))
690 {
691 }
|
692 alagaraja 1.41 };
693
694 /** Exception class */
|
695 mike 1.46 class PEGASUS_COMMON_LINKAGE OMConfigFileSyntaxError : public Exception
|
696 alagaraja 1.41 {
697 public:
698
699 OMConfigFileSyntaxError(const String& file, Uint32 line)
|
700 kumpf 1.47 : Exception(_formatMessage(file, line)) { }
|
701 alagaraja 1.41
702 static String _formatMessage(const String& file, Uint32 line);
703 };
704
705 /** Exception class */
|
706 mike 1.46 class PEGASUS_COMMON_LINKAGE OMUnrecognizedConfigFileOption : public Exception
|
707 alagaraja 1.41 {
708 public:
|
709 kumpf 1.47 OMUnrecognizedConfigFileOption(const String& name)
710 : Exception(MessageLoaderParms(
711 "Common.OptionManager.UNRECOGNIZED_CONFIG_FILE_OPTION",
712 "Unrecognized config file option: $0",
713 name))
714 {
715 }
|
716 alagaraja 1.41 };
717
718 /** Exception class */
|
719 mike 1.46 class PEGASUS_COMMON_LINKAGE OMMissingRequiredOptionValue : public Exception
|
720 alagaraja 1.41 {
721 public:
|
722 kumpf 1.47 OMMissingRequiredOptionValue(const String& name)
723 : Exception(MessageLoaderParms(
724 "Common.OptionManager.MISSING_REQUIRED_OPTION",
725 "Missing required option value: $0",
726 name))
727 {
728 }
|
729 alagaraja 1.41 };
730
731 /** Exception class */
|
732 mike 1.46 class PEGASUS_COMMON_LINKAGE OMMBadCmdLineOption : public Exception
|
733 alagaraja 1.41 {
734 public:
|
735 kumpf 1.47 OMMBadCmdLineOption(const String& name)
736 : Exception(MessageLoaderParms(
737 "Common.OptionManager.PARAMETER_NOT_VALID",
738 "Parameter not Valid: $0",
739 name))
740 {
741 }
|
742 alagaraja 1.41 };
743
744 PEGASUS_NAMESPACE_END
745
746 #endif /* Pegasus_OM_h */
|