(file) Return to OptionManager.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / General

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2