michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * vim: set ts=8 sts=4 et sw=4 tw=99: michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "shell/jsoptparse.h" michael@0: michael@0: #include michael@0: #include michael@0: michael@0: #include "jsutil.h" michael@0: michael@0: using namespace js; michael@0: using namespace js::cli; michael@0: using namespace js::cli::detail; michael@0: michael@0: const char OptionParser::prognameMeta[] = "{progname}"; michael@0: michael@0: #define OPTION_CONVERT_IMPL(__cls) \ michael@0: bool \ michael@0: Option::is##__cls##Option() const \ michael@0: { \ michael@0: return kind == OptionKind##__cls; \ michael@0: } \ michael@0: __cls##Option * \ michael@0: Option::as##__cls##Option() \ michael@0: { \ michael@0: JS_ASSERT(is##__cls##Option()); \ michael@0: return static_cast<__cls##Option *>(this); \ michael@0: } \ michael@0: const __cls##Option * \ michael@0: Option::as##__cls##Option() const \ michael@0: { \ michael@0: return const_cast