Skip to content

Commit

Permalink
libdeng2|Record: Added an explicit setter for char const*
Browse files Browse the repository at this point in the history
Evidently some compilers (MSVC at least) interpret a zero-length,
c-style string as bool, consequently resulting in a NumberValue
rather than a TextValue being written to the Record.
  • Loading branch information
danij-deng authored and skyjake committed Mar 13, 2014
1 parent 077d026 commit f2e2e15
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doomsday/libdeng2/include/de/data/record.h
Expand Up @@ -298,6 +298,9 @@ class DENG2_PUBLIC Record : public ISerializable, public LogEntry::Arg::Base,
*/
Variable &set(String const &name, bool value);

/// @copydoc set()
Variable &set(String const &name, char const *value);

/// @copydoc set()
Variable &set(String const &name, Value::Text const &value);

Expand Down
9 changes: 9 additions & 0 deletions doomsday/libdeng2/src/data/record.cpp
Expand Up @@ -435,6 +435,15 @@ Variable &Record::set(String const &name, bool value)
return addBoolean(name, value);
}

Variable &Record::set(String const &name, char const *value)
{
if(hasMember(name))
{
return (*this)[name].set(TextValue(value));
}
return addText(name, value);
}

Variable &Record::set(String const &name, Value::Text const &value)
{
if(hasMember(name))
Expand Down

0 comments on commit f2e2e15

Please sign in to comment.