Ignore:
Timestamp:
Dec 15, 2012, 7:29:55 AM (9 years ago)
Author:
Peter
Message:

New functions chdir, chmod, copy_file, fnmatch, remove, rename, and replace
refs #717

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/utility.h

    r2892 r2906  
    5757  /**
    5858     \return everything after last '/'
     59
     60     \since New in yat 0.10
    5961   */
    6062  std::string basename(const std::string& fn);
     
    7577
    7678  /**
     79     wrapper around GNU C Library function chdir
     80
     81     \throw if underlying chdir call does not return 0
     82
     83     \since New in yat 0.10
     84   */
     85  void chdir(const std::string& dir);
     86
     87  /**
     88     \since New in yat 0.10
     89   */
     90  void chmod(const std::string& filename, mode_t mode);
     91
     92  /**
    7793     \brief convert T to a string
    7894
     
    93109
    94110  /**
     111     @brief Copy file \a source to \a target.
     112
     113     @throw std::runtime_error when read error of \a source or write
     114     error for \a target is encountered.
     115  */
     116  void copy_file(const std::string& source, const std::string& target);
     117
     118  /**
    95119     \return everything prior last '/'.
     120
     121     \since New in yat 0.10
    96122   */
    97123  std::string dirname(const std::string& fn);
     124
     125  /**
     126     \return true if \a str matches \a pattern
     127
     128     \see fnmatch(3)
     129
     130     \since New in yat 0.10
     131  */
     132  bool fnmatch(const std::string& pattern, const std::string& str);
    98133
    99134  /**
     
    285320   */
    286321  void mkdir_p(const std::string& dir);
     322
     323  /**
     324     same as C function remove but throws errno_error at failure
     325
     326     \see man remove
     327   */
     328  void remove(const std::string& fn);
     329
     330  /**
     331     same as rename(2) but throws errno_error if error is encountered
     332
     333     \see man rename
     334
     335     \since New in yat 0.10
     336   */
     337  void rename(const std::string& from, const std::string to);
     338
     339  /**
     340     In \a full_str replace every sub-string \a old_str with \a
     341     new_str;
     342   */
     343  void replace(std::string& full_str, std::string old_str, std::string new_str);
    287344
    288345  // template implementations
     
    385442      pusher(element, vec);
    386443    }
    387   }           
    388 
     444  }
    389445
    390446namespace detail {
Note: See TracChangeset for help on using the changeset viewer.