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