url_canon_icu.h 1.2 KB

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