1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2008 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
41 /*! Attempts to set option \a name to \a value for the ImageFileHandler that
42 handles files with the given \a suffix.
43 If successful \c true is returned, false otherwise.
44 For the operation to succeed a \c boost::lexical_cast<> from the given type
45 has to succeed, usually that means an appropriate overload of
46 \c operator<< has to be available.
48 \param[in] suffix File extension to choose the image type
49 this option applies to.
50 \param[in] name Name of the option.
51 \param[in] value Value of the option.
52 \return Whether the value was set successfully.
54 template <class ValueTypeT>
56 ImageFileHandlerBase::setOptionAs(
57 const std::string &suffix,
58 const std::string &name,
59 const ValueTypeT &value )
62 ImageFileType *type = getFileType(suffix.c_str());
66 retVal = type->setOptionAs<ValueTypeT>(name, value);
72 /*! Retrieves the option \a name from the ImageFileType that handles files
73 with the given \a suffix and stores its value in \a value.
74 Returns \c true if successful, \c false otherwise in which case \a value has
77 \param[in] suffix File extension to choose the image type
78 this option applies to.
79 \param[in] name Name of the option.
80 \param[out] value Value the option.
81 \return Whether the option is present for the given ImageFileType.
83 template <class ValueTypeT>
85 ImageFileHandlerBase::getOptionAs(
86 const std::string &suffix,
87 const std::string &name,
91 ImageFileType *type = getFileType(suffix.c_str());
95 retVal = type->getOptionAs<ValueTypeT>(name, value);