1 /*---------------------------------------------------------------------------* 2 * Nametags.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 "plog.h" 21 #include "SR_Nametags.h" 22 23 ESR_ReturnCode SR_NametagsLoad(SR_Nametags* self, const LCHAR* filename) 24 { 25 if (self == NULL) 26 { 27 PLogError(L("ESR_INVALID_ARGUMENT")); 28 return ESR_INVALID_ARGUMENT; 29 } 30 return self->load(self, filename); 31 } 32 33 ESR_ReturnCode SR_NametagsSave(SR_Nametags* self, const LCHAR* filename) 34 { 35 if (self == NULL) 36 { 37 PLogError(L("ESR_INVALID_ARGUMENT")); 38 return ESR_INVALID_ARGUMENT; 39 } 40 return self->save(self, filename); 41 } 42 43 ESR_ReturnCode SR_NametagsAdd(SR_Nametags* self, SR_Nametag* nametag) 44 { 45 if (self == NULL) 46 { 47 PLogError(L("ESR_INVALID_ARGUMENT")); 48 return ESR_INVALID_ARGUMENT; 49 } 50 return self->add(self, nametag); 51 } 52 53 ESR_ReturnCode SR_NametagsRemove(SR_Nametags* self, const LCHAR* id) 54 { 55 if (self == NULL) 56 { 57 PLogError(L("ESR_INVALID_ARGUMENT")); 58 return ESR_INVALID_ARGUMENT; 59 } 60 return self->remove(self, id); 61 } 62 63 ESR_ReturnCode SR_NametagsGetSize(SR_Nametags* self, size_t* result) 64 { 65 if (self == NULL) 66 { 67 PLogError(L("ESR_INVALID_ARGUMENT")); 68 return ESR_INVALID_ARGUMENT; 69 } 70 return self->getSize(self, result); 71 } 72 73 ESR_ReturnCode SR_NametagsGet(SR_Nametags* self, const LCHAR* id, SR_Nametag** nametag) 74 { 75 if (self == NULL) 76 { 77 PLogError(L("ESR_INVALID_ARGUMENT")); 78 return ESR_INVALID_ARGUMENT; 79 } 80 return self->get(self, id, nametag); 81 } 82 83 ESR_ReturnCode SR_NametagsGetAtIndex(SR_Nametags* self, size_t index, SR_Nametag** nametag) 84 { 85 if (self == NULL) 86 { 87 PLogError(L("ESR_INVALID_ARGUMENT")); 88 return ESR_INVALID_ARGUMENT; 89 } 90 return self->getAtIndex(self, index, nametag); 91 } 92 93 ESR_ReturnCode SR_NametagsContains(SR_Nametags* self, const LCHAR* id, ESR_BOOL* result) 94 { 95 if (self == NULL) 96 { 97 PLogError(L("ESR_INVALID_ARGUMENT")); 98 return ESR_INVALID_ARGUMENT; 99 } 100 return self->contains(self, id, result); 101 } 102 103 ESR_ReturnCode SR_NametagsDestroy(SR_Nametags* self) 104 { 105 if (self == NULL) 106 { 107 PLogError(L("ESR_INVALID_ARGUMENT")); 108 return ESR_INVALID_ARGUMENT; 109 } 110 return self->destroy(self); 111 } 112