home *** CD-ROM | disk | FTP | other *** search
- /*
- File: PfTypLs.cpp
-
- Contains: Implementation of class ODPlatformTypeList.
-
- Owned by: Craig Carper
-
- Copyright: © 1994 - 1996 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <2> 5/24/96 jpa 1246074: SOM_CATCH --> SOM_TRY..SOM_ENDTRY
-
- To Do:
- In Progress:
-
- */
-
- #define VARIABLE_MACROS
-
- #define ODPlatformTypeList_Class_Source
- #include <PfTypLs.xih>
-
- #ifndef SOM_ODPlatformTypeListIterator_xh
- #include <PfTLItr.xh>
- #endif
-
- #ifndef SOM_ODObject_xh
- #include <ODObject.xh>
- #endif
-
- #ifndef _ORDCOLL_
- #include <OrdColl.h>
- #endif
-
- #ifndef _EXCEPT_
- #include <Except.h>
- #endif
-
- #pragma segment ODPlatformTypeList
-
- //==============================================================================
- // Class ODPlatformTypeList
- //==============================================================================
-
- //------------------------------------------------------------------------------
- // ODPlatformTypeList: somUninit
- //------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK ODPlatformTypeListsomUninit(ODPlatformTypeList *somSelf)
- {
- ODPlatformTypeListData *somThis = ODPlatformTypeListGetData(somSelf);
- ODPlatformTypeListMethodDebug("ODPlatformTypeList","somUninit");
-
- delete _fList;
-
- parent_somUninit(somSelf);
- }
-
- //------------------------------------------------------------------------------
- // ODPlatformTypeList: InitPlatformTypeList
- //------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK ODPlatformTypeListInitPlatformTypeList(ODPlatformTypeList *somSelf, Environment *ev,
- ODPlatformTypeList* typeList)
- {
- ODPlatformTypeListData *somThis = ODPlatformTypeListGetData(somSelf);
- ODPlatformTypeListMethodDebug("ODPlatformTypeList","InitPlatformTypeList");
-
- ODPlatformTypeListIterator* iter = kODNULL;
- ODVolatile(iter);
-
- SOM_TRY
-
- /* Moved from somInit. SOM itself sets fields to zero
- _fList = kODNULL;
- */
- somSelf->InitObject(ev);
-
- _fList = new OrderedCollection;
-
- if ( typeList != (ODPlatformTypeList*) kODNULL )
- {
- iter = typeList->CreatePlatformTypeListIterator(ev);
-
- for (ODPlatformType type = iter->First(ev);
- iter->IsNotComplete(ev);
- type = iter->Next(ev))
- {
- somSelf->AddLast(ev,type);
- }
- }
-
- SOM_CATCH_ALL
-
- ODDeleteObject(_fList);
-
- SOM_ENDTRY
-
- ODDeleteObject(iter);
- }
-
- //------------------------------------------------------------------------------
- // ODPlatformTypeList: AddLast
- //------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK ODPlatformTypeListAddLast(ODPlatformTypeList *somSelf, Environment *ev,
- ODPlatformType type)
- {
- ODPlatformTypeListData *somThis = ODPlatformTypeListGetData(somSelf);
- ODPlatformTypeListMethodDebug("ODPlatformTypeList","AddLast");
-
- SOM_TRY
-
- if ( somSelf->Contains(ev,type) == kODFalse )
- _fList->AddLast((ElementType)type);
-
- SOM_CATCH_ALL
- SOM_ENDTRY
- }
-
- //------------------------------------------------------------------------------
- // ODPlatformTypeList: Remove
- //------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK ODPlatformTypeListRemove(ODPlatformTypeList *somSelf, Environment *ev,
- ODPlatformType type)
- {
- ODPlatformTypeListData *somThis = ODPlatformTypeListGetData(somSelf);
- ODPlatformTypeListMethodDebug("ODPlatformTypeList","Remove");
-
- SOM_TRY
-
- if ( somSelf->Contains(ev,type) )
- _fList->Remove((ElementType)type);
-
- SOM_CATCH_ALL
- SOM_ENDTRY
- }
-
- //------------------------------------------------------------------------------
- // ODPlatformTypeList: Contains
- //------------------------------------------------------------------------------
-
- SOM_Scope ODBoolean SOMLINK ODPlatformTypeListContains(ODPlatformTypeList *somSelf, Environment *ev,
- ODPlatformType type)
- {
- ODPlatformTypeListData *somThis = ODPlatformTypeListGetData(somSelf);
- ODPlatformTypeListMethodDebug("ODPlatformTypeList","Contains");
-
- SOM_TRY
-
- return _fList->Contains((ElementType)type);
-
- SOM_CATCH_ALL
- SOM_ENDTRY
- return kODFalse;
- }
-
- //------------------------------------------------------------------------------
- // ODPlatformTypeList: Count
- //------------------------------------------------------------------------------
-
- SOM_Scope ODULong SOMLINK ODPlatformTypeListCount(ODPlatformTypeList *somSelf, Environment *ev)
- {
- ODPlatformTypeListData *somThis = ODPlatformTypeListGetData(somSelf);
- ODPlatformTypeListMethodDebug("ODPlatformTypeList","Count");
-
- SOM_TRY
-
- return _fList->Count();
-
- SOM_CATCH_ALL
- SOM_ENDTRY
- return 0;
- }
-
- //------------------------------------------------------------------------------
- // ODPlatformTypeList: CreatePlatformTypeListIterator
- //------------------------------------------------------------------------------
-
- SOM_Scope ODPlatformTypeListIterator* SOMLINK ODPlatformTypeListCreatePlatformTypeListIterator(ODPlatformTypeList *somSelf, Environment *ev)
- {
- ODPlatformTypeListData *somThis = ODPlatformTypeListGetData(somSelf);
- ODPlatformTypeListMethodDebug("ODPlatformTypeList","CreatePlatformTypeListIterator");
-
- SOM_TRY
-
- ODPlatformTypeListIterator* iter = new ODPlatformTypeListIterator;
- if (iter == kODNULL)
- ODSetSOMException(ev, kODErrOutOfMemory);
- else
- iter->InitPlatformTypeListIterator(ev, somSelf);
-
- return iter;
-
- SOM_CATCH_ALL
- SOM_ENDTRY
- return (ODPlatformTypeListIterator*) kODNULL;
- }
-
- //------------------------------------------------------------------------------
- // ODPlatformTypeList: GetImplementation
- //------------------------------------------------------------------------------
-
- SOM_Scope OrderedCollection* SOMLINK ODPlatformTypeListGetImplementation(ODPlatformTypeList *somSelf, Environment *ev)
- {
- ODPlatformTypeListData *somThis = ODPlatformTypeListGetData(somSelf);
- ODPlatformTypeListMethodDebug("ODPlatformTypeList","GetImplementation");
-
- return _fList;
- }
-