1*976fe0bfSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*976fe0bfSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*976fe0bfSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*976fe0bfSAndrew Rist * distributed with this work for additional information 6*976fe0bfSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*976fe0bfSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*976fe0bfSAndrew Rist * "License"); you may not use this file except in compliance 9*976fe0bfSAndrew Rist * with the License. You may obtain a copy of the License at 10*976fe0bfSAndrew Rist * 11*976fe0bfSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*976fe0bfSAndrew Rist * 13*976fe0bfSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*976fe0bfSAndrew Rist * software distributed under the License is distributed on an 15*976fe0bfSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*976fe0bfSAndrew Rist * KIND, either express or implied. See the License for the 17*976fe0bfSAndrew Rist * specific language governing permissions and limitations 18*976fe0bfSAndrew Rist * under the License. 19*976fe0bfSAndrew Rist * 20*976fe0bfSAndrew Rist *************************************************************/ 21*976fe0bfSAndrew Rist 22*976fe0bfSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _CODEMAKER_OPTIONS_HXX_ 25cdf0e10cSrcweir #define _CODEMAKER_OPTIONS_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <hash_map> 28cdf0e10cSrcweir #include <codemaker/global.hxx> 29cdf0e10cSrcweir 30cdf0e10cSrcweir #if defined( _MSC_VER ) && ( _MSC_VER < 1200 ) 31cdf0e10cSrcweir typedef ::std::__hash_map__ 32cdf0e10cSrcweir < 33cdf0e10cSrcweir ::rtl::OString, 34cdf0e10cSrcweir ::rtl::OString, 35cdf0e10cSrcweir HashString, 36cdf0e10cSrcweir EqualString, 37cdf0e10cSrcweir NewAlloc 38cdf0e10cSrcweir > OptionMap; 39cdf0e10cSrcweir #else 40cdf0e10cSrcweir typedef ::std::hash_map 41cdf0e10cSrcweir < 42cdf0e10cSrcweir ::rtl::OString, 43cdf0e10cSrcweir ::rtl::OString, 44cdf0e10cSrcweir HashString, 45cdf0e10cSrcweir EqualString 46cdf0e10cSrcweir > OptionMap; 47cdf0e10cSrcweir #endif 48cdf0e10cSrcweir 49cdf0e10cSrcweir class CannotDumpException 50cdf0e10cSrcweir { 51cdf0e10cSrcweir public: CannotDumpException(const::rtl::OString & msg)52cdf0e10cSrcweir CannotDumpException(const ::rtl::OString& msg) 53cdf0e10cSrcweir : m_message(msg) {} 54cdf0e10cSrcweir 55cdf0e10cSrcweir ::rtl::OString m_message; 56cdf0e10cSrcweir }; 57cdf0e10cSrcweir 58cdf0e10cSrcweir 59cdf0e10cSrcweir class IllegalArgument 60cdf0e10cSrcweir { 61cdf0e10cSrcweir public: IllegalArgument(const::rtl::OString & msg)62cdf0e10cSrcweir IllegalArgument(const ::rtl::OString& msg) 63cdf0e10cSrcweir : m_message(msg) {} 64cdf0e10cSrcweir 65cdf0e10cSrcweir ::rtl::OString m_message; 66cdf0e10cSrcweir }; 67cdf0e10cSrcweir 68cdf0e10cSrcweir 69cdf0e10cSrcweir class Options 70cdf0e10cSrcweir { 71cdf0e10cSrcweir public: 72cdf0e10cSrcweir Options(); 73cdf0e10cSrcweir virtual ~Options(); 74cdf0e10cSrcweir 75cdf0e10cSrcweir virtual sal_Bool initOptions(int ac, char* av[], sal_Bool bCmdFile=sal_False) 76cdf0e10cSrcweir throw( IllegalArgument ) = 0; 77cdf0e10cSrcweir 78cdf0e10cSrcweir virtual ::rtl::OString prepareHelp() = 0; 79cdf0e10cSrcweir 80cdf0e10cSrcweir const ::rtl::OString& getProgramName() const; 81cdf0e10cSrcweir sal_Bool isValid(const ::rtl::OString& option); 82cdf0e10cSrcweir const ::rtl::OString getOption(const ::rtl::OString& option) 83cdf0e10cSrcweir throw( IllegalArgument ); 84cdf0e10cSrcweir 85cdf0e10cSrcweir const StringVector& getInputFiles(); 86cdf0e10cSrcweir 87cdf0e10cSrcweir protected: 88cdf0e10cSrcweir ::rtl::OString m_program; 89cdf0e10cSrcweir StringVector m_inputFiles; 90cdf0e10cSrcweir OptionMap m_options; 91cdf0e10cSrcweir }; 92cdf0e10cSrcweir 93cdf0e10cSrcweir #endif // _CODEMAKER_OPTIONS_HXX_ 94cdf0e10cSrcweir 95