X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2FConsole%2FParsedCommand.cti;h=019ae8a9d9790cad8b7b9ff7d6c806eb29a894e6;hb=0003d55730b447329342161d12cf2ed23b63459e;hp=43a2cffbe880f0fae46585b559092877f621bc6f;hpb=f13780e9e4da7df981d6f6542fbdc714beb34765;p=senf.git diff --git a/senf/Utils/Console/ParsedCommand.cti b/senf/Utils/Console/ParsedCommand.cti index 43a2cff..019ae8a 100644 --- a/senf/Utils/Console/ParsedCommand.cti +++ b/senf/Utils/Console/ParsedCommand.cti @@ -1,24 +1,29 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) -// Competence Center NETwork research (NET), St. Augustin, GERMANY -// Stefan Bund // -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. +// The contents of this file are subject to the Fraunhofer FOKUS Public License +// Version 1.0 (the "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// http://senf.berlios.de/license.html // -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. +// The Fraunhofer FOKUS Public License Version 1.0 is based on, +// but modifies the Mozilla Public License Version 1.1. +// See the full license text for the amendments. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the -// Free Software Foundation, Inc., -// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// Software distributed under the License is distributed on an "AS IS" basis, +// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +// for the specific language governing rights and limitations under the License. +// +// The Original Code is Fraunhofer FOKUS code. +// +// The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. +// (registered association), Hansastraße 27 c, 80686 Munich, Germany. +// All Rights Reserved. +// +// Contributor(s): +// Stefan Bund /** \file \brief ParsedCommand inline template implementation */ @@ -31,9 +36,9 @@ #include #define prefix_ inline -///////////////////////////////cti.p/////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::console::detail::ArgumentInfo template @@ -45,7 +50,7 @@ senf::console::detail::ArgumentInfo::create() template prefix_ senf::console::detail::ArgumentInfo::ArgumentInfo() - : ArgumentInfoBase ( ArgumentTraits::description(), + : ArgumentInfoBase ( ArgumentTraits::description(), ArgumentTraits::singleToken ), defaultValue () {} @@ -57,7 +62,7 @@ prefix_ std::string senf::console::detail::ArgumentInfo::defaultV return hasDefault ? ArgumentTraits::str(defaultValue) : ""; } -/////////////////////////////////////////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::console::ParsedCommandOverloadBase template @@ -66,7 +71,7 @@ prefix_ void senf::console::ParsedCommandOverloadBase::addParameter() parameters_.push_back(detail::ArgumentInfo::create()); } -/////////////////////////////////////////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::console::ParsedCommandOverload #define BOOST_PP_ITERATION_PARAMS_1 (4, (0, SENF_CONSOLE_MAX_COMMAND_ARITY, \ @@ -74,7 +79,7 @@ prefix_ void senf::console::ParsedCommandOverloadBase::addParameter() 2)) #include BOOST_PP_ITERATE() -/////////////////////////////////////////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::console::ParsedCommandAttributor template @@ -96,7 +101,7 @@ ParsedCommandAttributor(ParsedCommandAttributorBase const & other, unsigned inde : ParsedCommandAttributorBase (other, index) {} -/////////////////////////////////////////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::console::ParsedArgumentAttributorBase template @@ -183,7 +188,7 @@ ParsedArgumentAttributorBase(ParsedCommandAttributorBase const & other, unsigned : ParsedCommandAttributor (other, index) {} -/////////////////////////////////////////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::console::ParsedArgumentAttributor template @@ -311,14 +316,14 @@ prefix_ void senf::console::ParsedArgumentAttributor::parse this->overload().arg().parser = fn; } -/////////////////////////////////////////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::console::ParsedArgumentAttributor template prefix_ senf::console::ParsedArgumentAttributor:: ParsedArgumentAttributor(typename Overload::ptr overload) - : ParsedArgumentAttributorBase< + : ParsedArgumentAttributorBase< Overload, ParsedArgumentAttributor > (overload, index) {} @@ -329,7 +334,7 @@ ParsedArgumentAttributor(ParsedCommandAttributorBase const & other) : ParsedArgumentAttributorBase (other, index) {} -/////////////////////////////////////////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// // namespace members namespace senf { @@ -361,9 +366,50 @@ namespace detail { }}} +//-///////////////////////////////////////////////////////////////////////////////////////////////// + +template +prefix_ senf::console::SimpleOverloadAttributor +senf::console::factory:: +Command(boost::function fn, + typename boost::enable_if_c::is_simple>::type *) +{ + return SimpleOverloadAttributor(fn); +} + +template +prefix_ senf::console::SimpleOverloadAttributor +senf::console::factory:: +Command(Function fn, + typename boost::enable_if_c::is_simple>::type *) +{ + return SimpleOverloadAttributor(fn); +} + +template +prefix_ senf::console::SimpleOverloadAttributor +senf::console::factory:: +Command(Member memfn, Owner * owner, + typename boost::enable_if >::type *, + typename boost::enable_if_c::is_simple>::type *) +{ + return SimpleOverloadAttributor(senf::membind(memfn,owner)); +} + +template +prefix_ senf::console::SimpleOverloadAttributor +senf::console::factory:: +Command(Member memfn, Owner const * owner, + typename boost::enable_if >::type *, + typename boost::enable_if_c::is_simple>::type *) +{ + return SimpleOverloadAttributor(senf::membind(memfn,owner)); +} + template prefix_ typename senf::console::detail::ParsedCommandTraits::Attributor -senf::console::factory::Command(boost::function fn) +senf::console::factory:: +Command(boost::function fn) { return detail::addOverloadedCommandNode(fn); } @@ -372,14 +418,16 @@ template prefix_ typename senf::console::detail::ParsedCommandTraits::Attributor senf::console::factory:: Command(Function fn, - typename boost::enable_if_c::is_callable>::type *) + typename boost::enable_if_c::is_callable>::type *, + typename boost::disable_if >::type *) { return detail::addOverloadedCommandNode(fn); } template prefix_ typename senf::console::detail::ParsedCommandTraits::Attributor -senf::console::factory::Command(boost::function fn) +senf::console::factory:: +Command(boost::function fn) { return detail::addOverloadedCommandNode(fn); } @@ -388,40 +436,49 @@ template prefix_ typename senf::console::detail::ParsedCommandTraits::Attributor senf::console::factory:: Command(Function fn, - typename boost::enable_if_c::is_callable>::type *) + typename boost::enable_if_c::is_callable>::type *, + typename boost::disable_if >::type *) { return detail::addOverloadedCommandNode(fn); } template prefix_ typename senf::console::detail::ParsedCommandTraits::Attributor -senf::console::factory::BoundCommand(Owner * owner, Member memfn) +senf::console::factory:: +Command(Member memfn, Owner * owner, + typename boost::enable_if >::type *) { return detail::addOverloadedCommandNode(senf::membind(memfn,owner)); } template prefix_ typename senf::console::detail::ParsedCommandTraits::Attributor -senf::console::factory::BoundCommand(Owner const * owner, Member memfn) +senf::console::factory:: +Command(Member memfn, Owner const * owner, + typename boost::enable_if >::type *) { return detail::addOverloadedCommandNode(senf::membind(memfn,owner)); } template prefix_ typename senf::console::detail::ParsedCommandTraits::Attributor -senf::console::factory::BoundCommand(Owner * owner, Member memfn) +senf::console::factory:: +Command(Member memfn, Owner * owner, + typename boost::enable_if >::type *) { return detail::addOverloadedCommandNode(senf::membind(memfn,owner)); } template prefix_ typename senf::console::detail::ParsedCommandTraits::Attributor -senf::console::factory::BoundCommand(Owner const * owner, Member memfn) +senf::console::factory:: +Command(Member memfn, Owner const * owner, + typename boost::enable_if >::type *) { return detail::addOverloadedCommandNode(senf::membind(memfn,owner)); } -///////////////////////////////cti.e/////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// #undef prefix_