• Main Page
  • Classes
  • Files
  • File List

XArch.h

00001 /*
00002  * synergy -- mouse and keyboard sharing utility
00003  * Copyright (C) 2012 Bolton Software Ltd.
00004  * Copyright (C) 2002 Chris Schoeneman
00005  * 
00006  * This package is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * found in the file COPYING that should have accompanied this file.
00009  * 
00010  * This package is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017  */
00018 
00019 #ifndef XARCH_H
00020 #define XARCH_H
00021 
00022 #include "common.h"
00023 #include "stdstring.h"
00024 
00026 
00031 class XThread { };
00032 
00034 
00038 class XThreadCancel : public XThread { };
00039 
00046 #define RETHROW_XTHREAD \
00047     try { throw; } catch (XThread&) { throw; } catch (...) { }
00048 
00050 
00056 class XArchEval {
00057 public:
00058     XArchEval() { }
00059     virtual ~XArchEval() { }
00060 
00061     virtual XArchEval*  clone() const throw() = 0;
00062 
00063     virtual std::string eval() const throw() = 0;
00064 };
00065 
00067 class XArch {
00068 public:
00069     XArch(XArchEval* adoptedEvaluator) : m_eval(adoptedEvaluator) { }
00070     XArch(const std::string& msg) : m_eval(NULL), m_what(msg) { }
00071     XArch(const XArch& e) : m_eval(e.m_eval != NULL ? e.m_eval->clone() : NULL),
00072                             m_what(e.m_what) { }
00073     ~XArch() { delete m_eval; }
00074 
00075     std::string         what() const throw();
00076 
00077 private:
00078     XArchEval*          m_eval;
00079     mutable std::string m_what;
00080 };
00081 
00082 // Macro to declare XArch derived types
00083 #define XARCH_SUBCLASS(name_, super_)                                   \
00084 class name_ : public super_ {                                           \
00085 public:                                                                 \
00086     name_(XArchEval* adoptedEvaluator) : super_(adoptedEvaluator) { }   \
00087     name_(const std::string& msg) : super_(msg) { }                     \
00088 }
00089 
00091 
00095 XARCH_SUBCLASS(XArchNetwork, XArch);
00096 
00098 XARCH_SUBCLASS(XArchNetworkInterrupted, XArchNetwork);
00099 
00101 XARCH_SUBCLASS(XArchNetworkAccess, XArchNetwork);
00102 
00104 XARCH_SUBCLASS(XArchNetworkResource, XArchNetwork);
00105 
00107 XARCH_SUBCLASS(XArchNetworkSupport, XArchNetwork);
00108 
00110 XARCH_SUBCLASS(XArchNetworkIO, XArchNetwork);
00111 
00113 XARCH_SUBCLASS(XArchNetworkNoAddress, XArchNetwork);
00114 
00116 XARCH_SUBCLASS(XArchNetworkAddressInUse, XArchNetwork);
00117 
00119 XARCH_SUBCLASS(XArchNetworkNoRoute, XArchNetwork);
00120 
00122 XARCH_SUBCLASS(XArchNetworkNotConnected, XArchNetwork);
00123 
00125 XARCH_SUBCLASS(XArchNetworkShutdown, XArchNetwork);
00126 
00128 XARCH_SUBCLASS(XArchNetworkDisconnected, XArchNetwork);
00129 
00131 XARCH_SUBCLASS(XArchNetworkConnectionRefused, XArchNetwork);
00132 
00134 XARCH_SUBCLASS(XArchNetworkTimedOut, XArchNetwork);
00135 
00137 XARCH_SUBCLASS(XArchNetworkName, XArchNetwork);
00138 
00140 XARCH_SUBCLASS(XArchNetworkNameUnknown, XArchNetworkName);
00141 
00143 XARCH_SUBCLASS(XArchNetworkNameNoAddress, XArchNetworkName);
00144 
00146 XARCH_SUBCLASS(XArchNetworkNameFailure, XArchNetworkName);
00147 
00149 XARCH_SUBCLASS(XArchNetworkNameUnavailable, XArchNetworkName);
00150 
00152 XARCH_SUBCLASS(XArchNetworkNameUnsupported, XArchNetworkName);
00153 
00155 
00159 XARCH_SUBCLASS(XArchDaemon, XArch);
00160 
00162 XARCH_SUBCLASS(XArchDaemonFailed, XArchDaemon);
00163 
00165 XARCH_SUBCLASS(XArchDaemonInstallFailed, XArchDaemon);
00166 
00168 XARCH_SUBCLASS(XArchDaemonUninstallFailed, XArchDaemon);
00169 
00171 XARCH_SUBCLASS(XArchDaemonUninstallNotInstalled, XArchDaemonUninstallFailed);
00172 
00173 
00174 #endif

Generated on Fri May 24 2013 00:00:04 for Synergy by  doxygen 1.7.1