1 /*---------------------------------------------------------------------------*
2 * Nametag.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 "SR_Nametag.h"
21 #include "SR_NametagImpl.h"
22 #include "plog.h"
23 #include "pmemory.h"
24
25
SR_NametagGetID(const SR_Nametag * self,LCHAR ** id)26 ESR_ReturnCode SR_NametagGetID(const SR_Nametag* self, LCHAR** id)
27 {
28 if (self == NULL)
29 {
30 PLogError(L("ESR_INVALID_ARGUMENT"));
31 return ESR_INVALID_ARGUMENT;
32 }
33 return self->getID(self, id);
34 }
35
SR_NametagGetValue(const SR_Nametag * self,const char ** pvalue,size_t * plen)36 ESR_ReturnCode SR_NametagGetValue(const SR_Nametag* self, const char** pvalue, size_t* plen)
37 {
38 if (self == NULL || pvalue == NULL || plen == NULL)
39 {
40 PLogError(L("ESR_INVALID_ARGUMENT"));
41 return ESR_INVALID_ARGUMENT;
42 }
43 return self->getValue(self, pvalue, plen);
44 }
45
SR_NametagSetID(SR_Nametag * self,const LCHAR * id)46 ESR_ReturnCode SR_NametagSetID(SR_Nametag* self, const LCHAR* id)
47 {
48 if (self == NULL)
49 {
50 PLogError(L("ESR_INVALID_ARGUMENT"));
51 return ESR_INVALID_ARGUMENT;
52 }
53 return self->setID(self, id);
54 }
55
SR_NametagClone(const SR_Nametag * self,SR_Nametag ** result)56 ESR_ReturnCode SR_NametagClone(const SR_Nametag* self, SR_Nametag** result)
57 {
58 if (self == NULL)
59 {
60 PLogError(L("ESR_INVALID_ARGUMENT"));
61 return ESR_INVALID_ARGUMENT;
62 }
63 return self->clone(self, result);
64 }
65
SR_NametagDestroy(SR_Nametag * self)66 ESR_ReturnCode SR_NametagDestroy(SR_Nametag* self)
67 {
68 if (self == NULL)
69 {
70 PLogError(L("ESR_INVALID_ARGUMENT"));
71 return ESR_INVALID_ARGUMENT;
72 }
73 return self->destroy(self);
74 }
75