2010-04-13 01:02:09 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2009, Adrien Destugues, pulkomandy@gmail.com.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2009-09-19 02:23:34 +04: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-02-17 03:46:43 +03:00
|
|
|
#include <String.h>
|
2009-09-19 02:23:34 +04:00
|
|
|
|
|
|
|
#include <unicode/bytestream.h>
|
2010-02-17 18:35:28 +03:00
|
|
|
#include <String.h>
|
2009-09-19 02:23:34 +04:00
|
|
|
|
|
|
|
|
|
|
|
/* Convert UnicodeString to BString needs an ICU ByteSink to do the work */
|
|
|
|
class BStringByteSink : public ByteSink {
|
|
|
|
public:
|
|
|
|
BStringByteSink(BString* dest) : dest_(dest) {}
|
|
|
|
virtual void Append(const char* data, int32_t n)
|
|
|
|
{ dest_->Append(data, n); }
|
|
|
|
private:
|
|
|
|
BString* dest_;
|
2010-04-13 01:02:09 +04:00
|
|
|
BStringByteSink();
|
|
|
|
BStringByteSink(const BStringByteSink &);
|
|
|
|
BStringByteSink &operator=(const BStringByteSink &);
|
2009-09-19 02:23:34 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|