1 /*---------------------------------------------------------------------------* 2 * Int8ArrayList.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 "Int8ArrayList.h" 21 #include "Int8ArrayListImpl.h" 22 #include "plog.h" 23 #include "pmemory.h" 24 25 26 ESR_ReturnCode Int8ArrayListAdd(Int8ArrayList* self, asr_int8_t element) 27 { 28 if (self == NULL) 29 { 30 PLogError(L("ESR_INVALID_ARGUMENT")); 31 return ESR_INVALID_ARGUMENT; 32 } 33 return self->add(self, element); 34 } 35 36 ESR_ReturnCode Int8ArrayListRemove(Int8ArrayList* self, asr_int8_t element) 37 { 38 if (self == NULL) 39 { 40 PLogError(L("ESR_INVALID_ARGUMENT")); 41 return ESR_INVALID_ARGUMENT; 42 } 43 return self->remove(self, element); 44 } 45 46 ESR_ReturnCode Int8ArrayListRemoveAll(Int8ArrayList* self) 47 { 48 if (self == NULL) 49 { 50 PLogError(L("ESR_INVALID_ARGUMENT")); 51 return ESR_INVALID_ARGUMENT; 52 } 53 return self->removeAll(self); 54 } 55 56 ESR_ReturnCode Int8ArrayListContains(Int8ArrayList* self, asr_int8_t element, ESR_BOOL* exists) 57 { 58 if (self == NULL) 59 { 60 PLogError(L("ESR_INVALID_ARGUMENT")); 61 return ESR_INVALID_ARGUMENT; 62 } 63 return self->contains(self, element, exists); 64 } 65 66 ESR_ReturnCode Int8ArrayListGetSize(Int8ArrayList* self, size_t* size) 67 { 68 if (self == NULL) 69 { 70 PLogError(L("ESR_INVALID_ARGUMENT")); 71 return ESR_INVALID_ARGUMENT; 72 } 73 return self->getSize(self, size); 74 } 75 76 ESR_ReturnCode Int8ArrayListGet(Int8ArrayList* self, size_t index, asr_int8_t* element) 77 { 78 if (self == NULL) 79 { 80 PLogError(L("ESR_INVALID_ARGUMENT")); 81 return ESR_INVALID_ARGUMENT; 82 } 83 return self->get(self, index, element); 84 } 85 86 ESR_ReturnCode Int8ArrayListSet(Int8ArrayList* self, size_t index, asr_int8_t element) 87 { 88 if (self == NULL) 89 { 90 PLogError(L("ESR_INVALID_ARGUMENT")); 91 return ESR_INVALID_ARGUMENT; 92 } 93 return self->set(self, index, element); 94 } 95 96 ESR_ReturnCode Int8ArrayListToStaticArray(Int8ArrayList* self, asr_int8_t** newArray) 97 { 98 if (self == NULL) 99 { 100 PLogError(L("ESR_INVALID_ARGUMENT")); 101 return ESR_INVALID_ARGUMENT; 102 } 103 return self->toStaticArray(self, newArray); 104 } 105 106 ESR_ReturnCode Int8ArrayListClone(Int8ArrayList* self, Int8ArrayList* clone) 107 { 108 if (self == NULL) 109 { 110 PLogError(L("ESR_INVALID_ARGUMENT")); 111 return ESR_INVALID_ARGUMENT; 112 } 113 return self->clone(self, clone); 114 } 115 116 ESR_ReturnCode Int8ArrayListDestroy(Int8ArrayList* self) 117 { 118 if (self == NULL) 119 { 120 PLogError(L("ESR_INVALID_ARGUMENT")); 121 return ESR_INVALID_ARGUMENT; 122 } 123 return self->destroy(self); 124 } 125