"Fossies" - the Fresh Open Source Software Archive

Member "encfs-1.9.5/encfs/Error.h" (27 Apr 2018, 1199 Bytes) of package /linux/misc/encfs-1.9.5.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "Error.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.9.4_vs_1.9.5.

    1 #ifndef _Error_incl_
    2 #define _Error_incl_
    3 
    4 // Provides compatibility with RLog's rAssert, which throws an Error exception.
    5 
    6 #include "easylogging++.h"
    7 #include <stdexcept>
    8 
    9 // Cygwin / WinFsp does not support EBADMSG yet
   10 // https://github.com/billziss-gh/winfsp/issues/156
   11 #ifdef __CYGWIN__
   12 #undef EBADMSG
   13 #define EBADMSG EINVAL
   14 #endif
   15 
   16 namespace encfs {
   17 
   18 class Error : public std::runtime_error {
   19  public:
   20   Error(const char *msg);
   21 };
   22 
   23 #define STR(X) #X
   24 
   25 #define rAssert(cond)                                \
   26   do {                                               \
   27     if ((cond) == false) {                           \
   28       RLOG(ERROR) << "Assert failed: " << STR(cond); \
   29       throw encfs::Error(STR(cond));                 \
   30     }                                                \
   31   } while (false)
   32 
   33 void initLogging(bool enable_debug = false, bool is_daemon = false);
   34 
   35 // This can be changed to change log action between normal and syslog logging.
   36 // Not thread-safe, so any change must occur outside of threading context.
   37 extern el::base::DispatchAction rlogAction;
   38 
   39 #define RLOG(LEVEL, ...) \
   40   C##LEVEL(el::base::Writer, rlogAction, ELPP_CURR_FILE_LOGGER_ID)
   41 
   42 }  // namespace encfs
   43 
   44 #endif