00001 /* 00002 * File Name: uds_string.h 00003 */ 00004 00005 /* 00006 * This file is part of uds-plugin-common. 00007 * 00008 * uds-plugin-common is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation, either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * uds-plugin-common is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 */ 00021 00022 /** 00023 * Copyright (C) 2008 iRex Technologies B.V. 00024 * All rights reserved. 00025 */ 00026 00027 #ifndef UDS_STRING_H_ 00028 #define UDS_STRING_H_ 00029 00030 #ifdef __cplusplus 00031 extern "C" { 00032 #endif 00033 00034 /** 00035 * @brief Universal Document Shell String object. 00036 * The UDS string is implemented by UDS and is usually used by plugin. 00037 */ 00038 typedef struct _UDSString 00039 { 00040 // Define a virtual desctuctor to avoid memory leaks in derived classes. 00041 // Note: UDSString is intended as a plain C struct, 00042 // but uds and/or plugins use it as a C++ base class. 00043 // This may cause memory leaks because the derived class destructor 00044 // is not called when deleting the base type. 00045 virtual ~_UDSString() {} 00046 00047 /** 00048 * @brief Assign the the source string to the UDS string object. 00049 * @param thiz The UDS string object. 00050 * @param src The source string. 00051 * @return This function returns the UDS string object equal to thiz. 00052 */ 00053 struct _UDSString* (* assign)( struct _UDSString *thiz, 00054 const char *src ); 00055 00056 /** 00057 * @brief Get the string buffer inside the UDS string object, always used 00058 * by plugin to retrieve the native string. 00059 * @param thiz The UDS string object. 00060 * @return string buffer inside the UDS string object. 00061 */ 00062 const char* (* get_buffer)( const struct _UDSString *thiz ); 00063 00064 /** 00065 * @brief Get the length of the source string, always used by coping the UDS 00066 * string to the internal string in Plugin 00067 * @param thiz The UDS string object 00068 */ 00069 unsigned int (* size)( const struct _UDSString *thiz); 00070 00071 } UDSString; 00072 00073 00074 #ifdef __cplusplus 00075 } 00076 #endif 00077 00078 #endif 00079