Changeset 1039 for trunk/lib


Ignore:
Timestamp:
Mar 7, 2010, 2:44:11 AM (11 years ago)
Author:
Peter Johansson
Message:

updating to the latest yat. refs #410

Location:
trunk/lib/yat
Files:
1 added
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/yat/CommandLine.cc

    r983 r1039  
    1 // $Id: CommandLine.cc 2119 2009-12-12 23:11:43Z peter $
     1// $Id: CommandLine.cc 2210 2010-03-05 22:59:01Z peter $
    22
    33/*
     
    55  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    66  Copyright (C) 2009 Peter Johansson
     7  Copyright (C) 2010 Jari Häkkinen, Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    6061        ss << "yat::utility::Commandline: two options with long_name: "
    6162           << option.long_name();
    62         throw std::runtime_error(ss.str());
     63        throw runtime_error(ss.str());
    6364      }
    6465      long_options_[option.long_name()] = &option;
     
    6970        ss << "yat::utility::Commandline: two options with short_name: "
    7071           << option.short_name();
    71         throw std::runtime_error(ss.str());
     72        throw runtime_error(ss.str());
    7273      }
    7374      short_options_[option.short_name()] = &option;
  • trunk/lib/yat/CommandLine.h

    r1027 r1039  
    22#define _theplu_yat_utility_commandline_
    33
    4 //$Id: CommandLine.h 2121 2009-12-13 16:17:07Z peter $
     4//$Id: CommandLine.h 2202 2010-02-21 18:39:13Z peter $
    55
    66/*
    7   Copyright (C) 2007, 2008, 2009 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2007, 2008, 2009, 2010 Jari Häkkinen, Peter Johansson
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/lib/yat/Exception.h

    r983 r1039  
    22#define _theplu_yat_utility_exception_
    33
    4 // $Id: Exception.h 2119 2009-12-12 23:11:43Z peter $
     4// $Id: Exception.h 2210 2010-03-05 22:59:01Z peter $
    55
    66/*
    77  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2010 Peter Johansson
    89
    910  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3031namespace utility {
    3132
     33 
     34
     35  /**
     36     \brief Class used for all runtime error detected within yat library.
     37   */
     38  class runtime_error : public std::runtime_error
     39  {
     40  public:
     41    /**
     42       \brief Constructor
     43
     44       \param message message to be displayed using function what().
     45     */
     46    runtime_error(std::string message);
     47  };
     48
     49
    3250  /**
    3351     \brief Class used for error reported from Commandline or Option.
     
    4159       \param message message to be displayed using function what().
    4260     */
    43     inline cmd_error(std::string message)
    44       : std::runtime_error(message) {}
     61    cmd_error(std::string message);
     62  };
     63
     64
     65  /**
     66     \brief Class that contains information reported bia global
     67     variable errno.
     68   */
     69  class errno_error : public std::runtime_error
     70  {
     71  public:
     72    /**
     73       The error message, return from what(), is set to
     74       \a message + strerror(errno)
     75     */
     76    errno_error(std::string message);
     77  };
     78
     79  /**
     80     \brief Class for errors reported from underlying GSL calls.
     81
     82     GSL_error is used in the same way as C++ standard library
     83     exceptions.
     84  */
     85  class GSL_error : public std::runtime_error
     86  {
     87  public:
     88    /**
     89       \brief Constructor to create an exception with a message.
     90    */
     91    GSL_error(std::string message);
     92
     93    /**
     94       \brief Constructor to create an exception with a message
     95       containg the GSL error description.
     96    */
     97    GSL_error(std::string message, int gsl_status);
    4598  };
    4699
     
    58111       \brief Constructor to create an exception with a message.
    59112    */
    60     inline IO_error(std::string message) throw()
    61       : std::runtime_error("IO_error: " + message) {}
     113    IO_error(std::string message);
    62114  };
    63115
  • trunk/lib/yat/Makefile.am

    r887 r1039  
    4242libyat_a_SOURCES += ColumnStream.cc
    4343libyat_a_SOURCES += CommandLine.cc
     44libyat_a_SOURCES += Exception.cc
    4445libyat_a_SOURCES += Option.cc
    4546libyat_a_SOURCES += OptionHelp.cc
     
    5758  test -d Fetchdir || $(SVN) co $(yat_url) Fetchdir
    5859  (cd Fetchdir && $(SVN) revert -Rq . && $(SVN) update)
    59   cp $(srcdir)/Exception.h.diff Fetchdir
    60   (cd Fetchdir && patch -i Exception.h.diff || exit 1)
     60  cp $(srcdir)/Exception.cc.patch Fetchdir
     61  (cd Fetchdir && patch -i Exception.cc.patch || exit 1)
    6162  @for f in $(FETCH_FILES); do \
    6263    $(MOVE_IF_CHANGE) -v Fetchdir/$$f $(srcdir)/$$f; \
  • trunk/lib/yat/Option.cc

    r983 r1039  
    1 // $Id: Option.cc 2119 2009-12-12 23:11:43Z peter $
     1// $Id: Option.cc 2210 2010-03-05 22:59:01Z peter $
    22
    33/*
     
    2323#include "Option.h"
    2424#include "CommandLine.h"
     25#include "Exception.h"
    2526
    2627#include <iostream>
    2728#include <sstream>
    28 #include <stdexcept>
    2929#include <string>
    3030
     
    3838  {
    3939    if (flag.empty())
    40       throw std::runtime_error("yat: Option: given flag is empty");
     40      throw runtime_error("yat: Option: given flag is empty");
    4141    if (flag.size()==1 || (flag.size()==2 && flag[1]==','))
    4242      short_name_ = flag[0];
     
    8989  {
    9090    if (!cmd().parsed()) {
    91       std::string s("Option::present called before Commandline was parsed");
     91      std::string s("theplu::yat::utility::Option::present");
     92      s += " called before Commandline was parsed";
    9293      throw std::logic_error(s);
    9394    }
  • trunk/lib/yat/OptionArg.h

    r1028 r1039  
    22#define _theplu_yat_utility_option_arg_
    33
    4 // $Id: OptionArg.h 2173 2010-01-27 18:02:54Z peter $
     4// $Id: OptionArg.h 2210 2010-03-05 22:59:01Z peter $
    55
    66/*
     
    145145        lhs = convert<T1>(rhs);
    146146      }
    147       catch (std::runtime_error& e) {
     147      catch (runtime_error& e) {
    148148        std::stringstream sstr(rhs);
    149149        sstr << ": invalid argument";
  • trunk/lib/yat/README

    r826 r1039  
    88fetch'. Be careful doing this and particularly in sensitive branches
    99such as a stable-branch. All files are left pristine except
    10 `Exception.h' that is modified to avoid a dependency to GSL.
     10`Exception.cc' that is modified to avoid a dependency to GSL.
    1111
    1212How to add a new file from yat? Add the file to 'noinst_HEADERS' or
     
    1919
    2020
    21 Copyright (C) 2009 Peter Johansson
     21Copyright (C) 2009, 2010 Peter Johansson
    2222
    2323This file is part of svndigest, http://dev.thep.lu.se/svndigest
  • trunk/lib/yat/utility.h

    r983 r1039  
    22#define _theplu_yat_utility_utility_
    33
    4 // $Id: utility.h 2119 2009-12-12 23:11:43Z peter $
     4// $Id: utility.h 2210 2010-03-05 22:59:01Z peter $
    55
    66/*
     
    212212        return -std::numeric_limits<T>::infinity();
    213213      else
    214         throw std::runtime_error(std::string("yat::utility::convert(\"")+s+
    215                                  std::string("\"): type is unsigned") );
     214        throw runtime_error(std::string("yat::utility::convert(\"")+s+
     215                            std::string("\"): type is unsigned") );
    216216    }
    217217    std::stringstream ss(s);
     
    225225    ss >> b;
    226226    if (!b.empty() || !ok)
    227       throw std::runtime_error(std::string("yat::utility::convert(\"")+s+
    228                                std::string("\")"));
     227      throw runtime_error(std::string("yat::utility::convert(\"")+s+
     228                          std::string("\")"));
    229229    return a;
    230230  }
Note: See TracChangeset for help on using the changeset viewer.