Home | History | Annotate | Download | only in src
      1 /*---------------------------------------------------------------------------*
      2  *  IntArrayList.c  *
      3  *                                                                           *
      4  *  Copyright 2007, 2008 Nuance Communciations, Inc.                               *
      5  *                                                                           *
      6  *  Licensed under the Apache License, Version 2.0 (the 'License');          *
      7  *  you may not use this file except in compliance with the License.         *
      8  *                                                                           *
      9  *  You may obtain a copy of the License at                                  *
     10  *      http://www.apache.org/licenses/LICENSE-2.0                           *
     11  *                                                                           *
     12  *  Unless required by applicable law or agreed to in writing, software      *
     13  *  distributed under the License is distributed on an 'AS IS' BASIS,        *
     14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
     15  *  See the License for the specific language governing permissions and      *
     16  *  limitations under the License.                                           *
     17  *                                                                           *
     18  *---------------------------------------------------------------------------*/
     19 
     20 #include "IntArrayList.h"
     21 #include "IntArrayListImpl.h"
     22 #include "pmemory.h"
     23 
     24 ESR_ReturnCode IntArrayListAdd(IntArrayList* self, int element)
     25 {
     26   if (self == NULL)
     27     return ESR_INVALID_ARGUMENT;
     28   return self->add(self, element);
     29 }
     30 
     31 ESR_ReturnCode IntArrayListRemove(IntArrayList* self, int element)
     32 {
     33   if (self == NULL)
     34     return ESR_INVALID_ARGUMENT;
     35   return self->remove(self, element);
     36 }
     37 
     38 ESR_ReturnCode IntArrayListRemoveAll(IntArrayList* self)
     39 {
     40   if (self == NULL)
     41     return ESR_INVALID_ARGUMENT;
     42   return self->removeAll(self);
     43 }
     44 
     45 ESR_ReturnCode IntArrayListContains(IntArrayList* self, int element, ESR_BOOL* exists)
     46 {
     47   if (self == NULL)
     48     return ESR_INVALID_ARGUMENT;
     49   return self->contains(self, element, exists);
     50 }
     51 
     52 ESR_ReturnCode IntArrayListGetSize(IntArrayList* self, size_t* size)
     53 {
     54   if (self == NULL)
     55     return ESR_INVALID_ARGUMENT;
     56   return self->getSize(self, size);
     57 }
     58 
     59 ESR_ReturnCode IntArrayListGet(IntArrayList* self, size_t index, int* element)
     60 {
     61   if (self == NULL)
     62     return ESR_INVALID_ARGUMENT;
     63   return self->get(self, index, element);
     64 }
     65 
     66 ESR_ReturnCode IntArrayListSet(IntArrayList* self, size_t index, int element)
     67 {
     68   if (self == NULL)
     69     return ESR_INVALID_ARGUMENT;
     70   return self->set(self, index, element);
     71 }
     72 
     73 ESR_ReturnCode IntArrayListToStaticArray(IntArrayList* self, int** newArray)
     74 {
     75   if (self == NULL)
     76     return ESR_INVALID_ARGUMENT;
     77   return self->toStaticArray(self, newArray);
     78 }
     79 
     80 ESR_ReturnCode IntArrayListDestroy(IntArrayList* self)
     81 {
     82   if (self == NULL)
     83     return ESR_INVALID_ARGUMENT;
     84   return self->destroy(self);
     85 }
     86