2 * Amiga Generic Set - set of libraries and includes to ease sw development for all Amiga platforms
3 * Copyright (C) 2001-2011 Tomasz Wiszkowski Tomasz.Wiszkowski at gmail.com.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #include "GenericOOP.h"
21 #include "LibrarySpool.h"
22 #include <libclass/exec.h>
23 #include <libclass/utility.h>
24 #include <libclass/intuition.h>
28 using namespace GenNS
;
30 uint32
GenericOOP::DoMtd(Object
* pObject
, uint32
*pMsg
)
32 return Utility
->CallHookPkt((const Hook
*)OCLASS(pObject
), pObject
, pMsg
);
35 uint32
GenericOOP::DoSuperMtd(IClass
*pClass
, Object
* pObject
, uint32
*pMsg
)
37 return Utility
->CallHookPkt((Hook
*)pClass
->cl_Super
, pObject
, pMsg
);
40 uint32
*GenericOOP::NewObj(char* Name
, uint32 FirstTag
, ...) // me hates mos for that.
43 uint32
*params
= new uint32
[128];
45 va_start(ap
, FirstTag
);
47 params
[pos
] = FirstTag
;
48 while (params
[pos
++] != 0)
50 params
[pos
++] = va_arg(ap
, unsigned long);
51 params
[pos
] = va_arg(ap
, unsigned long);
55 pos
= (int)Intuition
->NewObjectA(0, Name
, (struct TagItem
*)params
);
60 uint32
*GenericOOP::NewObj(Class
* cls
, uint32 FirstTag
, ...) // me hates mos for that.
63 uint32
*params
= new uint32
[128];
65 va_start(ap
, FirstTag
);
67 params
[pos
] = FirstTag
;
68 while (params
[pos
++] != 0)
70 params
[pos
++] = va_arg(ap
, unsigned long);
71 params
[pos
] = va_arg(ap
, unsigned long);
75 pos
= (int)Intuition
->NewObjectA((IClass
*)cls
, 0, (struct TagItem
*)params
);
81 void GenericOOP::DisposeObj(uint32
*obj
)
83 Intuition
->DisposeObject(obj
);
86 void GenericOOP::AddChildObj(Object
*parent
, uint32
*child
)
88 DoMtd(parent
, ARRAY(OM_ADDMEMBER
, (uint32
)child
));
91 void GenericOOP::RemChildObj(Object
*parent
, uint32
*child
)
93 DoMtd(parent
, ARRAY(OM_REMMEMBER
, (uint32
)child
));
96 GenericOOP::~GenericOOP()
100 GenericOOP::GenericOOP()
102 ASSERTS(Utility
!= 0, "Please create library spool!");