~ubuntu-branches/ubuntu/intrepid/schroot/intrepid

« back to all changes in this revision

Viewing changes to sbuild/sbuild-parse-value.cc

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2006-07-08 18:33:28 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060708183328-rlo4mpldmyoda55q
Tags: 0.99.2-2ubuntu1
* remerge ubuntu changes:
  + debian/control: libpam-dev (>> 0.79-3ubuntu6)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright © 2005-2006  Roger Leigh <rleigh@debian.org>
 
2
 *
 
3
 * schroot is free software; you can redistribute it and/or modify it
 
4
 * under the terms of the GNU General Public License as published by
 
5
 * the Free Software Foundation; either version 2 of the License, or
 
6
 * (at your option) any later version.
 
7
 *
 
8
 * schroot is distributed in the hope that it will be useful, but
 
9
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
11
 * General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program; if not, write to the Free Software
 
15
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 
16
 * MA  02111-1307  USA
 
17
 *
 
18
 *********************************************************************/
 
19
 
 
20
#include <config.h>
 
21
 
 
22
#include "sbuild-parse-value.h"
 
23
 
 
24
using namespace sbuild;
 
25
 
 
26
void
 
27
sbuild::parse_value (std::string const& value,
 
28
                     bool&              parsed_value)
 
29
{
 
30
  if (value == "true" || value == "yes" || value == "1")
 
31
    parsed_value = true;
 
32
  else if (value == "false" || value == "no" || value == "0")
 
33
    parsed_value = false;
 
34
  else
 
35
    {
 
36
      log_debug(DEBUG_NOTICE) << "parse error" << std::endl;
 
37
      throw parse_error(parse_error::BAD_VALUE, value);
 
38
    }
 
39
 
 
40
  log_debug(DEBUG_NOTICE) << "value=" << parsed_value << std::endl;
 
41
}
 
42
 
 
43
void
 
44
sbuild::parse_value (std::string const& value,
 
45
                     std::string&       parsed_value)
 
46
{
 
47
  parsed_value = value;
 
48
  log_debug(DEBUG_NOTICE) << "value=" << parsed_value << std::endl;
 
49
}
 
50
 
 
51
/*
 
52
 * Local Variables:
 
53
 * mode:C++
 
54
 * End:
 
55
 */