Skip to content

Commit

Permalink
libdeng2|Record: Adding a new variable without specifying a value
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed May 10, 2013
1 parent 8f401ee commit 5353505
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions doomsday/libdeng2/include/de/data/record.h
Expand Up @@ -129,6 +129,15 @@ class DENG2_PUBLIC Record : public ISerializable, public LogEntry::Arg::Base,
*/
Variable *remove(Variable &variable);

/**
* Adds a new variable to the record with a NoneValue.
*
* @param variableName Name of the variable.
*
* @return The new variable.
*/
Variable &add(String const &variableName);

/**
* Adds a number variable to the record. The variable is set up to only accept
* number values.
Expand Down
6 changes: 6 additions & 0 deletions doomsday/libdeng2/src/data/record.cpp
Expand Up @@ -264,6 +264,12 @@ Variable *Record::remove(Variable &variable)
return &variable;
}

Variable &Record::add(String const &name)
{
return d->parentRecordByPath(name)
.add(new Variable(Instance::memberNameFromPath(name)));
}

Variable &Record::addNumber(String const &name, Value::Number const &number)
{
return d->parentRecordByPath(name)
Expand Down

0 comments on commit 5353505

Please sign in to comment.