00001 // $Id: ParsedCommand.cc 1742 2010-11-04 14:51:56Z g0dil $ 00002 // 00003 // Copyright (C) 2008 00004 // Fraunhofer (FOKUS) 00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY 00006 // Stefan Bund <g0dil@berlios.de> 00007 // 00008 // This program is free software; you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation; either version 2 of the License, or 00011 // (at your option) any later version. 00012 // 00013 // This program is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with this program; if not, write to the 00020 // Free Software Foundation, Inc., 00021 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 00026 #include "ParsedCommand.hh" 00027 #include "ParsedCommand.ih" 00028 00029 // Custom includes 00030 00031 #include "ParsedCommand.mpp" 00032 #define prefix_ 00033 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00034 00035 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00036 // senf::console::detail::ArgumentInfoBase 00037 00038 prefix_ senf::console::detail::ArgumentInfoBase::~ArgumentInfoBase() 00039 {} 00040 00041 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00042 // senf::console::ParsedCommandOverloadBase 00043 00044 prefix_ unsigned senf::console::ParsedCommandOverloadBase::v_numArguments() 00045 const 00046 { 00047 return parameters_.size(); 00048 } 00049 00050 prefix_ void senf::console::ParsedCommandOverloadBase::v_argumentDoc(unsigned index, 00051 ArgumentDoc & doc) 00052 const 00053 { 00054 BOOST_ASSERT( index < parameters_.size() ); 00055 detail::ArgumentInfoBase & arg (*parameters_[index]); 00056 doc.name = arg.name.empty() 00057 ? (boost::format("arg%d%d") % overloadIndex() % (index+1)).str() 00058 : arg.name; 00059 doc.type = arg.type; 00060 if (arg.hasDefault) { 00061 doc.defaultValue = arg.defaultDoc.empty() 00062 ? arg.defaultValueStr() 00063 : arg.defaultDoc; 00064 if (doc.defaultValue.empty()) 00065 doc.defaultValue = "(empty)"; 00066 } 00067 doc.doc = arg.doc; 00068 doc.singleToken = arg.singleToken; 00069 } 00070 00071 prefix_ std::string senf::console::ParsedCommandOverloadBase::v_doc() 00072 const 00073 { 00074 return doc_; 00075 } 00076 00077 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00078 #undef prefix_ 00079 #include "ParsedCommand.mpp" 00080 00081 00082 // Local Variables: 00083 // mode: c++ 00084 // fill-column: 100 00085 // comment-column: 40 00086 // c-file-style: "senf" 00087 // indent-tabs-mode: nil 00088 // ispell-local-dictionary: "american" 00089 // compile-command: "scons -u test" 00090 // End: