summaryrefslogtreecommitdiffhomepage
path: root/mixmvc/mvc.h
diff options
context:
space:
mode:
authorjaortega <jaortega>2001-02-18 22:21:09 +0000
committerjaortega <jaortega>2001-02-18 22:21:09 +0000
commit07ab95690e85015a6623ffd4443daa1fd42b66b5 (patch)
treea32e12a2a4df2cd07cf3c7616d7245a991095445 /mixmvc/mvc.h
parent90e322c663b4e5a93c30f8d9004e6a6a07c34553 (diff)
downloadmdk-07ab95690e85015a6623ffd4443daa1fd42b66b5.tar.gz
mdk-07ab95690e85015a6623ffd4443daa1fd42b66b5.tar.bz2
mvc effort abandoned
Diffstat (limited to 'mixmvc/mvc.h')
-rw-r--r--mixmvc/mvc.h105
1 files changed, 0 insertions, 105 deletions
diff --git a/mixmvc/mvc.h b/mixmvc/mvc.h
deleted file mode 100644
index 6371a27..0000000
--- a/mixmvc/mvc.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* -*-c-*- ---------------- mvc.h :
- * This header defines basic types supporting the MVC pattern
- * ------------------------------------------------------------------
- * Last change: Time-stamp: <01/02/13 02:16:08 jose>
- * ------------------------------------------------------------------
- * Copyright (C) 2001 Free Software Foundation, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-
-#ifndef MVC_H
-#define MVC_H
-
-#include <glib.h>
-
-/* the subject which is observed (the model) */
-typedef struct subject_t subject_t;
-
-/* subject's observer (the view) */
-typedef struct observer_t observer_t;
-
-/* list of observers (maintained by the subject) */
-typedef GSList observer_list_t;
-
-/* data used in callbacks */
-typedef void data_t;
-
-/* (virtual) function used by subject on each observer to notify an update */
-typedef void (*update_callback_t)(observer_t *obs, data_t *data);
-
-/* (virtual) function used by observers to notify subject of a change */
-typedef void (*notify_callback_t)(subject_t *subj, data_t *data);
-
-/* base subject type, containing a notify callback to be invoked
- by observers */
-struct subject_t
-{
- notify_callback_t notify; /* notify callback used by observers */
- observer_list_t *observers; /* the list of current observers */
-};
-
-/* base observer type, containing an update callback (to be invoked by
- the subject) and a pointer to the observed subject
-*/
-struct observer_t
-{
- update_callback_t update; /* update callback used by subject */
- subject_t *subject; /* observed subject */
-};
-
-
-/* subject interface */
-/* init a subject */
-#define subject_init(sub) \
-do { \
- (sub)->notify = NULL; \
- (sub)->observers = NULL; \
-} while (FALSE)
-
-/* clean up a subject */
-extern void
-subject_clean (subject_t *sub);
-
-/* add a new observer */
-extern void
-subject_add_observer (subject_t *sub, observer_t *obs);
-
-/* remove an observer */
-extern void
-subject_remove_observer (subject_t *sub, observer_t *obs);
-
-/* notify all observers of a change */
-extern void
-subject_update_observers (subject_t *sub, data_t *data);
-
-/* observer interface */
-/* init an observer */
-#define observer_init(obs) \
-do { \
- (obs)->update = NULL; \
- (obs)->subject = NULL; \
-} while (FALSE)
-
-/* macro used by observers to notify their subject of a change */
-#define observer_notify_subject(obs, data) \
- (*((observer_t *)obs->subject->notify)((observer_t *)obs->subject, \
- (data_t *)data))
-
-
-#endif /* MVC_H */
-