// Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#include "Stdafx.h"
#pragma once
using namespace System;
using namespace System::Collections::Generic;
namespace CefSharp
{
namespace Internals
{
private class StringUtils
{
public:
///
/// Converts an unmanaged string to a (managed) .NET string.
///
/// The string that should be converted.
/// A .NET string.
static String^ ToClr(const cef_string_t& cefStr);
///
/// Converts an unmanaged string to a (managed) .NET string.
///
/// The string that should be converted.
/// A .NET string.
static String^ ToClr(const CefString& cefStr);
///
/// Converts an unmanaged vector of strings to a (managed) .NET List of strings.
///
/// The vector of strings that should be converted.
/// A .NET List of strings.
static List^ ToClr(const std::vector& cefStr);
///
/// Converts a .NET string to native (unmanaged) format. Note that this method does not allocate a new copy of the
// string, but rather returns a pointer to the memory in the existing managed String object.
///
/// The string that should be converted.
/// An unmanaged representation of the provided string, or an empty string if the input string is a nullptr.
static CefString ToNative(String^ str);
///
/// Converts a .NET List of strings to native (unmanaged) format.
///
/// The List of strings that should be converted.
/// An unmanaged representation of the provided List of strings, or an empty List if the input is a nullptr.
static std::vector ToNative(List^ str);
///
/// Assigns the provided cef_string_t object from the given .NET string.
///
/// The cef_string_t that should be updated.
/// The .NET string whose value should be used to update cefStr.
static void AssignNativeFromClr(cef_string_t& cefStr, String^ str);
};
}
}