From 1cec8df45e297a8136df6f293d4874ae6c6cb013 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 9 Mar 2015 13:48:41 +0000 Subject: [PATCH] ArrayView content is not const anymore As in upcoming std c++ array_view, ArrayView points to mutable data, use ArrayView or alias ConstArrayView for const data. --- src/array_view.hh | 32 ++++++++++++++++++-------------- src/buffer.hh | 2 +- src/buffer.inl.hh | 2 +- src/command_manager.cc | 10 +++++----- src/command_manager.hh | 6 +++--- src/commands.cc | 8 ++++---- src/commands.hh | 2 +- src/file.cc | 2 +- src/file.hh | 4 ++-- src/highlighter.hh | 2 +- src/highlighters.cc | 4 ++-- src/input_handler.cc | 10 +++++----- src/input_handler.hh | 2 +- src/keymap_manager.cc | 2 +- src/keymap_manager.hh | 5 ++--- src/main.cc | 4 ++-- src/ncurses_ui.cc | 6 +++--- src/ncurses_ui.hh | 4 ++-- src/normal.cc | 2 +- src/option_types.hh | 4 ++-- src/parameters_parser.hh | 2 +- src/register.hh | 4 ++-- src/register_manager.cc | 12 ++++++------ src/remote.cc | 8 ++++---- src/selection.cc | 6 +++--- src/selection.hh | 2 +- src/shell_manager.cc | 4 ++-- src/shell_manager.hh | 6 +++--- src/user_interface.hh | 4 ++-- 29 files changed, 82 insertions(+), 79 deletions(-) diff --git a/src/array_view.hh b/src/array_view.hh index 4e3d7775..0d225fd6 100644 --- a/src/array_view.hh +++ b/src/array_view.hh @@ -3,6 +3,7 @@ #include #include +#include namespace Kakoune { @@ -18,42 +19,42 @@ public: constexpr ArrayView() : m_pointer(nullptr), m_size(0) {} - constexpr ArrayView(const T& oneval) + constexpr ArrayView(T& oneval) : m_pointer(&oneval), m_size(1) {} - constexpr ArrayView(const T* pointer, size_t size) + constexpr ArrayView(T* pointer, size_t size) : m_pointer(pointer), m_size(size) {} - constexpr ArrayView(const T* begin, const T* end) + constexpr ArrayView(T* begin, T* end) : m_pointer(begin), m_size(end - begin) {} template - constexpr ArrayView(const T(&array)[N]) : m_pointer(array), m_size(N) {} + constexpr ArrayView(T(&array)[N]) : m_pointer(array), m_size(N) {} template constexpr ArrayView(const Iterator& begin, const Iterator& end) : m_pointer(&(*begin)), m_size(end - begin) {} - template - constexpr ArrayView(const std::vector& v) + template + constexpr ArrayView(const std::vector& v) : m_pointer(&v[0]), m_size(v.size()) {} constexpr ArrayView(const std::initializer_list& v) : m_pointer(v.begin()), m_size(v.size()) {} - constexpr const T* pointer() const { return m_pointer; } + constexpr T* pointer() const { return m_pointer; } constexpr size_t size() const { return m_size; } - constexpr const T& operator[](size_t n) const { return *(m_pointer + n); } + constexpr T& operator[](size_t n) const { return *(m_pointer + n); } - constexpr const T* begin() const { return m_pointer; } - constexpr const T* end() const { return m_pointer+m_size; } + constexpr T* begin() const { return m_pointer; } + constexpr T* end() const { return m_pointer+m_size; } - using reverse_iterator = std::reverse_iterator; + using reverse_iterator = std::reverse_iterator; constexpr reverse_iterator rbegin() const { return reverse_iterator(m_pointer+m_size); } constexpr reverse_iterator rend() const { return reverse_iterator(m_pointer); } - constexpr const T& front() const { return *m_pointer; } - constexpr const T& back() const { return *(m_pointer + m_size - 1); } + constexpr T& front() const { return *m_pointer; } + constexpr T& back() const { return *(m_pointer + m_size - 1); } constexpr bool empty() const { return m_size == 0; } @@ -63,10 +64,13 @@ public: } private: - const T* m_pointer; + T* m_pointer; size_t m_size; }; +template +using ConstArrayView = ArrayView; + } #endif // array_view_hh_INCLUDED diff --git a/src/buffer.hh b/src/buffer.hh index d6906c87..7402f769 100644 --- a/src/buffer.hh +++ b/src/buffer.hh @@ -164,7 +164,7 @@ public: ByteCoord begin; ByteCoord end; }; - ArrayView changes_since(size_t timestamp) const; + ConstArrayView changes_since(size_t timestamp) const; String debug_description() const; private: diff --git a/src/buffer.inl.hh b/src/buffer.inl.hh index 5db83659..0b013dcd 100644 --- a/src/buffer.inl.hh +++ b/src/buffer.inl.hh @@ -92,7 +92,7 @@ inline size_t Buffer::timestamp() const return m_changes.size(); } -inline ArrayView Buffer::changes_since(size_t timestamp) const +inline ConstArrayView Buffer::changes_since(size_t timestamp) const { return { m_changes.data() + timestamp, m_changes.data() + m_changes.size() }; diff --git a/src/command_manager.cc b/src/command_manager.cc index 918db6f8..67e33c1e 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -270,11 +270,11 @@ TokenList parse(StringView line) } String eval_token(const Token& token, Context& context, - ArrayView shell_params, + ConstArrayView shell_params, const EnvVarMap& env_vars); String eval(StringView str, Context& context, - ArrayView shell_params, + ConstArrayView shell_params, const EnvVarMap& env_vars) { String res; @@ -303,7 +303,7 @@ String eval(StringView str, Context& context, } String eval_token(const Token& token, Context& context, - ArrayView shell_params, + ConstArrayView shell_params, const EnvVarMap& env_vars) { auto& content = token.content(); @@ -356,7 +356,7 @@ void CommandManager::execute_single_command(CommandParameters params, if (params.empty()) return; - ArrayView param_view(params.begin()+1, params.end()); + ConstArrayView param_view(params.begin()+1, params.end()); auto command_it = find_command(context, params[0]); if (command_it == m_commands.end()) throw command_not_found(params[0]); @@ -396,7 +396,7 @@ static CharCoord find_coord(StringView str, ByteCount offset) void CommandManager::execute(StringView command_line, Context& context, - ArrayView shell_params, + ConstArrayView shell_params, const EnvVarMap& env_vars) { TokenList tokens = parse(command_line); diff --git a/src/command_manager.hh b/src/command_manager.hh index 3226449e..46afac26 100644 --- a/src/command_manager.hh +++ b/src/command_manager.hh @@ -18,7 +18,7 @@ namespace Kakoune { class Context; -using CommandParameters = ArrayView; +using CommandParameters = ConstArrayView; using Command = std::function; using CommandCompleter = std::function; - using ArgumentCompleterList = ArrayView; + using ArgumentCompleterList = ConstArrayView; PerArgumentCommandCompleter(ArgumentCompleterList completers) : m_completers(completers.begin(), completers.end()) {} @@ -61,7 +61,7 @@ class CommandManager : public Singleton { public: void execute(StringView command_line, Context& context, - ArrayView shell_params = {}, + ConstArrayView shell_params = {}, const EnvVarMap& env_vars = EnvVarMap{}); Completions complete(const Context& context, CompletionFlags flags, diff --git a/src/commands.cc b/src/commands.cc index 8a62e17b..7768d0dd 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -1267,7 +1267,7 @@ const CommandDesc prompt_cmd = { { if (event != PromptEvent::Validate) return; - RegisterManager::instance()[reg] = ArrayView(str); + RegisterManager::instance()[reg] = ConstArrayView(str); CommandManager::instance().execute(command, context); }); @@ -1449,7 +1449,7 @@ const CommandDesc set_register_cmd = { CommandCompleter{}, [](const ParametersParser& parser, Context& context) { - RegisterManager::instance()[parser[0]] = ArrayView(parser[1]); + RegisterManager::instance()[parser[0]] = ConstArrayView(parser[1]); } }; @@ -1474,7 +1474,7 @@ public: RegisterRestorer(char name, const Context& context) : m_name(name) { - ArrayView save = RegisterManager::instance()[name].values(context); + ConstArrayView save = RegisterManager::instance()[name].values(context); m_save = Vector(save.begin(), save.end()); } @@ -1488,7 +1488,7 @@ private: } -void exec_keys(ArrayView keys, Context& context) +void exec_keys(ConstArrayView keys, Context& context) { RegisterRestorer quote('"', context); RegisterRestorer slash('/', context); diff --git a/src/commands.hh b/src/commands.hh index 0923dc40..9e7479d7 100644 --- a/src/commands.hh +++ b/src/commands.hh @@ -10,7 +10,7 @@ namespace Kakoune class Context; void register_commands(); -void exec_keys(ArrayView keys, Context& context); +void exec_keys(ConstArrayView keys, Context& context); } diff --git a/src/file.cc b/src/file.cc index a5a55016..a12b40ce 100644 --- a/src/file.cc +++ b/src/file.cc @@ -255,7 +255,7 @@ void write_buffer_to_backup_file(Buffer& buffer) } } -String find_file(StringView filename, ArrayView paths) +String find_file(StringView filename, ConstArrayView paths) { struct stat buf; if (filename.length() > 1 and filename[0] == '/') diff --git a/src/file.hh b/src/file.hh index f9817e2d..8fc4eac0 100644 --- a/src/file.hh +++ b/src/file.hh @@ -1,6 +1,7 @@ #ifndef file_hh_INCLUDED #define file_hh_INCLUDED +#include "array_view.hh" #include "completion.hh" #include "exception.hh" #include "regex.hh" @@ -23,7 +24,6 @@ struct file_not_found : file_access_error }; class Buffer; -template class ArrayView; class String; class StringView; @@ -43,7 +43,7 @@ void write_buffer_to_file(Buffer& buffer, StringView filename); void write_buffer_to_fd(Buffer& buffer, int fd); void write_buffer_to_backup_file(Buffer& buffer); -String find_file(StringView filename, ArrayView paths); +String find_file(StringView filename, ConstArrayView paths); time_t get_fs_timestamp(StringView filename); diff --git a/src/highlighter.hh b/src/highlighter.hh index 9a5463af..1bbd704f 100644 --- a/src/highlighter.hh +++ b/src/highlighter.hh @@ -64,7 +64,7 @@ std::unique_ptr> make_simple_highlighter(T func) return make_unique>(std::move(func)); } -using HighlighterParameters = ArrayView; +using HighlighterParameters = ConstArrayView; using HighlighterFactory = std::function; struct HighlighterFactoryAndDocstring diff --git a/src/highlighters.cc b/src/highlighters.cc index 2bf031cd..3cd00a75 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -822,7 +822,7 @@ void find_matches(const Buffer& buffer, RegexMatchList& matches, const Regex& re } } -void update_matches(const Buffer& buffer, ArrayView modifs, +void update_matches(const Buffer& buffer, ConstArrayView modifs, RegexMatchList& matches, const Regex& regex) { // remove out of date matches and update line for others @@ -939,7 +939,7 @@ struct RegionDesc } void update_matches(const Buffer& buffer, - ArrayView modifs, + ConstArrayView modifs, RegionMatches& matches) const { Kakoune::update_matches(buffer, modifs, matches.begin_matches, m_begin); diff --git a/src/input_handler.cc b/src/input_handler.cc index 2f67953b..23717f88 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -342,7 +342,7 @@ private: class Menu : public InputMode { public: - Menu(InputHandler& input_handler, ArrayView choices, + Menu(InputHandler& input_handler, ConstArrayView choices, MenuCallback callback) : InputMode(input_handler), m_callback(callback), m_choices(choices.begin(), choices.end()), @@ -460,7 +460,7 @@ private: LineEditor m_filter_editor; }; -String common_prefix(ArrayView strings) +String common_prefix(ConstArrayView strings) { String res; if (strings.empty()) @@ -928,7 +928,7 @@ private: selections.sort_and_merge_overlapping(); } - void insert(ArrayView strings) + void insert(ConstArrayView strings) { context().selections().insert(strings, InsertMode::InsertCursor); } @@ -1096,7 +1096,7 @@ void InputHandler::set_prompt_face(Face prompt_face) prompt->set_prompt_face(prompt_face); } -void InputHandler::menu(ArrayView choices, +void InputHandler::menu(ConstArrayView choices, MenuCallback callback) { change_input_mode(new InputModes::Menu(*this, choices, callback)); @@ -1153,7 +1153,7 @@ bool InputHandler::is_recording() const void InputHandler::stop_recording() { kak_assert(m_recording_reg != 0); - RegisterManager::instance()[m_recording_reg] = ArrayView(m_recorded_keys); + RegisterManager::instance()[m_recording_reg] = ConstArrayView(m_recorded_keys); m_recording_reg = 0; } diff --git a/src/input_handler.hh b/src/input_handler.hh index d7d831a3..daac0c18 100644 --- a/src/input_handler.hh +++ b/src/input_handler.hh @@ -61,7 +61,7 @@ public: // abort or validation with corresponding MenuEvent value // returns to normal mode after validation if callback does // not change the mode itself - void menu(ArrayView choices, MenuCallback callback); + void menu(ArrayView choices, MenuCallback callback); // execute callback on next keypress and returns to normal mode // if callback does not change the mode itself diff --git a/src/keymap_manager.cc b/src/keymap_manager.cc index 4598c889..42308538 100644 --- a/src/keymap_manager.cc +++ b/src/keymap_manager.cc @@ -23,7 +23,7 @@ bool KeymapManager::is_mapped(Key key, KeymapMode mode) const (m_parent and m_parent->is_mapped(key, mode)); } -ArrayView KeymapManager::get_mapping(Key key, KeymapMode mode) const +ConstArrayView KeymapManager::get_mapping(Key key, KeymapMode mode) const { auto it = m_mapping.find({key, mode}); if (it != m_mapping.end()) diff --git a/src/keymap_manager.hh b/src/keymap_manager.hh index dd05c176..855290d5 100644 --- a/src/keymap_manager.hh +++ b/src/keymap_manager.hh @@ -1,6 +1,7 @@ #ifndef keymap_manager_hh_INCLUDED #define keymap_manager_hh_INCLUDED +#include "array_view.hh" #include "keys.hh" #include "hash.hh" #include "unordered_map.hh" @@ -21,8 +22,6 @@ enum class KeymapMode : int User, }; -template class ArrayView; - class KeymapManager { public: @@ -33,7 +32,7 @@ public: void unmap_key(Key key, KeymapMode mode); bool is_mapped(Key key, KeymapMode mode) const; - ArrayView get_mapping(Key key, KeymapMode mode) const; + ConstArrayView get_mapping(Key key, KeymapMode mode) const; private: KeymapManager() : m_parent(nullptr) {} diff --git a/src/main.cc b/src/main.cc index aa195d0c..af77ba44 100644 --- a/src/main.cc +++ b/src/main.cc @@ -314,7 +314,7 @@ int run_client(StringView session, StringView init_command) } int run_server(StringView session, StringView init_command, - bool ignore_kakrc, bool daemon, ArrayView files) + bool ignore_kakrc, bool daemon, ConstArrayView files) { static bool terminate = false; if (daemon) @@ -416,7 +416,7 @@ int run_server(StringView session, StringView init_command, return 0; } -int run_filter(StringView keystr, ArrayView files, bool quiet) +int run_filter(StringView keystr, ConstArrayView files, bool quiet) { StringRegistry string_registry; GlobalScope global_scope; diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index e5b58a4a..9e401985 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -564,7 +564,7 @@ void NCursesUI::draw_menu() m_dirty = true; } -void NCursesUI::menu_show(ArrayView items, +void NCursesUI::menu_show(ConstArrayView items, CharCoord anchor, Face fg, Face bg, MenuStyle style) { @@ -714,7 +714,7 @@ static CharCoord compute_pos(CharCoord anchor, CharCoord size, } String make_info_box(StringView title, StringView message, CharCount max_width, - ArrayView assistant) + ConstArrayView assistant) { CharCoord assistant_size; if (not assistant.empty()) @@ -851,7 +851,7 @@ void NCursesUI::set_ui_options(const Options& options) else if (it->second == "clippy") m_assistant = assistant_clippy; else if (it->second == "none" or it->second == "off") - m_assistant = ArrayView{}; + m_assistant = ConstArrayView{}; } } diff --git a/src/ncurses_ui.hh b/src/ncurses_ui.hh index 31941aef..411cab58 100644 --- a/src/ncurses_ui.hh +++ b/src/ncurses_ui.hh @@ -28,7 +28,7 @@ public: bool is_key_available() override; Key get_key() override; - void menu_show(ArrayView items, + void menu_show(ConstArrayView items, CharCoord anchor, Face fg, Face bg, MenuStyle style) override; void menu_select(int selected) override; @@ -73,7 +73,7 @@ private: InputCallback m_input_callback; bool m_status_on_top = false; - ArrayView m_assistant; + ConstArrayView m_assistant; bool m_dirty = false; }; diff --git a/src/normal.cc b/src/normal.cc index a1d0f55d..7a6cc6dd 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -1079,7 +1079,7 @@ void replay_macro(Context& context, NormalParams params) if (running_macros[idx]) throw runtime_error("recursive macros call detected"); - ArrayView reg_val = RegisterManager::instance()[name].values(context); + ConstArrayView reg_val = RegisterManager::instance()[name].values(context); if (not reg_val.empty()) { running_macros[idx] = true; diff --git a/src/option_types.hh b/src/option_types.hh index 5e7d8397..ef611ae4 100644 --- a/src/option_types.hh +++ b/src/option_types.hh @@ -109,7 +109,7 @@ struct TupleOptionDetail tuple_separator + escape(option_to_string(std::get(opt)), tuple_separator, '\\'); } - static void from_string(ArrayView elems, std::tuple& opt) + static void from_string(ConstArrayView elems, std::tuple& opt) { option_from_string(elems[I], std::get(opt)); TupleOptionDetail::from_string(elems, opt); @@ -124,7 +124,7 @@ struct TupleOptionDetail<0, Types...> return option_to_string(std::get<0>(opt)); } - static void from_string(ArrayView elems, std::tuple& opt) + static void from_string(ConstArrayView elems, std::tuple& opt) { option_from_string(elems[0], std::get<0>(opt)); } diff --git a/src/parameters_parser.hh b/src/parameters_parser.hh index fc8867d0..224754d6 100644 --- a/src/parameters_parser.hh +++ b/src/parameters_parser.hh @@ -10,7 +10,7 @@ namespace Kakoune { -using ParameterList = ArrayView; +using ParameterList = ConstArrayView; struct parameter_error : public runtime_error { diff --git a/src/register.hh b/src/register.hh index de9dedf6..40cd068d 100644 --- a/src/register.hh +++ b/src/register.hh @@ -13,9 +13,9 @@ class Register { public: virtual ~Register() {} - virtual Register& operator=(ArrayView values) = 0; + virtual Register& operator=(ConstArrayView values) = 0; - virtual ArrayView values(const Context& context) = 0; + virtual ConstArrayView values(const Context& context) = 0; }; } diff --git a/src/register_manager.cc b/src/register_manager.cc index af87dbb5..7a071ae3 100644 --- a/src/register_manager.cc +++ b/src/register_manager.cc @@ -12,18 +12,18 @@ namespace Kakoune class StaticRegister : public Register { public: - Register& operator=(ArrayView values) override + Register& operator=(ConstArrayView values) override { m_content = Vector(values.begin(), values.end()); return *this; } - ArrayView values(const Context&) override + ConstArrayView values(const Context&) override { if (m_content.empty()) - return ArrayView(ms_empty); + return ConstArrayView(ms_empty); else - return ArrayView(m_content); + return ConstArrayView(m_content); } protected: Vector m_content; @@ -41,12 +41,12 @@ public: DynamicRegister(RegisterRetriever function) : m_function(std::move(function)) {} - Register& operator=(ArrayView values) override + Register& operator=(ConstArrayView values) override { throw runtime_error("this register is not assignable"); } - ArrayView values(const Context& context) override + ConstArrayView values(const Context& context) override { m_content = m_function(context); return StaticRegister::values(context); diff --git a/src/remote.cc b/src/remote.cc index e2aa10cc..27394347 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -68,7 +68,7 @@ public: } template - void write(ArrayView view) + void write(ConstArrayView view) { write(view.size()); for (auto& val : view) @@ -78,7 +78,7 @@ public: template void write(const Vector& vec) { - write(ArrayView(vec)); + write(ConstArrayView(vec)); } template @@ -249,7 +249,7 @@ public: RemoteUI(int socket); ~RemoteUI(); - void menu_show(ArrayView choices, + void menu_show(ConstArrayView choices, CharCoord anchor, Face fg, Face bg, MenuStyle style) override; void menu_select(int selected) override; @@ -298,7 +298,7 @@ RemoteUI::~RemoteUI() m_socket_watcher.close_fd(); } -void RemoteUI::menu_show(ArrayView choices, +void RemoteUI::menu_show(ConstArrayView choices, CharCoord anchor, Face fg, Face bg, MenuStyle style) { diff --git a/src/selection.cc b/src/selection.cc index 936e8144..98c7288e 100644 --- a/src/selection.cc +++ b/src/selection.cc @@ -196,7 +196,7 @@ const Buffer::Change* backward_sorted_until(const Buffer::Change* first, const B return last; } -void update_forward(ArrayView changes, Vector& selections, size_t& main) +void update_forward(ConstArrayView changes, Vector& selections, size_t& main) { ForwardChangesTracker changes_tracker; @@ -221,7 +221,7 @@ void update_forward(ArrayView changes, Vector& select kak_assert(std::is_sorted(selections.begin(), selections.end(), compare_selections)); } -void update_backward(ArrayView changes, Vector& selections, size_t& main) +void update_backward(ConstArrayView changes, Vector& selections, size_t& main) { ForwardChangesTracker changes_tracker; @@ -463,7 +463,7 @@ BufferIterator prepare_insert(Buffer& buffer, const Selection& sel, InsertMode m return {}; } -void SelectionList::insert(ArrayView strings, InsertMode mode, +void SelectionList::insert(ConstArrayView strings, InsertMode mode, bool select_inserted) { if (strings.empty()) diff --git a/src/selection.hh b/src/selection.hh index 1a5834a9..1bd27510 100644 --- a/src/selection.hh +++ b/src/selection.hh @@ -128,7 +128,7 @@ struct SelectionList size_t timestamp() const { return m_timestamp; } void update_timestamp() { m_timestamp = m_buffer->timestamp(); } - void insert(ArrayView strings, InsertMode mode, + void insert(ConstArrayView strings, InsertMode mode, bool select_inserted = false); void erase(); diff --git a/src/shell_manager.cc b/src/shell_manager.cc index 697dfa0e..d10c4ad5 100644 --- a/src/shell_manager.cc +++ b/src/shell_manager.cc @@ -29,7 +29,7 @@ ShellManager::ShellManager() } String ShellManager::eval(StringView cmdline, const Context& context, - ArrayView params, + ConstArrayView params, const EnvVarMap& env_vars, int* exit_status) { @@ -38,7 +38,7 @@ String ShellManager::eval(StringView cmdline, const Context& context, String ShellManager::pipe(StringView input, StringView cmdline, const Context& context, - ArrayView params, + ConstArrayView params, const EnvVarMap& env_vars, int* exit_status) { diff --git a/src/shell_manager.hh b/src/shell_manager.hh index 6206b90c..60b9b13f 100644 --- a/src/shell_manager.hh +++ b/src/shell_manager.hh @@ -1,6 +1,7 @@ #ifndef shell_manager_hh_INCLUDED #define shell_manager_hh_INCLUDED +#include "array_view.hh" #include "regex.hh" #include "utils.hh" #include "env_vars.hh" @@ -9,7 +10,6 @@ namespace Kakoune { class Context; -template class ArrayView; class String; class StringView; @@ -21,13 +21,13 @@ public: ShellManager(); String eval(StringView cmdline, const Context& context, - ArrayView params, + ConstArrayView params, const EnvVarMap& env_vars, int* exit_status = nullptr); String pipe(StringView input, StringView cmdline, const Context& context, - ArrayView params, + ConstArrayView params, const EnvVarMap& env_vars, int* exit_status = nullptr); diff --git a/src/user_interface.hh b/src/user_interface.hh index 6734bf14..92aae13e 100644 --- a/src/user_interface.hh +++ b/src/user_interface.hh @@ -1,6 +1,7 @@ #ifndef user_interface_hh_INCLUDED #define user_interface_hh_INCLUDED +#include "array_view.hh" #include "safe_ptr.hh" #include "unordered_map.hh" @@ -15,7 +16,6 @@ class DisplayLine; struct CharCoord; struct Face; struct Key; -template class ArrayView; enum class MenuStyle { @@ -41,7 +41,7 @@ class UserInterface : public SafeCountable public: virtual ~UserInterface() {} - virtual void menu_show(ArrayView choices, + virtual void menu_show(ConstArrayView choices, CharCoord anchor, Face fg, Face bg, MenuStyle style) = 0; virtual void menu_select(int selected) = 0;