|
Nokia N97 SDK Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : stringutils.h 00004 * Part of : OpenCStringUtilsEx 00005 * Interface : 00006 * Description : Header file for stringutils 00007 * Version : 00008 * 00009 * Copyright (c) 2005-2007 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. 00013 * ============================================================================== 00014 */ 00015 #ifndef __STRINGUTILS_H__ 00016 #define __STRINGUTILS_H__ 00017 00018 /** @file stringutils.h 00019 * stringutils is a DLL that exports some set of genaralized APIs using which 00020 * user can convert the SYMBIAN descriptors to standard C character/wide-character 00021 * strings and vice-versa 00022 */ 00023 00024 00025 //Symbian Headers 00026 #include <e32cmn.h> 00027 #include <wchar.h> 00028 00029 /** 00030 * Aliases : Cconverting HBufC variants to char/wchar_t strings involves 00031 * similiar procedure to that of converting TBufC variants to char/wchar_t strings. 00032 * Hence HBufC to char/wchar_t conversion Apis are aliased to their corresponding TBufC 00033 * counterparts 00034 */ 00035 00036 00037 /** 00038 * Alias to the function tbufC16towchar 00039 */ 00040 #define hbufC16towchar tbufC16towchar 00041 /** 00042 * Alias to the function tbufC16tochar 00043 */ 00044 #define hbufC16tochar tbufC16tochar 00045 /** 00046 * Alias to the function tbufC8towchar 00047 */ 00048 #define hbufC8towchar tbufC8towchar 00049 /** 00050 * Alias to the function tbufC8tochar 00051 */ 00052 #define hbufC8tochar tbufC8tochar 00053 00054 00055 //Function prototypes 00056 00057 /** Functions to convert SYMBIAN descriptors to C character and 00058 * Wide-Character strings 00059 */ 00060 00061 /** 00062 * This Api converts the tbuf16 to a wide-character string 00063 * @param aArg TDes object 00064 * @return a pointer to a wide-character string 00065 */ 00066 IMPORT_C wchar_t* tbuf16towchar(TDes& aArg); 00067 00068 /** 00069 * This Api converts the tbuf8 to a character string 00070 * @param aArg TDes8 object 00071 * @return a pointer to a character string 00072 */ 00073 IMPORT_C char* tbuf8tochar(TDes8& aArg); 00074 00075 /** 00076 * This Api converts the tbuf16 to a character string. It is user 00077 * responsibality to allocate a required size of char object. Api may 00078 * resulting in crash, if the destination object size is smaller than 00079 * that of the source. 00080 * @param aSrc TDes16 object 00081 * @param aDes character pointer, to which the resultant string will be copied. 00082 * @return returns an integer value. 00083 * @return Api returns -1 in case of any error. 00084 */ 00085 IMPORT_C int tbuf16tochar(TDes& aSrc, char* aDes); 00086 00087 /** 00088 * This Api converts the tbuf8 to a wide-character string. It is user 00089 * responsibality to allocate a required size of wide-char object. Api may 00090 * resulting in crash, if the destination object size is smaller than that 00091 * of the source. 00092 * @param aSrc TDes8 object 00093 * @param aDes wide-character pointer, to which the resultant string will be copied. 00094 * @return returns an integer value. 00095 * @return Api returns -1 in case of any error. 00096 */ 00097 IMPORT_C int tbuf8towchar(TDes8& aSrc, wchar_t* aDes); 00098 00099 /** 00100 * This Api converts the tbuf16 to a wide-character string. It is user 00101 * responsibality to allocate a required size of wide-char object. Api may 00102 * resulting in crash, if the destination object size is smaller than 00103 * that of the source. 00104 * @param aSrc TDes16 object 00105 * @param aDes wide-character pointer, to which the resultant string will be copied. 00106 * @return none 00107 */ 00108 IMPORT_C void tbufC16towchar(TDesC& aSrc ,wchar_t* aDes); 00109 00110 00111 /** 00112 * This Api converts the tbufC8 to a character string. It is user 00113 * responsibality to allocate a required size of wide-char object. Api may 00114 * resulting in crash, if the destination object size is smaller than 00115 * that of the source. 00116 * @param aSrc TDesC8 object 00117 * @param aDes character pointer, to which the resultant string will be copied. 00118 * @return none 00119 */ 00120 00121 IMPORT_C void tbufC8tochar(TDesC8& aSrc, char* aDes); 00122 00123 /** 00124 * This Api converts the TBufC16 to a character string. It is user 00125 * responsibality to allocate a required size of wide-char object. Api may 00126 * resulting in crash, if the destination object size is smaller than 00127 * that of the source. 00128 * @param aSrc TDesC object 00129 * @param aDes character pointer, to which the resultant string will be copied. 00130 * @return returns an integer value. 00131 * @return Api returns -1 in case of any error. 00132 */ 00133 IMPORT_C int tbufC16tochar(TDesC& aSrc, char* aDes); 00134 00135 00136 /** 00137 * This Api converts the TBufC8 to a wide-character string. It is user 00138 * responsibality to allocate a required size of wide-char object. Api may 00139 * resulting in crash, if the destination object size is smaller than 00140 * that of the source. 00141 * @param aSrc TDesC8 object 00142 * @param aDes wide-character pointer, to which the resultant string will be copied. 00143 * @return returns an integer value. 00144 * @return Api returns -1 in case of any error. 00145 */ 00146 IMPORT_C int tbufC8towchar(TDesC8& aSrc, wchar_t* aDes); 00147 00148 00149 /** 00150 * Functions to convert C character and 00151 * Wide-Character strings to SYMBIAN descriptors 00152 */ 00153 00154 /** 00155 * This Api converts the wide-char to a TBuf16. It is user responsibality 00156 * to allocate a required size of TBuf16 object. Api may resulting in crash, 00157 * if the destination object size is smaller than that of the source. 00158 * @param aSrc wide-character pointer. 00159 * @param aDes TBuf16 object, to which the resultant string will be copied. 00160 * @return none 00161 */ 00162 IMPORT_C void wchartotbuf16(const wchar_t *aSrc, TDes16& aDes); 00163 00164 00165 /** 00166 * This Api converts the char to a TBuf16. It is user responsibality 00167 * to allocate a required size of TBuf16 object. Api may resulting in crash, 00168 * if the destination object size is smaller than that of the source. 00169 * @param aSrc character pointer. 00170 * @param aDes TBuf16 object, to which the resultant string will be copied. 00171 * @return returns an integer value. 00172 * @return Api returns -1 in case of any error. 00173 */ 00174 IMPORT_C int chartotbuf16(const char* aSrc, TDes16& aDes); 00175 00176 /** 00177 * This Api converts the wide-char string to a TBuf8. It is user 00178 * responsibality to allocate a required size of TBuf8 object. Api may 00179 * resulting in crash, if the destination object size is smaller than 00180 * that of the source. 00181 * @param aSrc wide-character pointer. 00182 * @param aDes TBuf8 object, to which the resultant string will be copied. 00183 * @return returns an integer value. 00184 * @return Api returns -1 in case of any error. 00185 */ 00186 IMPORT_C int wchartotbuf8(const wchar_t* aSrc, TDes8& aDes); 00187 00188 00189 /* 00190 * This Api converts the character string to a TBuf8. It is user 00191 * responsibality to allocate a required size of TBuf8 object. Api may 00192 * resulting in crash, if the destination object size is smaller than 00193 * that of the source. 00194 * @param aSrc character pointer. 00195 * @param aDes TBuf8 object, to which the resultant string will be copied. 00196 * @return none 00197 */ 00198 IMPORT_C void chartotbuf8(const char* aSrc, TDes8& aDes); 00199 00200 00201 /** 00202 * This Api converts the wide-char to a HBufC16. It is user responsibality 00203 * to allocate a required size of HBufC16 object. Api may resulting in crash, 00204 * if the destination object size is smaller than that of the source. 00205 * @param aSrc wide-character pointer. 00206 * @param aDes HBufC16 object, to which the resultant string will be copied. 00207 * @return none 00208 */ 00209 IMPORT_C void wchartohbufc16(const wchar_t* aSrc, HBufC16& aDes); 00210 00211 00212 /** 00213 * This Api converts the char to a HBufC16. It is user responsibality 00214 * to allocate a required size of HBufC16 object. Api may resulting in crash, 00215 * if the destination object size is smaller than that of the source. 00216 * @param aSrc character pointer. 00217 * @param aDes HBufC16 object, to which the resultant string will be copied. 00218 * @return returns an integer value. 00219 * @return Api returns -1 in case of any error. 00220 */ 00221 IMPORT_C int chartohbufc16(const char* aSrc, HBufC16& aDes); 00222 00223 /** 00224 * This Api converts the wide-char to a HBufC8. It is user responsibality 00225 * to allocate a required size of HBufC8 object. Api may resulting in crash, 00226 * if the destination object size is smaller than that of the source. 00227 * @param aSrc wide-character pointer. 00228 * @param aDes HBufC8 object, to which the resultant string will be copied. 00229 * @return returns an integer value. 00230 * @return Api returns -1 in case of any error. 00231 */ 00232 IMPORT_C int wchartohbufc8(const wchar_t* aSrc, HBufC8& aDes); 00233 00234 00235 /* 00236 * This Api converts the char to a HBufC8. It is user responsibality 00237 * to allocate a required size of HBufC8 object. Api may resulting in crash, 00238 * if the destination object size is smaller than that of the source. 00239 * @param aSrc character pointer. 00240 * @param aDes HBufC8 object, to which the resultant string will be copied. 00241 * @return none 00242 */ 00243 IMPORT_C void chartohbufc8(const char* aSrc, HBufC8& aDes); 00244 00245 #endif /*__STRINGUTILS_H__*/
|
© Nokia 2009 |