Skip to content

Commit

Permalink
libcore: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Oct 14, 2015
1 parent 888c1bb commit a3489d8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions doomsday/sdk/libcore/include/de/data/record.h
Expand Up @@ -14,7 +14,7 @@
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details. You should have received a copy of
* the GNU Lesser General Public License along with this program; if not, see:
* http://www.gnu.org/licenses</small>
* http://www.gnu.org/licenses</small>
*/

#ifndef LIBDENG2_RECORD_H
Expand All @@ -41,7 +41,7 @@ class NativeFunctionSpec;

#define DENG2_ADD_NUMBER_CONSTANT(record, constant) \
(record).addNumber(#constant, constant).setReadOnly()

/**
* A set of variables. A record may have any number of subrecords. Note
* that the members of a record do not have an order.
Expand All @@ -68,7 +68,7 @@ class DENG2_PUBLIC Record
DENG2_ERROR(UnnamedError);

/// Name of the special variable that specifies super records.
static String const SUPER_NAME;
static String const VAR_SUPER;

typedef QMap<String, Variable *> Members;
typedef QMap<String, Record *> Subrecords;
Expand Down
26 changes: 13 additions & 13 deletions doomsday/sdk/libcore/src/data/record.cpp
Expand Up @@ -14,7 +14,7 @@
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details. You should have received a copy of
* the GNU Lesser General Public License along with this program; if not, see:
* http://www.gnu.org/licenses</small>
* http://www.gnu.org/licenses</small>
*/

#include "de/Record"
Expand All @@ -41,8 +41,8 @@ namespace de {
/// maximum number of lines that a subrecord can have before it is shown as a short
/// excerpt.
int const SUBRECORD_CONTENT_EXCERPT_THRESHOLD = 100; // lines
String const Record::SUPER_NAME = "__super__";

String const Record::VAR_SUPER = "__super__";

/**
* Each record is given a unique identifier, so that serialized record
Expand Down Expand Up @@ -239,7 +239,7 @@ DENG2_PIMPL(Record)

// After deserialization all record values own their records.
if(value->hasOwnership() && !value->usedToHaveOwnership())
{
{
// Do we happen to know the record from earlier?
duint32 oldTargetId = value->record()->d->oldUniqueId;
if(refMap.contains(oldTargetId))
Expand Down Expand Up @@ -431,7 +431,7 @@ Variable &Record::addFunction(const String &name, Function *func)
.add(new Variable(Instance::memberNameFromPath(name),
new FunctionValue(func), Variable::AllowFunction));
}

Record &Record::add(String const &name, Record *subrecord)
{
std::auto_ptr<Record> sub(subrecord);
Expand Down Expand Up @@ -517,7 +517,7 @@ Variable &Record::operator [] (String const &name)
{
return const_cast<Variable &>((*const_cast<Record const *>(this))[name]);
}

Variable const &Record::operator [] (String const &name) const
{
// Path notation allows looking into subrecords.
Expand Down Expand Up @@ -573,7 +573,7 @@ String Record::asText(String const &prefix, List *lines) const
{
return QString("(Record imported from \"%1\")").arg(gets("__file__"));
}

// Recursive calls to collect all variables in the record.
if(lines)
{
Expand All @@ -582,7 +582,7 @@ String Record::asText(String const &prefix, List *lines) const
{
String separator = (d->isSubrecord(*i.value())? "." : ":");
String subContent = i.value()->value().asText();

// If the content is very long, shorten it.
int numberOfLines = subContent.count(QChar('\n'));
if(numberOfLines > SUBRECORD_CONTENT_EXCERPT_THRESHOLD)
Expand All @@ -604,7 +604,7 @@ String Record::asText(String const &prefix, List *lines) const

// Collect.
asText(prefix, &allLines);

// Sort and find maximum length.
qSort(allLines);
for(List::iterator i = allLines.begin(); i != allLines.end(); ++i)
Expand Down Expand Up @@ -645,11 +645,11 @@ Function const &Record::function(String const &name) const

void Record::addSuperRecord(Value *superValue)
{
if(!has(SUPER_NAME))
if(!has(VAR_SUPER))
{
addArray(SUPER_NAME);
addArray(VAR_SUPER);
}
(*this)[SUPER_NAME].array().add(superValue);
(*this)[VAR_SUPER].array().add(superValue);
}

void Record::operator >> (Writer &to) const
Expand All @@ -660,7 +660,7 @@ void Record::operator >> (Writer &to) const
to << *i.value();
}
}

void Record::operator << (Reader &from)
{
LOG_AS("Record deserialization");
Expand Down
4 changes: 2 additions & 2 deletions doomsday/sdk/libcore/src/scriptsys/nameexpression.cpp
Expand Up @@ -57,11 +57,11 @@ DENG2_PIMPL_NOREF(NameExpression)
foundIn = const_cast<Record *>(&where);
return const_cast<Variable *>(&where[name]);
}
if(lookInClass && where.hasMember(Record::SUPER_NAME))
if(lookInClass && where.hasMember(Record::VAR_SUPER))
{
// The namespace is derived from another record. Let's look into each
// super-record in turn.
ArrayValue const &supers = where.geta(Record::SUPER_NAME);
ArrayValue const &supers = where.geta(Record::VAR_SUPER);
for(int i = 0; i < int(supers.size()); ++i)
{
if(Variable *found = findInRecord(
Expand Down

0 comments on commit a3489d8

Please sign in to comment.