00001 #pragma ident "$Id: CommandOptionWithPositionArg.cpp 274 2006-10-27 14:24:35Z rickmach $" 00002 00003 00004 00005 //============================================================================ 00006 // 00007 // This file is part of GPSTk, the GPS Toolkit. 00008 // 00009 // The GPSTk is free software; you can redistribute it and/or modify 00010 // it under the terms of the GNU Lesser General Public License as published 00011 // by the Free Software Foundation; either version 2.1 of the License, or 00012 // any later version. 00013 // 00014 // The GPSTk is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU Lesser General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU Lesser General Public 00020 // License along with GPSTk; if not, write to the Free Software Foundation, 00021 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 // 00023 // Copyright 2004, The University of Texas at Austin 00024 // 00025 //============================================================================ 00026 00027 //============================================================================ 00028 // 00029 //This software developed by Applied Research Laboratories at the University of 00030 //Texas at Austin, under contract to an agency or agencies within the U.S. 00031 //Department of Defense. The U.S. Government retains all rights to use, 00032 //duplicate, distribute, disclose, or release this software. 00033 // 00034 //Pursuant to DoD Directive 523024 00035 // 00036 // DISTRIBUTION STATEMENT A: This software has been approved for public 00037 // release, distribution is unlimited. 00038 // 00039 //============================================================================= 00040 00041 00042 00043 00044 00045 00051 #include "StringUtils.hpp" 00052 #include "CommandOptionWithPositionArg.hpp" 00053 00054 using namespace std; 00055 00056 namespace gpstk 00057 { 00058 string CommandOptionWithPositionArg :: checkArguments() 00059 { 00060 string errstr = CommandOptionWithAnyArg::checkArguments(); 00061 00062 if( errstr != string() ) 00063 return errstr; 00064 00065 vector<string>::size_type vecIndex; 00066 for( vecIndex = 0; vecIndex < value.size(); vecIndex++ ) 00067 { 00068 string thisPosSpec = getPositionSpec( vecIndex ); 00069 if( thisPosSpec != string() ) 00070 { 00071 try 00072 { 00073 Position pos; 00074 pos.setToString( value[vecIndex], thisPosSpec ); 00075 positions.push_back( pos ); 00076 } 00077 catch (...) 00078 { 00079 errstr += "\"" + value[vecIndex] + "\" is not a valid position."; 00080 } 00081 } 00082 else 00083 { 00084 errstr += "\"" + value[vecIndex] + "\" is not a valid position."; 00085 } 00086 } 00087 00088 return errstr; 00089 } // end of checkArguments() 00090 00091 }
1.3.9.1