Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

vtkStringConverter.h

Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 00002 * 00003 * $Id: vtkStringConverter.h,v 1.3 2004/08/10 07:37:21 xpxqx Exp $ 00004 * 00005 * Copyright (c) 2004 Sean McInerney 00006 * All rights reserved. 00007 * 00008 * See Copyright.txt or http://vtkextensions.sourceforge.net/Copyright.html 00009 * for details. 00010 * 00011 * This software is distributed WITHOUT ANY WARRANTY; without even 00012 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 * PURPOSE. See the above copyright notice for more information. 00014 * 00015 * 00016 * Original File: ConvertUTF.h 00017 * Copyright 2001 Unicode, Inc. 00018 * 00019 * Disclaimer 00020 * 00021 * This source code is provided as is by Unicode, Inc. No claims are 00022 * made as to fitness for any particular purpose. No warranties of any 00023 * kind are expressed or implied. The recipient agrees to determine 00024 * applicability of information provided. If this file has been 00025 * purchased on magnetic or optical media from Unicode, Inc., the 00026 * sole remedy for any claim will be exchange of defective media 00027 * within 90 days of receipt. 00028 * 00029 * Limitations on Rights to Redistribute This Code 00030 * 00031 * Unicode, Inc. hereby grants the right to freely use the information 00032 * supplied in this file in the creation of products supporting the 00033 * Unicode Standard, and to make copies of this file in any form 00034 * for internal or external distribution as long as this notice 00035 * remains attached. 00036 * 00037 * Original File: ConvertUTF7.h 00038 * Author: David B. Goldsmith 00039 * Copyright (C) 1994 IBM Corporation All rights reserved. 00040 * Revisions: Header update only July, 2001. 00041 * 00042 * This code is copyrighted. Under the copyright laws, this code may not 00043 * be copied, in whole or part, without prior written consent of IBM 00044 * Corporation. 00045 * 00046 * IBM Corporation grants the right to use this code as long as this ENTIRE 00047 * copyright notice is reproduced in the code. The code is provided 00048 * AS-IS, AND IBM CORPORATION DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR 00049 * IMPLIED, INCLUDING, BUT NOT LIMITED TO IMPLIED WARRANTIES OF 00050 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT 00051 * WILL IBM CORPORATION BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING, 00052 * WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS 00053 * INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY 00054 * LOSS) ARISING OUT OF THE USE OR INABILITY TO USE THIS CODE, EVEN 00055 * IF IBM CORPORATION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 00056 * BECAUSE SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF 00057 * LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE 00058 * LIMITATION MAY NOT APPLY TO YOU. 00059 * 00060 * RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the 00061 * government is subject to restrictions as set forth in subparagraph 00062 * (c)(l)(ii) of the Rights in Technical Data and Computer Software 00063 * clause at DFARS 252.227-7013 and FAR 52.227-19. 00064 * 00065 * This code may be protected by one or more U.S. and International 00066 * Patents. 00067 */ 00068 #ifndef VTK_STRING_CONVERTER_H_ 00069 # define VTK_STRING_CONVERTER_H_ 00070 # include "vtkExtensionsCommonConfigure.h" // vtkExtensions configuration 00071 # include "vtkExtensionsTypes.h" // vtkExtensions types 00072 # include "vtkExtensionsExceptions.h" // vtkExtensions exceptions 00073 00074 VTK_EXTENSIONS_NAMESPACE_BEGIN 00075 00142 class VTK_EXTENSIONS_COMMON_EXPORT vtkStringConverter 00143 { 00144 public: 00147 static const vtkUCS4ChType UNI_REPLACEMENT_CHAR; 00148 static const vtkUCS4ChType UNI_MAX_BMP; 00149 static const vtkUCS4ChType UNI_MAX_UTF16; 00150 static const vtkUCS4ChType UNI_MAX_UTF32; 00200 static const vtkUCS2ChType UNI_SIGNATURE_UCS2[2]; 00201 static const vtkUCS4ChType UNI_SIGNATURE_UCS4[2]; 00202 static const vtkUTF8ChType UNI_SIGNATURE_UTF8[4]; 00203 static const vtkUTF16ChType UNI_SIGNATURE_UTF16[2]; 00208 static const vtkUCS4ChType ISO8859_REPLACEMENT_CHAR; 00209 static const vtkUCS4ChType ISO8859_MAX_CHAR; 00212 enum ConversionResult 00213 { 00214 eConversionOK = 0, 00215 eSourceExhausted, 00216 eTargetExhausted, 00217 eSourceIllegal, 00218 eSourceCorrupt, 00219 eInvalidEncoding 00220 }; 00221 00222 enum ConversionFlags 00223 { 00224 eStrictConversion = 0, 00225 eLenientConversion 00226 }; 00227 00228 enum EncodingEnum 00229 { 00230 eUnknownEncoding = 0, 00231 eIso8859_1 = 1, 00232 eIso8859_2 = 2, 00233 eIso8859_3 = 3, 00234 eIso8859_4 = 4, 00235 eIso8859_5 = 5, 00236 eIso8859_6 = 6, 00237 eIso8859_7 = 7, 00238 eIso8859_8 = 8, 00239 eIso8859_9 = 9, 00240 eIso8859_10 = 10, 00241 eIso8859_11 = 11, 00242 eIso8859_12 = eUnknownEncoding, 00243 eIso8859_13 = 13, 00244 eIso8859_14 = 14, 00245 eIso8859_15 = 15, 00246 eIso8859_16 = 16, 00247 eLatin1 = eIso8859_1, 00248 eLatin2 = eIso8859_2, 00249 eLatin3 = eIso8859_3, 00250 eLatin4 = eIso8859_4, 00251 eCyrillic = eIso8859_5, 00252 eArabic = eIso8859_6, 00253 eGreek = eIso8859_7, 00254 eHebrew = eIso8859_8, 00255 eLatin5 = eIso8859_9, 00256 eLatin6 = eIso8859_10, 00257 eThai = eIso8859_11, 00258 eLatin7 = eIso8859_13, 00259 eLatin8 = eIso8859_14, 00260 eLatin9 = eIso8859_15, 00261 eLatin10 = eIso8859_16, 00262 eUCS4, 00263 eUCS2, 00264 eUTF8, 00265 eUTF16, 00266 eUTF32 00267 }; 00268 00272 static int SizeofUTF8 (const vtkUTF16ChType* aSrc, 00273 const vtkUTF16ChType* aEnd, 00274 ConversionFlags = eStrictConversion) 00275 THROW_SPEC(); 00276 00280 static int SizeofUTF8 (const vtkUTF32ChType* aSrc, 00281 const vtkUTF32ChType* aEnd, 00282 ConversionFlags = eStrictConversion) 00283 THROW_SPEC(); 00284 00288 static int SizeofUTF8 (const char* aSrc, 00289 const char* aEnd, 00290 ConversionFlags = eStrictConversion) 00291 THROW_SPEC(); 00292 00293 static int SizeofUTF8fromUCS4 (const vtkUCS4ChType* aSrc, 00294 const vtkUCS4ChType* aEnd, 00295 ConversionFlags aFlags) 00296 THROW_SPEC(); 00297 00301 static int SizeofUTF16 (const vtkUTF32ChType* aSrc, 00302 const vtkUTF32ChType* aEnd, 00303 ConversionFlags = eStrictConversion) 00304 THROW_SPEC(); 00305 00309 static int SizeofUTF16 (const vtkUTF8ChType* aSrc, 00310 const vtkUTF8ChType* aEnd, 00311 ConversionFlags = eStrictConversion) 00312 THROW_SPEC(); 00313 00317 static int SizeofUTF16 (const char* aSrc, 00318 const char* aEnd, 00319 ConversionFlags = eStrictConversion) 00320 THROW_SPEC(); 00321 00325 static int SizeofUTF32 (const vtkUTF16ChType* aSrc, 00326 const vtkUTF16ChType* aEnd, 00327 ConversionFlags = eStrictConversion) 00328 THROW_SPEC(); 00329 00333 static int SizeofUTF32 (const vtkUTF8ChType* aSrc, 00334 const vtkUTF8ChType* aEnd, 00335 ConversionFlags = eStrictConversion) 00336 THROW_SPEC(); 00337 00338 static int SizeofUCS4 (const vtkUTF8ChType* aSrc, 00339 const vtkUTF8ChType* aEnd, 00340 ConversionFlags = eStrictConversion) 00341 THROW_SPEC(); 00342 00343 static int SizeofUCS4 (const char* aSrc, 00344 const char* aEnd, 00345 EncodingEnum = eLatin1) 00346 THROW_SPEC(); 00347 00351 static int SizeofLatin1 (const vtkUTF8ChType* aSrc, 00352 const vtkUTF8ChType* aEnd, 00353 ConversionFlags = eStrictConversion) 00354 THROW_SPEC(); 00355 00359 static int SizeofLatin1 (const vtkUTF16ChType* aSrc, 00360 const vtkUTF16ChType* aEnd, 00361 ConversionFlags = eStrictConversion) 00362 THROW_SPEC(); 00363 00364 00365 static int ConvertUTF8toUTF16 (const vtkUTF8ChType** srcStart, 00366 const vtkUTF8ChType* srcEnd, 00367 vtkUTF16ChType** dstStart, 00368 vtkUTF16ChType* dstEnd, 00369 ConversionFlags = eStrictConversion) 00370 THROW_SPEC(); 00371 00372 static int ConvertUTF16toUTF8 (const vtkUTF16ChType** srcStart, 00373 const vtkUTF16ChType* srcEnd, 00374 vtkUTF8ChType** dstStart, 00375 vtkUTF8ChType* dstEnd, 00376 ConversionFlags = eStrictConversion) 00377 THROW_SPEC(); 00378 00379 static int ConvertUTF8toUTF32 (const vtkUTF8ChType** srcStart, 00380 const vtkUTF8ChType* srcEnd, 00381 vtkUTF32ChType** dstStart, 00382 vtkUTF32ChType* dstEnd, 00383 ConversionFlags = eStrictConversion) 00384 THROW_SPEC(); 00385 00386 static int ConvertUTF32toUTF8 (const vtkUTF32ChType** srcStart, 00387 const vtkUTF32ChType* srcEnd, 00388 vtkUTF8ChType** dstStart, 00389 vtkUTF8ChType* dstEnd, 00390 ConversionFlags = eStrictConversion) 00391 THROW_SPEC(); 00392 00393 static int ConvertUTF16toUTF32 (const vtkUTF16ChType** srcStart, 00394 const vtkUTF16ChType* srcEnd, 00395 vtkUTF32ChType** dstStart, 00396 vtkUTF32ChType* dstEnd, 00397 ConversionFlags = eStrictConversion) 00398 THROW_SPEC(); 00399 00400 static int ConvertUTF32toUTF16 (const vtkUTF32ChType** srcStart, 00401 const vtkUTF32ChType* srcEnd, 00402 vtkUTF16ChType** dstStart, 00403 vtkUTF16ChType* dstEnd, 00404 ConversionFlags = eStrictConversion) 00405 THROW_SPEC(); 00406 00407 static int ConvertUCS4toUTF8 (const vtkUCS4ChType** aSrcStart, 00408 const vtkUCS4ChType* aSrcEnd, 00409 vtkUTF8ChType** aDstStart, 00410 vtkUTF8ChType* aDstEnd, 00411 ConversionFlags = eStrictConversion) 00412 THROW_SPEC(); 00413 00414 static int ConvertUTF8toUCS4 (const vtkUTF8ChType** aSrcStart, 00415 const vtkUTF8ChType* aSrcEnd, 00416 vtkUCS4ChType** aDstStart, 00417 vtkUCS4ChType* aDstEnd, 00418 ConversionFlags = eStrictConversion) 00419 THROW_SPEC(); 00420 00421 static int ConvertISO8859toUCS4 (const unsigned char** aSrcStart, 00422 const unsigned char* aSrcEnd, 00423 vtkUCS4ChType** aDstStart, 00424 vtkUCS4ChType* aDstEnd, 00425 EncodingEnum = eLatin1) 00426 THROW_SPEC(); 00427 00428 static bool IsLegalUTF8Sequence (const vtkUTF8ChType* src, 00429 const vtkUTF8ChType* srcEnd) 00430 THROW_SPEC(); 00431 00436 static int SizeofUTF7 (const vtkUCS2ChType* start, 00437 const vtkUCS2ChType* end, 00438 int optional, int verbose) 00439 THROW_SPEC(); 00440 00444 static int SizeofUCS2 (const char* start, const char* end) 00445 THROW_SPEC(); 00446 00467 static int ConvertUCS2toUTF7 (const vtkUCS2ChType** srcStart, 00468 const vtkUCS2ChType* srcEnd, 00469 char** dstStart, 00470 char* dstEnd, 00471 int optional, int verbose) 00472 THROW_SPEC(); 00473 00474 static int ConvertUTF7toUCS2 (const char** srcStart, 00475 const char* srcEnd, 00476 vtkUCS2ChType** dstStart, 00477 vtkUCS2ChType* dstEnd) 00478 THROW_SPEC(); 00481 static int ConvertUTF8toLatin1 (const vtkUTF8ChType** srcStart, 00482 const vtkUTF8ChType* srcEnd, 00483 char** dstStart, 00484 char* dstEnd, 00485 ConversionFlags = eStrictConversion) 00486 THROW_SPEC(); 00487 00488 static int ConvertUTF16toLatin1 (const vtkUTF16ChType** srcStart, 00489 const vtkUTF16ChType* srcEnd, 00490 char** dstStart, 00491 char* dstEnd, 00492 ConversionFlags = eStrictConversion) 00493 THROW_SPEC(); 00494 00496 static int ConvertLatin1toUTF8 (const char** srcStart, 00497 const char* srcEnd, 00498 vtkUTF8ChType** dstStart, 00499 vtkUTF8ChType* dstEnd, 00500 ConversionFlags = eStrictConversion) 00501 THROW_SPEC(); 00502 00503 static int ConvertLatin1toUTF16 (const char** srcStart, 00504 const char* srcEnd, 00505 vtkUTF16ChType** dstStart, 00506 vtkUTF16ChType* dstEnd, 00507 ConversionFlags = eStrictConversion) 00508 THROW_SPEC(); 00509 00510 private: 00511 vtkStringConverter (void); // Not implemented. 00512 ~vtkStringConverter(); // Not implemented. 00513 vtkStringConverter (const vtkStringConverter&); // Not implemented. 00514 void operator= (const vtkStringConverter&); // Not implemented. 00515 }; 00516 00517 VTK_EXTENSIONS_NAMESPACE_END 00518 00519 #endif /* VTK_STRING_CONVERTER_H_ */ 00520 /* 00521 * End of: $Id: vtkStringConverter.h,v 1.3 2004/08/10 07:37:21 xpxqx Exp $. 00522 * 00523 */

Generated on Tue Aug 10 03:38:39 2004 for vtkExtensions by doxygen 1.3.7