LCOV - code coverage report
Current view: top level - as2js/lib - options.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 8 8 100.0 %
Date: 2014-08-10 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* options.cpp -- written by Alexis WILKE for Made to Order Software Corp. (c) 2005-2014 */
       2             : 
       3             : /*
       4             : 
       5             : Copyright (c) 2005-2014 Made to Order Software Corp.
       6             : 
       7             : http://snapwebsites.org/project/as2js
       8             : 
       9             : Permission is hereby granted, free of charge, to any
      10             : person obtaining a copy of this software and
      11             : associated documentation files (the "Software"), to
      12             : deal in the Software without restriction, including
      13             : without limitation the rights to use, copy, modify,
      14             : merge, publish, distribute, sublicense, and/or sell
      15             : copies of the Software, and to permit persons to whom
      16             : the Software is furnished to do so, subject to the
      17             : following conditions:
      18             : 
      19             : The above copyright notice and this permission notice
      20             : shall be included in all copies or substantial
      21             : portions of the Software.
      22             : 
      23             : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
      24             : ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
      25             : LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
      26             : FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
      27             : EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
      28             : LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
      29             : WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
      30             : ARISING FROM, OUT OF OR IN CONNECTION WITH THE
      31             : SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
      32             : SOFTWARE.
      33             : 
      34             : */
      35             : 
      36             : #include "as2js/options.h"
      37             : 
      38             : 
      39             : namespace as2js
      40             : {
      41             : 
      42             : 
      43             : 
      44             : /** \brief Initialize an options object.
      45             :  *
      46             :  * The default constructor initializes the options array to the maximum
      47             :  * number of options. The options are all set to the default, zero (0).
      48             :  *
      49             :  * To change the option value, use the set_option() function. At this
      50             :  * point pretty much all the options accept either 0 or 1 as their
      51             :  * value, although any number of than 0 is considered to represent "set".
      52             :  */
      53     5816452 : Options::Options()
      54     5816452 :     : f_options(static_cast<size_t>(option_t::OPTION_max))
      55             : {
      56     5816452 : }
      57             : 
      58             : 
      59             : /** \brief Set an option to the specified value.
      60             :  *
      61             :  * This function sets the option to the specified value.
      62             :  *
      63             :  * At this point, all options expect the value to be 0 or 1, although
      64             :  * the system does not enforce that at this point. Any value is thus
      65             :  * accepted.
      66             :  *
      67             :  * Options make use of an int64_t so any 64 bit values works.
      68             :  *
      69             :  * \param[in] option  The option to set.
      70             :  * \param[in] value  The new 64 bit value for this option.
      71             :  */
      72    13523846 : void Options::set_option(option_t option, option_value_t value)
      73             : {
      74    13523846 :     f_options[static_cast<size_t>(option)] = value;
      75    13523846 : }
      76             : 
      77             : 
      78             : /** \brief Retrieve the current value of an option.
      79             :  *
      80             :  * This function is used to retrieve the current value of an option.
      81             :  * At this point, all options are expected to be zero (0), the default,
      82             :  * or one (1). It is possible to set options to other values, though.
      83             :  *
      84             :  * \param[in] option  The option to retrieve.
      85             :  *
      86             :  * \return The current value of this option.
      87             :  */
      88    14051229 : Options::option_value_t Options::get_option(option_t option)
      89             : {
      90    14051229 :     return f_options[static_cast<size_t>(option)];
      91             : }
      92             : 
      93             : 
      94             : }
      95             : // namespace as2js
      96             : 
      97             : // vim: ts=4 sw=4 et

Generated by: LCOV version 1.9