4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief Traits public header */
31 #include <boost/intrusive_ptr.hpp>
32 #include "../Utils/intrusive_refcount.hh"
36 //#include "Traits.mpp"
37 ///////////////////////////////hh.p////////////////////////////////////////
42 /** \brief Customize return value formating
44 ReturnValueTraits provides return value formatting. The default implementation provided here
45 will just write the value to the output stream.
47 To customize this behavior for some type, specialize this class for the type.
49 The output should \e not end in a newline since one is added automatically.
52 struct ReturnValueTraits
56 static void format(Type const & value, std::ostream & os);
57 ///< Write \a value to \a os
60 /** \brief Customize argument parsing
62 ArgumentTraits provides argument parsing, Additionally, this class provides a way to get a
63 string-description of a type and to convert a value back into it's string representation
64 used to display default values.
66 The default implementation provided here will use \c boost::lexical_cast and thereby \c
67 iostreams to convert an argument consisting of a single input token into the required
68 type. Types are named by returning the last component of the fully scoped name (e.g. \c
69 "string" for \c std::string). Values are formatted again using \c boost::lexical_cast.
71 To customize this behavior for some type, specialize this class for the type.
78 static void parse(ParseCommandInfo::TokensRange const & tokens, Type & out);
79 ///< Parse token range into value
80 /**< This function needs to parse \a tokens and write the
81 parsed value into \a out. This function needs to parse
82 the \e complete list of tokens, additional tokens must
83 be considered as syntax error.
84 \throws SyntaxErrorException
85 \param[in] tokens tokens to parse
86 \param[out] out parsed value */
88 static std::string description(); ///< String description of type
89 /**< Returns the string description of \a Type. Used to
90 generate online help. */
91 static std::string str(Type const & value); ///< Stringify value
92 /**< To show default values in the online help, this
93 function converts a value back into a one-line string
99 ///////////////////////////////hh.e////////////////////////////////////////
100 //#include "Traits.cci"
101 //#include "Traits.ct"
102 #include "Traits.cti"
109 // comment-column: 40
110 // c-file-style: "senf"
111 // indent-tabs-mode: nil
112 // ispell-local-dictionary: "american"
113 // compile-command: "scons -u test"