00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00047 #ifndef XCOVER_INCL_XCOVER_INTERNAL_H_REPORTER
00048 #define XCOVER_INCL_XCOVER_INTERNAL_H_REPORTER
00049
00050 #ifndef XCOVER_DOCUMENTATION_SKIP_SECTION
00051 # define XCOVER_VER_XCOVER_INTERNAL_H_REPORTER_MAJOR 1
00052 # define XCOVER_VER_XCOVER_INTERNAL_H_REPORTER_MINOR 0
00053 # define XCOVER_VER_XCOVER_INTERNAL_H_REPORTER_REVISION 2
00054 # define XCOVER_VER_XCOVER_INTERNAL_H_REPORTER_EDIT 2
00055 #endif
00056
00057
00058
00059
00060
00061 struct xcover_reporter_tVTable
00062 {
00063 void (XCOVER_CALLCONV* xcover_reporter_onBeginGroupReport)(xcover_reporter_t* instance, char const* groupName);
00064 void (XCOVER_CALLCONV* xcover_reporter_onEndGroupReport)(xcover_reporter_t* instance, char const* groupName);
00065
00066 void (XCOVER_CALLCONV* xcover_reporter_onBeginFileReport)(xcover_reporter_t* instance, char const* fileName, char const* aliasName);
00067 void (XCOVER_CALLCONV* xcover_reporter_onEndFileReport)(xcover_reporter_t* instance, char const* fileName, char const* aliasName, unsigned n);
00068
00069 void (XCOVER_CALLCONV* xcover_reporter_onReportItem)(xcover_reporter_t* reporter, xcover_coverItem_t const* item);
00070 };
00071
00072 struct xcover_reporter_t
00073 {
00074 #ifdef __cplusplus
00075 private:
00076 #endif
00077 struct xcover_reporter_tVTable *const vtable;
00078 #ifdef __cplusplus
00079 public:
00080 typedef xcover_reporter_t interface_type;
00081 protected:
00082 typedef struct xcover_reporter_tVTable vtable_t;
00083
00084 vtable_t *get_vtable_()
00085 {
00086 return vtable;
00087 }
00088 vtable_t const *get_vtable_() const
00089 {
00090 return vtable;
00091 }
00092
00093 protected:
00094 xcover_reporter_t(struct xcover_reporter_tVTable *vt)
00095 : vtable(vt)
00096 {}
00097 ~xcover_reporter_t()
00098 {}
00099 public:
00100 inline void onBeginGroupReport(char const* groupName)
00101 {
00102 STLSOFT_ASSERT(NULL != get_vtable_());
00103 get_vtable_()->xcover_reporter_onBeginGroupReport(this, groupName);
00104 }
00105 inline void onEndGroupReport(char const* groupName)
00106 {
00107 STLSOFT_ASSERT(NULL != get_vtable_());
00108 get_vtable_()->xcover_reporter_onEndGroupReport(this, groupName);
00109 }
00110 inline void onBeginFileReport(char const* fileName, char const* aliasName)
00111 {
00112 STLSOFT_ASSERT(NULL != get_vtable_());
00113 get_vtable_()->xcover_reporter_onBeginFileReport(this, fileName, aliasName);
00114 }
00115 inline void onEndFileReport(char const* fileName, char const* aliasName, unsigned n)
00116 {
00117 STLSOFT_ASSERT(NULL != get_vtable_());
00118 get_vtable_()->xcover_reporter_onEndFileReport(this, fileName, aliasName, n);
00119 }
00120 inline void onReportItem(xcover_coverItem_t const* item)
00121 {
00122 STLSOFT_ASSERT(NULL != get_vtable_());
00123 get_vtable_()->xcover_reporter_onReportItem(this, item);
00124 }
00125 private:
00126 xcover_reporter_t(xcover_reporter_t const &rhs);
00127 xcover_reporter_t &operator =(xcover_reporter_t const &rhs);
00128 #endif
00129 };
00130
00131 #ifdef __cplusplus
00132 # ifdef XCOVER_INTRINSIC_VTABLES_ARE_PORTABLE
00133 typedef xcover_reporter_t xcover_reporter_concrete_t;
00134 # else
00135 struct xcover_reporter_concrete_t
00136 : public xcover_reporter_t
00137 {
00138 public:
00139 typedef xcover_reporter_concrete_t class_type;
00140 private:
00141 typedef xcover_reporter_t::vtable_t vtable_t;
00142
00143 public:
00144 xcover_reporter_concrete_t()
00145 : xcover_reporter_t(get_VTable())
00146 {}
00147 xcover_reporter_concrete_t(class_type const &)
00148 : xcover_reporter_t(get_VTable())
00149 {}
00150 xcover_reporter_concrete_t &operator =(class_type const &)
00151 {
00152 return *this;
00153 }
00154
00155
00156 public:
00157 virtual void XCOVER_CALLCONV onBeginGroupReport(char const* groupName) = 0;
00158 virtual void XCOVER_CALLCONV onEndGroupReport(char const* groupName) = 0;
00159 virtual void XCOVER_CALLCONV onBeginFileReport(char const* fileName, char const* aliasName) = 0;
00160 virtual void XCOVER_CALLCONV onEndFileReport(char const* fileName, char const* aliasName, unsigned n) = 0;
00161 virtual void XCOVER_CALLCONV onReportItem(xcover_coverItem_t const* item) = 0;
00162
00163 private:
00164 static void XCOVER_CALLCONV onBeginGroupReport_(xcover_reporter_t *this_, char const* groupName)
00165 {
00166 static_cast<class_type*>(this_)->onBeginGroupReport(groupName);
00167 }
00168 static void XCOVER_CALLCONV onEndGroupReport_(xcover_reporter_t *this_, char const* groupName)
00169 {
00170 static_cast<class_type*>(this_)->onEndGroupReport(groupName);
00171 }
00172 static void XCOVER_CALLCONV onBeginFileReport_(xcover_reporter_t *this_, char const* fileName, char const* aliasName)
00173 {
00174 static_cast<class_type*>(this_)->onBeginFileReport(fileName, aliasName);
00175 }
00176 static void XCOVER_CALLCONV onEndFileReport_(xcover_reporter_t *this_, char const* fileName, char const* aliasName, unsigned n)
00177 {
00178 static_cast<class_type*>(this_)->onEndFileReport(fileName, aliasName, n);
00179 }
00180 static void XCOVER_CALLCONV onReportItem_(xcover_reporter_t *this_, xcover_coverItem_t const* item)
00181 {
00182 static_cast<class_type*>(this_)->onReportItem(item);
00183 }
00184
00185 static vtable_t make_VTable()
00186 {
00187 vtable_t vt = { onBeginGroupReport_, onEndGroupReport_, onBeginFileReport_, onEndFileReport_, onReportItem_ };
00188
00189 return vt;
00190 }
00191 static vtable_t *const get_VTable()
00192 {
00193 static vtable_t s_vt = make_VTable();
00194
00195 return &s_vt;
00196 }
00197 };
00198 # endif
00199 #endif
00200
00201
00202
00203 #endif
00204
00205