Changeset 2964


Ignore:
Timestamp:
Jan 22, 2013, 5:49:14 AM (9 years ago)
Author:
Peter
Message:

prefer quoting like 'this' and not like `this'

Location:
trunk/yat/utility
Files:
6 edited

Legend:

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

    r2881 r2964  
    166166      *arg = value;
    167167      *(--arg) = std::string("--")+key;
    168     }         
     168    }
    169169    else
    170170      *arg = key;
     
    173173    if (iter!=long_options_.end())
    174174      iter->second->parse(arg, last);
    175     else if (key.size()>3 && key.substr(0,3)=="no-") { 
     175    else if (key.size()>3 && key.substr(0,3)=="no-") {
    176176      iter = long_options_.find(key.substr(3));
    177177      if (iter!=long_options_.end())
    178178        iter->second->parse(arg, last);
    179     }           
     179    }
    180180    if (iter==long_options_.end()) {
    181181      std::stringstream ss3;
    182       ss3 << "unrecognized option `" << key << "'\n" << try_help();
     182      ss3 << "unrecognized option '" << key << "'\n" << try_help();
    183183      throw cmd_error(ss3.str());
    184184    }
     
    250250  std::string CommandLine::try_help(void) const
    251251  {
    252     return std::string("Try `"+program_name()+" --help' for more information.");
     252    return std::string("Try '"+program_name()+" --help' for more information.");
    253253  }
    254254
  • trunk/yat/utility/CommandLine.h

    r2817 r2964  
    182182
    183183    /**
    184        \return something like "Try `<program_name()> --help` for
     184       \return something like "Try '<program_name()> --help' for
    185185       more information."
    186186     */
  • trunk/yat/utility/OptionArg.h

    r2384 r2964  
    5353  public:
    5454    /**
    55        \brief Constructor 
    56        
    57        \param cmd Commandline Option is associated with 
     55       \brief Constructor
     56
     57       \param cmd Commandline Option is associated with
    5858       \param name string such as "help" for --help, "h" for -h or
    5959       "h,help" for having both short and long option name
     
    6767
    6868    /**
    69        \param arg string to be used in help output such as `=TARGET'
    70        in `--target=TARGET'. See print3().
     69       \param arg string to be used in help output such as '=TARGET'
     70       in '--target=TARGET'. See print3().
    7171
    7272       \since New in yat 0.5.
     
    7777       \return value
    7878    */
    79     T value(void) const 
    80     { 
     79    T value(void) const
     80    {
    8181      if (!cmd().parsed()) {
    8282        std::string s("OptionArg::value called before Commandline was parsed");
    8383        throw std::logic_error(s);
    8484      }
    85       return value_; 
     85      return value_;
    8686    }
    8787
     
    105105    T value_;
    106106
    107     void do_parse(std::vector<std::string>::iterator& first, 
    108                   const std::vector<std::string>::iterator& last) 
     107    void do_parse(std::vector<std::string>::iterator& first,
     108                  const std::vector<std::string>::iterator& last)
    109109    {
    110110      if ( first->size()>2 && (*first)[0]=='-' && (*first)[1]!='-'){
     
    117117        if (first->size()>2){
    118118          std::stringstream ss;
    119           ss << "option `--" << long_name() << "' requires an argument\n"
     119          ss << "option '--" << long_name() << "' requires an argument\n"
    120120             << cmd().try_help();
    121121          throw cmd_error(ss.str());
     
    127127          throw cmd_error(ss.str());
    128128        }
    129       }       
    130        
     129      }
     130
    131131      if ( *(first+1)->begin() == '"' && *((first+1)->end()-1) == '"')
    132         *(first+1) = (first+1)->substr(1, (first+1)->size()-2); 
     132        *(first+1) = (first+1)->substr(1, (first+1)->size()-2);
    133133      assign(value_, *(++first));
    134134    }
    135135
    136136    void assign(std::string& lhs, const std::string& rhs )
    137     { 
     137    {
    138138      lhs = rhs;
    139139    }
    140    
     140
    141141    template<class T1>
    142142    void assign(T1& lhs, const std::string& rhs )
    143     { 
     143    {
    144144      try {
    145145        lhs = convert<T1>(rhs);
     
    148148        std::stringstream sstr(rhs);
    149149        sstr << "invalid argument";
    150         sstr << "`" << rhs << "' for `";
     150        sstr << "'" << rhs << "' for '";
    151151        if (!long_name().empty())
    152152          sstr << "--" << long_name();
     
    160160    /**
    161161     */
    162     void do_validate(void) const 
     162    void do_validate(void) const
    163163    {
    164164      if (required_ && !present()) {
    165165        std::stringstream ss;
    166         ss << "mandatory option `";
     166        ss << "mandatory option '";
    167167        if (long_name().size())
    168168          ss << long_name();
     
    179179    virtual void do_validate2(void) const {}
    180180
    181     virtual std::string print3(void) const 
    182     { 
    183       return print_arg_; 
     181    virtual std::string print3(void) const
     182    {
     183      return print_arg_;
    184184    }
    185185
  • trunk/yat/utility/OptionFile.cc

    r2919 r2964  
    4848
    4949  void OptionFile::do_validate2() const
    50   {   
     50  {
    5151    if (!present())
    5252      return;
     
    5858    catch (IO_error& e) {
    5959      std::stringstream ss;
    60       ss << "cannot stat `" << value() << "': " << strerror(errno);
     60      ss << "cannot stat '" << value() << "': " << strerror(errno);
    6161      errno = 0;
    6262      throw cmd_error(ss.str());
     
    6464    if (exist_ && !exists){
    6565      std::stringstream ss;
    66       ss << "cannot stat `" << value() << "': No such file or directory";
     66      ss << "cannot stat '" << value() << "': No such file or directory";
    6767      throw cmd_error(ss.str());
    6868    }
    6969    if (fu.permissions(bits_)) {
    7070      // Peter, this loop is stupid but I wanna differentiate the error message
    71       for (std::string::const_iterator iter=bits_.begin(); 
     71      for (std::string::const_iterator iter=bits_.begin();
    7272           iter!=bits_.end(); ++iter) {
    7373        if (*iter=='r' && fu.permissions("r")){
    7474          std::stringstream ss;
    75           ss << "cannot open `" << value() << "' for reading: "
     75          ss << "cannot open '" << value() << "' for reading: "
    7676             << strerror(errno);
    7777          throw cmd_error(ss.str());
     
    7979        else if (*iter=='w' && fu.permissions("w")){
    8080          std::stringstream ss;
    81           ss << "cannot create file `" << value()
     81          ss << "cannot create file '" << value()
    8282             << "': " << strerror(errno);
    8383          throw cmd_error(ss.str());
     
    8585      }
    8686      std::stringstream ss;
    87       ss << "`" << value() << "': " << strerror(errno);
     87      ss << "'" << value() << "': " << strerror(errno);
    8888      throw cmd_error(ss.str());
    8989    }
  • trunk/yat/utility/stl_utility.h

    r2963 r2964  
    829829    if (iter==m.end()) {
    830830      std::stringstream ss;
    831       ss << "utility::get(const Map&, const Key&): `"
     831      ss << "utility::get(const Map&, const Key&): '"
    832832         << key << "' not found in map\n";
    833833      throw runtime_error(ss.str());
  • trunk/yat/utility/yat_assert.h

    r2384 r2964  
    5555// invisible outside macro, or multiple calls to macro would result in
    5656// multiple declaration of the stringstream. Also the macro is
    57 // supposed to be called with a trailing `;', and that's why we need
     57// supposed to be called with a trailing ';', and that's why we need
    5858// to end with something that allows that.
    5959#define YAT_ASSERT(expr) \
    6060  if (!(expr)) {                                                \
    6161    std::stringstream yat_msg_;                                 \
    62     yat_msg_ << __FILE__ << ":" << __LINE__ << " failed assertion `" \
     62    yat_msg_ << __FILE__ << ":" << __LINE__ << " failed assertion '" \
    6363             << #expr << "'";                                           \
    6464    theplu::yat::utility::yat_assert<theplu::yat::utility::runtime_error>(expr, \
Note: See TracChangeset for help on using the changeset viewer.