Changeset 824 for trunk/lib/yat


Ignore:
Timestamp:
Sep 26, 2009, 12:57:46 AM (12 years ago)
Author:
Peter Johansson
Message:

adding missing file Exception.h.diff

Location:
trunk/lib/yat
Files:
1 added
7 edited

Legend:

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

    r795 r824  
    1 // $Id: CommandLine.cc 1874 2009-03-17 22:09:01Z peter $
     1// $Id: CommandLine.cc 2046 2009-09-02 21:42:32Z peter $
    22
    33/*
     
    3333#include <functional>
    3434#include <fstream>
    35 #include <iostream>
     35#include <ostream>
    3636#include <sstream>
    3737#include <stdexcept>
  • trunk/lib/yat/CommandLine.h

    r795 r824  
    22#define _theplu_yat_utility_commandline_
    33
    4 //$Id: CommandLine.h 1954 2009-05-07 15:30:58Z jari $
     4//$Id: CommandLine.h 2054 2009-09-06 18:25:06Z peter $
    55
    66/*
     
    2626#include <cctype>
    2727#include <map>
    28 #include <iostream>
     28#include <iosfwd>
    2929#include <sstream>
    3030#include <stdexcept>
     
    5252     CommandLine cmd;
    5353     OptionHelp help(cmd);
    54      OptionInFile in(cmd, "i,in",
    55                      "Read input from file (rather than standard input)");
    56      OptionOutFile out(cmd, "o,out", "Place the output to file");
     54     OptionFile in(cmd, "i,in",
     55                   "Read input from file (rather than standard input)",
     56                   false, true, "r");
     57     OptionFile out(cmd, "o,out", "Place the output to file", false, false, "w");
    5758     OptionSwitch target(cmd, "T,target", "treat DEST as a normal file", true);
    5859     OptionSwitch verbose(cmd, "v,verbose", "explain what is being done");
     
    7980       return EXIT_SUCCESS;
    8081     }
     82     StreamRedirect sr_out(std::cout, out.value(), out.present());
     83     StreamRedirect sr_in(std::cin, in.value(), in.present());
    8184     ...
    8285     \endcode
     
    129132    /**
    130133       \brief parse the commandline
     134
     135       First the commandline is parsed to detect which options are
     136       present, then each Option parses the its relevant part of
     137       commandline (Option::parse()), and finally each Option is
     138       validated (Option::validate()).
    131139
    132140       throw cmd_error if an error is detected.
  • trunk/lib/yat/Option.h

    r795 r824  
    22#define _theplu_yat_utility_option_
    33
    4 // $Id: Option.h 1797 2009-02-12 18:07:10Z peter $
     4// $Id: Option.h 2046 2009-09-02 21:42:32Z peter $
    55
    66/*
    77  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2009 Peter Johansson
    89
    910  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2324*/
    2425
    25 #include <iostream>
    2626#include <string>
    2727#include <vector>
     
    104104       \brief Validate the Option
    105105
    106        This function is called after commandline is parsed.
     106       This function is called by CommandLine::parse() after all
     107       options have been detected and parsed (see Option::parse()).
    107108     */
    108109    void validate(void);
  • trunk/lib/yat/OptionArg.h

    r795 r824  
    22#define _theplu_yat_utility_option_arg_
    33
    4 // $Id: OptionArg.h 1797 2009-02-12 18:07:10Z peter $
     4// $Id: OptionArg.h 2046 2009-09-02 21:42:32Z peter $
    55
    66/*
     
    4545     "--support-gnu=value", POSIX-like "--support-posix value", as
    4646     well as shorter "-s value". The argument of an parameter is
    47      retrived by the value() function
     47     retrived by the value() function. The type \c T should be either
     48     a string or a type supported by function convert().
    4849   */
    4950  template<typename T>
  • trunk/lib/yat/OptionHelp.cc

    r823 r824  
    1 // $Id: OptionHelp.cc 1797 2009-02-12 18:07:10Z peter $
     1// $Id: OptionHelp.cc 2055 2009-09-08 18:23:43Z peter $
    22
    33/*
     
    2424
    2525#include <cstdlib>
    26 #include <sstream>
     26#include <iostream>
    2727#include <string>
    2828
  • trunk/lib/yat/deprecate.h

    r795 r824  
    22#define _theplu_yat_utility_deprecate_
    33
    4 // $Id: deprecate.h 1707 2009-01-12 22:51:35Z peter $
     4// $Id: deprecate.h 2062 2009-09-14 20:19:17Z peter $
    55
    66/*
     
    4141#endif
    4242
     43// With GCC version < 4.3 deprecation of classes yields no
     44// warning. Therefore, we deprecate the constructors of those classes
     45// with this macro YAT_DEPRECATE_GCC_PRE4_3, which is mute for
     46// compiler GCC 4.3 and newer and for others compilers than GCC.
     47#ifndef YAT_DEPRECATE_GCC_PRE4_3
     48#if defined(__GNUC__) && ((__GNUC__<4) || (__GNUC__==4 && __GNUC_MINOR__<3))
     49/// if GCC version before 4.3 define as YAT_DEPRECATE defined above
     50#define YAT_DEPRECATE_GCC_PRE4_3 YAT_DEPRECATE
     51#else
     52/// with GCC 4.3 and newer (or other compilers) define it as empty
     53#define YAT_DEPRECATE_GCC_PRE4_3
    4354#endif
     55#endif
     56
     57#endif
  • trunk/lib/yat/utility.h

    r795 r824  
    22#define _theplu_yat_utility_utility_
    33
    4 // $Id: utility.h 1971 2009-05-11 20:42:16Z peter $
     4// $Id: utility.h 2055 2009-09-08 18:23:43Z peter $
    55
    66/*
     
    205205    if (is_equal(s, "inf"))
    206206      return std::numeric_limits<T>::infinity();
    207     if (is_equal(s, "-inf"))
     207    if (is_equal(s, "-inf")) {
    208208      if (std::numeric_limits<T>::is_signed)
    209209        return -std::numeric_limits<T>::infinity();
     
    211211        throw std::runtime_error(std::string("yat::utility::convert(\"")+s+
    212212                                 std::string("\"): type is unsigned") );
     213    }
    213214    std::stringstream ss(s);
    214215    T a;
Note: See TracChangeset for help on using the changeset viewer.