Skip to content

Commit

Permalink
libdeng2: Continued code style update (usage of const)
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Nov 25, 2012
1 parent 4ae3a47 commit 2d9d72a
Show file tree
Hide file tree
Showing 29 changed files with 126 additions and 126 deletions.
2 changes: 1 addition & 1 deletion doomsday/libdeng2/include/de/core/commandline.h
Expand Up @@ -144,7 +144,7 @@ namespace de
*/
static bool isOption(String const &arg);

const String at(duint pos) const;
String at(duint pos) const;

/**
* Returns a list of pointers to the arguments. The list contains
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdeng2/include/de/data/accessorvalue.h
Expand Up @@ -34,7 +34,7 @@ namespace de
{
public:
/// Mode to use for variables that have an accessor value.
static const Variable::Flags VARIABLE_MODE;
static Variable::Flags const VARIABLE_MODE;

public:
AccessorValue();
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdeng2/include/de/data/string.h
Expand Up @@ -71,7 +71,7 @@ class DENG2_PUBLIC String : public QString
typedef dint size_type;

public:
static const size_type npos;
static size_type const npos;

public:
String();
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdeng2/include/de/filesys/directoryfeed.h
Expand Up @@ -117,7 +117,7 @@ namespace de
void populateFile(Folder &folder, String const &entryName);

private:
const NativePath _nativePath;
NativePath const _nativePath;
Flags _mode;
};

Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdeng2/include/de/filesys/file.h
Expand Up @@ -261,7 +261,7 @@ namespace de
* @return Path of the object. This is not a native path, but instead
* intended for de::FS.
*/
const String path() const;
String const path() const;

