// $Id$
//
-// Copyright (C) 2008
+// Copyright (C) 2008
// Fraunhofer Institute for Open Communication Systems (FOKUS)
// Competence Center NETwork research (NET), St. Augustin, GERMANY
// Stefan Bund <g0dil@berlios.de>
#include "Traits.ih"
// Custom includes
-#include <boost/format.hpp>
#include <senf/Utils/senfassert.hh>
//#include "Traits.mpp"
#define prefix_
-///////////////////////////////cc.p////////////////////////////////////////
-
-prefix_ std::string senf::console::ArgumentTraits<std::string>::str(std::string const & value)
-{
- if (! value.empty() && boost::algorithm::all(value, CommandParser::isWordChar))
- return value;
- else {
- std::string rv (value);
- for (std::string::size_type i (0); i < rv.size(); ++i)
- if (rv[i] == '"' || rv[i] == '\\')
- rv.insert(i++,"\\");
- else if (rv[i] < ' ' || rv[i] > 126) {
- rv.insert(i+1, (boost::format("x%02x")
- % unsigned(static_cast<unsigned char>(rv[i]))).str().c_str());
- rv[i] = '\\';
- i += 3;
- }
-
- rv.insert(0,"\"");
- rv.push_back('"');
- return rv;
- }
-}
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
prefix_ long senf::console::detail::parseEnum(EnumTable const & table,
ParseCommandInfo::TokensRange const & tokens)
prefix_ std::string senf::console::detail::formatEnum(EnumTable const & table, long value)
{
EnumTable::right_map::const_iterator i (table.right.find(value));
- SENF_ASSERT( i != table.right.end() );
+ SENF_ASSERT( i != table.right.end(), "Invalid enum value" );
return i->second;
}
-///////////////////////////////cc.e////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
#undef prefix_
//#include "Traits.mpp"