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,2009 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (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                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 *********************************************************************************
00021 * $Id: FXId.h,v 1.25 2009/01/06 13:07:25 fox Exp $                              *
00022 ********************************************************************************/
00023 #ifndef FXID_H
00024 #define FXID_H
00025 
00026 #ifndef FXOBJECT_H
00027 #include "FXObject.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 class FXApp;
00033 
00034 
00035 /// Encapsulates server side resource
00036 class FXAPI FXId : public FXObject {
00037   FXDECLARE_ABSTRACT(FXId)
00038 private:
00039   FXApp *app;             // Back link to application object
00040   void  *data;            // User data
00041 protected:
00042   FXID   xid;
00043 private:
00044   FXId(const FXId&);
00045   FXId &operator=(const FXId&);
00046 protected:
00047   FXId():app((FXApp*)-1L),data(NULL),xid(0){}
00048   FXId(FXApp* a):app(a),data(NULL),xid(0){}
00049 public:
00050 
00051   /// Get application
00052   FXApp* getApp() const { return app; }
00053 
00054   /// Get XID handle
00055   FXID id() const { return xid; }
00056 
00057   /// Create resource
00058   virtual void create();
00059 
00060   /// Detach resource
00061   virtual void detach();
00062 
00063   /// Destroy resource
00064   virtual void destroy();
00065 
00066   /// Set user data pointer
00067   void setUserData(void *ptr){ data=ptr; }
00068 
00069   /// Get user data pointer
00070   void* getUserData() const { return data; }
00071 
00072   /// Save object to stream
00073   virtual void save(FXStream& store) const;
00074 
00075   /// Load object from stream
00076   virtual void load(FXStream& store);
00077 
00078   /// Destructor
00079   virtual ~FXId();
00080   };
00081 
00082 }
00083 
00084 #endif

Copyright © 1997-2009 Jeroen van der Zijp