Skip to content

Commit

Permalink
Implement operator+ for Value and String.
Browse files Browse the repository at this point in the history
Refs #2710
  • Loading branch information
gunnarbeutner committed Nov 7, 2013
1 parent 1fc3f45 commit 56471d8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/base/value.cpp
Expand Up @@ -251,6 +251,16 @@ Value icinga::operator+(const char *lhs, const Value& rhs)
return lhs + static_cast<String>(rhs);
}

Value icinga::operator+(const Value& lhs, const String& rhs)
{
return static_cast<String>(lhs) + rhs;
}

Value icinga::operator+(const String& lhs, const Value& rhs)
{
return lhs + static_cast<String>(rhs);
}

std::ostream& icinga::operator<<(std::ostream& stream, const Value& value)
{
stream << static_cast<String>(value);
Expand Down
3 changes: 3 additions & 0 deletions lib/base/value.h
Expand Up @@ -117,6 +117,9 @@ static Value Empty;
I2_BASE_API Value operator+(const Value& lhs, const char *rhs);
I2_BASE_API Value operator+(const char *lhs, const Value& rhs);

I2_BASE_API Value operator+(const Value& lhs, const String& rhs);
I2_BASE_API Value operator+(const String& lhs, const Value& rhs);

I2_BASE_API std::ostream& operator<<(std::ostream& stream, const Value& value);
I2_BASE_API std::istream& operator>>(std::istream& stream, Value& value);

Expand Down

0 comments on commit 56471d8

Please sign in to comment.