From b0080e69d64ce69e21c8ce1b22b1bb7f888f1e58 Mon Sep 17 00:00:00 2001 From: Gary Scavone Date: Tue, 7 Aug 2007 14:52:05 +0000 Subject: Check in of new version 4.0.0 distribution (GS). --- tests/Windows/rtaudiotest/StdOpt.cpp | 91 ------------------------------------ 1 file changed, 91 deletions(-) delete mode 100644 tests/Windows/rtaudiotest/StdOpt.cpp (limited to 'tests/Windows/rtaudiotest/StdOpt.cpp') diff --git a/tests/Windows/rtaudiotest/StdOpt.cpp b/tests/Windows/rtaudiotest/StdOpt.cpp deleted file mode 100644 index 02c8eea..0000000 --- a/tests/Windows/rtaudiotest/StdOpt.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/************************************************************************/ -/*! \class CommandLine - \brief Command-line option parser. - - Copyright (c) 2005 Robin Davies. - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation files - (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Software, - and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR - ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -/************************************************************************/ - -#include ".\stdopt.h" - -using namespace stdopt; - -CommandLine::CommandLine() -{ -} - -void CommandLine::ProcessCommandLine(int argc, char**argv) -{ - std::vector cmdline; - for (int i = 0; i < argc; ++i) { - cmdline.push_back(argv[i]); - } - ProcessCommandLine(cmdline); -} - -const CommandLine::COptionHandlerBase*CommandLine::GetOptionHandler(const std::string &name) const -{ - // Return excact matches only. - for (size_t i = 0; i < optionHandlers.size(); ++i) - { - if (optionHandlers[i]->getName() == name) { - return (optionHandlers[i]); - } - } - return NULL; -} - -void CommandLine::ProcessCommandLine(const std::vector& cmdline) -{ - for (size_t i = 1; i < cmdline.size(); ++i) - { - if (cmdline[i].length() != 0 && cmdline[i][0] == L'/' || (cmdline[i][0] == '-')) { - std::string arg = cmdline[i].substr(1); - const COptionHandlerBase *pHandler = GetOptionHandler(arg); - if (pHandler == NULL) { - throw CommandLineException(std::string("Unknown option: ") + arg); - } - if (pHandler->HasArgument()) - { - std::string strArg; - if (i+1 < cmdline.size()) { - ++i; - strArg = cmdline[i]; - } - pHandler->Process(strArg.c_str()); - } else { - pHandler->Process(NULL); - } - } else { - args.push_back(cmdline[i]); - } - } -} - -CommandLine::~CommandLine(void) -{ - for (size_t i = 0; i < optionHandlers.size(); ++i) - { - delete optionHandlers[i]; - } - optionHandlers.resize(0); -} -- cgit v1.2.3