xref: /aoo42x/main/registry/tools/options.hxx (revision 5a5f4a75)
1*5a5f4a75SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*5a5f4a75SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*5a5f4a75SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*5a5f4a75SAndrew Rist  * distributed with this work for additional information
6*5a5f4a75SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*5a5f4a75SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*5a5f4a75SAndrew Rist  * "License"); you may not use this file except in compliance
9*5a5f4a75SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*5a5f4a75SAndrew Rist  *
11*5a5f4a75SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*5a5f4a75SAndrew Rist  *
13*5a5f4a75SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*5a5f4a75SAndrew Rist  * software distributed under the License is distributed on an
15*5a5f4a75SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5a5f4a75SAndrew Rist  * KIND, either express or implied.  See the License for the
17*5a5f4a75SAndrew Rist  * specific language governing permissions and limitations
18*5a5f4a75SAndrew Rist  * under the License.
19*5a5f4a75SAndrew Rist  *
20*5a5f4a75SAndrew Rist  *************************************************************/
21*5a5f4a75SAndrew Rist 
22*5a5f4a75SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef INCLUDED_REGISTRY_TOOLS_OPTIONS_HXX
25cdf0e10cSrcweir #define INCLUDED_REGISTRY_TOOLS_OPTIONS_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <string>
28cdf0e10cSrcweir #include <vector>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir namespace registry
31cdf0e10cSrcweir {
32cdf0e10cSrcweir namespace tools
33cdf0e10cSrcweir {
34cdf0e10cSrcweir class Options
35cdf0e10cSrcweir {
36cdf0e10cSrcweir     std::string m_program;
37cdf0e10cSrcweir 
38cdf0e10cSrcweir     Options (Options const &);
39cdf0e10cSrcweir     Options & operator= (Options const &);
40cdf0e10cSrcweir 
41cdf0e10cSrcweir public:
42cdf0e10cSrcweir     explicit Options (char const * program);
43cdf0e10cSrcweir     virtual ~Options();
44cdf0e10cSrcweir 
45cdf0e10cSrcweir     static bool checkArgument (std::vector< std::string > & rArgs, char const * arg, size_t len);
46cdf0e10cSrcweir 
47cdf0e10cSrcweir     bool initOptions (std::vector< std::string > & rArgs);
48cdf0e10cSrcweir     bool badOption (char const * reason, char const * option) const;
49cdf0e10cSrcweir 
getProgramName() const50cdf0e10cSrcweir     std::string const & getProgramName() const { return m_program; }
51cdf0e10cSrcweir     bool printUsage() const;
52cdf0e10cSrcweir 
53cdf0e10cSrcweir protected:
54cdf0e10cSrcweir     static  bool checkCommandFile(std::vector< std::string > & rArgs, char const * filename);
55cdf0e10cSrcweir 
56cdf0e10cSrcweir     virtual bool initOptions_Impl(std::vector< std::string > & rArgs) = 0;
57cdf0e10cSrcweir     virtual void printUsage_Impl() const = 0;
58cdf0e10cSrcweir };
59cdf0e10cSrcweir 
60cdf0e10cSrcweir } // namespace tools
61cdf0e10cSrcweir } // namespace registry
62cdf0e10cSrcweir 
63cdf0e10cSrcweir #endif /* INCLUDED_REGISTRY_TOOLS_OPTIONS_HXX */
64