Add coverage and remove deprecated WideInput.

This commit is contained in:
ArthurSonzogni
2022-04-27 11:33:42 +02:00
parent 5ba301d316
commit 114cbfcffd
7 changed files with 61 additions and 99 deletions

View File

@@ -93,9 +93,6 @@ Component Collapsible(ConstStringRef label,
Ref<bool> show = false);
} // namespace ftxui
// Include component using the old deprecated wstring.
#include "ftxui/component/deprecated.hpp"
#endif /* end of include guard: FTXUI_COMPONENT_HPP */
// Copyright 2021 Arthur Sonzogni. All rights reserved.

View File

@@ -1,18 +0,0 @@
#ifndef FTXUI_COMPONENT_DEPRECATED_HPP
#define FTXUI_COMPONENT_DEPRECATED_HPP
#include "ftxui/component/component.hpp"
namespace ftxui {
[[deprecated("use Input with normal std::string instead.")]] Component Input(
WideStringRef content,
ConstStringRef placeholder,
Ref<InputOption> option = {});
} // namespace ftxui
#endif /* FTXUI_COMPONENT_DEPRECATED_HPP */
// Copyright 2021 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -55,23 +55,6 @@ class StringRef {
std::string* address_ = nullptr;
};
/// @brief An adapter. Own or reference a constant string. For convenience, this
/// class convert multiple mutable string toward a shared representation.
class WideStringRef {
public:
WideStringRef(std::wstring* ref) : address_(ref) {}
WideStringRef(std::wstring ref) : owned_(std::move(ref)) {}
WideStringRef(const wchar_t* ref) : WideStringRef(std::wstring(ref)) {}
WideStringRef(const char* ref)
: WideStringRef(to_wstring(std::string(ref))) {}
std::wstring& operator*() { return address_ ? *address_ : owned_; }
std::wstring* operator->() { return address_ ? address_ : &owned_; }
private:
std::wstring owned_;
std::wstring* address_ = nullptr;
};
/// @brief An adapter. Own or reference a constant string. For convenience, this
/// class convert multiple immutable string toward a shared representation.
class ConstStringRef {