blob: 67ba836e4cddb2868ff3ea2838fc96e26fc80a3c [file] [log] [blame]
Henrique Nakashimab9776c72017-06-23 15:03:50 -04001// Copyright 2014 PDFium 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 TESTING_FX_STRING_TESTHELPERS_H_
6#define TESTING_FX_STRING_TESTHELPERS_H_
7
Lei Zhangb6992dd2019-02-05 23:30:20 +00008#include <memory>
Henrique Nakashimab9776c72017-06-23 15:03:50 -04009#include <ostream>
Lei Zhangb6992dd2019-02-05 23:30:20 +000010#include <string>
11#include <vector>
Henrique Nakashimab9776c72017-06-23 15:03:50 -040012
13#include "core/fxcrt/cfx_datetime.h"
Lei Zhangb6992dd2019-02-05 23:30:20 +000014#include "public/fpdfview.h"
15#include "testing/free_deleter.h"
Henrique Nakashimab9776c72017-06-23 15:03:50 -040016
17// Output stream operator so GTEST macros work with CFX_DateTime objects.
18std::ostream& operator<<(std::ostream& os, const CFX_DateTime& dt);
19
Lei Zhangb6992dd2019-02-05 23:30:20 +000020std::vector<std::string> StringSplit(const std::string& str, char delimiter);
21
22// Converts a FPDF_WIDESTRING to a std::string.
23// Deals with differences between UTF16LE and UTF8.
24std::string GetPlatformString(FPDF_WIDESTRING wstr);
25
26// Converts a FPDF_WIDESTRING to a std::wstring.
27// Deals with differences between UTF16LE and wchar_t.
28std::wstring GetPlatformWString(FPDF_WIDESTRING wstr);
29
Lei Zhangf0f67682019-04-08 17:03:21 +000030using ScopedFPDFWideString = std::unique_ptr<FPDF_WCHAR, pdfium::FreeDeleter>;
31
Lei Zhangb6992dd2019-02-05 23:30:20 +000032// Returns a newly allocated FPDF_WIDESTRING.
33// Deals with differences between UTF16LE and wchar_t.
Lei Zhangf0f67682019-04-08 17:03:21 +000034ScopedFPDFWideString GetFPDFWideString(const std::wstring& wstr);
Lei Zhangb6992dd2019-02-05 23:30:20 +000035
Henrique Nakashimab9776c72017-06-23 15:03:50 -040036#endif // TESTING_FX_STRING_TESTHELPERS_H_