replace Option::operator {String,int} with Option::as_{string,int}

This commit is contained in:
Maxime Coste 2012-06-12 18:26:20 +00:00
parent c0987ebacc
commit 20315eac85
3 changed files with 4 additions and 4 deletions

View File

@ -40,7 +40,7 @@ void cleanup_whitespaces(Buffer& buffer, Modification& modification)
void expand_tabulations(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 if (modification.type == Modification::Insert and
modification.content == "\t") modification.content == "\t")
{ {

View File

@ -106,7 +106,7 @@ HighlighterAndId colorize_regex_factory(Window& window,
void expand_tabulations(Window& window, DisplayBuffer& display_buffer) 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(); for (auto atom_it = display_buffer.begin();
atom_it != display_buffer.end(); ++atom_it) atom_it != display_buffer.end(); ++atom_it)
{ {

View File

@ -28,8 +28,8 @@ public:
Option& operator=(int value) { m_value = int_to_str(value); return *this; } Option& operator=(int value) { m_value = int_to_str(value); return *this; }
Option& operator=(const String& value) { m_value = value; return *this; } Option& operator=(const String& value) { m_value = value; return *this; }
operator int() const { return atoi(m_value.c_str()); } int as_int() const { return atoi(m_value.c_str()); }
operator String() const { return m_value; } String as_string() const { return m_value; }
private: private:
String m_value; String m_value;
}; };