1 /* 2 * Copyright 2009, Adrien Destugues, pulkomandy@gmail.com. 3 * Distributed under the terms of the MIT License. 4 */ 5 /* This file holds various wrapper functions to interface easily between ICU 6 * and the Be API. 7 */ 8 #ifndef __ICU_WRAPPER_H__ 9 #define __ICU_WRAPPER_H__ 10 11 12 #include <String.h> 13 14 #include <unicode/bytestream.h> 15 #include <String.h> 16 17 18 /* Convert UnicodeString to BString needs an ICU ByteSink to do the work */ 19 class BStringByteSink : public U_NAMESPACE_QUALIFIER ByteSink { 20 public: BStringByteSink(BString * dest)21 BStringByteSink(BString* dest) 22 : fDest(dest) 23 {} Append(const char * data,int32_t n)24 virtual void Append(const char* data, int32_t n) 25 { fDest->Append(data, n); } 26 SetTo(BString * dest)27 void SetTo(BString* dest) 28 { fDest = dest; } 29 30 private: 31 BString* fDest; 32 33 BStringByteSink(); 34 BStringByteSink(const BStringByteSink&); 35 BStringByteSink& operator=(const BStringByteSink&); 36 }; 37 38 39 #endif 40