codereadercallback.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/xtistrm.h
  3. // Purpose: streaming runtime metadata information (extended class info)
  4. // Author: Stefan Csomor
  5. // Modified by:
  6. // Created: 27/07/03
  7. // Copyright: (c) 2003 Stefan Csomor
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _CODEDEPERSISTER_
  11. #define _CODEDEPERSISTER_
  12. #include "wx/defs.h"
  13. #include "wx/sstream.h"
  14. /*
  15. wxObjectCodeReaderCallback implements the callbacks that will depersist
  16. an object into a C++ initialization function.
  17. */
  18. class WXDLLIMPEXP_BASE wxTextOutputStream;
  19. class WXDLLIMPEXP_BASE wxObjectCodeReaderCallback: public wxObjectReaderCallback
  20. {
  21. private:
  22. struct wxObjectCodeReaderCallbackInternal;
  23. wxObjectCodeReaderCallbackInternal * m_data;
  24. wxString& m_headerincludes;
  25. wxString& m_source;
  26. public:
  27. wxObjectCodeReaderCallback(wxString& headerincludes, wxString &source);
  28. virtual ~wxObjectCodeReaderCallback();
  29. // allocate the new object on the heap, that object will have the passed in ID
  30. virtual void AllocateObject(int objectID, wxClassInfo *classInfo,
  31. wxStringToAnyHashMap &metadata);
  32. // initialize the already allocated object having the ID objectID
  33. // with the Create method creation parameters which are objects are
  34. // having their Ids passed in objectIDValues having objectId <> wxInvalidObjectID
  35. virtual void CreateObject(int objectID,
  36. const wxClassInfo *classInfo,
  37. int paramCount,
  38. wxAny *variantValues,
  39. int *objectIDValues,
  40. const wxClassInfo **objectClassInfos,
  41. wxStringToAnyHashMap &metadata
  42. );
  43. // construct the new object on the heap, that object will have the
  44. // passed in ID (for objects that don't support allocate-create type
  45. // of creation) creation parameters which are objects are having their
  46. // Ids passed in objectIDValues having objectId <> wxInvalidObjectID
  47. virtual void ConstructObject(int objectID,
  48. const wxClassInfo *classInfo,
  49. int paramCount,
  50. wxAny *VariantValues,
  51. int *objectIDValues,
  52. const wxClassInfo **objectClassInfos,
  53. wxStringToAnyHashMap &metadata);
  54. // destroy the heap-allocated object having the ID objectID, this may
  55. // be used if an object is embedded in another object and set via value
  56. // semantics, so the intermediate object can be destroyed after safely
  57. virtual void DestroyObject(int objectID, wxClassInfo *classInfo);
  58. // set the corresponding property
  59. virtual void SetProperty(int objectID,
  60. const wxClassInfo *classInfo,
  61. const wxPropertyInfo* propertyInfo,
  62. const wxAny &variantValue);
  63. // sets the corresponding property (value is an object)
  64. virtual void SetPropertyAsObject(int objectId,
  65. const wxClassInfo *classInfo,
  66. const wxPropertyInfo* propertyInfo,
  67. int valueObjectId);
  68. // adds an element to a property collection
  69. virtual void AddToPropertyCollection( int objectID,
  70. const wxClassInfo *classInfo,
  71. const wxPropertyInfo* propertyInfo,
  72. const wxAny &VariantValue);
  73. // sets the corresponding property (value is an object)
  74. virtual void AddToPropertyCollectionAsObject(int objectID,
  75. const wxClassInfo *classInfo,
  76. const wxPropertyInfo* propertyInfo,
  77. int valueObjectId);
  78. // sets the corresponding event handler
  79. virtual void SetConnect(int eventSourceObjectID,
  80. const wxClassInfo *eventSourceClassInfo,
  81. const wxPropertyInfo *delegateInfo,
  82. const wxClassInfo *eventSinkClassInfo,
  83. const wxHandlerInfo* handlerInfo,
  84. int eventSinkObjectID );
  85. // utility function exposed for callbacks
  86. wxString ValueAsCode( const wxAny &param );
  87. };
  88. #endif