Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _IDLC_OPTIONS_HXX_
21 : #define _IDLC_OPTIONS_HXX_
22 :
23 : #include <idlc/idlctypes.hxx>
24 :
25 : typedef ::boost::unordered_map< ::rtl::OString,
26 : ::rtl::OString,
27 : HashString,
28 : EqualString > OptionMap;
29 :
30 0 : class IllegalArgument
31 : {
32 : public:
33 0 : IllegalArgument(const ::rtl::OString& msg)
34 0 : : m_message(msg) {}
35 :
36 : ::rtl::OString m_message;
37 : };
38 :
39 :
40 : class Options
41 : {
42 : public:
43 : explicit Options(char const * progname);
44 : ~Options();
45 :
46 : static bool checkArgument(std::vector< std::string > & rArgs, char const * arg, size_t len);
47 : static bool checkCommandFile(std::vector< std::string > & rArgs, char const * filename);
48 :
49 : bool initOptions(std::vector< std::string > & rArgs)
50 : throw(IllegalArgument);
51 : bool badOption(char const * reason, std::string const & rArg)
52 : throw(IllegalArgument);
53 : bool setOption(char const * option, std::string const & rArg);
54 :
55 : #if 0 /* @@@ */
56 : sal_Bool initOptions(int ac, char* av[], sal_Bool bCmdFile=sal_False)
57 : throw( IllegalArgument );
58 : #endif /* @@@ */
59 :
60 : ::rtl::OString prepareHelp();
61 : ::rtl::OString prepareVersion();
62 :
63 : const ::rtl::OString& getProgramName() const;
64 : bool isValid(const ::rtl::OString& option);
65 : const ::rtl::OString& getOption(const ::rtl::OString& option)
66 : throw( IllegalArgument );
67 :
68 138 : const StringVector& getInputFiles() const { return m_inputFiles; }
69 138 : bool readStdin() const { return m_stdin; }
70 276 : bool verbose() const { return m_verbose; }
71 5250 : bool quiet() const { return m_quiet; }
72 :
73 : protected:
74 : ::rtl::OString m_program;
75 : StringVector m_inputFiles;
76 : bool m_stdin;
77 : bool m_verbose;
78 : bool m_quiet;
79 : OptionMap m_options;
80 : };
81 :
82 : #endif // _IDLC_OPTIONS_HXX_
83 :
84 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|