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