string_byte_sink.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef ENCODINGS_COMPACT_LANG_DET_STRING_BYTE_SINK_H_
6#define ENCODINGS_COMPACT_LANG_DET_STRING_BYTE_SINK_H_
7
8#include <string>
9
10#include <unicode/unistr.h>
11
12// Implementation of a string byte sink needed when ICU is compiled without
13// support for std::string which is the case on Android.
14class StringByteSink : public icu::ByteSink {
15 public:
16  // Constructs a ByteSink that will append bytes to the dest string.
17  explicit StringByteSink(std::string* dest);
18  virtual ~StringByteSink();
19
20  virtual void Append(const char* data, int32_t n);
21
22 private:
23  std::string* const dest_;
24};
25
26#endif  // ENCODINGS_COMPACT_LANG_DET_STRING_BYTE_SINK_H_
27