Branch data 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 _CODEMAKER_OPTIONS_HXX_
21 : : #define _CODEMAKER_OPTIONS_HXX_
22 : :
23 : : #include <boost/unordered_map.hpp>
24 : : #include <codemaker/global.hxx>
25 : :
26 : : typedef ::boost::unordered_map
27 : : <
28 : : ::rtl::OString,
29 : : ::rtl::OString,
30 : : HashString,
31 : : EqualString
32 : : > OptionMap;
33 : :
34 : : class CannotDumpException
35 : : {
36 : : public:
37 : : CannotDumpException(const ::rtl::OString& msg)
38 : : : m_message(msg) {}
39 : :
40 : : ::rtl::OString m_message;
41 : : };
42 : :
43 : :
44 : 0 : class IllegalArgument
45 : : {
46 : : public:
47 : 0 : IllegalArgument(const ::rtl::OString& msg)
48 : 0 : : m_message(msg) {}
49 : :
50 : : ::rtl::OString m_message;
51 : : };
52 : :
53 : :
54 : : class Options
55 : : {
56 : : public:
57 : : Options();
58 : : virtual ~Options();
59 : :
60 : : virtual sal_Bool initOptions(int ac, char* av[], sal_Bool bCmdFile=sal_False)
61 : : throw( IllegalArgument ) = 0;
62 : :
63 : : virtual ::rtl::OString prepareHelp() = 0;
64 : :
65 : : const ::rtl::OString& getProgramName() const;
66 : : sal_Bool isValid(const ::rtl::OString& option);
67 : : const ::rtl::OString getOption(const ::rtl::OString& option)
68 : : throw( IllegalArgument );
69 : :
70 : : const StringVector& getInputFiles();
71 : :
72 : : protected:
73 : : ::rtl::OString m_program;
74 : : StringVector m_inputFiles;
75 : : OptionMap m_options;
76 : : };
77 : :
78 : : #endif // _CODEMAKER_OPTIONS_HXX_
79 : :
80 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|