Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXId.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                                  X - O b j e c t                              *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXId.h,v 1.18 2006/01/22 17:58:05 fox Exp $                              *
00023 ********************************************************************************/
00024 #ifndef FXID_H
00025 #define FXID_H
00026 
00027 #ifndef FXOBJECT_H
00028 #include "FXObject.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 class FXApp;
00034 
00035 
00036 /// Encapsulates server side resource
00037 class FXAPI FXId : public FXObject {
00038   FXDECLARE_ABSTRACT(FXId)
00039 private:
00040   FXApp *app;             // Back link to application object
00041   void  *data;            // User data
00042 protected:
00043   FXID   xid;
00044 private:
00045   FXId(const FXId&);
00046   FXId &operator=(const FXId&);
00047 protected:
00048   FXId():app((FXApp*)-1L),data(NULL),xid(0){}
00049   FXId(FXApp* a):app(a),data(NULL),xid(0){}
00050 public:
00051 
00052   /// Get application
00053   FXApp* getApp() const { return app; }
00054 
00055   /// Get XID handle
00056   FXID id() const { return xid; }
00057 
00058   /// Create resource
00059   virtual void create(){}
00060 
00061   /// Detach resource
00062   virtual void detach(){}
00063 
00064   /// Destroy resource
00065   virtual void destroy(){}
00066 
00067   /// Set user data pointer
00068   void setUserData(void *ptr){ data=ptr; }
00069 
00070   /// Get user data pointer
00071   void* getUserData() const { return data; }
00072 
00073   /// Save object to stream
00074   virtual void save(FXStream& store) const;
00075 
00076   /// Load object from stream
00077   virtual void load(FXStream& store);
00078 
00079   /// Destructor
00080   virtual ~FXId(){app=(FXApp*)-1L;}
00081   };
00082 
00083 }
00084 
00085 #endif

Copyright © 1997-2005 Jeroen van der Zijp