wxArt2D
gen.h
Go to the documentation of this file.
1 /*! \file wx/general/gen.h
2  \brief fundamental classes used by all other modules.
3 
4  In here the reference counted a2dObject and a derived object which can have properties
5  attached to it. Save and Load for serialisation is part of this object.
6  The basic type properties classes are here.
7  The a2dComEvent for communicating events in between classes using an event.
8  At last base classes for the serialisation of documents to files or just algorithms performed on documents.
9  For all in and output of a document a2dIOHandler is the base.
10 
11  \author Klaas Holwerda
12 
13  Copyright: 2001-2004 (c) Klaas Holwerda
14 
15  Licence: wxWidgets Licence
16 
17  RCS-ID: $Id: gen.h,v 1.81 2009/07/15 21:23:43 titato Exp $
18 */
19 
20 #ifndef __WXDOCPROP_H__
21 #define __WXDOCPROP_H__
22 
23 // shared builds stuff
24 #include "wx/general/generaldef.h"
25 
26 //#ifndef WX_PRECOMP
27 #include "wx/filename.h"
28 #include "wx/colour.h"
29 
30 // it is defined in a2dopt.h for precompiled header
31 #include <wx/mstream.h>
32 
33 #include "wx/general/smrtptr.h"
34 #include "wx/general/a2dmemmgr.h"
35 #include "wx/general/id.h"
36 //#endif
37 
38 
39 #if defined(__VISUALC__) && (_MSC_VER <= 1300)
40 #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
41 #define _CRT_SECURE_NO_DEPRECATE 1
42 
43 #undef wxSTD
44 #define wxSTD std::
45 #endif // VC++ >= 7
46 
47 #if wxUSE_STD_IOSTREAM
48 #include <wx/ioswrap.h>
49 #include <fstream>
50 #include <sstream>
51 #include <wx/txtstrm.h>
52 
53 /*
54 typedef enum
55 {
56  wxEOL_NATIVE,
57  wxEOL_UNIX,
58  wxEOL_MAC,
59  wxEOL_DOS
60 } wxEOL;
61 */
62 
63 #else
64 #include "wx/wfstream.h"
65 #include <wx/sstream.h>
66 #include <wx/txtstrm.h>
67 #endif
68 
69 //! Define wxDynamicCast so that it will give a compiler error for unrelated types
70 #undef wxDynamicCast
71 #if wxCHECK_VERSION(2, 5, 0)
72 #define wxDynamicCast(obj, className) \
73  ((className *) wxCheckDynamicCast(const_cast<className*>(static_cast<const className*>(obj)), &className::ms_classInfo))
74 #else
75 #define wxDynamicCast(obj, className) \
76  ((className *) wxCheckDynamicCast(const_cast<className*>(static_cast<const className*>(obj)), &className::sm_class##className))
77 #endif
78 
79 //! The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice
80 
81 #undef wxStaticCast
82 
83 #ifdef __WXDEBUG__
84 
85 inline void* wxCheckCastFixed( void* ptr )
86 {
87  wxASSERT_MSG( ptr, _T( "wxStaticCast() used incorrectly" ) );
88  return ptr;
89 }
90 #define wxStaticCast(obj, className) \
91  ((className *)wxCheckCastFixed(wxDynamicCast(obj, className)))
92 
93 #define wxStaticCastConst(obj, className) \
94  ((const className *)wxCheckCastFixed(wxDynamicCast(obj, className)))
95 
96 //! wxStaticCast asserts, if the input is null, this version not.
97 inline wxObject* wxCheckCastNull( wxObject* obj, wxClassInfo* clssInfo )
98 {
99  if( !obj ) return 0;
100  wxASSERT_MSG( wxCheckDynamicCast( obj, clssInfo ), _T( "wxStaticCast() used incorrectly" ) );
101  return obj;
102 }
103 
104 #if wxCHECK_VERSION(2, 5, 0)
105 #define wxStaticCastNull(obj, className) \
106  ((className *)wxCheckCastNull(const_cast<wxObject*>(static_cast<const wxObject*>(obj)), &className::ms_classInfo))
107 #else
108 #define wxStaticCastNull(obj, className) \
109  ((className *)wxCheckCastNull(const_cast<wxObject*>(static_cast<const wxObject*>(obj)), &className::sm_class##className))
110 #endif
111 
112 // In 2.4.2, wxStaticCast cannot be used in templates
113 #if wxCHECK_VERSION(2, 5, 0)
114 #define wxStaticCastTmpl(obj, className) wxStaticCast(obj, className)
115 #define wxStaticCastNullTmpl(obj, className) wxStaticCastNull(obj, className)
116 #else
117 #define wxStaticCastTmpl(obj, className) ((className *)(wxObject*)(obj))
118 #define wxStaticCastNullTmpl(obj, className) ((className *)(wxObject*)(obj))
119 #endif
120 
121 #else // !__WXDEBUG__
122 
123 #define wxStaticCast(obj, className) ((className *)(wxObject*)(obj))
124 #define wxStaticCastConst(obj, className) ((const className *)(wxObject*)(obj))
125 #define wxStaticCastNull(obj, className) ((className *)(wxObject*)(obj))
126 #define wxStaticCastTmpl(obj, className) ((className *)(wxObject*)(obj))
127 #define wxStaticCastNullTmpl(obj, className) ((className *)(wxObject*)(obj))
128 
129 #endif // __WXDEBUG__
130 
132 {
133 public:
134  a2dVersNo(int major = 0, int minor = 0, int micro = 0)
135  : m_major(major), m_minor(minor), m_micro(micro) {}
136  a2dVersNo(const wxString& versionString);
137 
138  bool operator==( const a2dVersNo& rhs ) const;
139  bool operator!=( const a2dVersNo& rhs ) const { return !(*this == rhs); }
140  bool operator>( const a2dVersNo& rhs ) const;
141  bool operator>=( const a2dVersNo& rhs ) const;
142  bool operator<( const a2dVersNo& rhs ) const { return !(*this >= rhs); }
143  bool operator<=( const a2dVersNo& rhs ) const { return !(*this > rhs); }
144 
145  int GetMajor() const { return m_major; }
146  int GetMinor() const { return m_minor; }
147  int GetMicro() const { return m_micro; }
148 
149 private:
150  int m_major,
151  m_minor,
152  m_micro;
153 };
154 
156 {
157 public:
158 
159  a2dVersionInfo(const wxString& name,
160  int major,
161  int minor,
162  int micro,
163  const wxString& description = wxEmptyString,
164  const wxString& copyright = wxEmptyString)
165  :
166  m_name( name ),
167  m_vers( major, minor, micro ),
168  m_description( description ),
169  m_copyright( copyright )
170  {}
171 
172  a2dVersionInfo(const wxString& versionString,
173  const wxString& name = wxEmptyString,
174  const wxString& description = wxEmptyString,
175  const wxString& copyright = wxEmptyString)
176  :
177  m_name( name ),
178  m_vers( versionString ),
179  m_description( description ),
180  m_copyright( copyright )
181  {}
182 
183  // Default copy ctor, assignment operator and dtor are ok.
184 
185 
186  const wxString& GetName() const { return m_name; }
187 
188  const a2dVersNo& GetVersion() const { return m_vers; }
189  int GetVersionMajor() const { return m_vers.GetMajor(); }
190  int GetVersionMinor() const { return m_vers.GetMinor(); }
191  int GetVersionMicro() const { return m_vers.GetMicro(); }
192 
193  wxString ToString() const
194  {
195  return HasDescription() ? GetDescription() : GetVersionString();
196  }
197 
198  wxString GetVersionString() const
199  {
200  wxString str;
201  str << m_name << ' ' << m_vers.GetMajor() << '.' << m_vers.GetMinor();
202  if ( m_vers.GetMicro() )
203  str << '.' << m_vers.GetMicro();
204 
205  return str;
206  }
207 
208  bool HasDescription() const { return !m_description.empty(); }
209  const wxString& GetDescription() const { return m_description; }
210 
211  bool HasCopyright() const { return !m_copyright.empty(); }
212  const wxString& GetCopyright() const { return m_copyright; }
213 
214 private:
215  wxString m_name,
216  m_description,
217  m_copyright;
218 
219  a2dVersNo m_vers;
220 };
221 
222 
223 //! This function is like wxNewId, but it has its own ID set
224 /*! wxNewId is used for menu command ids and frequently the same number space is used
225  for menu ids and control/window ids. As window/control ids are limited to 15 bit
226  in MSW, they should not be used for other stuff (like canvas object IDs)
227 */
228 A2DGENERALDLLEXP long wxGenNewId();
229 
230 //! see wxGenNewId(), use this to resrve a specific id
231 /*!
232  An id of a specific value is allocated.
233  new wxGenNewId() generated id's after this will be incremented from this id.
234 */
235 A2DGENERALDLLEXP void wxGenRegisterId( long id );
236 
237 class A2DGENERALDLLEXP a2dObjectList;
238 class A2DGENERALDLLEXP a2dResolveIdList;
239 class A2DGENERALDLLEXP a2dIOHandler;
240 class A2DGENERALDLLEXP a2dRefMap;
241 
242 #if wxART2D_USE_CVGIO
243 
246 
247 /* XML a2dObject serialiser flags*/
248 enum a2dXmlSer_flag
249 {
250  a2dXmlSer_attrib,
251  a2dXmlSer_Content
252 };
253 
254 #endif //wxART2D_USE_CVGIO
255 
256 class A2DGENERALDLLEXP a2dWalkerIOHandler;
257 
258 //! error codes generated in docview framework.
260 
261 
262 #include "wx/xrc/xmlres.h"
263 
264 #include <map>
265 class A2DGENERALDLLEXP a2dError;
266 typedef std::map< wxString, a2dError* > a2dErrorHash;
267 #include <vector>
268 typedef std::vector< a2dError > a2dErrorVector;
269 
270 // ============================================================================
271 // event handler and related classes
272 // ============================================================================
273 
274 typedef int a2dSignal;
275 
276 class A2DGENERALDLLEXP a2dEvent : public wxEvent
277 {
278 
279 public:
280 
281  a2dEvent( int id = 0, wxEventType eventType = wxEVT_NULL )
282  : wxEvent( id, eventType )
283  {
284  SetIntTimeStamp();
285  }
286 
287  void SetIntTimeStamp()
288  {
289  if ( ms_timestamp == LONG_MAX )
290  ms_timestamp = 0;
291  SetTimestamp( ++ms_timestamp );
292  }
293 
294  static long ms_timestamp;
295 };
296 
297 
298 //----------------------------------------------------------------------------
299 // a2dComEvent
300 //----------------------------------------------------------------------------
301 
302 /*
303 #define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \
304  extern expdecl const wxEventType name;
305 
306 #define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType();
307 */
308 
309 BEGIN_DECLARE_EVENT_TYPES()
310 //! see a2dComEvent \ingroup eventid
311 DECLARE_EXPORTED_EVENT_TYPE( A2DGENERALDLLEXP, a2dEVT_COM_EVENT, 1 )
312 END_DECLARE_EVENT_TYPES()
313 
314 //! special event for communicating between a2dObject's and GUI objects and Command processors.
315 /*!
316  Used for communicating and distributing events which change e.g. a2dObject's
317 
318  The information that is sent around is stored in a a2dNamedProperty.
319 
320  To intercept this event ( when sent to an object ), use the next event table entries:
321 
322  - EVT_COM_EVENT in case of base wxEvtHandler
323 
324  event id's for Change events used for specifying which type of information is communicated
325  via a a2dComEvent event.
326 
327  The idea is to add static members like this to a class you wnat to sent an event from.
328  Like in a2dCanvasObject we have in the header file:
329 
330  \code
331  const static a2dComEvent::wxEventType sm_changedLayer;
332  \endcode
333 
334  and in the cpp file do initilize the static member:
335 
336  \code
337  const a2dComEvent::wxEventType a2dCanvasDocument::sm_changedLayer;
338  \endcode
339 
340  and in the cpp file do sent an event from member function:
341 
342  \code
343  a2dComEvent changedlayer( this, PROPID_layer, layer, &sm_changedLayer );
344  ProcessEvent( changedlayer );
345  \endcode
346 
347 
348  \code
349  BEGIN_EVENT_TABLE( anyclass, wxWindow )
350  EVT_COM_EVENT( anyclass::OnComEvent )
351  END_EVENT_TABLE()
352 
353  void anyclass::OnComEvent( a2dComEvent& event )
354  {
355  if ( event.GetId() == &sm_changedLayer )
356  {
357  DoIt();
358  }
359  }
360  \endcode
361 
362  \see a2dGeneralGlobals
363 
364  \see a2dComEvent
365 
366  \ingroup canvasobject eventmanager property
367 
368  \ingroup eventmanager
369  \ingroup events
370 */
371 class A2DGENERALDLLEXP a2dComEvent: public wxEvent
372 {
373  DECLARE_DYNAMIC_CLASS( a2dComEvent )
374 
375 public:
376 
377  //! sent from a2dObject::OnPropertyChanged().
378  //! id for changed properties
379  //! a property on a wxProprefObject has accured.
380  //! \ingroup events
381  static const a2dSignal sm_changedProperty;
382  //! id for changed a2dObject
383  //! \ingroup events
384  static const a2dSignal sm_changedRefObject;
385  //! non info.
386  //! \ingroup events
387  static const a2dSignal sm_non;
388 
389  //! for sending just an event id, m_property is not set
390  a2dComEvent( wxObject* sender, a2dSignal id );
391 
392  //! sent a property id ( in order to get property on sender object )
393  /*!
394  \param sender the object which did sent this event.
395  \param id id of the property in the sender object
396  \param eventid eventid is to further specify the nature of the event.
397  */
398  a2dComEvent( a2dObject* sender, const a2dPropertyId* id, a2dSignal = sm_changedProperty );
399 
400  //! sent a property
401  /*!
402  \param sender the object which did sent this event.
403  \param property the property to sent
404  \param id eventid is to further specify the nature of the event.
405  \param ownProp when true the property will be cloned and deleted here
406  */
407  a2dComEvent( wxObject* sender, a2dNamedProperty* property, a2dSignal id = sm_changedProperty, bool ownProp = false );
408 
409  //! sent a property by reference
410  /*!
411  \param sender the object which did sent this event.
412  \param property the property to sent
413  \param eventid eventid is to further specify the nature of the event.
414  */
415  a2dComEvent( wxObject* sender, const a2dNamedProperty& property, a2dSignal eventid = sm_changedProperty );
416 
417  //! sent a property generated from a a2dObject.
418  /*!
419  Creates a wxRefObjectPtrProperty internal.
420 
421  \param sender the object which did sent this event.
422  \param refObject the a2dObject
423  \param eventid eventid is to further specify the nature of the event.
424  */
425  a2dComEvent( wxObject* sender, a2dObject* refObject, a2dSignal id = sm_changedRefObject );
426 
427  //! sent a property id ( in order to get property on sender object )
428  /*!
429  \param sender the object which did sent this event.
430  \param id id of the property in the sender object
431  \param eventid eventid is to further specify the nature of the event.
432  */
433  // a2dComEvent( wxObject* sender, const a2dPropertyId& id, a2dSignalid = sm_changedProperty );
434 
435  //! sent a property generated from a a2dObject.
436  a2dComEvent( wxObject* sender, const a2dPropertyIdRefObject* propId, a2dObject* refObject, a2dSignal id = sm_changedProperty );
437 
438  //! sent a property generated from a bool.
439  a2dComEvent( wxObject* sender, const a2dPropertyIdBool* propId, bool propertyValue, a2dSignal id = sm_changedProperty );
440 
441  //! sent a property generated from a wxUint16.
442  a2dComEvent( wxObject* sender, const a2dPropertyIdUint16* propId, wxUint16 propertyValue, a2dSignal id = sm_changedProperty );
443 
444  //! sent a property generated from a wxInt32.
445  a2dComEvent( wxObject* sender, const a2dPropertyIdInt32* propId, wxInt32 propertyValue, a2dSignal id = sm_changedProperty );
446 
447  //! sent a property generated from a double.
448  a2dComEvent( wxObject* sender, const a2dPropertyIdDouble* propId, double propertyValue, a2dSignal id = sm_changedProperty );
449 
450  //! sent a property generated from a wxString.
451  a2dComEvent( wxObject* sender, const a2dPropertyIdString* propId, const wxString& propertyValue, a2dSignal id = sm_changedProperty );
452 
453  //! sent a property generated from a bool.
454  a2dComEvent( wxObject* sender, bool propertyValue, a2dSignal id );
455 
456  //! sent a property generated from a wxIint16.
457  a2dComEvent( wxObject* sender, wxInt16 propertyValue, a2dSignal id );
458 
459  //! sent a property generated from a wxUint16.
460  a2dComEvent( wxObject* sender, wxUint16 propertyValue, a2dSignal id );
461 
462  //! sent a property generated from a wxInt32.
463  a2dComEvent( wxObject* sender, wxInt32 propertyValue, a2dSignal id );
464 
465  //! sent a property generated from a wxUint32.
466  a2dComEvent( wxObject* sender, wxUint32 propertyValue, a2dSignal id );
467 
468  //! sent a property generated from a double.
469  a2dComEvent( wxObject* sender, double propertyValue, a2dSignal id );
470 
471  //! sent a property generated from a wxString.
472  a2dComEvent( wxObject* sender, const wxString& propertyValue, a2dSignal id );
473 
474  a2dComEvent();
475 
476  ~a2dComEvent();
477 
478  a2dComEvent( const a2dComEvent& other );
479 
480  wxEvent* Clone( void ) const;
481 
482  a2dNamedProperty* GetProperty() { return m_property; }
483 
484  const a2dPropertyId* GetPropertyId() const;
485 
486  //! after proecssin the event, on return an id can be set to communicate back to sender.
487  a2dSignal GetEventComIdReturn() { return m_comReturn; }
488 
489 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
490  //! this is a list of all smart pointers pointing to this object
491  a2dSmrtPtr<a2dComEvent> *m_ownerlist;
492  //! this is needed inside the smart pointer template code
493  typedef a2dSmrtPtr<a2dComEvent> TOwnerListClass;
494  //! Make a Dump of the objects owner list to the Debug console
495  /*! This function is usually called from the Debuggers watch window */
496  void DumpOwners();
497 #endif
498 
499 private:
500 
501 
502  //! Call to have a new owner for this object
503  /*! This function should only be called by a2dSmrtPtr
504 
505  \remark owning mean that the object calling this member needs to call Release at some time,
506  in order to actually release/delete the object.
507 
508  \return The return value is the object itself, which is now owned on time extra.
509 
510  increment refcount by 1 ( use when adding a reference to this object)
511  */
512  a2dComEvent* SmrtPtrOwn() { m_refcount++; return this; }
513 
514  //!To release the object, it is not longer owned by the calling object.
515  /*! This function should only be called by a2dSmrtPtr
516  */
517  bool SmrtPtrRelease()
518  {
519  m_refcount--;
520  wxASSERT_MSG( m_refcount >= 0, wxT( "a2dComEvent Own/Release not matched (extra Release calls)" ) );
521  if ( m_refcount <= 0 )
522  {
523  delete this;
524  return true;
525  }
526  return false;
527  }
528 
529  friend class a2dSmrtPtrBase;
530 
531  //!how many references to this object do exist
532  int m_refcount;
533 
534  //! information of the event is in form of a property.
535  a2dNamedProperty* m_property;
536 
537  //! id of return option
538  a2dSignal m_comReturn;
539 
540  //! when true, will delete the property itself.
541  bool m_ownProp;
542 };
543 
544 #if (defined(__WXMSW__) && defined(WXUSINGDLL) )
545 template class A2DGENERALDLLEXP a2dSmrtPtr<class a2dComEvent>;
546 template class A2DGENERALDLLEXP std::allocator<class a2dSmrtPtr<class a2dComEvent> >;
547 template class A2DGENERALDLLEXP std::allocator< std::_List_nod<class a2dSmrtPtr<class a2dComEvent>, std::allocator<class a2dSmrtPtr<class a2dComEvent> > >::_Node >;
548 template class A2DGENERALDLLEXP std::allocator< std::_List_ptr<class a2dSmrtPtr<class a2dComEvent>, std::allocator<class a2dSmrtPtr<class a2dComEvent> > >::_Nodeptr >;
549 template class A2DGENERALDLLEXP std::list<class a2dSmrtPtr<class a2dComEvent> >;
550 template class A2DGENERALDLLEXP a2dlist<class a2dSmrtPtr<class a2dComEvent> >;
551 template class A2DGENERALDLLEXP a2dSmrtPtrList<class a2dComEvent>;
552 #endif
553 
554 typedef void ( wxEvtHandler::*a2dComEventFunction ) ( a2dComEvent& );
555 
556 #define a2dComEventHandler(func) \
557  (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(a2dComEventFunction, &func)
558 
559 /*! \addtogroup eventhandlers
560 * @{
561 */
562 
563 //! static wxEvtHandler for communication event
564 #define EVT_COM_EVENT(func) wx__DECLARE_EVT0( a2dEVT_COM_EVENT, a2dComEventHandler( func ))
565 
566 //! static wxEvtHandler for communication event with specific id.
567 #define EVT_COM_EVENT_ID(id, func) \
568  wx__DECLARE_EVT1( a2dEVT_COM_EVENT, id, a2dComEventHandler( func ))
569 
570 
571 //! @} eventhandlers
572 
573 
574 extern const a2dError a2dError_NoError; /*!< No Error */
575 extern const a2dError a2dError_CommandError; /*!< command syntax */
576 extern const a2dError a2dError_NotSpecified; /*!< Not Specified Error */
577 extern const a2dError a2dError_CanceledFileDialog; /*!< canceled file dialog */
578 extern const a2dError a2dError_FileCouldNotOpen; /*!< file could not be opened */
579 extern const a2dError a2dError_CouldNotCreateDocument; /*!< a document could not be created from the template */
580 extern const a2dError a2dError_NoDocTemplateRef; /*!< a document template was not found */
581 extern const a2dError a2dError_DocumentsOpened; /*!< To many documents open */
582 extern const a2dError a2dError_SetEnv; /*!< SetEnv failed */
583 extern const a2dError a2dError_GetEnv; /*!< GetEnv failed */
584 extern const a2dError a2dError_GetVar; /*!< GetVariable failed wrong name*/
585 extern const a2dError a2dError_SaveFile; /*!< SaveFile in a2dDocument*/
586 extern const a2dError a2dError_LoadFile; /*!< LoadFile in a2dDocument*/
587 extern const a2dError a2dError_ExportFile; /*!< ExportFile in a2dDocument*/
588 extern const a2dError a2dError_ImportFile; /*!< ImportFile in a2dDocument*/
589 extern const a2dError a2dError_IOHandler; /*!< a2dIOHandler In or Out problem*/
590 extern const a2dError a2dError_SaveObject; /*!< SaveObject in a2dDocument*/
591 extern const a2dError a2dError_LoadObject; /*!< LoadObject in a2dDocument*/
592 extern const a2dError a2dError_FileHistory; /*!< File history*/
593 extern const a2dError a2dError_ImportObject; /*!< ImportObject in a2dDocument*/
594 extern const a2dError a2dError_XMLparse; /*!< XML parsing error*/
595 extern const a2dError a2dError_FileVersion; /*!< version of file not for this version of application*/
596 extern const a2dError a2dError_LoadLayers; /*!< Layer Load problems */
597 extern const a2dError a2dError_property; /*!< property problems */
598 extern const a2dError a2dError_NoView; /*!< current view not set */
599 extern const a2dError a2dError_NoDocument; /*!< current document not set */
600 extern const a2dError a2dError_NoController; /*!< no controller set */
601 extern const a2dError a2dError_NoTool; /*!< no tool available */
602 extern const a2dError a2dError_LinkRef; /*!< Linking references problem */
603 extern const a2dError a2dError_NoWrapper; /*!< No wrapper with that name */
604 extern const a2dError a2dError_LinkPin; /*!< Linking pins problem */
605 extern const a2dError a2dError_NoPinClass; /*!< a2dPinClass of a2dPin not found */
606 extern const a2dError a2dError_CouldNotEvaluatePath; /*!< path containing aliases/variables could not be evaluated correctly */
607 extern const a2dError a2dError_Canceled; /*!< file dialog was canceled */
608 extern const a2dError a2dError_CouldNotLoad; /*!< Could not load */
609 extern const a2dError a2dError_NoSelection; /*!< no selection made */
610 extern const a2dError a2dError_ToManyOpen; /*!< to many open documents */
611 extern const a2dError a2dError_canvasObjectRelease; /*!< could not release canvas objects */
612 
613 
614 //! holds one error report.
615 /*!
616  Error within the docview framework are reported to the one and only a2dDocviewGlobal instance.
617  There they are store in a list of this class.
618  Each a2dError holds a message and an errorcode. The error code can be used to check
619  the eror independent of language.
620 
621  \ingroup general
622 */
623 class A2DGENERALDLLEXP a2dError: public wxObject
624 {
625 public:
626 
627  //! default constructor
629  : m_code( a2dError_NoError.GetErrorCode() )
630  {
631  }
632 
633  //! constructor
634  a2dError( const wxString& errorIdName, const wxString& error = wxEmptyString, bool warning = false )
635  {
636  if ( errorIdName == wxEmptyString )
637  m_code = wxXmlResource::GetXRCID( wxT( "a2dError_NoError" ) );
638  else
639  m_code = wxXmlResource::GetXRCID( errorIdName );
640  m_error = error;
641  m_warning = warning;
642  }
643 
644  a2dError( const a2dError& error )
645  {
646  m_code = error.m_code;
647  m_error = error.m_error;
648  m_warning = error.m_warning;
649  }
650 
651  bool operator==( const a2dError& a )
652  {
653  return m_code == a.m_code;
654  }
655 
656  bool operator!=( const a2dError& a )
657  {
658  return m_code != a.m_code;
659  }
660 
661  friend inline bool operator==( const a2dError& a, const a2dError& b )
662  {
663  return a.m_code == b.m_code;
664  }
665 
666  friend inline bool operator!=( const a2dError& a, const a2dError& b )
667  {
668  return a.m_code != b.m_code;
669  }
670 
671  //! name of the name of this error id
672  wxString GetIdName() const { return m_errorIdName; }
673 
674  //! get error string
675  inline wxString GetErrorMessage() const { return wxGetTranslation( m_error ); }
676  //! get error code
677  inline a2dErrorWarningCode GetErrorCode() const { return m_code; }
678 
679  //! set error message
680  inline void SetErrorMessage( const wxString& error ) { m_error = error; }
681  //! set error code
682  inline void SetErrorCode( a2dErrorWarningCode code ) { m_code = code; }
683 
684  static a2dErrorHash& GetHashMap();
685 
686 private:
687 
688  wxString m_errorIdName;
689 
690  //! error string
691  wxString m_error;
692 
693  //! error string
694  wxString m_format;
695 
696  //! error code
697  a2dErrorWarningCode m_code;
698 
699  //! is it a warning only
700  bool m_warning;
701 };
702 
703 
704 class A2DGENERALDLLEXP a2dObject;
705 class A2DGENERALDLLEXP a2dHashMapIntToObject;
706 class A2DGENERALDLLEXP a2dHashMapIntToObject_wxImplementation_HashTable;
707 class A2DGENERALDLLEXP a2dHashMapIntToObject_wxImplementation_KeyEx;
708 
709 class A2DGENERALDLLEXP a2dHashMapCreateObject;
710 class A2DGENERALDLLEXP a2dHashMapCreateObject_wxImplementation_HashTable;
711 class A2DGENERALDLLEXP a2dHashMapCreateObject_wxImplementation_KeyEx;
712 
713 class A2DGENERALDLLEXP a2dNamedProperty;
714 class A2DGENERALDLLEXP a2dNamedPropertyList;
715 
716 //! This hash table is used for serialization of multiple referenced object
717 WX_DECLARE_HASH_MAP_WITH_DECL( wxString, class a2dObject*, wxStringHash, wxStringEqual, a2dHashMapIntToObject, class A2DGENERALDLLEXP );
718 
719 //! This hash table is used for creating object using a symbolic name
720 WX_DECLARE_HASH_MAP_WITH_DECL( wxString, wxString, wxStringHash, wxStringEqual, a2dHashMapCreateObject, class A2DGENERALDLLEXP );
721 
722 //! class used in a2dResolveIdList to resolve references to other objects while readin in a file.
723 /*!
724  a2dObject can be referenced multiple times, in certain file formats this can be maintained.
725  When reading back such files, the original references need to be restored.
726  When reading a reference from a file, the object that it references might not have bin read yet.
727  Therefore if not found they are first stored, and when all is read those are resolved.
728  The a2dResolveIdList is used to store onsolved references, while all objects which can be referenced to,
729  are stored in a2dHashMapIntToObject so they can be quickly found.
730 
731  \ingroup fileio
732 
733 */
734 class A2DGENERALDLLEXP a2dResolveIdInfo : public wxObject
735 {
736 public:
737  a2dResolveIdInfo( const wxString& idStr, a2dSmrtPtr<a2dObject>* storedHere )
738  {
739  m_mode = mode_a2dObjectSmrtPtr;
740  m_idStr = idStr;
741  m_storedHere.m_a2dObjectSmrtPtr = storedHere;
742  }
743 
744  a2dResolveIdInfo( const wxString& idStr, a2dAutoZeroPtr<a2dObject>* storedHere )
745  {
746  m_mode = mode_a2dObjectAutoZeroPtr;
747  m_idStr = idStr;
748  m_storedHere.m_a2dObjectAutoZeroPtr = storedHere;
749  }
750 
751  a2dResolveIdInfo( const wxString& idStr, a2dObject* link )
752  {
753  m_mode = mode_link;
754  m_idStr = idStr;
755  m_storedHere.m_link = link;
756  }
757 
758  a2dResolveIdInfo( a2dObject* inform )
759  {
760  m_mode = mode_inform;
761  m_storedHere.m_inform = inform;
762  }
763 
764 private:
765  bool Assign( a2dObject* ptr );
766 
767  enum Mode
768  {
769  mode_a2dObjectSmrtPtr,
770  mode_a2dObjectAutoZeroPtr,
771  mode_link,
772  mode_inform
773  };
774 
775  Mode m_mode;
776 
777  wxString m_idStr;
778 
779  union UPtr
780  {
781  a2dSmrtPtr<a2dObject> *m_a2dObjectSmrtPtr;
782  a2dAutoZeroPtr<a2dObject> *m_a2dObjectAutoZeroPtr;
783  a2dObject* m_link;
784  a2dObject* m_inform;
785  } m_storedHere;
786 
787  friend class a2dResolveIdList;
788  friend class a2dRefMap;
789 };
790 
791 WX_DECLARE_LIST_WITH_DECL( a2dResolveIdInfo, a2dResolveIdList, class A2DGENERALDLLEXP );
792 
793 #include <map>
795 typedef std::map< wxString, a2dPropertyIdPtr > a2dDynamicIdMap;
796 
797 //! list of a2dNamedProperty objects
798 /*!
799  \remark this is only used for lists handled e.g. as paramaters outside of
800  a2dObject. a2dObject handles the lists on its own.
801 
802  \ingroup property
803 */
804 class A2DGENERALDLLEXP a2dNamedPropertyList : public a2dSmrtPtrList<a2dNamedProperty>
805 {
806 public:
807  //! Default constructor
809  {
810  }
811  //! Copy constructor (clones all properties and copies the list)
812  a2dNamedPropertyList( const a2dNamedPropertyList& other );
813  //! Destructor
814  ~a2dNamedPropertyList();
815  //! Remove first/all properties with given id from the list
816  /*! return true if the property was found */
817  bool Remove( const a2dPropertyId* id, bool all = true );
818  //! Remove all temporrary properties from the list
819  void RemoveTemporary();
820 
821  //! walk a list of properties
822  void Walker( wxObject* parent, a2dWalkerIOHandler& handler );
823 
824 
825 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
826  wxObject* m_owner;
827 #endif
828 
829 };
830 
831 //! check if class has the given id as a valid id for this object
832 /*!
833  The id hashlist for the class and base class etc. is checked for the given id.
834 */
835 #define DECLARE_PROPERTIES() \
836  static bool InitializePropertyIds();\
837  static a2dDynamicIdMap& GetPropertyIdMap();\
838  static bool AddPropertyId( a2dPropertyId *dynproperty );\
839  virtual bool HasPropertyId( const a2dPropertyId* id ) const;\
840  virtual a2dPropertyId* HasPropertyId( const wxString& name );\
841  virtual const a2dNamedProperty* FindProperty( const wxString &idName ) const;\
842  virtual void CollectProperties2( a2dNamedPropertyList *total, const a2dPropertyId *id = NULL, a2dPropertyId::Flags flags = a2dPropertyId::flag_none ) const;\
843  private:\
844  static a2dDynamicIdMap sm_dymPropIds;
845 
846 #define INITIALIZE_PROPERTIES_BASE( classname ) \
847  a2dDynamicIdMap& classname::GetPropertyIdMap() \
848  {\
849  return sm_dymPropIds;\
850  }\
851  bool classname::AddPropertyId( a2dPropertyId *dynproperty )\
852  {\
853  if ( sm_dymPropIds.find( dynproperty->GetName() ) == sm_dymPropIds.end() )\
854  sm_dymPropIds[ dynproperty->GetName() ]= dynproperty;\
855  else\
856  wxASSERT_MSG( 0, _("The property id name '") + dynproperty->GetName() + _("' already exists in #classname") );\
857  return true;\
858  }\
859  bool classname::HasPropertyId( const a2dPropertyId* id ) const\
860  {\
861  a2dDynamicIdMap::iterator iter = sm_dymPropIds.find( id->GetName() );\
862  if ( iter != sm_dymPropIds.end() )\
863  return true;\
864  return false;\
865  }\
866  a2dPropertyId* classname::HasPropertyId( const wxString& name )\
867  {\
868  a2dDynamicIdMap::iterator iter = sm_dymPropIds.find( name );\
869  if ( iter != sm_dymPropIds.end() )\
870  return sm_dymPropIds[ name ];\
871  return NULL;\
872  }\
873  const a2dNamedProperty *classname::FindProperty( const wxString &idName ) const\
874  {\
875  a2dDynamicIdMap::iterator iter = sm_dymPropIds.find( idName );\
876  if ( iter != sm_dymPropIds.end() )\
877  {\
878  a2dPropertyIdPtr propId = ( *iter ).second;\
879  return GetProperty( propId );\
880  }\
881  return 0;\
882  }\
883  void classname::CollectProperties2( a2dNamedPropertyList *total, const a2dPropertyId *id, a2dPropertyId::Flags flags ) const\
884  {\
885  for ( a2dDynamicIdMap::iterator i = sm_dymPropIds.begin(); i != sm_dymPropIds.end(); i++ )\
886  {\
887  a2dPropertyIdPtr p = (*i).second;\
888  if( p->CheckCollect( id, flags ) )\
889  {\
890  a2dNamedProperty* dprop = p->GetPropertyAsNamedProperty( this );\
891  if ( dprop )\
892  total->push_back( dprop );\
893  }\
894  }\
895  }\
896  a2dDynamicIdMap classname::sm_dymPropIds; \
897  static bool initProp##classname = classname::InitializePropertyIds(); \
898  bool classname::InitializePropertyIds()
899 
900 
901 #define INITIALIZE_PROPERTIES( classname, baseclassname ) \
902  a2dDynamicIdMap& classname::GetPropertyIdMap() \
903  {\
904  return sm_dymPropIds;\
905  }\
906  bool classname::AddPropertyId( a2dPropertyId *dynproperty )\
907  {\
908  if ( sm_dymPropIds.find( dynproperty->GetName() ) == sm_dymPropIds.end() )\
909  sm_dymPropIds[ dynproperty->GetName() ]= dynproperty;\
910  else\
911  wxASSERT_MSG( 0, _("The property id name '") + dynproperty->GetName() + _("' already exists in #classname") );\
912  return true;\
913  }\
914  bool classname::HasPropertyId( const a2dPropertyId* id ) const\
915  {\
916  a2dDynamicIdMap::iterator iter = sm_dymPropIds.find( id->GetName() );\
917  if ( iter != sm_dymPropIds.end() )\
918  return true;\
919  return baseclassname::HasPropertyId( id );\
920  }\
921  a2dPropertyId* classname::HasPropertyId( const wxString& name )\
922  {\
923  a2dDynamicIdMap::iterator iter = sm_dymPropIds.find( name );\
924  if ( iter != sm_dymPropIds.end() )\
925  return sm_dymPropIds[ name ];\
926  return baseclassname::HasPropertyId( name );\
927  }\
928  const a2dNamedProperty *classname::FindProperty( const wxString &idName ) const\
929  {\
930  a2dDynamicIdMap::iterator iter = sm_dymPropIds.find( idName );\
931  if ( iter != sm_dymPropIds.end() )\
932  {\
933  a2dPropertyIdPtr propId = ( *iter ).second;\
934  return GetProperty( propId );\
935  }\
936  return baseclassname::FindProperty( idName );\
937  }\
938  void classname::CollectProperties2( a2dNamedPropertyList *total, const a2dPropertyId *id, a2dPropertyId::Flags flags ) const\
939  {\
940  for ( a2dDynamicIdMap::iterator i = sm_dymPropIds.begin(); i != sm_dymPropIds.end(); i++ )\
941  {\
942  a2dPropertyIdPtr p = (*i).second;\
943  if( p->CheckCollect( id, flags ) )\
944  {\
945  a2dNamedProperty* dprop = p->GetPropertyAsNamedProperty( this );\
946  if ( dprop )\
947  total->push_back( dprop );\
948  }\
949  }\
950  return baseclassname::CollectProperties2( total, id, flags );\
951  }\
952  a2dDynamicIdMap classname::sm_dymPropIds; \
953  static bool initProp##classname = classname::InitializePropertyIds(); \
954  bool classname::InitializePropertyIds()
955 
956 #ifdef WXVALIDEVENTENTRY
957 #else
958 #if !wxCHECK_VERSION(2,9,0)
959 
960 // an entry used in dynamic event table managed by wxEvtHandler::Connect()
961 struct WXDLLIMPEXP_BASE a2dDynamicEventTableEntry : public wxDynamicEventTableEntry
962 {
963  a2dDynamicEventTableEntry( int evType, int winid, int idLast,
964  wxObjectEventFunction fn, wxObject* data, wxEvtHandler* eventSink )
965  : wxDynamicEventTableEntry( evType, winid, idLast, fn, data, eventSink ),
966  m_disconnect( false )
967  { }
968 
969  bool m_disconnect:1;
970 
971  DECLARE_NO_COPY_CLASS( a2dDynamicEventTableEntry )
972 };
973 #else
974 // an entry used in dynamic event table managed by wxEvtHandler::Connect()
975 struct WXDLLIMPEXP_BASE a2dDynamicEventTableEntry : public wxDynamicEventTableEntry
976 {
977  a2dDynamicEventTableEntry( int evType, int winid, int idLast,
978  wxEventFunctor* fn, wxObject* data )
979  : wxDynamicEventTableEntry( evType, winid, idLast, fn, data ),
980  m_disconnect( false )
981  { }
982 
984  { }
985 
986  bool m_disconnect:1;
987 
988  DECLARE_NO_COPY_CLASS( a2dDynamicEventTableEntry )
989 };
990 #endif
991 #endif
992 
993 //! Ref Counted base object.
994 /*!
995  Used for counting the number of objects that own this (derived) object.
996 
997  This object is the base object for most classes which used a2dSmrtPtr to keep track of them.
998  An instance of a2dObject is held by a a2dObjectPtr, and many of those can point to the same a2dObject.
999  When the a2dObjectPtr goes out of scope, automatically the reference count will be decremented.
1000  When the last a2dObjectPtr holding on to the a2dObject goes is destructed, the a2dObject will be deleted
1001  too.
1002 
1003  Smart pointers are ideal for holding events, since you can hold on to it until you think it is oke to
1004  release them.
1005  In wxDocview smart pointers are used for a2dCanvasObject's, that makes it possible to have a hierarchy of
1006  drawable objects, a multiple references a2dCanvasObject is drawn at a different locations, because its
1007  parent is responsible for its position.
1008 
1009 
1010  a2dObject has a a2dNamedProperty List containing dynamic properties.
1011  All objects derived from this can have dynamic properties added to them.
1012  For that there is a property list, to which those properties are added.
1013  Functions to manipulate the properties are all concentrated in this class.
1014 
1015  A property is a2dNamedProperty class, which are unique via a a2dPropertyId identification class.
1016 
1017  Assume that a derived class a2dCanvasObject has:
1018 
1019  <code>
1020  //declare of static member in the class
1021  static const a2dPropertyIdBoundingBox PROPID_BoundingBox;
1022 
1023  //initialize static member in cpp file
1024  const a2dPropertyIdBoundingBox a2dCanvasObject::PROPID_BoundingBox( CLASSNAME( a2dCanvasObject ), wxT("statebox"), a2dPropertyId::flag_temporary|a2dPropertyId::flag_multiple, a2dBoundingBox() );
1025 
1026  </code>
1027  We can set it like this:
1028  <code>
1029  a2dBoundingBox updatearea(0,0,100,100);
1030  a2dCanvasObject::PROPID_BoundingBox->SetPropertyToObject( a_canvasobject, updatearea );
1031  a2dBoundingBox updatearea2(0,0,100,100);
1032  a2dCanvasObject::PROPID_BoundingBox->SetPropertyToObject( a_canvasobject, updatearea2 );
1033  </code>
1034 
1035  see a2dPropertyId a2dPropertyIdTyped for more.
1036 
1037  \ingroup property
1038 
1039  \remark Little is needed to make it carbage collected.
1040  \remark Specilized memeory allocation is possible e.g like in a2dFill with a2dMemManager
1041  \remark And debugging on id, helps a lot.
1042 
1043  \ingroup general
1044 */
1045 class A2DGENERALDLLEXP a2dObject : public wxEvtHandler
1046 {
1047 
1048  DECLARE_ABSTRACT_CLASS( a2dObject )
1049 
1050 public:
1051 
1052 #ifdef WXVALIDEVENTENTRY
1053 
1054  bool SearchDynamicEventTable( wxEvent& event );
1055 
1056 #else //WXVALIDEVENTENTRY
1057  virtual bool ProcessEvent( wxEvent& event );
1058 
1059  bool SearchDynamicEventTable( wxEvent& event );
1060 
1061 #if !wxCHECK_VERSION(2,9,0)
1062 
1063  // Dynamic association of a member function handler with the event handler,
1064  // winid and event type
1065  void Connect( int winid,
1066  int lastId,
1067  int eventType,
1068  wxObjectEventFunction func,
1069  wxObject* userData = ( wxObject* ) NULL,
1070  wxEvtHandler* eventSink = ( wxEvtHandler* ) NULL );
1071  bool Disconnect( int winid,
1072  int lastId,
1073  wxEventType eventType,
1074  wxObjectEventFunction func = NULL,
1075  wxObject* userData = ( wxObject* ) NULL,
1076  wxEvtHandler* eventSink = ( wxEvtHandler* ) NULL );
1077 
1078 #else //!wxCHECK_VERSION(2,9,0)
1079 
1080  bool TryBeforeAndHere( wxEvent& event )
1081  {
1082  return TryBefore( event ) || TryHereOnly( event );
1083  }
1084 
1085  bool DoTryChain( wxEvent& event );
1086 
1087  bool ProcessEventLocally( wxEvent& event );
1088 
1089  bool TryHereOnly( wxEvent& event );
1090 
1091  void Connect( int winid,
1092  int lastId,
1093  wxEventType eventType,
1094  wxObjectEventFunction func,
1095  wxObject* userData = NULL,
1096  wxEvtHandler* eventSink = NULL )
1097  {
1098  DoBind( winid, lastId, eventType,
1099  wxNewEventFunctor( eventType, func, eventSink ),
1100  userData );
1101  }
1102 
1103  bool Disconnect( int winid,
1104  int lastId,
1105  wxEventType eventType,
1106  wxObjectEventFunction func = NULL,
1107  wxObject* userData = NULL,
1108  wxEvtHandler* eventSink = NULL )
1109  {
1110  return DoUnbind( winid, lastId, eventType,
1111  wxMakeEventFunctor( eventType, func, eventSink ),
1112  userData );
1113  }
1114 
1115 private:
1116  void DoBind( int winid,
1117  int lastId,
1118  wxEventType eventType,
1119  wxEventFunctor* func,
1120  wxObject* userData = NULL );
1121 
1122  bool DoUnbind( int winid,
1123  int lastId,
1124  wxEventType eventType,
1125  const wxEventFunctor& func,
1126  wxObject* userData = NULL );
1127 #endif //!wxCHECK_VERSION(2,9,0)
1128 #endif //WXVALIDEVENTENTRY
1129 
1130 public:
1131 
1132  //! Used to connect an event coming from classA to classB as a dynamic event.
1133  //! The dynamic can be handled by the static event table of classB.
1134  //! The event is handled by calling ProcessEvent(), but will always be skipped.
1135  void ProcessConnectedEvent( wxEvent& event );
1136 
1137  //! Connect an event from coming classA to classB as a dynamic event.
1138  //! The event is handled by calling ProcessEvent(), but will always be skipped.
1139  //! \param eventSink ClassB in which to receive the event.
1140  void ConnectEvent( wxEventType type, wxEvtHandler* eventSink );
1141 
1142  //! Disconnect an event from classA to classB as a dynamic event.
1143  //! The event is handled by calling ProcessEvent(), but will always be skipped.
1144  //! \param eventSink ClassB in to which connection was made.
1145  bool DisconnectEvent( wxEventType type, wxEvtHandler* eventSink );
1146 
1147  //! Remove all dynamic events in classA, going to classB (eventSink)
1148  bool DisconnectEventAll( wxEvtHandler* eventSink );
1149 
1150  //!constructor
1151  a2dObject();
1152 
1153  //!destructor
1154  virtual ~a2dObject();
1155 
1156  //!assignment operator
1157  void operator = ( const a2dObject& other );
1158 
1159  //! like it to be protected, but this does not work with wxList macros
1160  //void operator delete(void* recordptr);
1161 
1162  //! used together with wxObject debug possibility, sent a string containing m_id to the output stream.
1163 #if wxUSE_STD_IOSTREAM && (defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT)
1164  virtual void Dump( wxSTD ostream& str );
1165 #endif
1166 
1167  //!get the reference count, how many owners/references are made to this object.
1168  /*!
1169  normally the object should only be deleted is the refcount is 0, which means that is not
1170  longer owned by any other object.
1171  Use Release() For that.
1172  */
1173  inline int GetOwnedBy() { return m_refcount; }
1174 
1175  //! Call to mark this object as non-dynamic (static/local/auto)
1176  /*!
1177  Used to have an a2dObject as a non pointer/smart pointer.
1178 
1179  \return The return value is the object itself.
1180 
1181  \remark You need NOT call Release, but you must destruct the object (usually automatic)
1182  */
1183  virtual a2dObject* SetNonDynamic();
1184 
1185  //!Check zero reference count and delete if count is 0
1186  /*! This is usefull if a reference counted object was never owned.
1187  Then the reference counter is always 0 and Release will never be called.
1188  As not all pointers (e.g. temporary, paramaters) call Own, this may happen.
1189  */
1190  void CheckReferences();
1191 
1192  //! options for cloning
1193  /*!
1194  a2dObject is reference counted, and therefore each object can have more then one owner.
1195  For this reason there are many ways to clone a tree of nested a2dObject's.
1196  The options here are meant to stear this clone process for nested childs and/or properties.
1197  Although a a2dObject by itself does not have properties nor child objects, the idea is that
1198  in derived objects there will be such a structure, a2dObject and a2dCanvasObject to start with.
1199  */
1201  {
1202  //! if set, clone members (e.g. line end styles), otherwise ref-copy them
1203  clone_members = 0x00000001,
1204  //! if set, clone properties (e.g. fill style), otherwise ref-copy them
1205  clone_properties = 0x00000002,
1206  //! if set, clone childs, otherwise ref-copy them
1207  clone_childs = 0x00000004,
1208  //! use this for new future flag
1209  clone_unused = 0x00000008,
1210  //! if set, set in the clone the PROPID_Original property to the copied object
1211  /*! clone_setoriginal is done recursively, if childs are cloned */
1212  clone_setoriginal = 0x00000010,
1213  //! if set, set in the clone the PROPID_editcopy property to the original object
1214  /*! clone_seteditcopy is NOT done recursively, even if childs are cloned */
1215  clone_seteditcopy = 0x00000020,
1216  //! Prevent cloning a reference at a deeper level
1217  clone_noReference = 0x00000040,
1218  //! Prevent cloning a a2dCameleon reference at a deeper level
1219  clone_noCameleonRef = 0x00000080,
1220  //! Hint to clone enough of the object to do proper dragging in graphics
1221  clone_toDrag = 0x00000100,
1222 
1223  clone_flat = 0x00000000,
1224  clone_deep = clone_members | clone_properties | clone_childs,
1225  };
1226  friend inline CloneOptions operator|( CloneOptions a, CloneOptions b )
1227  {
1228  return ( CloneOptions )( ( int )a | ( int ) b );
1229  }
1230 
1231  //! create an exact copy of this property
1232  a2dObject* Clone( CloneOptions options, a2dRefMap* refs = NULL ) const;
1233 
1234  a2dObject( const a2dObject& other, CloneOptions options, a2dRefMap* refs );
1235 
1236  //!Returns the name of this object, if no name is given the internal id will be returned
1237  /*!
1238  Gives the name of the object in string form,
1239  or when the a2dStringProperty PROPID_Name is set, its value will be returned
1240 
1241  \remark
1242  Don't rely on the internal id, because it's a temporary value.
1243  If you want to save this value, it's more secure to set a name because the
1244  name can be persistent instead of the internal id.
1245 
1246  \see SetName
1247  \see a2dObject::GetId
1248  */
1249  virtual wxString GetName() const;
1250 
1251  //! Creates the a2dStringProperty PROPID_Name
1252  /*! If set, the name will be returned for GetName() from now on.
1253  \param name name to be set for the object
1254  */
1255  virtual void SetName( const wxString& name );
1256 
1257  //!Check if this is a temporary object, which should not be saved
1258  virtual bool IsTemporary_DontSave() const { return false; }
1259 
1260 #if wxART2D_USE_CVGIO
1261 
1262  //! Save this object and all below as an XML document
1263  /*!
1264  <code>
1265  //check flag is used for writing once an object which is referenced many times
1266  a2dWalker_SetCheck setp( false );
1267  setp.Start( m_rootObject );
1268  setp.Start( m_layersetup );
1269  a2dIOHandlerXmlSerOut out;
1270  SaveAsDocument( out );
1271  <code/>
1272 
1273  */
1274  void SaveAsDocument( a2dIOHandlerXmlSerOut& out );
1275 
1276  //!write all needed to an XML type of file called the CVG format
1277  /*!
1278  \param parent parent object from where this was called.
1279  \param out XML io handler
1280  \param towrite nested object to write later.
1281  */
1282  virtual void Save( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dObjectList* towrite );
1283 
1284  //! Load this object and all below from an XML document
1285  /*!
1286  <code>
1287  a2dWalker_SetBoolProperty setp( PROPID_Check, false );
1288  setp.Start( this );
1289  a2dIOHandlerXmlSerIn parser;
1290  SaveAsDocument( parser );
1291  <code/>
1292 
1293  */
1294  void LoadFromDocument( a2dIOHandlerXmlSerIn& parser );
1295 
1296  //!load object from CVG file
1297  /*!
1298  \param parent parent object from where this was called.
1299  \param parser basic pull parser for XML content
1300  */
1301  virtual void Load( wxObject* parent, a2dIOHandlerXmlSerIn& parser );
1302 
1303 #endif //wxART2D_USE_CVGIO
1304 
1305  //! return a unique id for this object
1306  /*! The id is derived from the address
1307  */
1308  wxInt64 GetUniqueSerializationId() const;
1309 
1310  //! If true, always write an id
1311  /*! Usually an id is only written if the object is multiple referenced and
1312  refcount is >= 2. Some objects, namely a2dPin objects, are multiple
1313  referenced even if refcount = 1.
1314  */
1315  virtual bool AlwaysWriteSerializationId() const;
1316 
1317  //! link a reference in the object to the given value
1318  /*! This is intended for e.g. paired links as in a2dPin, where the usual a2dResolveIdInfo mechanism cannot be used. */
1319  virtual bool LinkReference( a2dObject* other );
1320 
1321  //! inform an object that reference resolution was done
1322  /*! This is intended for objects that need to do something with loaded objects */
1323  virtual void ResolveInform( );
1324 
1325  //! This is used to recursively walk through an object tree
1326  void Walker( wxObject* parent, a2dWalkerIOHandler& handler );
1327 
1328  //!general flag use at will.
1329  /*!
1330  \remark
1331  This flag should only be used for temporarly purposes.
1332  This object uses this flag too and you might run into problems if you use this flag.
1333  It's a good practice to set this flag if you need it and reset this flag to <code>false</code>
1334  if you don't need it anymore. Another possibility might be to add a new property to this object
1335  if you want to be on the secure side.
1336 
1337  \param check temporarely status information
1338  */
1339  inline void SetCheck( bool check ) { m_check = check; }
1340 
1341  //!general flag use at will.
1342  inline bool GetCheck() const {return m_check;}
1343 
1344  //!set release flag
1345  /*!If this flag is set, the object will be released on the next update */
1346  void SetRelease( bool value ) { m_release = value; }
1347 
1348  //!get release flag
1349  /*!If this flag is set, the object will be released on the next update */
1350  bool GetRelease( ) const { return m_release; }
1351 
1352 public:
1353 
1354  //! return the list head pointer for autozero pointers to this object
1355  /*! This is a void pointer, because there might be auto zero pointers
1356  of various different types (for derived classes) pointing to this object,
1357  so a strictly typed pointer isn't possible anyway
1358  */
1359  a2dAutoZeroPtr<a2dObject> ** GetAutoZeroPtrList() { return &m_autozeroptrlist; }
1360  //! this is needed inside the smart pointer template code
1362 
1363 private:
1364 
1365  //! Call to have a new owner for this object
1366  /*! This function should only be called by a2dSmrtPtr
1367 
1368  \remark owning mean that the object calling this member needs to call Release at some time,
1369  in order to actually release/delete the object.
1370 
1371  \return The return value is the object itself, which is now owned on time extra.
1372 
1373  increment refcount by 1 ( use when adding a reference to this object)
1374  */
1375  virtual a2dObject* SmrtPtrOwn()
1376  {
1377  m_refcount++; return this;
1378  }
1379 
1380  //!To release the object, it is not longer owned by the calling object.
1381  /*! This function should only be called by a2dSmrtPtr
1382  */
1383  virtual bool SmrtPtrRelease();
1384 
1385  //! wxProperty is a friend and allowed to use these functions
1386  friend class a2dPropertyId;
1387 
1388 protected:
1389 
1390  //! used to decide if a property shall be ignored, if it is not a member
1391  /*! The base class definition ignores all ids, that have the "flag_onlymember" set
1392  Derived classes might want to check the flag_onlymemberhint or specific ids. */
1393  virtual bool DoIgnoreIfNotMember( const a2dPropertyId* id ) const { return id->IsOnlyMember(); }
1394 
1395  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const = 0;
1396 
1397  //********************** PROPERTIES *********************/
1398  /*! \name Properties
1399  a a2dObject has a list of general named properties
1400  */
1401  //\{
1402 public:
1403 
1404 
1405  //! get property on this object
1406  /*!
1407  If the propertyId has member or member function pointers, that will be used to get the value.
1408  Else the property list will be searched for the right propertyId.
1409  In any case the value of the property is wrapped into a new a2dNamedProperty, which is returned.
1410  You must delete the returned object yourself.
1411  */
1412  a2dNamedProperty* GetProperty( const a2dPropertyId* propertyId, a2dPropertyId::Flags flags = a2dPropertyId::flag_none ) const;
1413 
1414  //! Set the property to the this object.
1415  /*!
1416  The a2dNamedProperty to set to the object as indicated by its a2dPropertyId, is used as as,
1417  or the value is taken from it and assigned to something in the object and the property is deleted itself in the end.
1418 
1419  - The property given will be \b owned by the object or deleted, so you must give a new or cloned property
1420  - Derived class versions of this function might redirect to a different object (wxHierarchicalId)
1421  - This is the recommended function for setting a property object in/to a target object
1422  - Typed derived classes supply a SetPropertyToObject function that takes a value. That is the prefered method.
1423  */
1424  void SetProperty( a2dNamedProperty* propertyHolder, a2dPropertyId::SetFlags flags = a2dPropertyId::set_none );
1425 
1426  //! Set the property to the this object and if enabled, to all childs and object members
1427  /*!
1428  The a2dNamedProperty to set to the object as indicated by this a2dPropertyId is cloned and like that added to the object,
1429  or the value is taken from it and assigned to something in the object.
1430 
1431  - The property given will <b> NOT be owned </b> by the object or deleted. You can give a temporary object. If required, the property will be cloned.
1432  - Derived class versions of this function might redirect to a different object (wxHierarchicalId)
1433  - This is the recommended function for setting a property object in/to a target object
1434  - Typed derived classes supply a SetPropertyToObject function that takes a value. This is the prefered method.
1435  */
1436  void SetProperty( const a2dNamedProperty& propertyHolder, a2dPropertyId::SetFlags flags = a2dPropertyId::set_none );
1437 
1438 #ifdef DOXYGEN
1439  //! Find a property with given the name of the a2dPropertyId.
1440  /*!\
1441  Searches the a2dPropertyId with this name on the object, if found, it is returned as
1442  a a2dNamedProperty containing the value.
1443  */
1444  const a2dNamedProperty* classname::FindProperty( const wxString& idName ) const;
1445 #endif // DOXYGEN
1446 
1447  //! Find a dynamic property with given id in the property list.
1448  /*!
1449  Searches the Properties stored in the dynamic property list of a a2dObject, not the
1450  member properties.
1451  */
1452  virtual a2dNamedProperty* FindProperty( const a2dPropertyId* id, a2dPropertyId::Flags flags = a2dPropertyId::flag_none );
1453 
1454  //! Find a dynamic property with given id in the property list.
1455  /*!
1456  Searches the Properties stored in the dynamic property list of a a2dObject, not the
1457  member properties.
1458  */
1459  virtual const a2dNamedProperty* FindProperty( const a2dPropertyId* id, a2dPropertyId::Flags flags = a2dPropertyId::flag_none ) const;
1460 
1461  //! Check if the object has a property with given id and string representation.
1462  /*! first the a check is done if the given id is valid for this object.
1463  If yes, the property value is retrieved and the stringvalue checked.
1464  If the property id dynamic, and not set, false is returned.
1465  If stringvalue is an empty string, only availability of the property is checked.
1466  */
1467  virtual bool HasProperty( const a2dPropertyId* id, const wxString& stringvalue = wxEmptyString ) const;
1468 
1469  //! This function is called after a property changed
1470  /*! This is overloaded to set e.g. a pending flag
1471  */
1472  virtual void OnPropertyChanged( const a2dPropertyId* id );
1473 
1474  //! edit properties of the object
1475  /*!
1476  \param id If property id is set only matching properties are selected
1477  \param withUndo If true, the changes can be undone later.
1478  */
1479  virtual bool EditProperties( const a2dPropertyId* id, bool withUndo = true );
1480 
1481  //! Properties in the id list are taken from the given object, en set to this.
1482  /*!
1483  If some id in the list is not found in this or the other object, it will be skipped.
1484  */
1485  void TakeOverProperties( a2dObject* from, a2dPropertyIdList* listOfIds );
1486 
1487  //!quick way to get to PROPID_URI property
1488  /*!
1489  \return if no property PROPID_URI is available the return string is empty
1490  else it is the string containing the complete URL.
1491  */
1492  wxURI GetURI() const;
1493 
1494  //! quickly set a property PROPID_URI
1495  /*!
1496  This function stores an url string within a property called PROPID_URI
1497  When writing to SVG (scalable vector graphics), it is translated to the <a> tag.
1498  This tag is for linking to other svg content or HTML etc.
1499  See SVG specification, for a complete overview.
1500  \param url a string containing a complete url
1501  ex: "xlink:href="http://www.w3.org""
1502  ex: "href="http://www.w3.org"
1503  ex: "mydrawing.svg#myid"
1504  */
1505  void SetURI( const wxURI& url );
1506 
1507  //! Get the Property List.
1508  /*! Returns a reference to the propertylist
1509  */
1510  const a2dNamedPropertyList& GetPropertyList() const { return m_propertylist; }
1511 
1512  //! test if there are dynamic properties in the m_propertylist
1514  {
1515  return !m_propertylist.empty();
1516  }
1517 
1518  //! This function is called by a2dPropertyId to remove a property from the list
1519  /*! The base class implementation does nothing */
1520  virtual bool RemoveProperty( const a2dPropertyId* WXUNUSED( id ), bool all = true );
1521 
1522  //! remove all temporary properties
1523  void RemoveTemporaryProperties( );
1524 
1525  //! This function is called by a2dPropertyId to add a property to the list
1526  /*!
1527  Best used via the a2dPropertyId.
1528  */
1529  virtual bool AddProperty( a2dNamedProperty* property );
1530 
1531  //\}
1532  //**************** END PROPERTIES ***************/
1533 
1534 protected:
1535 
1536  //! iterate over this object and its children
1537  /*!
1538  This function allows you to extend the functionality of all a2dObject classes
1539  in a a2dDocument, without adding extra members to these objects.
1540 
1541  Default functions are called on the a2dWalkerIOHandler, which redirect the
1542  calls to other functions based on this object its classname.
1543  On can register classes to a2dWalkerIOHandler or derived classes.
1544  This way for each unique object in the document there can be a function
1545  in a2dWalkerIOHandler.
1546 
1547  \return false if some object did not have a function attached via a2dWalkerIOHandler.
1548 
1549  See a2dWalkerIOHandler for more.
1550  */
1551  virtual void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
1552 
1553 #if wxART2D_USE_CVGIO
1554  //! Save settings.
1555  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts, a2dObjectList* towrite );
1556  //! Load settings.
1557  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
1558 #endif //wxART2D_USE_CVGIO
1559 
1560  //!properties
1561  a2dNamedPropertyList m_propertylist;
1562 
1563  //!how many references to this object do exist
1565 
1566  //! used for linking multiple referenced objects when serializing
1567  bool m_check: 1;
1568 
1569  //! when set object is treated as being deleted, and wil be deleted in idle time.
1570  bool m_release: 1;
1571 
1572  //! this is used as a recursion stopper
1573  bool m_recursion_active: 1;
1574 
1575  bool m_pendingDisconnects: 1;
1576 
1577  unsigned int m_iteratorCount;
1578 
1579  //!this is a list of all a2dAutoZeroPtr object pointing to this object
1581 
1582  //!special refcount value for non-dynamic objects
1583  enum { refcount_nondynamic = 0x76543210 };
1584 
1585 public:
1586 
1587 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
1588  //! this is a list of all smart pointers pointing to this object
1589  a2dSmrtPtr<a2dObject> *m_ownerlist;
1590  //! this is needed inside the smart pointer template code
1591  typedef a2dSmrtPtr<a2dObject> TOwnerListClass;
1592  //! Make a Dump of the objects owner list to the Debug console
1593  /*! This function is usually called from the Debuggers watch window */
1594  void DumpOwners();
1595 #endif
1596 
1597 
1598  //! used for linking multiple referenced objects when serializing
1600  //! attach an URL to the object
1602  //! Name property, to return name of this object
1604  static a2dPropertyIdVoidPtr* PROPID_autozeroptrlist;
1605  //! edit properties event, see EditProperties()
1606  static const a2dSignal sm_Edit_properties;
1607 
1609 
1610 private:
1611  friend class a2dSmrtPtrBase;
1612 
1613  //!this is a not implemented copy constructor that avoids automatic creation of one
1614  a2dObject( const a2dObject& other );
1615 
1616 };
1617 
1618 //! smart pointer to a2dObject
1620 
1621 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
1622 //! we must check this->m_refcount != 0 before keepalive = this
1623 //! keepalive used in ProcessEvent, maybe in destuctor a2dObject where m_refcount already 0,
1624 //! so destructor is called second time when is destroing keepalive
1625 #define a2dREFOBJECTPTR_KEEPALIVE CurrentSmartPointerOwner = this;\
1626  a2dObjectPtr keepalive(__FILE__, __LINE__,(this->m_refcount != 0 ? this : NULL ))
1627 #else
1628 //! we must check this->m_refcount != 0 before keepalive = this
1629 //! keepalive used in ProcessEvent, maybe in destuctor a2dObject where m_refcount already 0,
1630 //! so destructor is called second time when is destroing keepalive
1631 #define a2dREFOBJECTPTR_KEEPALIVE a2dObjectPtr keepalive = (this->m_refcount != 0 ? this : NULL )
1632 #endif
1633 
1634 //! is a a2dAutoZeroPtr<a2dObject>
1636 
1637 //! simple ref counted class to maintain a wxObject* as if it is a smart pointer
1638 /*!
1639  If you want to store wxObject pointers in a STL template list ( like a2dlist ), that becomes a problem.
1640  STL stores object by value, and does not delete the object pointed to when removing a pointer from the list.
1641  The trick is to store a2dSmrtPtr< wxObject> in the list, which will automatically delete wxObject when a smart pointer.
1642  But a a2dSmrtPtr< wxObject> can not be created since wxObject has no refcounting as needed for a2dSmrtPtr.
1643  Now this class wraps the wxObject into a class which does have the refcounting, so one stores a2dSmrtPtr< a2dRefCount >
1644  in the STL list instead, and all will be oke.
1645 
1646  \ingroup general
1647 */
1649 {
1650 
1651 public:
1652 
1653  //! constructor
1654  a2dRefCount( wxObject* theObjectToWrap )
1655  {
1656  m_refcount = 0;
1657  m_object = theObjectToWrap;
1658  }
1659 
1660  //! destructor
1661  virtual ~a2dRefCount()
1662  {
1663  wxASSERT_MSG( m_refcount == 0, wxT( "deleting a2dRefCount while referenced" ) );
1664  delete m_object;
1665  }
1666 
1667  wxObject* GetObj() { return m_object; }
1668 
1669 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
1670  //! this is a list of all smart pointers pointing to this object
1671  a2dSmrtPtr<a2dRefCount> *m_ownerlist;
1672  //! this is needed inside the smart pointer template code
1673  typedef a2dSmrtPtr<a2dRefCount> TOwnerListClass;
1674  //! Make a Dump of the objects owner list to the Debug console
1675  /*! This function is usually called from the Debuggers watch window */
1676  void DumpOwners();
1677 #endif
1678 
1679 private:
1680 
1681  //! Call to have a new owner for this object
1682  /*! This function should only be called by wxlSmrtPtr
1683 
1684  \remark owning mean that the object calling this member needs to call Release at some time,
1685  in order to actually release/delete the object.
1686 
1687  \return The return value is the object itself, which is now owned on time extra.
1688 
1689  increment refcount by 1 ( use when adding a reference to this object)
1690  */
1691  virtual a2dRefCount* SmrtPtrOwn()
1692  {
1693  m_refcount++; return this;
1694  }
1695 
1696  //!To release the object, it is not longer owned by the calling object.
1697  /*! This function should only be called by wxlSmrtPtr
1698  */
1699  virtual bool SmrtPtrRelease()
1700  {
1701  m_refcount--;
1702  wxASSERT_MSG( m_refcount >= 0, wxT( "wxRefCount Own/Release not matched (extra Release calls)" ) );
1703  if ( m_refcount <= 0 )
1704  {
1705  delete this;
1706  return true;
1707  }
1708  return false;
1709  }
1710 
1711  friend class a2dSmrtPtrBase;
1712 
1713 protected:
1714 
1715  //!how many references to this object do exist
1717 
1718  //! the wxObject that is maintained using Smart pointer within here.
1719  wxObject* m_object;
1720 };
1721 
1722 
1723 //! list for a2dRefCount Smart pointers
1724 /*!
1725  Makes it possible to store wxObject* in a STL lists by using smart pointers.
1726  Deletion of the wxObject will be automaticaly done via a2dRefCount class.
1727 
1728  \ingroup general
1729 */
1731 {
1732 
1733 public:
1734 
1735  //! constructor
1737 
1738  //! destructor
1740 
1741  //! convenient to push wxObject, instead of a2dRefCount( theObjectToWrap )
1742  void push_backobj( wxObject* obj )
1743  {
1744  push_back( new a2dRefCount( obj ) );
1745  }
1746 
1747  //! convenient to push wxObject, instead of a2dRefCount( theObjectToWrap )
1748  void push_frontobj( wxObject* obj )
1749  {
1750  push_front( new a2dRefCount( obj ) );
1751  }
1752 
1753 };
1754 
1755 //! smart pointer for a2dRefCount
1757 
1758 //! (In) Visible property that can be added to Docview Objects.
1759 /*!
1760 
1761  In general derived objects of this class are added as properties to a a2dObject.
1762  You can store/wrap almost any information you like in a property. The purpose is mainly to allow users
1763  of the library to attach extra information to an object, without the need to extend the object with C++ members.
1764  The properties are dynamic, and space needed for them is freed when the property is removed. This keeps classes small
1765  since all extra information needed for editing an object are whatever, can be stored via the property system,
1766  as soon as the action is finished all extra data can be removed again.
1767 
1768  There are many ways to use the properties. But the important thing is to understand that a2dNamedProperties instances are
1769  made unique in type of info and purpose by its a2dPropertyId. A specific derived a2dNamedProperty, containing some data,
1770  does have a a2dPropertyId set to it on creation. This id is like a unique application broad name for this a2dNamedProperty.
1771  The type of id can only be used in conbination with that type of a2dNamedProperty.
1772  Normally you add specific a2dPropertyId instances to a a2dObject as static members, which defines which properties
1773  can be set to the object.
1774 
1775  class a2dNamedProperty_X has a one to relation to a class a2dPropertyId_Y.
1776  There can be many instances of a2dNamedProperty_X all with instantiated with different instances of that a2dPropertyId_Y.
1777 
1778  Properties are chained via its next member.
1779 
1780  see a2dObject
1781 
1782  \ingroup property
1783 
1784 */
1785 class A2DGENERALDLLEXP a2dNamedProperty : public wxObject
1786 {
1787 
1788 #ifdef CLASS_MEM_MANAGEMENT
1789 
1790  //! memory manager for speed up to replace system calls allocation and deallocation
1791  static a2dMemManager sm_memManager;
1792 
1793 public:
1794 
1795  //! overloaded operator new for this class and it all derived classes
1796  void* operator new( size_t bytes )
1797  {
1798  return sm_memManager.Allocate( bytes );
1799  }
1800 
1801  //! overloaded operator delete for this class and it all derived classes
1802  /*!
1803  This function doesn't free to OS-system memory block by pointer 'space'.
1804  It adds memory block by pointer 'space' to internal lists.
1805  It is for speed up.
1806  */
1807  void operator delete( void* space, size_t bytes )
1808  {
1809  sm_memManager.Deallocate( space, bytes );
1810  }
1811 
1812 #endif //CLASS_MEM_MANAGEMENT
1813 
1814 public:
1815  //! Default constructor
1816  a2dNamedProperty();
1817 
1818  //! Constructor giving an id
1819  a2dNamedProperty( const a2dPropertyId* id );
1820 
1821  //! Copy constructor
1822  a2dNamedProperty( const a2dNamedProperty& other );
1823 
1824  //! Virtual copy constructor
1825  a2dNamedProperty* Clone( a2dObject::CloneOptions options, a2dRefMap* refs = NULL ) const;
1826 
1827  //! Virtual assignment operator
1828  virtual void Assign( const a2dNamedProperty& other ) = 0;
1829 
1830  //! Destructor
1831  virtual ~a2dNamedProperty();
1832 
1833  //!general flag use at will.
1834  /*!
1835  \remark
1836  This flag should only be used for temporarly purposes.
1837  This object uses this flag too and you might run into problems if you use this flag.
1838  It's a good practice to set this flag if you need it and reset this flag to <code>false</code>
1839  if you don't need it anymore. Another possibility might be to add a new property to this object
1840  if you want to be on the secure side.
1841 
1842  \param check temporarely status information
1843  */
1844  inline void SetCheck( bool check ) { m_check = check; }
1845 
1846  //!general flag use at will.
1847  inline bool GetCheck() const {return m_check;}
1848 
1849  //! Set this property to an object
1850  /*! The property "this" will be owned by the object */
1851  inline void SetToObject ( a2dObject* obj, a2dPropertyId::SetFlags setflags = a2dPropertyId::set_none ) { obj->SetProperty( this, setflags ); }
1852 
1853  //! Set this property to an object and clone it if neccessary
1854  /*! The property "this" will NOT be owned by the object. It will be cloned if neccessary */
1855  inline void SetToObjectClone( a2dObject* obj, a2dPropertyId::SetFlags setflags = a2dPropertyId::set_none ) const { obj->SetProperty( *this, setflags ); }
1856 
1857  //! Get the a2dPropertyId object identifying this property
1858  const a2dPropertyId* GetId() const { wxASSERT_MSG( m_id, wxT( "id not set in property" ) ); return m_id; }
1859 
1860  //! creates an a2dPropertyId for this property, if it is not available.
1861  virtual const a2dPropertyId* CreateId( a2dObject* parent, const wxString& name );
1862 
1863  //! Get the name of the a2dPropertyId object
1864  wxString GetName() const { return m_id->GetName(); }
1865 
1866  //! when a2dStringProperty, return its value else assert
1867  virtual wxString GetString() const;
1868 
1869  //! when a2dDoubleProperty, return its value else assert
1870  virtual double GetDouble() const;
1871 
1872  //! when a2dFloatProperty, return its value else assert
1873  virtual float GetFloat() const;
1874 
1875  //! when a2dBoolProperty, return its value else assert
1876  virtual bool GetBool() const;
1877 
1878  //! when a2dInt16Property, return its value else assert
1879  virtual wxInt16 GetInt16() const;
1880 
1881  //! when a2dUint16Property, return its value else assert
1882  virtual wxUint16 GetUint16() const;
1883 
1884  //! when a2dInt32Property, return its value else assert
1885  virtual wxInt32 GetInt32() const;
1886 
1887  //! when a2dUint32Property, return its value else assert
1888  virtual wxUint32 GetUint32() const;
1889 
1890  //! when a2dVoidPtrProperty, return its value else assert
1891  virtual void* GetVoidPtr() const;
1892 
1893  //! when a2dProperty, return its value else assert
1894  virtual a2dObject* GetRefObject() const;
1895 
1896  //! when a2dProperty, return its value else return NULL
1897  virtual a2dObject* GetRefObjectNA() const;
1898 
1899  //! Convert the property to a string, used to serialize class.
1900  //! Override to define it for your properties.
1901  virtual wxString StringRepresentation() const { return m_id->GetName(); }
1902 
1903  //! Convert the property value to a string, used to serialize class.
1904  //! Override to define it for your properties.
1905  virtual wxString StringValueRepresentation() const { wxASSERT( 0 ); return wxT( "" ); }
1906 
1907  //! some derived properties can be visible or not and override this
1908  virtual bool GetVisible() const { return true; }
1909  //! some derived properties can be renderable or not and override this
1910  /*!
1911  some properties have a reference to a a2dCanvasObject, but only to store it,
1912  not to render it as part of the object.
1913 
1914  a2dPropertyId of a property normally decides if this specific property is to be rendered or not.
1915  */
1916  virtual bool GetCanRender() const { return false; }
1917 
1918  //! parse a double from the value string
1919  double ParseDouble( unsigned int& position );
1920  //! parse comma, whitespace and skip it form teh value string
1921  void SkipCommaSpaces( unsigned int& position );
1922  //! parse whitespace and skip it form teh value string
1923  void SkipSpaces( unsigned int& position );
1924 
1925  //! This is used to recursively walk through an object tree
1926  /*!
1927  */
1928  void Walker( wxObject* parent, a2dWalkerIOHandler& handler );
1929  virtual void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
1930 
1931 #if wxART2D_USE_CVGIO
1932  virtual void Save( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dObjectList* towrite );
1933  virtual void Load( wxObject* parent, a2dIOHandlerXmlSerIn& parser );
1934  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
1935  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
1936 #endif //wxART2D_USE_CVGIO
1937 
1938  DECLARE_CLASS( a2dNamedProperty )
1939 
1940 protected:
1941 
1942  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const = 0;
1943 
1944  //! The property id object identifying this property
1945  const a2dPropertyId* m_id;
1946  // the propeerty ids also have special access right sto properties
1947  friend class a2dPropertyId;
1948 
1949 #ifdef _DEBUG
1950  int _debug_id;
1951 #endif
1952 
1953 public:
1954 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
1955  a2dNamedPropertyList* m_ownerlist;
1956 #endif
1957 
1958 private:
1959 
1960  //! used for linking multiple referenced objects when serializing
1961  bool m_check: 1;
1962 
1963  //!how many references to this object do exist
1964  int m_refcount;
1965 
1966  //! Call to have a new owner for this object
1967  /*! This function should only be called by a2dSmrtPtr
1968 
1969  \remark owning mean that the object calling this member needs to call Release at some time,
1970  in order to actually release/delete the object.
1971 
1972  \return The return value is the object itself, which is now owned on time extra.
1973 
1974  increment refcount by 1 ( use when adding a reference to this object)
1975  */
1976  a2dNamedProperty* SmrtPtrOwn() { m_refcount++; return this; }
1977 
1978  //!To release the object, it is not longer owned by the calling object.
1979  /*! This function should only be called by a2dSmrtPtr
1980  */
1981  bool SmrtPtrRelease()
1982  {
1983  m_refcount--;
1984  wxASSERT_MSG( m_refcount >= 0, wxT( "a2dNamedProperty Own/Release not matched (extra Release calls)" ) );
1985  if ( m_refcount <= 0 )
1986  {
1987  delete this;
1988  return true;
1989  }
1990  return false;
1991  }
1992 
1993 private:
1994  friend class a2dSmrtPtrBase;
1995 };
1996 
1997 //! smart pointerv to a2dNamedProperty
1999 
2000 //! property to hold a bool type variable to be associated with a a2dObject
2001 /*!
2002  \ingroup property
2003 */
2004 class A2DGENERALDLLEXP a2dBoolProperty: public a2dNamedProperty
2005 {
2006 public:
2007 
2008  a2dBoolProperty();
2009 
2010  a2dBoolProperty( const a2dPropertyIdBool* id, bool deep = true );
2011 
2012  a2dBoolProperty( const a2dBoolProperty& other, a2dObject::CloneOptions options );
2013 
2014  virtual void Assign( const a2dNamedProperty& other );
2015 
2016  virtual ~a2dBoolProperty();
2017 
2018  //! Construct a new property object from a string
2019  /*! Accepted values for true are:
2020  - "true"
2021  - "yes"
2022  - "y"
2023  - "1"
2024  - native yes, eg. "ja" in the Netherlands or Germany. Dependant on local settings (i18n).
2025  All other values are interpreted as false.
2026  */
2027  static a2dBoolProperty* CreatePropertyFromString( const a2dPropertyIdBool* id, const wxString& value );
2028 
2029  void SetValue( bool value );
2030 
2031  bool GetValue() const { return m_value; }
2032 
2033  virtual bool GetBool() const { return m_value; }
2034 
2035  bool* GetValuePtr() { return &m_value; }
2036 
2037  bool& GetValueRef() { return m_value; }
2038 
2039  const bool* GetValuePtr() const { return &m_value; }
2040 
2041  const bool& GetValueRef() const { return m_value; }
2042 
2043  virtual wxString StringRepresentation() const;
2044 
2045  virtual wxString StringValueRepresentation() const;
2046 
2047  virtual const a2dPropertyId* CreateId( a2dObject* parent, const wxString& name );
2048 
2049 #if wxART2D_USE_CVGIO
2050  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
2051  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
2052 #endif //wxART2D_USE_CVGIO
2053 
2054  DECLARE_DYNAMIC_CLASS( a2dBoolProperty )
2055 
2056 protected:
2057  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
2058 
2059  bool m_value;
2060 };
2061 
2062 //! property to hold a wxString type variable to be associated with a a2dObject
2063 /*!
2064  \ingroup property
2065 */
2066 class A2DGENERALDLLEXP a2dStringProperty: public a2dNamedProperty
2067 {
2068 public:
2069 
2071 
2072  a2dStringProperty( const a2dPropertyIdString* id, const wxString& value );
2073 
2075 
2076  virtual void Assign( const a2dNamedProperty& other );
2077 
2078  virtual ~a2dStringProperty();
2079 
2080  //! Construct a new property object from a string
2081  //! If this is not appropriate, this may return NULL
2082  static a2dStringProperty* CreatePropertyFromString( const a2dPropertyIdString* id, const wxString& value );
2083 
2084  void SetValue( const wxString& value );
2085 
2086  wxString& GetValue() { return m_value; }
2087  const wxString& GetValue() const { return m_value; }
2088 
2089  virtual wxString GetString() const { return m_value; }
2090 
2091  wxString* GetValuePtr() { return &m_value; }
2092 
2093  virtual wxString StringRepresentation() const { return m_id->GetName() + m_value; };
2094 
2095  virtual wxString StringValueRepresentation() const { return m_value; };
2096 
2097  virtual const a2dPropertyId* CreateId( a2dObject* parent, const wxString& name );
2098 
2099 #if wxART2D_USE_CVGIO
2100  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
2101  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
2102 #endif //wxART2D_USE_CVGIO
2103 
2104  DECLARE_DYNAMIC_CLASS( a2dStringProperty )
2105 
2106 protected:
2107 
2108  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
2109 
2110  wxString m_value;
2111 };
2112 
2113 //! property to hold a void pointer type variable to be associated with a a2dObject
2114 /*!
2115  \ingroup property
2116 */
2117 class A2DGENERALDLLEXP a2dVoidPtrProperty: public a2dNamedProperty
2118 {
2119 public:
2120 
2122 
2123  a2dVoidPtrProperty( const a2dPropertyIdVoidPtr* id, void* value );
2124 
2125  a2dVoidPtrProperty( const a2dVoidPtrProperty& other );
2126 
2127  virtual void Assign( const a2dNamedProperty& other );
2128 
2129  virtual ~a2dVoidPtrProperty();
2130 
2131  //! Construct a new property object from a string
2132  //! If this is not appropriate, this may return NULL
2133  static a2dVoidPtrProperty* CreatePropertyFromString( const a2dPropertyIdVoidPtr* id, const wxString& value );
2134 
2135  void SetValue( void* value );
2136 
2137  void* GetValue() const { return m_value; }
2138 
2139  virtual void* GetVoidPtr() const { return m_value; }
2140 
2141  void** GetValuePtr() { return &m_value; }
2142 
2143  virtual wxString StringRepresentation() const;
2144 
2145  virtual wxString StringValueRepresentation() const;
2146 
2147 #if wxART2D_USE_CVGIO
2148  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
2149  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
2150 #endif //wxART2D_USE_CVGIO
2151 
2152  DECLARE_DYNAMIC_CLASS( a2dVoidPtrProperty )
2153 
2154 protected:
2155  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
2156 
2157  void* m_value;
2158 };
2159 
2160 //! property to hold a wxObject variable to be associated with a a2dObject
2161 /*!
2162  \ingroup property
2163 */
2164 class A2DGENERALDLLEXP a2dObjectProperty: public a2dNamedProperty
2165 {
2166 public:
2167 
2169 
2170  a2dObjectProperty( const a2dPropertyIdObject* id, const wxObject& value );
2171 
2172  a2dObjectProperty( const a2dObjectProperty& other );
2173 
2174  virtual void Assign( const a2dNamedProperty& other );
2175 
2176  virtual ~a2dObjectProperty();
2177 
2178  //! Construct a new property object from a string
2179  //! If this is not appropriate, this may return NULL
2180  static a2dObjectProperty* CreatePropertyFromString( const a2dPropertyIdObject* id, const wxString& value );
2181 
2182  void SetValue( const wxObject& value );
2183 
2184  const wxObject& GetValue() const { return m_value; }
2185 
2186  DECLARE_DYNAMIC_CLASS( a2dObjectProperty )
2187 
2188 protected:
2189 
2190  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
2191 
2192  wxObject m_value;
2193 };
2194 
2195 //! property to hold a a2dObjectPtr smart pointer type variable to be associated with a a2dObject
2196 /*!
2197  \ingroup property
2198 */
2199 class A2DGENERALDLLEXP a2dProperty: public a2dNamedProperty
2200 {
2201 public:
2202 
2203  a2dProperty();
2204 
2205  a2dProperty( const a2dPropertyIdRefObject* id, a2dObject* value );
2206 
2207  a2dProperty( const a2dProperty& other, a2dObject::CloneOptions options );
2208 
2209  virtual void Assign( const a2dNamedProperty& other );
2210 
2211  virtual ~a2dProperty();
2212 
2213  //! Construct a new property object from a string
2214  //! If this is not appropriate, this may return NULL
2215  static a2dProperty* CreatePropertyFromString( const a2dPropertyIdRefObject* id, const wxString& value );
2216 
2217  void SetValue( a2dObject* value );
2218 
2219  virtual a2dObject* GetRefObject() const { return m_value; }
2220  virtual a2dObject* GetRefObjectNA() const { return m_value; }
2221 
2222  a2dObject* GetValue() const { return m_value; }
2223 
2224  a2dObjectPtr* GetValuePtr() { return &m_value; }
2225 
2226  a2dObjectPtr& GetValueRef() { return m_value; }
2227 
2228  virtual wxString StringRepresentation() const;
2229 
2230  virtual wxString StringValueRepresentation() const;
2231 
2232 #if wxART2D_USE_CVGIO
2233  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
2234  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
2235 #endif //wxART2D_USE_CVGIO
2236 
2237  DECLARE_DYNAMIC_CLASS( a2dProperty )
2238 
2239 protected:
2240 
2241  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
2242 
2243  a2dObjectPtr m_value;
2244 };
2245 
2246 //! property to hold a a2dObject pointer type variable to be associated with a a2dObject
2247 /*!
2248  \ingroup property
2249 */
2250 class A2DGENERALDLLEXP a2dAutoZeroProperty: public a2dNamedProperty
2251 {
2252 public:
2253 
2255 
2256  a2dAutoZeroProperty( const a2dPropertyIdRefObjectAutoZero* id, a2dObject* value );
2257 
2259 
2260  virtual void Assign( const a2dNamedProperty& other );
2261 
2262  virtual ~a2dAutoZeroProperty();
2263 
2264  //! Construct a new property object from a string
2265  //! If this is not appropriate, this may return NULL
2266  static a2dAutoZeroProperty* CreatePropertyFromString( const a2dPropertyIdRefObjectAutoZero* id, const wxString& value );
2267 
2268  void SetValue( a2dObject* value );
2269 
2270  virtual a2dObject* GetRefObject() const { return m_value; }
2271  virtual a2dObject* GetRefObjectNA() const { return m_value; }
2272 
2273  a2dObject* GetValue() const { return m_value; }
2274 
2275  a2dObjectAutoZeroPtr* GetValuePtr() { return &m_value; }
2276 
2277  a2dObjectAutoZeroPtr& GetValueRef() { return m_value; }
2278 
2279  virtual wxString StringRepresentation() const;
2280 
2281  virtual wxString StringValueRepresentation() const;
2282 
2283 #if wxART2D_USE_CVGIO
2284  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
2285  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
2286 #endif //wxART2D_USE_CVGIO
2287 
2288  DECLARE_DYNAMIC_CLASS( a2dAutoZeroProperty )
2289 
2290 protected:
2291 
2292  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
2293 
2294  a2dObjectAutoZeroPtr m_value;
2295 };
2296 
2297 //! property to hold a 2 byte integer type variable to be associated with a a2dObject
2298 /*!
2299  \ingroup property
2300 */
2301 class A2DGENERALDLLEXP a2dInt16Property: public a2dNamedProperty
2302 {
2303 public:
2304 
2305  a2dInt16Property();
2306 
2307  a2dInt16Property( const a2dPropertyIdInt16* id, wxInt16 value );
2308 
2309  a2dInt16Property( const a2dInt16Property& other );
2310 
2311  virtual void Assign( const a2dNamedProperty& other );
2312 
2313  virtual ~a2dInt16Property();
2314 
2315  //! Construct a new property object from a string
2316  //! If this is not appropriate, this may return NULL
2317  static a2dInt16Property* CreatePropertyFromString( const a2dPropertyIdInt16* id, const wxString& value );
2318 
2319  void SetValue( wxInt16 value );
2320 
2321  wxInt16 GetValue() const { return m_value; }
2322 
2323  virtual wxInt16 GetInt16() const { return m_value; }
2324 
2325  wxInt16* GetValuePtr() { return &m_value; }
2326 
2327  wxInt16& GetValueRef() { return m_value; }
2328 
2329  virtual wxString StringRepresentation() const;
2330 
2331  virtual wxString StringValueRepresentation() const;
2332 
2333 #if wxART2D_USE_CVGIO
2334  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
2335  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
2336 #endif //wxART2D_USE_CVGIO
2337 
2338  DECLARE_DYNAMIC_CLASS( a2dInt16Property )
2339 
2340 protected:
2341 
2342  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
2343 
2344  wxInt16 m_value;
2345 };
2346 
2347 //! property to hold an unsigned 2 byte integer type variable to be associated with a a2dObject
2348 /*!
2349  \ingroup property
2350 */
2351 class A2DGENERALDLLEXP a2dUint16Property: public a2dNamedProperty
2352 {
2353 public:
2354 
2356 
2357  a2dUint16Property( const a2dPropertyIdUint16* id, wxUint16 value );
2358 
2359  a2dUint16Property( const a2dUint16Property& other );
2360 
2361  virtual void Assign( const a2dNamedProperty& other );
2362 
2363  virtual ~a2dUint16Property();
2364 
2365  //! Construct a new property object from a string
2366  //! If this is not appropriate, this may return NULL
2367  static a2dUint16Property* CreatePropertyFromString( const a2dPropertyIdUint16* id, const wxString& value );
2368 
2369  void SetValue( wxUint16 value );
2370 
2371  wxUint16 GetValue() const { return m_value; }
2372 
2373  virtual wxUint16 GetUint16() const { return m_value; }
2374 
2375  wxUint16* GetValuePtr() { return &m_value; }
2376 
2377  wxUint16& GetValueRef() { return m_value; }
2378 
2379  virtual wxString StringRepresentation() const;
2380 
2381  virtual wxString StringValueRepresentation() const;
2382 
2383 #if wxART2D_USE_CVGIO
2384  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
2385  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
2386 #endif //wxART2D_USE_CVGIO
2387 
2388  DECLARE_DYNAMIC_CLASS( a2dUint16Property )
2389 
2390 protected:
2391 
2392  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
2393 
2394  wxUint16 m_value;
2395 };
2396 
2397 //! property to hold a 2 byte integer type variable to be associated with a a2dObject
2398 /*!
2399  \ingroup property
2400 */
2401 class A2DGENERALDLLEXP a2dInt32Property: public a2dNamedProperty
2402 {
2403 public:
2404 
2405  a2dInt32Property();
2406 
2407  a2dInt32Property( const a2dPropertyIdInt32* id, wxInt32 value );
2408 
2409  a2dInt32Property( const a2dInt32Property& other );
2410 
2411  virtual void Assign( const a2dNamedProperty& other );
2412 
2413  virtual ~a2dInt32Property();
2414 
2415  //! Construct a new property object from a string
2416  //! If this is not appropriate, this may return NULL
2417  static a2dInt32Property* CreatePropertyFromString( const a2dPropertyIdInt32* id, const wxString& value );
2418 
2419  void SetValue( wxInt32 value );
2420 
2421  wxInt32 GetValue() const { return m_value; }
2422 
2423  virtual wxInt32 GetInt32() const { return m_value; }
2424 
2425  wxInt32* GetValuePtr() { return &m_value; }
2426 
2427  wxInt32& GetValueRef() { return m_value; }
2428 
2429  virtual wxString StringRepresentation() const;
2430 
2431  virtual wxString StringValueRepresentation() const;
2432 
2433  virtual const a2dPropertyId* CreateId( a2dObject* parent, const wxString& name );
2434 
2435 #if wxART2D_USE_CVGIO
2436  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
2437  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
2438 #endif //wxART2D_USE_CVGIO
2439 
2440  DECLARE_DYNAMIC_CLASS( a2dInt32Property )
2441 
2442 protected:
2443 
2444  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
2445 
2446  wxInt32 m_value;
2447 };
2448 
2449 //! property to hold an unsigned 4 byte integer type variable to be associated with a a2dObject
2450 /*!
2451  \ingroup property
2452 */
2453 class A2DGENERALDLLEXP a2dUint32Property: public a2dNamedProperty
2454 {
2455 public:
2456 
2458 
2459  a2dUint32Property( const a2dPropertyIdUint32* id, wxUint32 value );
2460 
2461  a2dUint32Property( const a2dUint32Property& other );
2462 
2463  virtual void Assign( const a2dNamedProperty& other );
2464 
2465  virtual ~a2dUint32Property();
2466 
2467  //! Construct a new property object from a string
2468  //! If this is not appropriate, this may return NULL
2469  static a2dUint32Property* CreatePropertyFromString( const a2dPropertyIdUint32* id, const wxString& value );
2470 
2471  void SetValue( wxUint32 value );
2472 
2473  wxUint32 GetValue() const { return m_value; }
2474 
2475  virtual wxUint32 GetUint32() const { return m_value; }
2476 
2477  wxUint32* GetValuePtr() { return &m_value; }
2478 
2479  wxUint32& GetValueRef() { return m_value; }
2480 
2481  virtual wxString StringRepresentation() const;
2482 
2483  virtual wxString StringValueRepresentation() const;
2484 
2485 #if wxART2D_USE_CVGIO
2486  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
2487  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
2488 #endif //wxART2D_USE_CVGIO
2489 
2490  DECLARE_DYNAMIC_CLASS( a2dUint32Property )
2491 
2492 protected:
2493 
2494  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
2495 
2496  wxUint32 m_value;
2497 };
2498 
2499 //! property to hold a double type variable to be associated with a a2dObject
2500 /*!
2501  \ingroup property
2502 */
2503 class A2DGENERALDLLEXP a2dDoubleProperty: public a2dNamedProperty
2504 {
2505 public:
2506 
2508 
2509  a2dDoubleProperty( const a2dPropertyIdDouble* id, double value );
2510 
2511  a2dDoubleProperty( const a2dDoubleProperty& other );
2512 
2513  virtual void Assign( const a2dNamedProperty& other );
2514 
2515  virtual ~a2dDoubleProperty();
2516 
2517  //! Construct a new property object from a string
2518  //! If this is not appropriate, this may return NULL
2519  static a2dDoubleProperty* CreatePropertyFromString( const a2dPropertyIdDouble* id, const wxString& value );
2520 
2521  void SetValue( double value );
2522 
2523  double GetValue() const { return m_value; }
2524 
2525  virtual double GetDouble() const { return m_value; }
2526 
2527  double* GetValuePtr() { return &m_value; }
2528 
2529  double& GetValueRef() { return m_value; }
2530 
2531  virtual wxString StringRepresentation() const;
2532 
2533  virtual wxString StringValueRepresentation() const;
2534 
2535 #if wxART2D_USE_CVGIO
2536  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
2537  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
2538 #endif //wxART2D_USE_CVGIO
2539 
2540  DECLARE_DYNAMIC_CLASS( a2dDoubleProperty )
2541 
2542 protected:
2543 
2544  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
2545 
2546  double m_value;
2547 };
2548 
2549 //! property to hold a float type variable to be associated with a a2dObject
2550 /*!
2551  \ingroup property
2552 */
2553 class A2DGENERALDLLEXP a2dFloatProperty: public a2dNamedProperty
2554 {
2555 public:
2556 
2557  a2dFloatProperty();
2558 
2559  a2dFloatProperty( const a2dPropertyIdFloat* id, float value );
2560 
2561  a2dFloatProperty( const a2dFloatProperty& other );
2562 
2563  virtual void Assign( const a2dNamedProperty& other );
2564 
2565  virtual ~a2dFloatProperty();
2566 
2567  //! Construct a new property object from a string
2568  //! If this is not appropriate, this may return NULL
2569  static a2dFloatProperty* CreatePropertyFromString( const a2dPropertyIdFloat* id, const wxString& value );
2570 
2571  void SetValue( float value );
2572 
2573  float GetValue() const { return m_value; }
2574 
2575  virtual float GetFloat() const { return m_value; }
2576 
2577  virtual double GetDouble() const { return m_value; }
2578 
2579  float* GetValuePtr() { return &m_value; }
2580 
2581  float& GetValueRef() { return m_value; }
2582 
2583  virtual wxString StringRepresentation() const;
2584 
2585  virtual wxString StringValueRepresentation() const;
2586 
2587 #if wxART2D_USE_CVGIO
2588  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
2589  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
2590 #endif //wxART2D_USE_CVGIO
2591 
2592  DECLARE_DYNAMIC_CLASS( a2dFloatProperty )
2593 
2594 protected:
2595 
2596  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
2597 
2598  float m_value;
2599 };
2600 
2601 //! property to hold a wxArrayString type variable to be associated with a a2dObject
2602 /*!
2603  \ingroup property
2604 */
2605 class A2DGENERALDLLEXP a2dArrayStringProperty: public a2dNamedProperty
2606 {
2607 public:
2608 
2610 
2611  a2dArrayStringProperty( const a2dPropertyIdArrayString* id, const wxArrayString& value );
2612 
2613  a2dArrayStringProperty( const a2dPropertyIdArrayString* id, const wxString& value );
2614 
2616 
2617  virtual void Assign( const a2dNamedProperty& other );
2618 
2619  virtual ~a2dArrayStringProperty();
2620 
2621  //! Construct a new property object from a string
2622  //! If this is not appropriate, this may return NULL
2623  static a2dArrayStringProperty* CreatePropertyFromString( const a2dPropertyIdArrayString* id, const wxString& value );
2624 
2625  void Add( const wxString& value );
2626 
2627  void SetValue( const wxArrayString& value );
2628 
2629  wxArrayString& GetValue() { return m_value; }
2630  const wxArrayString& GetValue() const { return m_value; }
2631 
2632  wxArrayString* GetValuePtr() { return &m_value; }
2633 
2634  virtual wxString StringRepresentation() const;
2635 
2636  virtual wxString StringValueRepresentation() const;
2637 
2638 #if wxART2D_USE_CVGIO
2639  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
2640  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
2641 #endif //wxART2D_USE_CVGIO
2642 
2643  DECLARE_DYNAMIC_CLASS( a2dArrayStringProperty )
2644 
2645 protected:
2646 
2647  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
2648 
2649  wxArrayString m_value;
2650 };
2651 
2652 //! property to hold a FileName type variable to be associated with a a2dObject
2653 /*!
2654  \ingroup property
2655 */
2656 class A2DGENERALDLLEXP a2dFileNameProperty: public a2dNamedProperty
2657 {
2658 public:
2659 
2661 
2662  a2dFileNameProperty( const a2dPropertyIdFileName* id, const wxFileName& filename );
2663 
2664  a2dFileNameProperty( const a2dFileNameProperty& other );
2665 
2666  virtual void Assign( const a2dNamedProperty& other );
2667 
2668  virtual ~a2dFileNameProperty();
2669 
2670  //! Construct a new property object from a string
2671  //! If this is not appropriate, this may return NULL
2672  static a2dFileNameProperty* CreatePropertyFromString( const a2dPropertyIdFileName* id, const wxString& value );
2673 
2674  void SetValue( const wxFileName& filenameObject );
2675 
2676  wxFileName GetValue() const { return m_filenameObject; }
2677 
2678  wxFileName* GetValuePtr() { return &m_filenameObject; }
2679 
2680  wxFileName& GetValueRef() { return m_filenameObject; }
2681 
2682  void SetFileName( const wxFileName& filenameObject );
2683 
2684  wxFileName GetFileName() { return m_filenameObject; }
2685 
2686  wxFileName& GetFileNameRef() { return m_filenameObject; }
2687 
2688  virtual wxString StringRepresentation() const;
2689 
2690  virtual wxString StringValueRepresentation() const;
2691 
2692 #if wxART2D_USE_CVGIO
2693  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
2694  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
2695 #endif //wxART2D_USE_CVGIO
2696 
2697  DECLARE_DYNAMIC_CLASS( a2dFileNameProperty )
2698 
2699 protected:
2700 
2701  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
2702 
2703  wxFileName m_filenameObject;
2704 };
2705 
2706 //! property to hold a wxDateTime type variable to be associated with a a2dObject
2707 /*!
2708  \ingroup property
2709 */
2710 class A2DGENERALDLLEXP a2dDateTimeProperty: public a2dNamedProperty
2711 {
2712 public:
2713 
2715 
2716  a2dDateTimeProperty( const a2dPropertyIdDateTime* id, const wxDateTime& datetime );
2717 
2718  a2dDateTimeProperty( const a2dDateTimeProperty& other );
2719 
2720  virtual void Assign( const a2dNamedProperty& other );
2721 
2722  virtual ~a2dDateTimeProperty();
2723 
2724  //! Construct a new property object from a string
2725  //! If this is not appropriate, this may return NULL
2726  static a2dDateTimeProperty* CreatePropertyFromString( const a2dPropertyIdDateTime* id, const wxString& value );
2727 
2728  void SetValue( const wxDateTime& datetimeObject );
2729 
2730  wxDateTime GetValue() const { return m_datetimeObject; }
2731 
2732  wxDateTime* GetValuePtr() { return &m_datetimeObject; }
2733 
2734  wxDateTime& GetValueRef() { return m_datetimeObject; }
2735 
2736  void SetDateTime( const wxDateTime& datetimeObject );
2737 
2738  wxDateTime GetDateTime() { return m_datetimeObject; }
2739 
2740  wxDateTime& GetDateTimeRef() { return m_datetimeObject; }
2741 
2742  virtual wxString StringRepresentation() const;
2743 
2744  virtual wxString StringValueRepresentation() const;
2745 
2746 #if wxART2D_USE_CVGIO
2747  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
2748  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
2749 #endif //wxART2D_USE_CVGIO
2750 
2751  DECLARE_DYNAMIC_CLASS( a2dDateTimeProperty )
2752 
2753 protected:
2754 
2755  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
2756 
2757  wxDateTime m_datetimeObject;
2758 };
2759 
2760 //! property to hold a Menu type variable to be associated with a a2dObject
2761 /*!
2762  \ingroup property
2763 */
2764 class A2DGENERALDLLEXP a2dMenuProperty: public a2dNamedProperty
2765 {
2766 public:
2767 
2768  a2dMenuProperty();
2769 
2770  a2dMenuProperty( const a2dPropertyIdMenu* id, wxMenu* menu );
2771 
2772  a2dMenuProperty( const a2dMenuProperty& other );
2773 
2774  virtual void Assign( const a2dNamedProperty& other );
2775 
2776  virtual ~a2dMenuProperty();
2777 
2778  //! Construct a new property object from a string
2779  //! If this is not appropriate, this may return NULL
2780  static a2dMenuProperty* CreatePropertyFromString( const a2dPropertyIdMenu* id, const wxString& value );
2781 
2782  void SetValue( wxMenu* menu );
2783 
2784  wxMenu* GetValue() const { return m_menu; }
2785 
2786  wxMenu** GetValuePtr() { return &m_menu; }
2787 
2788 #if wxART2D_USE_CVGIO
2789  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
2790  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
2791 #endif //wxART2D_USE_CVGIO
2792 
2793  DECLARE_DYNAMIC_CLASS( a2dMenuProperty )
2794 
2795 protected:
2796 
2797  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
2798 
2799  wxMenu* m_menu;
2800 };
2801 
2802 //! property to hold a window type variable (for example wxTipWindow) to be associated with a a2dObject
2803 /*!
2804  \ingroup property
2805 */
2806 class A2DGENERALDLLEXP a2dWindowProperty: public a2dNamedProperty
2807 {
2808 public:
2809 
2811 
2812  a2dWindowProperty( const a2dPropertyIdWindow* id, wxWindow* window );
2813 
2814  a2dWindowProperty( const a2dWindowProperty& other );
2815 
2816  virtual void Assign( const a2dNamedProperty& other );
2817 
2818  virtual ~a2dWindowProperty();
2819 
2820  //! Construct a new property object from a string
2821  //! If this is not appropriate, this may return NULL
2822  static a2dWindowProperty* CreatePropertyFromString( const a2dPropertyIdWindow* id, const wxString& value );
2823 
2824  void SetValue( wxWindow* window );
2825 
2826  wxWindow* GetValue() const { return m_window; }
2827 
2828  wxWindow** GetValuePtr() { return &m_window; }
2829 
2830 #if wxART2D_USE_CVGIO
2831  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
2832  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
2833 #endif //wxART2D_USE_CVGIO
2834 
2835  DECLARE_DYNAMIC_CLASS( a2dWindowProperty )
2836 
2837 protected:
2838 
2839  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
2840 
2841  wxWindow* m_window;
2842 };
2843 
2844 //! property to hold a tip window type variable to be associated with a a2dObject
2845 /*!
2846  Value is stired as wxWindow*. GetValue() must be casted to wxTipWindow to get the tip window.
2847 
2848  \ingroup property
2849 */
2850 class A2DGENERALDLLEXP a2dTipWindowProperty: public a2dWindowProperty
2851 {
2852 public:
2853 
2855 
2856  //! constructor
2857  /*!
2858  \param id id of property e.g. a2dCanvasObject::PROPID_TipWindow
2859  \param window tip window to show
2860  \param topstring string to show in tip window
2861  \param useObjRect if true, use the a2dCanvasObject its boundingbox to keep tip visible
2862  */
2863  a2dTipWindowProperty( const a2dPropertyIdWindow* id, wxTipWindow* window, const wxString& tipstring, bool useObjRect = true );
2864 
2865  //! constructor
2866  /*!
2867  \param id id of property e.g. a2dCanvasObject::PROPID_TipWindow
2868  \param window tip window to show
2869  \param topstring string to show in tip window
2870  \param rect use rect to keep tip visible
2871  */
2872  a2dTipWindowProperty( const a2dPropertyIdWindow* id, wxTipWindow* window, const wxString& tipstring, const wxRect& rect );
2873 
2875 
2877 
2878  virtual void Assign( const a2dNamedProperty& other );
2879 
2880  virtual ~a2dTipWindowProperty();
2881 
2882  //! Construct a new property object from a string
2883  //! If this is not appropriate, this may return NULL
2884  static a2dTipWindowProperty* CreatePropertyFromString( const a2dPropertyIdWindow* id, const wxString& value );
2885 
2886  void SetString( const wxString& tipstring );
2887 
2888  const wxString& GetString( void )
2889  {
2890  return m_tipstring;
2891  }
2892 
2893  //! get rect which keep tip visible
2894  const wxRect& GetRect() const { return m_rectStay; }
2895 
2896  //! is the tip based on a2dCanvasObject boundingbox
2897  bool GetUseObjRect() const { return m_useObjRect; }
2898 
2899 #if wxART2D_USE_CVGIO
2900  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
2901  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
2902 #endif //wxART2D_USE_CVGIO
2903 
2904  DECLARE_DYNAMIC_CLASS( a2dTipWindowProperty )
2905 
2906 protected:
2907 
2908  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
2909 
2910  wxString m_tipstring;
2911 
2912  bool m_useObjRect;
2913 
2914  wxRect m_rectStay;
2915 };
2916 
2917 //! Path searching
2918 /*!
2919  Path may contain ${aap} for environment variables and %{aap} for internal variables.
2920  See VarRef() for exact syntax.
2921 
2922  Internal variables come from a2dGeneralGlobals->GetVariablesHash()
2923 
2924  \ingroup general
2925 */
2926 class A2DGENERALDLLEXP a2dPathList : public wxPathList
2927 {
2928 public:
2929 
2930  a2dPathList();
2931 
2932  ~a2dPathList();
2933 
2934  //! Find the first full path for which the file exists
2935  wxString FindValidPath ( const wxString& filename, bool reportError = true );
2936 
2937  //! Find the first full path for which the file exists; ensure it's an
2938  //! absolute path that gets returned.
2939  wxString FindAbsoluteValidPath( const wxString& filename );
2940 
2941  //! Get all search paths as one string.
2942  wxString GetAsString();
2943 
2944  bool ExpandPath( wxString& pathToExpand, wxPathFormat format = wxPATH_NATIVE );
2945 
2946 private:
2947 
2948  bool Name();
2949 
2950  void IncC();
2951 
2952  // <aliasref> ::= ('%') { <name> <blank> | ('{') <name> ('}') }
2953  // Get Environment string
2954  // <envstring> ::= ('$') { <name> <blank> | ('{') <name> ('}') }
2955  bool VarRef( wxChar type );
2956 
2957  wxChar a;
2958  wxString m_path;
2959  const wxChar* m_c;
2960  wxString m_b;
2961  wxString m_error_mes;
2962  wxString m_varref;
2963 };
2964 
2965 
2966 class A2DGENERALDLLEXP a2dPathListProperty;
2967 #if defined(WXDOCVIEW_USINGDLL)
2968 template class A2DGENERALDLLEXP a2dPropertyIdTyped<a2dPathList, a2dPathListProperty>;
2969 #endif
2971 
2972 //! property to hold a FileName type variable to be associated with a a2dObject
2973 /*!
2974  \ingroup property
2975 */
2976 class A2DGENERALDLLEXP a2dPathListProperty: public a2dNamedProperty
2977 {
2978 public:
2979 
2980  a2dPathListProperty();
2981 
2982  a2dPathListProperty( const a2dPropertyIdPathList* id, const a2dPathList& pathlist );
2983 
2984  a2dPathListProperty( const a2dPathListProperty* ori );
2985 
2986  a2dPathListProperty( const a2dPathListProperty& other );
2987 
2988  virtual void Assign( const a2dNamedProperty& other );
2989 
2990  virtual ~a2dPathListProperty();
2991 
2992  //! Construct a new property object from a string
2993  //! If this is not appropriate, this may return NULL
2994  static a2dPathListProperty* CreatePropertyFromString( const a2dPropertyIdPathList* id, const wxString& value );
2995 
2996  void SetValue( const a2dPathList& pathlistObject );
2997 
2998  a2dPathList GetValue() const { return m_pathlistObject; }
2999 
3000  a2dPathList* GetValuePtr() { return &m_pathlistObject; }
3001 
3002  a2dPathList& GetValueRef() { return m_pathlistObject; }
3003 
3004  void SetFileName( const a2dPathList& pathlistObject );
3005 
3006  a2dPathList GetFileName() { return m_pathlistObject; }
3007 
3008  a2dPathList& GetFileNameRef() { return m_pathlistObject; }
3009 
3010  virtual wxString StringRepresentation() const;
3011 
3012  virtual wxString StringValueRepresentation() const;
3013 
3014 #if wxART2D_USE_CVGIO
3015  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
3016  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
3017 #endif //wxART2D_USE_CVGIO
3018 
3019  DECLARE_DYNAMIC_CLASS( a2dPathListProperty )
3020 
3021 protected:
3022 
3023  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
3024 
3025  a2dPathList m_pathlistObject;
3026 };
3027 
3028 
3029 extern A2DGENERALDLLEXP wxColour ParseSvgColour( wxString value );
3030 
3031 //! property to hold a FileName type variable to be associated with a a2dObject
3032 /*!
3033  \ingroup property
3034 */
3035 class A2DGENERALDLLEXP a2dColourProperty: public a2dNamedProperty
3036 {
3037 public:
3038 
3040 
3041  a2dColourProperty( const a2dPropertyIdColour* id, const wxColour& colour );
3042 
3043  a2dColourProperty( const a2dColourProperty& other );
3044 
3045  virtual void Assign( const a2dNamedProperty& other );
3046 
3047  virtual ~a2dColourProperty();
3048 
3049  //! Construct a new property object from a string
3050  /*! If this is not appropriate, this may return NULL.
3051  Accepted colours are:
3052  - hex numbers: "#a1b2c3" or just "a1b2c3".
3053  - decimal numbers: "rgb(10,20,30)", "10,20,30" or "10 20 30".
3054  - colour names: "red", "pink", "forest green".
3055  */
3056  static a2dColourProperty* CreatePropertyFromString( const a2dPropertyIdColour* id, const wxString& value );
3057 
3058  void SetValue( const wxColour& colour );
3059 
3060  wxColour GetValue() const { return m_colour; }
3061 
3062  wxColour* GetValuePtr() { return &m_colour; }
3063 
3064  wxColour& GetValueRef() { return m_colour; }
3065 
3066  void SetColour( const wxColour& colour );
3067 
3068  wxColour GetColour() { return m_colour; }
3069 
3070  wxColour& GetColourRef() { return m_colour; }
3071 
3072  virtual wxString StringRepresentation() const;
3073 
3074  virtual wxString StringValueRepresentation() const;
3075 
3076 #if wxART2D_USE_CVGIO
3077  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
3078  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
3079 #endif //wxART2D_USE_CVGIO
3080 
3081  DECLARE_DYNAMIC_CLASS( a2dColourProperty )
3082 
3083 protected:
3084 
3085  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
3086 
3087  wxColour m_colour;
3088 };
3089 
3090 
3091 //! property to hold a wxURI type variable to be associated with a a2dObject
3092 /*!
3093  \ingroup property
3094 */
3095 class A2DGENERALDLLEXP a2dUriProperty: public a2dNamedProperty
3096 {
3097 public:
3098 
3099  a2dUriProperty();
3100 
3101  a2dUriProperty( const a2dPropertyIdUri* id, const wxURI& uri );
3102 
3103  a2dUriProperty( const a2dUriProperty& other );
3104 
3105  virtual void Assign( const a2dNamedProperty& other );
3106 
3107  virtual ~a2dUriProperty();
3108 
3109  //! Construct a new property object from a string
3110  //! If this is not appropriate, this may return NULL
3111  static a2dUriProperty* CreatePropertyFromString( const a2dPropertyIdUri* id, const wxString& value );
3112 
3113  void SetValue( const wxURI& uri );
3114 
3115  wxURI GetValue() const { return m_uri; }
3116 
3117  wxURI& GetValueRef() { return m_uri; }
3118 
3119 #if wxART2D_USE_CVGIO
3120  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
3121  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
3122 #endif //wxART2D_USE_CVGIO
3123 
3124  DECLARE_DYNAMIC_CLASS( a2dUriProperty )
3125 
3126 protected:
3127 
3128  virtual a2dNamedProperty* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
3129 
3130  wxURI m_uri;
3131 };
3132 
3133 
3134 
3135 //! define a NON a2dObjectList
3136 /*!
3137  Even if a wxDocviewObject has no properties, still its Length can be asked for.
3138 */
3139 A2DGENERALDLLEXP_DATA( extern a2dObjectList* ) wxNullRefObjectList;
3140 
3141 #include <wx/listimpl.cpp>
3142 
3143 #if (defined(__WXMSW__) && defined(WXUSINGDLL) )
3144 template class A2DGENERALDLLEXP a2dSmrtPtr<class a2dObject>;
3145 template class A2DGENERALDLLEXP std::allocator<class a2dSmrtPtr<class a2dObject> >;
3146 template class A2DGENERALDLLEXP std::allocator< std::_List_nod<class a2dSmrtPtr<class a2dObject>, std::allocator<class a2dSmrtPtr<class a2dObject> > >::_Node >;
3147 template class A2DGENERALDLLEXP std::allocator< std::_List_ptr<class a2dSmrtPtr<class a2dObject>, std::allocator<class a2dSmrtPtr<class a2dObject> > >::_Nodeptr >;
3148 template class A2DGENERALDLLEXP std::list<class a2dSmrtPtr<class a2dObject> >;
3149 template class A2DGENERALDLLEXP a2dlist<class a2dSmrtPtr<class a2dObject> >;
3150 template class A2DGENERALDLLEXP a2dSmrtPtrList<class a2dObject>;
3151 #endif
3152 
3153 //! list of a2dObject's
3154 /*!
3155  \ingroup general
3156 */
3157 class A2DGENERALDLLEXP a2dObjectList: public a2dSmrtPtrList<a2dObject>
3158 {
3159 public:
3160  a2dObjectList();
3161 
3162  ~a2dObjectList();
3163 
3164  //! all with reference count > 1 are cloned.
3165  void MakeUnique();
3166 
3167  //!this only copies pointer stored in the list, if you want the object itself
3168  //!copied also, use Clone
3169  a2dObjectList& operator=( a2dObjectList& other );
3170 
3171  //!Clone everything ( Clones objects also) in a new created list
3172  a2dObjectList* Clone( a2dObject::CloneOptions options, a2dRefMap* refs = NULL ) const;
3173 
3174  //!release only objects with the given classname and has property named propertyname and object name
3175  //! empty string means ignore.
3176  bool Release( const wxString& classname = wxT( "" ), bool all = false );
3177 
3178  //!Find object within the given property name and classname.
3179  /*!
3180  \param classname If classname is empty it collects all objects else only object with this class name.
3181  \param name If a name is set the object needs to have this name
3182  */
3183  a2dObject* Find( const wxString& classname = wxT( "" ), const wxString& name = wxT( "" ) );
3184 
3185  //!Copy objects fitting the given filter to the total list.
3186  /*!
3187  \param total list of object found (may already contain elements found in earlier call)
3188  \param propertyNameFilter If property name is set the object needs to have a name which matches propertyname.
3189  \param classname If type is empty it collects all objects else only object with this class name.
3190 
3191  \return number of objects found
3192  */
3193  int CollectObjects( a2dObjectList* total, const wxString& propertyNameFilter = wxT( "" ), const wxString& classname = wxT( "" ) );
3194 
3195  //DECLARE_CLASS(a2dObjectList)
3196 
3197 };
3198 
3199 #include <wx/hashmap.h>
3200 
3201 //! wxString keys plus a2dObject pointers
3202 /*!
3203  This holds internal variables.
3204 */
3205 class A2DGENERALDLLEXP a2dVariablesHashBase;
3206 class A2DGENERALDLLEXP a2dVariablesHashBase_wxImplementation_HashTable;
3207 class A2DGENERALDLLEXP a2dVariablesHashBase_wxImplementation_KeyEx;
3208 WX_DECLARE_STRING_HASH_MAP_WITH_DECL( a2dNamedProperty*, a2dVariablesHashBase, class A2DGENERALDLLEXP );
3209 
3210 
3211 //! Holds internal variables to be used whereever needed.
3212 /*!
3213  The variables are stored as wxString keys plus a2dNamedProperty in a hash table.
3214 
3215  Understand that a variable can hold any type of property and therefore any type of information can be stored.
3216  How that information is used in the commands within a2dCommandProcessor depends on the commands you implement.
3217  e.g. You can have C++ command functions which return a a2dObject* and this you can add a variable to the variable hash.
3218  Next that variable can be used to extract information using other commands again.
3219 
3220  \ingroup general property
3221 
3222 */
3223 class A2DGENERALDLLEXP a2dVariablesHash : private a2dVariablesHashBase
3224 {
3225 
3226 public:
3227 
3228  //! constructor
3229  a2dVariablesHash();
3230 
3231  //! copy constructor
3232  a2dVariablesHash( const a2dVariablesHash& other );
3233 
3234  //! assignment operator
3235  void operator = ( const a2dVariablesHash& other );
3236 
3237  //! destructor
3238  ~a2dVariablesHash();
3239 
3240  //! set a new or replace an existing variable of arbitrary type
3241  /*!
3242  \remark The given property object is owned and deleted by the variable hash.
3243  \param variableName variable to add or replace
3244  \param property new property object for the variable ( id is usually wxPropertyIdXXX::GetDummy )
3245 
3246  \return true if variable already did exist.
3247  */
3248  bool SetVariable( const wxString& variableName, a2dNamedProperty* property );
3249 
3250  //! set a new or replace an existing a2dObject variable
3251  /*!
3252  \param variableName variable to add or replace
3253  \param value new value of the variable
3254 
3255  \return true if variable already did exist.
3256  */
3257  bool SetVariableRefObject( const wxString& variableName, a2dObject* value );
3258 
3259  //! set a new or replace an existing wxString variable
3260  /*!
3261  \param variableName variable to add or replace
3262  \param value new value of the variable
3263 
3264  \return true if variable already did exist.
3265  */
3266  bool SetVariableString( const wxString& variableName, const wxString& value );
3267 
3268  //! set a new or replace an existing double variable
3269  /*!
3270  \param variableName variable to add or replace
3271  \param value new value of the variable
3272 
3273  \return true if variable already did exist.
3274  */
3275  bool SetVariableDouble( const wxString& variableName, double value );
3276 
3277  //! set a new or replace an existing int variable
3278  /*!
3279  \param variableName variable to add or replace
3280  \param value new value of the variable
3281 
3282  \return true if variable already did exist.
3283  */
3284  bool SetVariableInt( const wxString& variableName, int value );
3285 
3286  //! get an existing variable of unknown type (not cloned)
3287  /*!
3288  \param variableName variable to search
3289  \return NULL if variable does not exist, else the property found.
3290  */
3291  const a2dNamedProperty* GetVariable( const wxString& variableName );
3292 
3293  //! get an existing variable of unknown type (cloned)
3294  /*!
3295  \param variableName variable to search
3296  \return NULL if variable does not exist, else the property found.
3297  */
3298  a2dNamedProperty* GetVariableClone( const wxString& variableName );
3299 
3300  //! get an existing a2dObject variable
3301  /*!
3302  \param variableName variable to search
3303  \return NULL if variable does not exist, else the property found.
3304  */
3305  a2dObject* GetVariableRefObject( const wxString& variableName );
3306 
3307  //! get an existing wxString variable
3308  /*!
3309  \param variableName variable to search
3310  \return NULL if variable does not exist, else the property found.
3311  */
3312  wxString* GetVariableString( const wxString& variableName );
3313 };
3314 
3315 //! Holds arrayed variables, e.g. parameter lists in a command processor
3316 /*!
3317  The variables are stored as a2dNamedProperty in an integer indexed array.
3318 
3319  Understand that a variable can hold any type of property and therefore any type of information can be stored.
3320  How that information is used in the commands within a2dCommandProcessor depends on the commands you implement.
3321  e.g. You can have C++ command functions which return a a2dObject* and this you can add a variable to the variable hash.
3322  Next that variable can be used to extract information using other commands again.
3323 
3324  \ingroup general property
3325 */
3326 class A2DGENERALDLLEXP a2dVariablesArray
3327 {
3328 
3329 public:
3330 
3331  //! constructor
3333 
3334  //! destructor
3335  ~a2dVariablesArray();
3336 
3337  //! delete all variables in the array
3338  void DeleteAll();
3339 
3340  //! add a new variable of arbitrary type
3341  /*!
3342  \param property new variable to add ( id is usually wxPropertyIdXXX::GetDummy )
3343  */
3344  void AppendVariable( a2dNamedProperty* property );
3345 
3346  //! add a new a2dObject variable
3347  /*!
3348  \param value new value of the variable
3349  */
3350  void AppendVariableRefObject( a2dObject* value );
3351 
3352  //! add a new wxString variable
3353  /*!
3354  \param value new value of the variable
3355  */
3356  void AppendVariableString( const wxString& value );
3357 
3358  //! add a new double variable
3359  /*!
3360  \param value new value of the variable
3361  */
3362  void AppendVariableDouble( double value );
3363 
3364  //! add a new int variable
3365  /*!
3366  \param value new value of the variable
3367  */
3368  void AppendVariableInt( int value );
3369 
3370  //! get an existing variable of unknown type (not cloned)
3371  /*!
3372  \param index of the variable (must be valid!)
3373  \return the property found.
3374  */
3375  const a2dNamedProperty& GetVariable( int index );
3376 
3377  //! get an existing variable of unknown type (cloned)
3378  /*!
3379  \param index of the variable (must be valid!)
3380  \return the property found.
3381  */
3382  a2dNamedProperty* GetVariableClone( int index );
3383 
3384  //! get an existing a2dObject variable
3385  /*!
3386  \param index of the variable (must be valid!)
3387  \return the refobject of the property found.
3388  */
3389  a2dObject* GetVariableRefObject( int index );
3390 
3391  //! get an existing wxString variable
3392  /*!
3393  \param index of the variable (must be valid!)
3394  \return the string value of the property found.
3395  */
3396  wxString GetVariableString( int index );
3397 
3398  //! get an existing variable of any type as String
3399  /*!
3400  \param index of the variable (must be valid!)
3401  \return the string representation of the property found
3402  */
3403  wxString GetVariableAsString( int index );
3404 
3405  //! get the number of elements in the array
3406  int GetCount() { return m_nelements; }
3407 
3408 protected:
3409  //! set the minimum size for the array
3410  void SetMinSize( int size );
3411  //! this is the array of properties
3412  a2dNamedProperty** m_properties;
3413  //! number of used elements in m_properties
3415  //! number of elements in m_properties
3417 };
3418 
3419 // type defs to work both stream types within wxDocview
3420 #if wxUSE_STD_IOSTREAM
3421 
3422 #if wxUSE_WSTREAM //!wxCHECK_VERSION(2,9,0)
3423 //! string input stream based on STD
3424 typedef wxSTD wistringstream a2dDocumentStringInputStream;
3425 //! string output stream based on STD
3426 typedef wxSTD wostringstream a2dDocumentStringOutputStream;
3427 //! input stream based on STD
3428 typedef wxSTD wistream a2dDocumentInputStream;
3429 //! output stream based on STD
3430 typedef wxSTD wostream a2dDocumentOutputStream;
3431 //! input stream based on STD
3432 typedef wxSTD wifstream a2dDocumentFileInputStream;
3433 //! output stream based on STD
3434 typedef wxSTD wofstream a2dDocumentFileOutputStream;
3435 #else
3436 //! string input stream based on STD
3437 typedef wxSTD istringstream a2dDocumentStringInputStream;
3438 //! string output stream based on STD
3439 typedef wxSTD ostringstream a2dDocumentStringOutputStream;
3440 //! input stream based on STD
3441 typedef wxSTD istream a2dDocumentInputStream;
3442 //! output stream based on STD
3443 typedef wxSTD ostream a2dDocumentOutputStream;
3444 //! input stream based on STD
3445 typedef wxSTD ifstream a2dDocumentFileInputStream;
3446 //! output stream based on STD
3447 typedef wxSTD ofstream a2dDocumentFileOutputStream;
3448 #endif
3449 
3450 #else
3451 //! string input stream based wxStreams
3452 typedef wxStringInputStream a2dDocumentStringInputStream;
3453 //! string output stream based wxStreams
3454 typedef wxStringOutputStream a2dDocumentStringOutputStream;
3455 //! input stream based wxStreams
3456 typedef wxInputStream a2dDocumentInputStream;
3457 //! output stream based wxStreams
3458 typedef wxOutputStream a2dDocumentOutputStream;
3459 #endif
3460 
3461 //! class to map references to objects stored in XML, in order to make the connection later on.
3462 class A2DGENERALDLLEXP a2dRefMap : public a2dObject
3463 {
3464 
3465 public:
3466 
3467  //! constructor
3468  a2dRefMap();
3469 
3470  //! destructor
3471  ~a2dRefMap();
3472 
3473  //!initialize mapping tables
3474  /*!
3475  */
3476  virtual void Initialize();
3477 
3478  //! This is used to find multiple referenced objects by id
3479  a2dHashMapIntToObject& GetObjectHashMap() { return m_objecthashmap; }
3480 
3481  //! has to map symbolic names to real classnames.
3482  a2dHashMapCreateObject& GetObjectCreateHashMap() { return m_objectCreate; }
3483 
3484  //! list of not resolved objects
3485  a2dResolveIdList& GetResolveIdList() { return m_toResolve; }
3486 
3487  //! try to resolve the object that is in storedHere when it is a reference.
3488  /*! If not succes, add it to m_toResolve.
3489  \param storedHere pointer to the smart pointer, that is to be set
3490  \param id object id of the referenced object. if "" SetLastObjectLoadedId is used.
3491  */
3492  bool ResolveOrAdd( a2dSmrtPtr<a2dObject>* storedHere, const wxString& id = wxT( "" ) );
3493 
3494  //! try to resolve the object that is in storedHere when it is a reference.
3495  bool ResolveOrAdd( a2dAutoZeroPtr<a2dObject>* storedHere, const wxString& id = wxT( "" ) );
3496 
3497  //! try to resolve an object referenced by obj using the LinkReference function
3498  //* If not succes, add it to m_toResolve. */
3499  bool ResolveOrAddLink( a2dObject* obj, const wxString& id = wxT( "" ) );
3500 
3501  //! call the objects LinkReference function (ptr=0) to inform it that links are done
3502  void ResolveInform( a2dObject* obj );
3503 
3504  //! set by RefObject when finding a reference id during loading.
3505  void SetLastObjectLoadedId( const wxString& lastid );
3506 
3507  //! link references to their destination
3508  /*!
3509  Override this to define input format specific needs for linking references in a certain format.
3510  In the default situation the parser uses m_objecthashmap to store object to which references can be made,
3511  while m_lastObjectId is used to store unresolved references.
3512  Here those too are resolved.
3513 
3514  In the CVG format one can store multiple refrences to one and the same object.
3515  The object that is referenced is only written once, for the other references only
3516  the object with refid or specific id attributes are written to the CVG file.
3517  When loading a file in CVG, such references are resolved and removed from the document.
3518  So in the end the old reference is restored. When loading an object, it is created, but its contents
3519  will be empty, after resolving, this one will be replaced by the real referenced object.
3520  The reason behind all this, is that the actual object might need to be read yet, when a reference
3521  is encountered in the CVG file, and therefore the link can not be directly created.
3522  In other formats references are used in a simular manner, and to resolve them the same mechanism
3523  is used.
3524 
3525  Some input/ouput formats are organized in a list of grouped objects, the hierarchy is created
3526  after the whole file is read into memory.
3527  All non referenced objects are direct childs of the rootobject.
3528  In the GDSII format these are called top structures.
3529 
3530  \return true if all references were resolved.
3531  */
3532  virtual bool LinkReferences( bool ignoreNonResolved = false );
3533 
3534  //! remove given reference if from reference map.
3535  bool RemoveReference( const wxString& idToRemove );
3536 
3537  //! get last error encountered
3538  a2dError GetLastError() const { return m_lastError; }
3539 
3540  //! set last error encountered
3541  void SetLastError( a2dError error ) { m_lastError = error; }
3542 
3543 protected:
3544 
3545  //! This is used to find multiple referenced objects by id
3546  a2dHashMapIntToObject m_objecthashmap;
3547 
3548  //! This is used to find a classname using a symbolic name.
3549  a2dHashMapCreateObject m_objectCreate;
3550 
3551  //! refernces to object which have not bin resolved yet ( e.g not read yet, but already referenced )
3552  a2dResolveIdList m_toResolve;
3553 
3554  wxString m_lastObjectId;
3555 
3556  //! set to last error found when parsing
3558 
3559 private:
3560 
3561 #if wxART2D_USE_CVGIO
3562  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts, a2dObjectList* towrite );
3563  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
3564 #endif //wxART2D_USE_CVGIO
3565 
3566  virtual a2dObject* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
3567 
3568 };
3569 
3570 
3571 //! a2dIOHandler takes care of loading and/or saving data.
3572 /*!
3573  Classes to read data from a file into a specific a2dDocument, are derived from this class.
3574  Classes to write data from a specific a2dDocument to a file, are derived from this class.
3575 
3576  This class provides a way to add parsers and writers to a specific type of document.
3577  It will not become part of that document class itself, but still fills it with information.
3578  It acts like a plugin in that sence.
3579  The a2dDocumentTemplate class is used to connect a a2dDocumentIOhandler to a document.
3580  It tells for which files ( extensions ), this handler should be used.
3581 
3582  If a a2dDocument has a native data format, which is integrated into the class itself,
3583  one should make a sort of dummy a2dIOHandler, which internal calls the read/write
3584  function on the a2dDocument.
3585  Or you can override a2dDocument::SaveObject() a2dDocument::LoadObject() to make it work
3586  the way you want.
3587 
3588  \ingroup docview
3589  \ingroup fileio
3590 
3591 */
3592 class A2DGENERALDLLEXP a2dIOHandler : public a2dRefMap
3593 {
3594 
3595 public:
3596 
3597  //! constructor
3598  a2dIOHandler();
3599 
3600  //! destructor
3601  ~a2dIOHandler();
3602 
3603  //! Creates an specific object by name.
3604  /*!
3605  A hash table has a list of names and its coresponding classname,
3606  from which the object is created using wxWidgets wxCreateDynamicObject().
3607  In order to be more flexible in future classname changes,
3608  the hash of symbolic names is in between.
3609  */
3610  virtual wxObject* CreateObject( const wxString& symbolicName );
3611 
3612 private:
3613 
3614 #if wxART2D_USE_CVGIO
3615  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts, a2dObjectList* towrite );
3616  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
3617 #endif //wxART2D_USE_CVGIO
3618 
3619  virtual a2dObject* DoClone( a2dObject::CloneOptions options, a2dRefMap* refs ) const;
3620 
3621  a2dIOHandler( a2dIOHandler& other );
3622 
3623 };
3624 
3625 //! using a file stream for input, stream the file into a a2dDocument or other object
3626 /*!
3627  Base class used to model loading data from a stream into an object, which can be a a2dDocument but also any other.
3628  What can be read into the object, depends on the implementation for which the derived IOHandler was written.
3629 
3630  \ingroup fileio
3631 */
3632 class A2DGENERALDLLEXP a2dIOHandlerStrIn : public a2dIOHandler
3633 {
3634 
3635 public:
3636 
3637  //! constructor
3638  a2dIOHandlerStrIn( wxMBConv& conv = wxConvUTF8 );
3639 
3640  //! destructor
3641  ~a2dIOHandlerStrIn();
3642 
3643  //! Inits the handler for reading
3644  /*!
3645  */
3646  virtual void InitializeLoad();
3647 
3648  //! Reset the handler after loading
3649  virtual void ResetLoad();
3650 
3651  //! Should return true if the handler can read from the stream.
3652  /*!
3653  A typical implementation is to read the first part of the file, to see if the
3654  contents is right for this handler.
3655  Then it resets the file pointer to the beginning again.
3656 
3657  In general a handler is written with a certain type of document in mind, since that is where the information will be stored.
3658  The document view framework, uses document templates to get to input handlers.
3659  The last 2 parameters can be checked if set.
3660  Use SetDocumentClassInfo() to set the right classinfo, in case of a derived document object,
3661  which still can be read with the this handler.
3662  Like:
3663  \code
3664  a2dIOHandlerKeyIn* keyhin = new a2dIOHandlerKeyIn();
3665  keyhin->SetDocumentClassInfo( &MyDocument::ms_classInfo );
3666  \endcode
3667 
3668 
3669  \param stream the open stream which its header can be tested
3670  \param obj to check and load the data into, needs to be casted to the right one internal.
3671  \param docClassInfo to check if the inout handler is indeed able to read document of m_docClassInfo.
3672 
3673  */
3674  virtual bool CanLoad( a2dDocumentInputStream& stream, const wxObject* obj = NULL, wxClassInfo* docClassInfo = NULL ) = 0;
3675 
3676  //! override to read the stream and store (part of) the contents in to a specific a2dDocument or othere object.
3677  /*!
3678  Understand that a a2dDocument itself is useless for storing data,
3679  so it needs to be casted internal.
3680 
3681  \param stream the open stream to load from
3682  \param obj to load the data into, needs to be casted to the right one internal.
3683  */
3684  virtual bool Load( a2dDocumentInputStream& stream , wxObject* obj ) = 0;
3685 
3686  //! class info for the (document) class this handler reads data into.
3687  wxClassInfo* GetDocumentClassInfo() const { return m_docClassInfo; }
3688 
3689  //! class info for the (document) class this handler reads data into.
3690  void SetDocumentClassInfo( wxClassInfo* docClassInfo ) { m_docClassInfo = docClassInfo; }
3691 
3692  void SetFileName( const wxFileName& filename ) { m_filename = filename; }
3693 
3694  const wxFileName& GetFileName() const { return m_filename; }
3695 
3696 protected:
3697 
3698  // if set, can be used to find path to load/save images etc.
3699  wxFileName m_filename;
3700 
3701  //! unicode conversion
3702  wxMBConv& m_conv;
3703 
3704  //! define the line end mode for textual files
3705  void SetMode( wxEOL mode = wxEOL_NATIVE );
3706  //! get line end mode for textual files
3707  wxEOL GetMode() { return m_mode; }
3708 
3709  //! return a character from the stream without removing it, i.e. it will
3710  //! still be returned by the next call to GetC()
3711  char Peek();
3712 
3713  //! return one character from the stream, blocking until it appears if
3714  //! necessary
3715  char GetC();
3716 
3717  //! set stream at a position
3718  a2dIOHandlerStrIn& SeekI( wxFileOffset pos );
3719 
3720  // is the stream at EOF?
3721  bool Eof() const;
3722 
3723  // is the stream OK
3724  bool IsOk() const;
3725 
3726  // read at most the given number of bytes from the stream
3727  //size_t Read( wxChar* buffer, size_t size);
3728 
3729 //#if wxUSE_UNICODE
3730  size_t Read( char* buffer, size_t size );
3731 //#endif
3732 
3733  //! file or other string stream containing the format to parse.
3734  a2dDocumentInputStream* m_streami;
3735 
3736  //! Run-time class information that allows document instances to be constructed dynamically.
3737  wxClassInfo* m_docClassInfo;
3738 
3739  //! end of line mode
3740  wxEOL m_mode;
3741 };
3742 
3743 //! using a file stream for output, stream a a2dDocument or other wxObject into a stream.
3744 /*!
3745  Base class used to model saving data to a stream from an object, which can be a a2dDocument but also any other.
3746  What can be saved into the stream, depends on the implementation for which the derived IOHandler was written.
3747 
3748  \ingroup fileio
3749 
3750 */
3751 class A2DGENERALDLLEXP a2dIOHandlerStrOut : public a2dIOHandler
3752 {
3753 
3754 public:
3755 
3756  //! constructor
3757  a2dIOHandlerStrOut( wxMBConv& conv = wxConvUTF8 );
3758 
3759  //! destructor
3760  ~a2dIOHandlerStrOut();
3761 
3762  //! Inits the handler for writing
3763  virtual void InitializeSave();
3764 
3765  //! Reset the object after saving
3766  virtual void ResetSave();
3767 
3768  //! Should return true if the handler can write this document to a stream.
3769  /*!
3770  Mostly implemented by simply returning true if the handler can indeed do this job.
3771  Understand that a a2dDocument itself is useless for storing data,
3772  so it needs to be casted internal to a specific a2dDocument.
3773 
3774  \param obj pointer to object to save, normally a document.
3775  */
3776  virtual bool CanSave( const wxObject* obj = NULL ) = 0;
3777 
3778  //! Override to write to the stream and store (part of) of the document contents in the stream.
3779  /*!
3780  Understand that a a2dDocument itself is useless for storing data,
3781  so it needs to be casted internal to a specific a2dDocument.
3782 
3783  \param stream the open stream to which the object needs to be saved
3784  \param obj object to save into stream, needs to be casted to the right one internal.
3785  */
3786  virtual bool Save( a2dDocumentOutputStream& stream, const wxObject* obj ) = 0;
3787 
3788  void SetFileName( const wxFileName& filename ) { m_filename = filename; }
3789 
3790  const wxFileName& GetFileName() const { return m_filename; }
3791 
3792 protected:
3793 
3794  // if set, can be used to find path to load/save images etc.
3795  wxFileName m_filename;
3796 
3797  //! define the line end mode for textual files
3798  void SetMode( wxEOL mode = wxEOL_NATIVE );
3799  //! get line end mode for textual files
3800  wxEOL GetMode() { return m_mode; }
3801 
3802  //! write a 32 bits integer
3803  void Write32( wxUint32 i );
3804  //! write a 16 bits integer
3805  void Write16( wxUint16 i );
3806  //! write a 8 bits integer
3807  void Write8( wxUint8 i );
3808  //! write a double
3809  virtual void WriteDouble( double d );
3810  //! write a string
3811  virtual void WriteString( const wxString& string );
3812 
3813  //! is the stream Oke to write
3814  bool IsOk() const;
3815 
3816  //! write on character
3817  a2dIOHandlerStrOut& PutChar( wxChar c );
3818 
3819 protected:
3820 
3821  //! unicode conversion
3822  wxMBConv& m_conv;
3823 
3824  //! file or other string stream containing the format to output to.
3825  a2dDocumentOutputStream* m_streamo;
3826 
3827  //! end of line mode
3828  wxEOL m_mode;
3829 
3830 private:
3831 
3833 
3834 };
3835 
3836 /*! \addtogroup docalgo
3837 * @{
3838 */
3839 
3840 
3841 /*! a2dDocument object traversing via design visitor pattern */
3842 typedef const long a2dWalkEvent;
3843 
3844 //! id for a2dWalkEvent issued from within a2dWalkerIOHandler
3845 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dObjectStart;
3846 //! id for a2dWalkEvent issued from within a2dWalkerIOHandler
3847 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dObjectEnd;
3848 //! id for a2dWalkEvent issued from within a2dWalkerIOHandler
3849 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dPropertyStart;
3850 //! id for a2dWalkEvent issued from within a2dWalkerIOHandler
3851 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dPropertyEnd;
3852 //! id for a2dWalkEvent issued from within a2dWalkerIOHandler
3853 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dNamedPropertyListStart;
3854 //! id for a2dWalkEvent issued from within a2dWalkerIOHandler
3855 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dNamedPropertyListEnd;
3856 //! id for a2dWalkEvent issued from within a2dWalkerIOHandler
3857 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dNamedPropertyStart;
3858 //! id for a2dWalkEvent issued from within a2dWalkerIOHandler
3859 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dNamedPropertyEnd;
3860 
3861 //! id for a2dWalkEvent issued from within a2dWalkerIOHandler
3862 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dCanvasObjectStart;
3863 //! id for a2dWalkEvent issued from within a2dWalkerIOHandler
3864 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dCanvasObjectProperties;
3865 //! id for a2dWalkEvent issued from within a2dWalkerIOHandler
3866 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dCanvasObjectPreChild;
3867 //! id for a2dWalkEvent issued from within a2dWalkerIOHandler
3868 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dCanvasObjectPostChild;
3869 //! id for a2dWalkEvent issued from within a2dWalkerIOHandler
3870 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dCanvasObjectEnd;
3871 //! id for a2dWalkEvent issued from within a2dWalkerIOHandler
3872 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dDerivedCanvasObjectStart;
3873 //! id for a2dWalkEvent issued from within a2dWalkerIOHandler
3874 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dDerivedCanvasObjectEnd;
3875 
3876 //! @} docalgo
3877 
3878 
3879 //! a functions to store in a hash table
3880 typedef bool ( *a2dObjectIOFn )( wxObject* parent, wxObject* object, a2dWalkEvent );
3881 
3882 class A2DGENERALDLLEXP a2dIOHandlerCoupleHash;
3883 class A2DGENERALDLLEXP a2dIOHandlerCoupleHash_wxImplementation_HashTable;
3884 class A2DGENERALDLLEXP a2dIOHandlerCoupleHash_wxImplementation_KeyEx;
3885 
3886 #include <wx/hashmap.h>
3887 
3888 WX_DECLARE_STRING_HASH_MAP( a2dObjectIOFn*, a2dIOHandlerCoupleHash );
3889 
3890 //! Io handler to iterate through a a2dDocument.
3891 /*!
3892  It can be used in combination with a file for reading or writing.
3893 
3894  Calling a2dObject::Walker( a2dWalkerIOHandler& handler ),
3895  will have the a2dObject start calling the function WalkTask()
3896  at predifined moments. The a2dCanvasObject will also recursively
3897  go into its children. While a2dObject goes into its properties.
3898  In a derived class you can define what needs to happen in each WalkTask().
3899 
3900  This makes it possible to write algorithm on a a2dDocument, without
3901  extending the a2dObject derived classes itself.
3902  For instance calculating the area occupied by all a2dCanvasObject, can be implemented
3903  with this class.
3904 
3905  The default WalkTask() function, checks if a function is registrated for the specific class,
3906  and if so calls that function.
3907 
3908  \ingroup docalgo
3909  \ingroup fileio
3910 */
3911 class A2DGENERALDLLEXP a2dWalkerIOHandler : public a2dIOHandler
3912 {
3913 
3914  DECLARE_CLASS( a2dWalkerIOHandler )
3915 
3916 public:
3917 
3918  //! constructor
3920 
3921  //! destructor
3922  ~a2dWalkerIOHandler();
3923 
3924  //! to initialize a walker class, default does nothing.
3925  virtual void Initialize();
3926 
3927  //! get this when an error occured.
3928  wxString GetErrorString() { return m_error; }
3929 
3930  //! to further recursion, e.g. in a2dObject::Walker()
3931  void SetStopWalking( bool stopWalking ) { m_stopWalking = stopWalking; }
3932 
3933  //! check for stop
3934  bool GetStopWalking() { return m_stopWalking; }
3935 
3936  //! Increment recursion depth
3937  void IncCurrentDepth() { m_currentDepth++; }
3938 
3939  //! Decrement recursion depth
3940  void DecCurrentDepth() { m_currentDepth--; }
3941 
3942  //! What is the current recursion depth
3943  int GetCurrentDepth() { return m_currentDepth; }
3944 
3945  //! set if walker needs to go into recursive objects first.
3946  void SetDepthFirst( bool depthFirst ) { m_depthFirst = depthFirst; }
3947 
3948  //! What is the current recursion depth
3949  bool GetDepthFirst() { return m_depthFirst; }
3950 
3951  //! set if walker needs to check objects for a2dObject::m_check set, before walking into it
3952  void SetUseCheck( bool useCheck ) { m_useCheck = useCheck; }
3953 
3954  //! see SetUseCheck
3955  bool GetUseCheck() { return m_useCheck; }
3956 
3957  //! to register a function to handle a class
3958  void Register( const wxString& classname, a2dObjectIOFn* IOfunc ) { m_register[ classname ] = IOfunc; }
3959 
3960  //! to Un-register a function to handle a class
3961  void Unregister( const wxString& classname ) { m_register.erase( classname ); }
3962 
3963  //! called from within a2dObject's and derived classes
3964  /*!
3965  The object which are walked over/into, can announce specific events within that object to
3966  the a2dWalkerIOHandler at hand. The a2dWalkerIOHandler can react to those events.
3967  */
3968  virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
3969 
3970  //!if set by walker in WalkTask(), it can be used in child object to get to the parent via the
3971  //! a2dWalkerIOHandler, which is the argument to a child member function.
3972  wxObject* GetParent() { return m_currentParent; }
3973 
3974  bool GetSkipNotRenderedInDrawing() const { return m_skipNotRenderedInDrawing; }
3975 
3976  void SetSkipNotRenderedInDrawing( bool skipNotRenderedInDrawing ) { m_skipNotRenderedInDrawing = skipNotRenderedInDrawing; }
3977 
3978  //! depending upon derived class implementation.
3979  bool GetResult() { return m_result; }
3980 
3981 protected:
3982 
3983  //! result of walk, set false at start, use at will.
3984  bool m_result;
3985 
3986  //! parent object of current object
3987  wxObject* m_currentParent;
3988 
3989  //! to store errors
3990  wxString m_error;
3991 
3992  //! quit the iteration
3994 
3995  //! contour to be used by algorithm, to decide on how deep recursing is to be.
3997 
3998  //! if true objects with nested objects should be walked first.
3999  //! it is the object to test this flag and if set, search for nested objects to walk first.
4001 
4002  //! if set a2dObject are only walked if not m_check is set
4004 
4005  //! if a drawing contains references to objects in other drawings, which shuld not be included in the walk.
4006  //! this flag can be used to check it inside that kind of objects to stop walking.
4008 
4009  //! coupling function to event and classname
4010  a2dIOHandlerCoupleHash m_register;
4011 };
4012 
4013 
4014 
4015 //! 3-digit hex to wxColour
4016 extern wxColour A2DGENERALDLLEXP HexToColour( const wxString& hex );
4017 
4018 //! RGB to 3-digit hex
4019 extern wxString A2DGENERALDLLEXP ColourToHex( const wxColour& colour );
4020 
4021 /*! This object helps fixing initialization order of static objects and the wxWidgets
4022 internal memory critical sections. If you have static object that owns dynamic memory,
4023 but doesn't create it in its constructor, just create such an object in the objects
4024 constructor of before the definition of the static object to fix crashes in memory.cpp.
4025 
4026 This could also be a function as it doesn't have data, but you might want to use it as
4027 static object, so it is a class.
4028 
4029  \ingroup general
4030 */
4031 class A2DGENERALDLLEXP a2dMemoryCriticalSectionHelper
4032 {
4033 public:
4035  {
4036  // Just create some memory, so that the MemoryCriticalSection in GetMemLocker in memory.cpp is initialized
4037  int* dummy = new int;
4038  delete dummy;
4039  }
4040 };
4041 
4042 #include <wx/sstream.h>
4043 
4044 //#if defined(WXDOCVIEW_USINGDLL)
4045 #include "wx/general/id.inl"
4046 //#endif
4047 
4048 
4049 //! defines what to print
4050 /*!
4051 */
4052 typedef wxUint16 a2dPrintWhat;
4053 
4054 
4055 #endif
4056 
bool m_result
result of walk, set false at start, use at will.
Definition: gen.h:3984
a2dHashMapCreateObject m_objectCreate
This is used to find a classname using a symbolic name.
Definition: gen.h:3549
const a2dError a2dError_LinkRef
property to hold an unsigned 4 byte integer type variable to be associated with a a2dObject ...
Definition: gen.h:2453
void SetLastError(a2dError error)
set last error encountered
Definition: gen.h:3541
(In) Visible property that can be added to Docview Objects.
Definition: gen.h:1785
a2dSmrtPtr< a2dObject > a2dObjectPtr
smart pointer to a2dObject
Definition: gen.h:1619
a2dHashMapCreateObject & GetObjectCreateHashMap()
has to map symbolic names to real classnames.
Definition: gen.h:3482
A2DGENERALDLLEXP long wxGenNewId()
This function is like wxNewId, but it has its own ID set.
Definition: gen.cpp:92
void Unregister(const wxString &classname)
to Un-register a function to handle a class
Definition: gen.h:3961
list for a2dRefCount Smart pointers
Definition: gen.h:1730
virtual double GetDouble() const
when a2dDoubleProperty, return its value else assert
Definition: gen.h:2525
wxString GetIdName() const
name of the name of this error id
Definition: gen.h:672
wxEOL GetMode()
get line end mode for textual files
Definition: gen.h:3707
static const a2dSignal sm_Edit_properties
edit properties event, see EditProperties()
Definition: gen.h:1606
virtual bool GetVisible() const
some derived properties can be visible or not and override this
Definition: gen.h:1908
virtual float GetFloat() const
when a2dFloatProperty, return its value else assert
Definition: gen.h:2575
const a2dError a2dError_CommandError
~a2dRefCountList()
destructor
Definition: gen.h:1739
const a2dError a2dError_NoDocTemplateRef
void SetErrorCode(a2dErrorWarningCode code)
set error code
Definition: gen.h:682
static const a2dSignal sm_changedProperty
Definition: gen.h:381
wxColour A2DGENERALDLLEXP HexToColour(const wxString &hex)
3-digit hex to wxColour
Definition: gen.cpp:5279
a2dSmrtPtr< a2dRefCount > a2dRefCountPtr
smart pointer for a2dRefCount
Definition: gen.h:1756
wxString GetErrorString()
get this when an error occured.
Definition: gen.h:3928
Simple Memory manager for some objects which often create and destroy to replace OS-system calls...
Definition: a2dmemmgr.h:20
static long ms_timestamp
initialize timestamp
Definition: gen.h:294
void SetRelease(bool value)
set release flag
Definition: gen.h:1346
virtual bool IsTemporary_DontSave() const
Check if this is a temporary object, which should not be saved.
Definition: gen.h:1258
void SetDepthFirst(bool depthFirst)
set if walker needs to go into recursive objects first.
Definition: gen.h:3946
property to hold a a2dObject pointer type variable to be associated with a a2dObject ...
Definition: gen.h:2250
const a2dError a2dError_GetVar
class to map references to objects stored in XML, in order to make the connection later on...
Definition: gen.h:3462
a2dDocumentRenderStyle operator|(a2dDocumentRenderStyle a, a2dDocumentRenderStyle b)
OR-ing a2dDocumentRenderStyle is allowed.
Definition: canglob.h:50
virtual wxString GetName() const
Get the ids print and serialization name.
Definition: id.h:245
void DecCurrentDepth()
Decrement recursion depth.
Definition: gen.h:3940
static a2dPropertyIdBool * PROPID_Check
used for linking multiple referenced objects when serializing
Definition: gen.h:1599
a2dAutoZeroPtr< a2dObject > * m_autozeroptrlist
this is a list of all a2dAutoZeroPtr object pointing to this object
Definition: gen.h:1580
void Register(const wxString &classname, a2dObjectIOFn *IOfunc)
to register a function to handle a class
Definition: gen.h:3958
const a2dError a2dError_CouldNotEvaluatePath
const wxRect & GetRect() const
get rect which keep tip visible
Definition: gen.h:2894
a2dError GetLastError() const
get last error encountered
Definition: gen.h:3538
friend class a2dPropertyId
wxProperty is a friend and allowed to use these functions
Definition: gen.h:1386
Ref Counted base object.
Definition: gen.h:1045
virtual wxString StringRepresentation() const
Definition: gen.h:1901
wxEOL GetMode()
get line end mode for textual files
Definition: gen.h:3800
Flags
Flags for property ids.
Definition: id.h:158
const a2dError a2dError_NoError
a2dIOHandler takes care of loading and/or saving data.
Definition: gen.h:3592
int a2dErrorWarningCode
error codes generated in docview framework.
Definition: gen.h:259
wxOutputStream a2dDocumentOutputStream
output stream based wxStreams
Definition: gen.h:3458
virtual wxInt32 GetInt32() const
when a2dInt32Property, return its value else assert
Definition: gen.h:2423
bool GetDepthFirst()
What is the current recursion depth.
Definition: gen.h:3949
property to hold a double type variable to be associated with a a2dObject
Definition: gen.h:2503
a2dDocumentInputStream * m_streami
file or other string stream containing the format to parse.
Definition: gen.h:3734
property to hold a bool type variable to be associated with a a2dObject
Definition: gen.h:2004
void IncCurrentDepth()
Increment recursion depth.
Definition: gen.h:3937
const a2dError a2dError_FileCouldNotOpen
Input and output handler for the XmlSer format.
Definition: genxmlpars.h:819
a2dNamedPropertyList m_propertylist
properties
Definition: gen.h:1561
Path searching.
Definition: gen.h:2926
wxString A2DGENERALDLLEXP ColourToHex(const wxColour &colour)
RGB to 3-digit hex.
Definition: gen.cpp:5295
A2DGENERALDLLEXP void wxGenRegisterId(long id)
see wxGenNewId(), use this to resrve a specific id
Definition: gen.cpp:97
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dNamedPropertyEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
const a2dError a2dError_NoTool
a2dResolveIdList m_toResolve
refernces to object which have not bin resolved yet ( e.g not read yet, but already referenced ) ...
Definition: gen.h:3552
property to hold a wxURI type variable to be associated with a a2dObject
Definition: gen.h:3095
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dNamedPropertyListStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
A trivial base class for a2dSmrtPtr. Non-template class, so that it can.
Definition: smrtptr.h:55
const a2dError a2dError_DocumentsOpened
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dCanvasObjectPreChild
id for a2dWalkEvent issued from within a2dWalkerIOHandler
using a file stream for input, stream the file into a a2dDocument or other object ...
Definition: gen.h:3632
wxEOL m_mode
end of line mode
Definition: gen.h:3740
wxString GetName() const
Get the name of the a2dPropertyId object.
Definition: gen.h:1864
list of a2dNamedProperty objects
Definition: gen.h:804
#define DECLARE_PROPERTIES()
check if class has the given id as a valid id for this object
Definition: gen.h:835
int m_nelements
number of used elements in m_properties
Definition: gen.h:3414
const long a2dWalkEvent
Definition: gen.h:3842
virtual bool GetCanRender() const
some derived properties can be renderable or not and override this
Definition: gen.h:1916
virtual a2dObject * GetRefObjectNA() const
when a2dProperty, return its value else return NULL
Definition: gen.h:2220
property to hold a window type variable (for example wxTipWindow) to be associated with a a2dObject ...
Definition: gen.h:2806
const a2dError a2dError_LoadFile
wxStringOutputStream a2dDocumentStringOutputStream
string output stream based wxStreams
Definition: gen.h:3454
wxEOL m_mode
end of line mode
Definition: gen.h:3828
property to hold a FileName type variable to be associated with a a2dObject
Definition: gen.h:3035
class A2DGENERALDLLEXP a2dVariablesHashBase
wxString keys plus a2dObject pointers
Definition: gen.h:3205
property to hold a a2dObjectPtr smart pointer type variable to be associated with a a2dObject ...
Definition: gen.h:2199
property to hold a wxArrayString type variable to be associated with a a2dObject
Definition: gen.h:2605
static a2dPropertyIdUri * PROPID_URI
attach an URL to the object
Definition: gen.h:1601
no special flags set
Definition: id.h:161
bool m_depthFirst
Definition: gen.h:4000
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dDerivedCanvasObjectStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
Definition: gen.h:276
bool m_stopWalking
quit the iteration
Definition: gen.h:3993
property to hold a 2 byte integer type variable to be associated with a a2dObject ...
Definition: gen.h:2301
wxMBConv & m_conv
unicode conversion
Definition: gen.h:3702
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dNamedPropertyStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
bool GetUseObjRect() const
is the tip based on a2dCanvasObject boundingbox
Definition: gen.h:2897
Id based property system with its base a2dPropertyId.
virtual double GetDouble() const
when a2dDoubleProperty, return its value else assert
Definition: gen.h:2577
void SetProperty(a2dNamedProperty *propertyHolder, a2dPropertyId::SetFlags flags=a2dPropertyId::set_none)
Set the property to the this object.
Definition: gen.cpp:1605
const a2dError a2dError_FileHistory
const a2dError a2dError_CanceledFileDialog
const a2dError a2dError_IOHandler
virtual a2dObject * GetRefObject() const
when a2dProperty, return its value else assert
Definition: gen.h:2219
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dObjectStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
bool m_skipNotRenderedInDrawing
Definition: gen.h:4007
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dCanvasObjectPostChild
id for a2dWalkEvent issued from within a2dWalkerIOHandler
const a2dError a2dError_CouldNotCreateDocument
wxClassInfo * GetDocumentClassInfo() const
class info for the (document) class this handler reads data into.
Definition: gen.h:3687
const a2dError a2dError_NoSelection
property to hold a wxDateTime type variable to be associated with a a2dObject
Definition: gen.h:2710
a2dHashMapIntToObject m_objecthashmap
This is used to find multiple referenced objects by id.
Definition: gen.h:3546
SetFlags
Flags used for manipulating the way a property is set to a2dObject.
Definition: id.h:219
Io handler to iterate through a a2dDocument.
Definition: gen.h:3911
property to hold a 2 byte integer type variable to be associated with a a2dObject ...
Definition: gen.h:2401
bool GetCheck() const
general flag use at will.
Definition: gen.h:1342
Holds arrayed variables, e.g. parameter lists in a command processor.
Definition: gen.h:3326
wxObject * m_currentParent
parent object of current object
Definition: gen.h:3987
a2dRefCount(wxObject *theObjectToWrap)
constructor
Definition: gen.h:1654
bool GetCheck() const
general flag use at will.
Definition: gen.h:1847
std list compatible list
Definition: a2dlist.h:42
virtual ~a2dRefCount()
destructor
Definition: gen.h:1661
bool(* a2dObjectIOFn)(wxObject *parent, wxObject *object, a2dWalkEvent)
a functions to store in a hash table
Definition: gen.h:3880
int GetCount()
get the number of elements in the array
Definition: gen.h:3406
const a2dError a2dError_SaveFile
wxString m_error
to store errors
Definition: gen.h:3990
a2dResolveIdList & GetResolveIdList()
list of not resolved objects
Definition: gen.h:3485
a2dAutoZeroPtr< a2dObject > TAutoZeroPtrListClass
this is needed inside the smart pointer template code
Definition: gen.h:1361
wxUint16 a2dPrintWhat
defines what to print
Definition: gen.h:4052
no special flags set
Definition: id.h:222
void Deallocate(void *space, size_t bytes)
function for adding memory block by size bytes to list of freed memory blocks
Definition: a2dmemmgr.cpp:71
property to hold a Menu type variable to be associated with a a2dObject
Definition: gen.h:2764
a2dNamedPropertyList()
Default constructor.
Definition: gen.h:808
const a2dError a2dError_XMLparse
const a2dError a2dError_NoWrapper
void push_backobj(wxObject *obj)
convenient to push wxObject, instead of a2dRefCount( theObjectToWrap )
Definition: gen.h:1742
const a2dError a2dError_canvasObjectRelease
const a2dError a2dError_CouldNotLoad
a2dSignal GetEventComIdReturn()
after proecssin the event, on return an id can be set to communicate back to sender.
Definition: gen.h:487
void * Allocate(size_t bytes)
function for allocating memory block by size bytes
Definition: a2dmemmgr.cpp:47
memory management which can optionally be used for certain intensively used classes.
const a2dError a2dError_LinkPin
const a2dError a2dError_FileVersion
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dNamedPropertyListEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
static const a2dSignal sm_non
Definition: gen.h:387
wxStringInputStream a2dDocumentStringInputStream
string input stream based wxStreams
Definition: gen.h:3452
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dCanvasObjectProperties
id for a2dWalkEvent issued from within a2dWalkerIOHandler
const a2dPropertyId * GetId() const
Get the a2dPropertyId object identifying this property.
Definition: gen.h:1858
Holds internal variables to be used whereever needed.
Definition: gen.h:3223
const a2dError a2dError_LoadObject
wxObject * m_object
the wxObject that is maintained using Smart pointer within here.
Definition: gen.h:1719
Input and output handler for the XmlSer format.
Definition: genxmlpars.h:862
const a2dError a2dError_SetEnv
const wxString & GetString(void)
when a2dStringProperty, return its value else assert
Definition: gen.h:2888
virtual void * GetVoidPtr() const
when a2dVoidPtrProperty, return its value else assert
Definition: gen.h:2139
a2dError()
default constructor
Definition: gen.h:628
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dObjectEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
static const a2dSignal sm_changedRefObject
Definition: gen.h:384
WX_DECLARE_STRING_HASH_MAP(a2dPropertyId *, a2dPropertyIdHashMap)
Declaration of the hash map type to convert prop names to prop id objects.
virtual wxUint16 GetUint16() const
when a2dUint16Property, return its value else assert
Definition: gen.h:2373
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dPropertyStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
a2dHashMapIntToObject & GetObjectHashMap()
This is used to find multiple referenced objects by id.
Definition: gen.h:3479
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dCanvasObjectStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
int m_refcount
how many references to this object do exist
Definition: gen.h:1564
virtual wxUint32 GetUint32() const
when a2dUint32Property, return its value else assert
Definition: gen.h:2475
property to hold a tip window type variable to be associated with a a2dObject
Definition: gen.h:2850
void SetCheck(bool check)
general flag use at will.
Definition: gen.h:1339
property to hold a wxString type variable to be associated with a a2dObject
Definition: gen.h:2066
a2dError(const wxString &errorIdName, const wxString &error=wxEmptyString, bool warning=false)
constructor
Definition: gen.h:634
bool GetUseCheck()
see SetUseCheck
Definition: gen.h:3955
static a2dPropertyIdString * PROPID_Name
Name property, to return name of this object.
Definition: gen.h:1603
using a file stream for output, stream a a2dDocument or other wxObject into a stream.
Definition: gen.h:3751
const a2dError a2dError_SaveObject
bool GetResult()
depending upon derived class implementation.
Definition: gen.h:3979
const a2dError a2dError_ImportObject
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dCanvasObjectEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
wxClassInfo * m_docClassInfo
Run-time class information that allows document instances to be constructed dynamically.
Definition: gen.h:3737
int m_currentDepth
contour to be used by algorithm, to decide on how deep recursing is to be.
Definition: gen.h:3996
virtual wxString StringRepresentation() const
Definition: gen.h:2093
const a2dError a2dError_Canceled
wxInputStream a2dDocumentInputStream
input stream based wxStreams
Definition: gen.h:3456
const a2dError a2dError_NoPinClass
void SetToObjectClone(a2dObject *obj, a2dPropertyId::SetFlags setflags=a2dPropertyId::set_none) const
Set this property to an object and clone it if neccessary.
Definition: gen.h:1855
the settings used by all other include files are stored here.
virtual bool GetBool() const
when a2dBoolProperty, return its value else assert
Definition: gen.h:2033
class used in a2dResolveIdList to resolve references to other objects while readin in a file...
Definition: gen.h:734
property to hold a FileName type variable to be associated with a a2dObject
Definition: gen.h:2976
simple ref counted class to maintain a wxObject* as if it is a smart pointer
Definition: gen.h:1648
property to hold a void pointer type variable to be associated with a a2dObject
Definition: gen.h:2117
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dPropertyEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
const a2dError a2dError_NoView
int GetOwnedBy()
like it to be protected, but this does not work with wxList macros
Definition: gen.h:1173
wxObject * GetParent()
Definition: gen.h:3972
bool GetRelease() const
get release flag
Definition: gen.h:1350
virtual wxString GetString() const
when a2dStringProperty, return its value else assert
Definition: gen.h:2089
virtual bool DoIgnoreIfNotMember(const a2dPropertyId *id) const
used to decide if a property shall be ignored, if it is not a member
Definition: gen.h:1393
This is the base class for all kinds of property id&#39;s for a2dObject.
Definition: id.h:154
a2dAutoZeroPtr< a2dObject > a2dObjectAutoZeroPtr
is a a2dAutoZeroPtr&lt;a2dObject&gt;
Definition: gen.h:1635
const a2dError a2dError_LoadLayers
bool HasDynamicProperties() const
test if there are dynamic properties in the m_propertylist
Definition: gen.h:1513
a2dRefCountList()
constructor
Definition: gen.h:1736
const a2dError a2dError_ImportFile
void SetErrorMessage(const wxString &error)
set error message
Definition: gen.h:680
a2dErrorWarningCode GetErrorCode() const
get error code
Definition: gen.h:677
wxString GetErrorMessage() const
get error string
Definition: gen.h:675
a2dAutoZeroPtr< a2dObject > ** GetAutoZeroPtrList()
return the list head pointer for autozero pointers to this object
Definition: gen.h:1359
virtual a2dObject * GetRefObjectNA() const
when a2dProperty, return its value else return NULL
Definition: gen.h:2271
void SetToObject(a2dObject *obj, a2dPropertyId::SetFlags setflags=a2dPropertyId::set_none)
Set this property to an object.
Definition: gen.h:1851
const a2dError a2dError_GetEnv
property to hold a wxObject variable to be associated with a a2dObject
Definition: gen.h:2164
smart pointer class and list.
bool m_useCheck
if set a2dObject are only walked if not m_check is set
Definition: gen.h:4003
A list class for reference counted objects.
Definition: smrtptr.h:653
int m_refcount
how many references to this object do exist
Definition: gen.h:1716
const a2dError a2dError_NotSpecified
see a2dComEvent
Definition: gen.h:371
const a2dError a2dError_property
virtual wxString StringValueRepresentation() const
Definition: gen.h:1905
const a2dError a2dError_ToManyOpen
const a2dNamedPropertyList & GetPropertyList() const
Get the Property List.
Definition: gen.h:1510
virtual a2dObject * GetRefObject() const
when a2dProperty, return its value else assert
Definition: gen.h:2270
const a2dError a2dError_ExportFile
const a2dError a2dError_NoDocument
virtual wxInt16 GetInt16() const
when a2dInt16Property, return its value else assert
Definition: gen.h:2323
a2dSmrtPtr< a2dNamedProperty > a2dNamedPropertyPtr
smart pointerv to a2dNamedProperty
Definition: gen.h:1998
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dDerivedCanvasObjectEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
int m_melements
number of elements in m_properties
Definition: gen.h:3416
bool GetStopWalking()
check for stop
Definition: gen.h:3934
void push_frontobj(wxObject *obj)
convenient to push wxObject, instead of a2dRefCount( theObjectToWrap )
Definition: gen.h:1748
This template class is for property ids with a known data type.
Definition: id.h:477
holds one error report.
Definition: gen.h:623
void SetDocumentClassInfo(wxClassInfo *docClassInfo)
class info for the (document) class this handler reads data into.
Definition: gen.h:3690
wxMBConv & m_conv
unicode conversion
Definition: gen.h:3822
void SetCheck(bool check)
general flag use at will.
Definition: gen.h:1844
Definition: gen.h:131
const a2dError a2dError_NoController
a2dIOHandlerCoupleHash m_register
coupling function to event and classname
Definition: gen.h:4010
a2dNamedProperty ** m_properties
this is the array of properties
Definition: gen.h:3412
void SetUseCheck(bool useCheck)
set if walker needs to check objects for a2dObject::m_check set, before walking into it ...
Definition: gen.h:3952
property to hold a FileName type variable to be associated with a a2dObject
Definition: gen.h:2656
virtual wxString StringValueRepresentation() const
Definition: gen.h:2095
list of a2dObject&#39;s
Definition: gen.h:3157
property to hold a float type variable to be associated with a a2dObject
Definition: gen.h:2553
A pointer class, that automatically calls SmrtPtrOwn/SmrtPtrRelease.
Definition: a2dlist.h:20
a2dDocumentOutputStream * m_streamo
file or other string stream containing the format to output to.
Definition: gen.h:3825
WX_DECLARE_HASH_MAP_WITH_DECL(wxString, a2dCommandId *, wxStringHash, wxStringEqual, a2dHashMapCommandIds, class A2DGENERALDLLEXP)
This hash table is used for a2dCommandId with name.
void SetStopWalking(bool stopWalking)
to further recursion, e.g. in a2dObject::Walker()
Definition: gen.h:3931
CloneOptions
options for cloning
Definition: gen.h:1200
property to hold an unsigned 2 byte integer type variable to be associated with a a2dObject ...
Definition: gen.h:2351
a2dError m_lastError
set to last error found when parsing
Definition: gen.h:3557
int GetCurrentDepth()
What is the current recursion depth.
Definition: gen.h:3943
gen.h Source File -- Sun Oct 12 2014 17:04:20 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation