2
**********************************************************************
3
* Copyright (c) 2001, International Business Machines
4
* Corporation and others. All Rights Reserved.
5
**********************************************************************
6
* Date Name Description
7
* 11/19/2001 aliu Creation.
8
**********************************************************************
11
#include "unicode/utypes.h"
12
#include "unicode/unistr.h"
14
//--------------------------------------------------------------------
17
// This is a tiny wrapper class that is used internally to make a
18
// UnicodeString look like a const char*. It can be allocated on the
19
// stack. It only creates a heap buffer if it needs to.
20
//--------------------------------------------------------------------
26
inline CharString(const UnicodeString& str);
28
inline operator const char*() { return ptr; }
34
inline CharString::CharString(const UnicodeString& str) {
35
// TODO This isn't quite right -- we should probably do
36
// preflighting here to determine the real length.
37
if (str.length() >= (int32_t)sizeof(buf)) {
38
ptr = new char[str.length() + 8];
42
str.extract(0, 0x7FFFFFFF, ptr, "");
45
inline CharString::~CharString() {