1 // Copyright 2013 The Chromium Authors 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 URL_URL_CANON_ICU_H_ 6 #define URL_URL_CANON_ICU_H_ 7 8 // ICU integration functions. 9 10 #include "base/compiler_specific.h" 11 #include "base/component_export.h" 12 #include "base/memory/raw_ptr.h" 13 #include "url/url_canon.h" 14 15 typedef struct UConverter UConverter; 16 17 namespace url { 18 19 // An implementation of CharsetConverter that implementations can use to 20 // interface the canonicalizer with ICU's conversion routines. COMPONENT_EXPORT(URL)21class COMPONENT_EXPORT(URL) ICUCharsetConverter : public CharsetConverter { 22 public: 23 // Constructs a converter using an already-existing ICU character set 24 // converter. This converter is NOT owned by this object; the lifetime must 25 // be managed by the creator such that it is alive as long as this is. 26 ICUCharsetConverter(UConverter* converter); 27 28 ~ICUCharsetConverter() override; 29 30 void ConvertFromUTF16(const char16_t* input, 31 int input_len, 32 CanonOutput* output) override; 33 34 private: 35 // The ICU converter, not owned by this class. 36 raw_ptr<UConverter> converter_; 37 }; 38 39 } // namespace url 40 41 #endif // URL_URL_CANON_ICU_H_ 42