From 20315eac859168238ad5228a910df499a0510164 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 12 Jun 2012 18:26:20 +0000 Subject: [PATCH] replace Option::operator {String,int} with Option::as_{string,int} --- src/filters.cc | 2 +- src/highlighters.cc | 2 +- src/option_manager.hh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/filters.cc b/src/filters.cc index 7b1d95e6..453f95e3 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -40,7 +40,7 @@ void cleanup_whitespaces(Buffer& buffer, Modification& modification) void expand_tabulations(Buffer& buffer, Modification& modification) { - const int tabstop = buffer.option_manager()["tabstop"]; + const int tabstop = buffer.option_manager()["tabstop"].as_int(); if (modification.type == Modification::Insert and modification.content == "\t") { diff --git a/src/highlighters.cc b/src/highlighters.cc index 45cc95e5..72c633bd 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -106,7 +106,7 @@ HighlighterAndId colorize_regex_factory(Window& window, void expand_tabulations(Window& window, DisplayBuffer& display_buffer) { - const int tabstop = window.option_manager()["tabstop"]; + const int tabstop = window.option_manager()["tabstop"].as_int(); for (auto atom_it = display_buffer.begin(); atom_it != display_buffer.end(); ++atom_it) { diff --git a/src/option_manager.hh b/src/option_manager.hh index 4309abed..91f35c08 100644 --- a/src/option_manager.hh +++ b/src/option_manager.hh @@ -28,8 +28,8 @@ public: Option& operator=(int value) { m_value = int_to_str(value); return *this; } Option& operator=(const String& value) { m_value = value; return *this; } - operator int() const { return atoi(m_value.c_str()); } - operator String() const { return m_value; } + int as_int() const { return atoi(m_value.c_str()); } + String as_string() const { return m_value; } private: String m_value; };