]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - tools/elftosb/common/OptionContext.h
Unified codebase for TX28, TX48, TX51, TX53
[karo-tx-uboot.git] / tools / elftosb / common / OptionContext.h
1 /*
2  * File:        OptionContext.h
3  *
4  * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
5  * See included license file for license details.
6  */
7 #if !defined(_OptionContext_h_)
8 #define _OptionContext_h_
9
10 #include <string>
11 #include "Value.h"
12
13 namespace elftosb
14 {
15
16 /*!
17  * \brief Pure abstract interface class to a table of options.
18  */
19 class OptionContext
20 {
21 public: 
22         //! \brief Detemine whether the named option is present in the table.
23         //! \param name The name of the option to query.
24         //! \retval true The option is present and has a value.
25         //! \retval false No option with that name is in the table.
26         virtual bool hasOption(const std::string & name) const=0;
27         
28         //! \brief Returns the option's value.
29         //! \param name The name of the option.
30         //! \return The value for the option named \a name.
31         //! \retval NULL No option is in the table with that name.
32         virtual const Value * getOption(const std::string & name) const=0;
33         
34         //! \brief Adds or changes an option's value.
35         //!
36         //! If the option was not already present in the table, it is added.
37         //! Otherwise the old value is replaced.
38         //!
39         //! \param name The option's name.
40         //! \param value New value for the option.
41         virtual void setOption(const std::string & name, Value * value)=0;
42         
43         //! \brief Removes an option from the table.
44         //! \param name The name of the option to remove.
45         virtual void deleteOption(const std::string & name)=0;
46 };
47
48 }; // namespace elftosb
49
50 #endif // _OptionContext_h_