Home | History | Annotate | Download | only in d
      1 /* -----------------------------------------------------------------------------
      2  * director.swg
      3  *
      4  * This file contains support for director classes so that D proxy
      5  * methods can be called from C++.
      6  * ----------------------------------------------------------------------------- */
      7 
      8 #ifdef __cplusplus
      9 
     10 #if defined(DEBUG_DIRECTOR_OWNED)
     11 #include <iostream>
     12 #endif
     13 #include <string>
     14 
     15 namespace Swig {
     16   // Director base class  not used in D directors.
     17   class Director {
     18   };
     19 
     20   // Base class for director exceptions.
     21   class DirectorException {
     22   protected:
     23     std::string swig_msg;
     24 
     25   public:
     26     DirectorException(const char* msg) : swig_msg(msg) {
     27     }
     28     DirectorException(const std::string &msg) : swig_msg(msg) {
     29     }
     30     const std::string& what() const {
     31       return swig_msg;
     32     }
     33     virtual ~DirectorException() {
     34     }
     35   };
     36 
     37   // Exception which is thrown when attempting to call a pure virtual method
     38   // from D code thorugh the director layer.
     39   class DirectorPureVirtualException : public Swig::DirectorException {
     40   public:
     41     DirectorPureVirtualException(const char* msg) : DirectorException(std::string("Attempted to invoke pure virtual method ") + msg) {
     42     }
     43   };
     44 }
     45 
     46 #endif /* __cplusplus */
     47