/**
* Returns the mode of the file.
Expand Down
4 changes: 2 additions & 2 deletions doomsday/libdeng2/include/de/math.h
Expand Up @@ -32,8 +32,8 @@

namespace de
{
const ddouble PI = 3.14159265358979323846;
const ddouble EPSILON = 1.0e-7;
ddouble const PI = 3.14159265358979323846;
ddouble const EPSILON = 1.0e-7;

/// Absolute value.
template <typename Type>
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdeng2/include/de/net/packet.h
Expand Up @@ -41,7 +41,7 @@ class DENG2_PUBLIC Packet : public ISerializable
DENG2_SUB_ERROR(DeserializationError, InvalidTypeError);

/// Length of a type identifier.
static const dint TYPE_SIZE = 4;
static dint const TYPE_SIZE = 4;

typedef String Type;

Expand Down
12 changes: 6 additions & 6 deletions doomsday/libdeng2/include/de/scriptsys/lex.h
Expand Up @@ -68,12 +68,12 @@ namespace de
};

// Constants.
static const String T_PARENTHESIS_OPEN;
static const String T_PARENTHESIS_CLOSE;
static const String T_BRACKET_OPEN;
static const String T_BRACKET_CLOSE;
static const String T_CURLY_OPEN;
static const String T_CURLY_CLOSE;
static String const T_PARENTHESIS_OPEN;
static String const T_PARENTHESIS_CLOSE;
static String const T_BRACKET_OPEN;
static String const T_BRACKET_CLOSE;
static String const T_CURLY_OPEN;
static String const T_CURLY_CLOSE;

public:
Lex(String const &input = "");
Expand Down
60 changes: 30 additions & 30 deletions doomsday/libdeng2/include/de/scriptsys/scriptlex.h
Expand Up @@ -48,38 +48,38 @@ namespace de
DENG2_SUB_ERROR(SyntaxError, MismatchedBracketError);

// Keywords.
static const String AND;
static const String OR;
static const String NOT;
static const String ELSIF;
static const String ELSE;
static const String THROW;
static const String CATCH;
static const String IN;
static const String END;
static const String IF;
static const String WHILE;
static const String FOR;
static const String DEF;
static const String TRY;
static const String IMPORT;
static const String RECORD;
static const String DEL;
static const String PASS;
static const String CONTINUE;
static const String BREAK;
static const String RETURN;
static const String PRINT;
static const String CONST;
static const String T_TRUE;
static const String T_FALSE;
static const String NONE;
static const String PI;
static String const AND;
static String const OR;
static String const NOT;
static String const ELSIF;
static String const ELSE;
static String const THROW;
static String const CATCH;
static String const IN;
static String const END;
static String const IF;
static String const WHILE;
static String const FOR;
static String const DEF;
static String const TRY;
static String const IMPORT;
static String const RECORD;
static String const DEL;
static String const PASS;
static String const CONTINUE;
static String const BREAK;
static String const RETURN;
static String const PRINT;
static String const CONST;
static String const T_TRUE;
static String const T_FALSE;
static String const NONE;
static String const PI;

// Operators.
static const String ASSIGN;
static const String SCOPE_ASSIGN;
static const String WEAK_ASSIGN;
static String const ASSIGN;
static String const SCOPE_ASSIGN;
static String const WEAK_ASSIGN;

public:
ScriptLex(String const &input = "");
Expand Down
18 changes: 9 additions & 9 deletions doomsday/libdeng2/include/de/scriptsys/tokenbuffer.h
Expand Up @@ -48,15 +48,15 @@ namespace de
};

// Token constants.
static const String PARENTHESIS_OPEN;
static const String PARENTHESIS_CLOSE;
static const String BRACKET_OPEN;
static const String BRACKET_CLOSE;
static const String CURLY_OPEN;
static const String CURLY_CLOSE;
static const String COLON;
static const String COMMA;
static const String SEMICOLON;
static String const PARENTHESIS_OPEN;
static String const PARENTHESIS_CLOSE;
static String const BRACKET_OPEN;
static String const BRACKET_CLOSE;
static String const CURLY_OPEN;
static String const CURLY_CLOSE;
static String const COLON;
static String const COMMA;
static String const SEMICOLON;

public:
Token(QChar *begin = 0, QChar *end = 0, duint line = 0)
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdeng2/include/de/scriptsys/tokenrange.h
Expand Up @@ -204,7 +204,7 @@ namespace de

public:
static void bracketTokens(Token const &openingToken,
const QChar*& opening, const QChar*& closing);
QChar const * &opening, QChar const * &closing);

private:
TokenBuffer const *_tokens;
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdeng2/src/core/commandline.cpp
Expand Up @@ -257,7 +257,7 @@ bool CommandLine::isOption(String const &arg)
return !(arg.empty() || arg[0] != '-');
}

const String CommandLine::at(duint pos) const
String CommandLine::at(duint pos) const
{
return d->arguments.at(pos);
}
Expand Down
4 changes: 2 additions & 2 deletions doomsday/libdeng2/src/core/log.cpp
Expand Up @@ -34,9 +34,9 @@ char const *MAIN_SECTION = "";
#ifdef DENG2_DEBUG
/// If the section is longer than this, it will be alone on one line while
/// the rest of the entry continues after a break.
static const int LINE_BREAKING_SECTION_LENGTH = 35;
static int const LINE_BREAKING_SECTION_LENGTH = 35;
#else
static const int LINE_BREAKING_SECTION_LENGTH = 60;
static int const LINE_BREAKING_SECTION_LENGTH = 60;
#endif

namespace internal {
Expand Down
12 changes: 6 additions & 6 deletions doomsday/libdeng2/src/core/logbuffer.cpp
Expand Up @@ -32,7 +32,7 @@

namespace de {

const Time::Delta FLUSH_INTERVAL = .2; // seconds
Time::Delta const FLUSH_INTERVAL = .2; // seconds

namespace internal {

Expand Down Expand Up @@ -267,9 +267,9 @@ void LogBuffer::flush()
{
#ifdef _DEBUG
// Debug builds include a timestamp and msg type indicator.
const duint MAX_LENGTH = 110;
duint const MAX_LENGTH = 110;
#else
const duint MAX_LENGTH = 89;
duint const MAX_LENGTH = 89;
#endif

DENG2_FOR_EACH(Instance::EntryList, i, d->toBeFlushed)
Expand All @@ -295,15 +295,15 @@ void LogBuffer::flush()
while(pos != String::npos)
{
#ifdef _DEBUG
const int minimumIndent = 25;
int const minimumIndent = 25;
#else
const int minimumIndent = 0;
int const minimumIndent = 0;
#endif

// Find the length of the current line.
String::size_type next = message.indexOf('\n', pos);
duint lineLen = (next == String::npos? message.size() - pos : next - pos);
const duint maxLen = (pos > 0? MAX_LENGTH - wrapIndent : MAX_LENGTH);
duint const maxLen = (pos > 0? MAX_LENGTH - wrapIndent : MAX_LENGTH);
if(lineLen > maxLen)
{
// Wrap overly long lines.
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdeng2/src/data/accessorvalue.cpp
Expand Up @@ -21,7 +21,7 @@

using namespace de;

const Variable::Flags AccessorValue::VARIABLE_MODE = Variable::AllowText |
Variable::Flags const AccessorValue::VARIABLE_MODE = Variable::AllowText |
Variable::ReadOnly | Variable::NoSerialize;

AccessorValue::AccessorValue()
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdeng2/src/data/path.cpp
Expand Up @@ -27,7 +27,7 @@
namespace de {

/// Size of the fixed-size portion of the segment buffer.
static const int SEGMENT_BUFFER_SIZE = 24;
static int const SEGMENT_BUFFER_SIZE = 24;

static String emptyPath;

Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdeng2/src/data/reader.cpp
Expand Up @@ -265,7 +265,7 @@ Reader &Reader::operator >> (FixedByteArray &fixedByteArray)
* because the destination byte array is not guaranteed to be
* a memory buffer where you can copy the contents directly.
*/
const dsize size = fixedByteArray.size();
dsize const size = fixedByteArray.size();
QScopedPointer<IByteArray::Byte> data(new IByteArray::Byte[size]);
d->readBytes(data.data(), size);
fixedByteArray.set(0, data.data(), size);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdeng2/src/data/string.cpp
Expand Up @@ -26,7 +26,7 @@

using namespace de;

const String::size_type String::npos = -1;
String::size_type const String::npos = -1;

