1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _CODEMAKER_OPTIONS_HXX_ 29 #define _CODEMAKER_OPTIONS_HXX_ 30 31 #include <hash_map> 32 #include <codemaker/global.hxx> 33 34 #if defined( _MSC_VER ) && ( _MSC_VER < 1200 ) 35 typedef ::std::__hash_map__ 36 < 37 ::rtl::OString, 38 ::rtl::OString, 39 HashString, 40 EqualString, 41 NewAlloc 42 > OptionMap; 43 #else 44 typedef ::std::hash_map 45 < 46 ::rtl::OString, 47 ::rtl::OString, 48 HashString, 49 EqualString 50 > OptionMap; 51 #endif 52 53 class CannotDumpException 54 { 55 public: 56 CannotDumpException(const ::rtl::OString& msg) 57 : m_message(msg) {} 58 59 ::rtl::OString m_message; 60 }; 61 62 63 class IllegalArgument 64 { 65 public: 66 IllegalArgument(const ::rtl::OString& msg) 67 : m_message(msg) {} 68 69 ::rtl::OString m_message; 70 }; 71 72 73 class Options 74 { 75 public: 76 Options(); 77 virtual ~Options(); 78 79 virtual sal_Bool initOptions(int ac, char* av[], sal_Bool bCmdFile=sal_False) 80 throw( IllegalArgument ) = 0; 81 82 virtual ::rtl::OString prepareHelp() = 0; 83 84 const ::rtl::OString& getProgramName() const; 85 sal_Bool isValid(const ::rtl::OString& option); 86 const ::rtl::OString getOption(const ::rtl::OString& option) 87 throw( IllegalArgument ); 88 89 const StringVector& getInputFiles(); 90 91 protected: 92 ::rtl::OString m_program; 93 StringVector m_inputFiles; 94 OptionMap m_options; 95 }; 96 97 #endif // _CODEMAKER_OPTIONS_HXX_ 98 99