2010-04-12 21:02:09 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2009, Adrien Destugues, pulkomandy@gmail.com.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2009-09-18 22:23:34 +00:00
|
|
|
/* This file holds various wrapper functions to interface easily between ICU
|
|
|
|
* and the Be API.
|
|
|
|
*/
|
|
|
|
#ifndef __ICU_WRAPPER_H__
|
|
|
|
#define __ICU_WRAPPER_H__
|
|
|
|
|
2010-07-29 20:03:05 +00:00
|
|
|
|
2010-02-17 00:46:43 +00:00
|
|
|
#include <String.h>
|
2009-09-18 22:23:34 +00:00
|
|
|
|
|
|
|
#include <unicode/bytestream.h>
|
2010-02-17 15:35:28 +00:00
|
|
|
#include <String.h>
|
2009-09-18 22:23:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Convert UnicodeString to BString needs an ICU ByteSink to do the work */
|
2020-08-02 11:53:25 +02:00
|
|
|
class BStringByteSink : public U_NAMESPACE_QUALIFIER ByteSink {
|
2010-07-29 20:03:05 +00:00
|
|
|
public:
|
|
|
|
BStringByteSink(BString* dest)
|
|
|
|
: fDest(dest)
|
|
|
|
{}
|
|
|
|
virtual void Append(const char* data, int32_t n)
|
|
|
|
{ fDest->Append(data, n); }
|
|
|
|
|
|
|
|
void SetTo(BString* dest)
|
|
|
|
{ fDest = dest; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
BString* fDest;
|
|
|
|
|
|
|
|
BStringByteSink();
|
|
|
|
BStringByteSink(const BStringByteSink&);
|
|
|
|
BStringByteSink& operator=(const BStringByteSink&);
|
2009-09-18 22:23:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|