String::String()
{}
Expand Down
4 changes: 2 additions & 2 deletions doomsday/libdeng2/src/data/writer.cpp
Expand Up @@ -36,7 +36,7 @@ struct Writer::Instance
IByteArray *destination;
IOStream *stream;
IByteArray::Offset offset;
const IByteArray::Offset fixedOffset;
IByteArray::Offset const fixedOffset;

Instance(ByteOrder const &order, IByteArray *dest, IByteArray::Offset off)
: convert(order), destination(dest), stream(0), offset(off), fixedOffset(0) {}
Expand Down Expand Up @@ -195,7 +195,7 @@ Writer &Writer::operator << (FixedByteArray const &fixedByteArray)
*/

// Read the entire contents of the array.
const dsize size = fixedByteArray.size();
dsize const size = fixedByteArray.size();
QScopedPointer<IByteArray::Byte> data(new IByteArray::Byte[size]);
fixedByteArray.get(0, data.data(), size);
d->write(data.data(), size);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdeng2/src/data/ziparchive.cpp
Expand Up @@ -290,7 +290,7 @@ ZipArchive::ZipArchive(IByteArray const &archive) : Archive(archive)
CentralEnd summary;
reader >> summary;

const duint entryCount = summary.totalEntryCount;
duint const entryCount = summary.totalEntryCount;

// The ZIP must have only one part, all entries in the same archive.
if(entryCount != summary.diskEntryCount)
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdeng2/src/filesys/file.cpp
Expand Up @@ -81,7 +81,7 @@ void File::setOriginFeed(Feed *feed)
_originFeed = feed;
}

const String File::path() const
String const File::path() const
{
String thePath = name();
for(Folder *i = _parent; i; i = i->_parent)
Expand Down
4 changes: 2 additions & 2 deletions doomsday/libdeng2/src/filesys/fs.cpp
Expand Up @@ -26,7 +26,7 @@

using namespace de;

static const FS::Index emptyIndex;
static FS::Index const emptyIndex;

struct FS::Instance
{
Expand Down Expand Up @@ -174,7 +174,7 @@ File &FS::find(String const &path) const

void FS::index(File &file)
{
const String lowercaseName = file.name().lower();
String const lowercaseName = file.name().lower();

d->index.insert(IndexEntry(lowercaseName, &file));

Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdeng2/src/filesys/nativepath.cpp
Expand Up @@ -117,7 +117,7 @@ NativePath NativePath::expand(bool *didExpand) const
{
if(didExpand) *didExpand = true;

const String path = toString();
String const path = toString();
int firstSlash = path.indexOf('/');
if(firstSlash > 1)
{
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdeng2/src/legacy/legacycore.cpp
Expand Up @@ -169,7 +169,7 @@ int LegacyCore::runEventLoop()

void LegacyCore::setLoopRate(int freqHz)
{
const int oldInterval = d->loop.interval;
int const oldInterval = d->loop.interval;
d->loop.interval = qMax(1, 1000/freqHz);

if(oldInterval != d->loop.interval)
Expand Down
12 changes: 6 additions & 6 deletions doomsday/libdeng2/src/net/socket.cpp
Expand Up @@ -75,14 +75,14 @@
namespace de {

/// Version of the block transfer protocol.
static const duint PROTOCOL_VERSION = 0;
static duint const PROTOCOL_VERSION = 0;

/// Maximum number of channels.
static const duint MAX_CHANNELS = 2;
static duint const MAX_CHANNELS = 2;

static const int MAX_SIZE_SMALL = 127; // bytes
static const int MAX_SIZE_MEDIUM = 4095; // bytes
static const int MAX_SIZE_LARGE = DENG2_SOCKET_MAX_PAYLOAD_SIZE;
static int const MAX_SIZE_SMALL = 127; // bytes
static int const MAX_SIZE_MEDIUM = 4095; // bytes
static int const MAX_SIZE_LARGE = DENG2_SOCKET_MAX_PAYLOAD_SIZE;

/// Threshold for input data size: messages smaller than this are first compressed
/// with Doomsday's Huffman codes. If the result is smaller than the deflated data,
Expand Down Expand Up @@ -252,7 +252,7 @@ struct Socket::Instance

if(!header.size) // Try deflate.
{
const int level = (payload.size() < 2*MAX_SIZE_MEDIUM? 6 /*default*/ : 9 /*best*/);
int const level = (payload.size() < 2*MAX_SIZE_MEDIUM? 6 /*default*/ : 9 /*best*/);
QByteArray deflated = qCompress(payload, level);

if(!deflated.size())
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdeng2/src/scriptsys/process.cpp
Expand Up @@ -31,7 +31,7 @@ using namespace de;
using std::auto_ptr;

/// If execution continues for longer than this, a HangError is thrown.
static const Time::Delta MAX_EXECUTION_TIME = 10;
static Time::Delta const MAX_EXECUTION_TIME = 10;

Process::Process(Record *externalGlobalNamespace) : _state(STOPPED), _workingPath("/")
{
Expand Down

0 comments on commit 2d9d72a

Please sign in to comment.