diff --git a/doomsday/plugins/dehread/include/dehread.h b/doomsday/plugins/dehread/include/dehread.h index 5d465fe838..aa8c6923fb 100644 --- a/doomsday/plugins/dehread/include/dehread.h +++ b/doomsday/plugins/dehread/include/dehread.h @@ -1,9 +1,9 @@ -/** - * @file dehread.h - * DeHackEd patch reader plugin for Doomsday Engine. @ingroup dehread +/** @file dehread.h DeHackEd patch reader plugin for Doomsday Engine. + * + * @ingroup dehread * - * @author Copyright © 2003-2013 Jaakko Keränen - * @author Copyright © 2006-2013 Daniel Swanson + * @authors Copyright © 2003-2014 Jaakko Keränen + * @authors Copyright © 2006-2014 Daniel Swanson * * @par License * GPL: http://www.gnu.org/licenses/gpl.html @@ -20,11 +20,6 @@ * 02110-1301 USA */ -/** - * @defgroup dehread - * DeHackEd patch reader plugin. - */ - #ifndef LIBDEHREAD_DEHREAD_H #define LIBDEHREAD_DEHREAD_H @@ -42,13 +37,13 @@ struct font_s; #include #include -DENG_EXTERN_C void DP_Initialize(void); +DENG_EXTERN_C void DP_Initialize(); // Internal: -extern ded_t* ded; // @todo Remove me. +extern ded_t *ded; // @todo Remove me. -const int NUMSPRITES = 138; -const int NUMSTATES = 968; +int const NUMSPRITES = 138; +int const NUMSTATES = 968; extern ded_sprid_t origSpriteNames[NUMSPRITES]; extern ded_funcid_t origActionNames[NUMSTATES]; @@ -57,7 +52,6 @@ DENG_USING_API(Con); DENG_USING_API(Def); DENG_USING_API(F); DENG_USING_API(Plug); -DENG_USING_API(Uri); DENG_USING_API(W); #endif // LIBDEHREAD_DEHREAD_H diff --git a/doomsday/plugins/dehread/include/dehreader.h b/doomsday/plugins/dehread/include/dehreader.h index 85c113a4d3..a0d3fb1a06 100644 --- a/doomsday/plugins/dehread/include/dehreader.h +++ b/doomsday/plugins/dehread/include/dehreader.h @@ -1,11 +1,10 @@ -/** - * @file dehreader.h - * DeHackEd patch parser. @ingroup dehreader +/** @file dehreader.h DeHackEd patch parser. + * @ingroup dehreader * * Parses DeHackEd patches and updates the engine's definition databases. * - * @author Copyright © 2013 Daniel Swanson - * @author Copyright © 2012-2013 Jaakko Keränen + * @authors Copyright © 2013-2014 Daniel Swanson + * @authors Copyright © 2012-2014 Jaakko Keränen * * @par License * GPL: http://www.gnu.org/licenses/gpl.html @@ -50,6 +49,6 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(DehReaderFlags) * @param patch DeHackEd patch to parse. * @param flags @ref DehReaderFlags */ -void readDehPatch(const de::Block& patch, DehReaderFlags flags = 0); +void readDehPatch(de::Block const &patch, DehReaderFlags flags = 0); #endif // LIBDEHREAD_DEHREADER_H diff --git a/doomsday/plugins/dehread/include/dehreader_util.h b/doomsday/plugins/dehread/include/dehreader_util.h index d1a1289f81..d58e9ca69b 100644 --- a/doomsday/plugins/dehread/include/dehreader_util.h +++ b/doomsday/plugins/dehread/include/dehreader_util.h @@ -1,11 +1,11 @@ -/** - * @file dehreader_util.h - * DeHackEd patch parser. @ingroup dehread +/** @file dehreader_util.h DeHackEd patch parser. + * + * @ingroup dehread * * Miscellaneous utility routines. * - * @author Copyright © 2003-2013 Jaakko Keränen - * @author Copyright © 2006-2013 Daniel Swanson + * @authors Copyright © 2003-2014 Jaakko Keränen + * @authors Copyright © 2006-2014 Daniel Swanson * * @par License * GPL: http://www.gnu.org/licenses/gpl.html @@ -30,11 +30,11 @@ #include "dehreader.h" /// @return Newly composed map URI, must be free'd with Uri_Delete(). -Uri* composeMapUri(int episode, int map); +de::Uri composeMapUri(int episode, int map); -int mapInfoDefForUri(const Uri& uri, ded_mapinfo_t** def = NULL); +int mapInfoDefForUri(de::Uri const &uri, ded_mapinfo_t **def = 0); -int valueDefForPath(const QString& id, ded_value_t** def = NULL); +int valueDefForPath(de::String const &id, ded_value_t **def = 0); /** * Tokenize a @a string, splitting it into at most @a max tokens. @@ -54,6 +54,6 @@ int valueDefForPath(const QString& id, ded_value_t** def = NULL); * * @todo Should this be incorporated into de::String ? */ -QStringList splitMax(const QString& string, QChar sep, int max = -1); +QStringList splitMax(QString const &string, QChar sep, int max = -1); #endif // LIBDEHREAD_DEHREADER_UTIL_H diff --git a/doomsday/plugins/dehread/src/dehread.cpp b/doomsday/plugins/dehread/src/dehread.cpp index e809110d9f..f66d629b27 100644 --- a/doomsday/plugins/dehread/src/dehread.cpp +++ b/doomsday/plugins/dehread/src/dehread.cpp @@ -2,7 +2,7 @@ * @ingroup dehread * * @authors Copyright © 2013-2014 Daniel Swanson - * @authors Copyright © 2012-2013 Jaakko Keränen + * @authors Copyright © 2012-2014 Jaakko Keränen * * @par License * GPL: http://www.gnu.org/licenses/gpl.html @@ -174,7 +174,6 @@ DENG_DECLARE_API(Def); DENG_DECLARE_API(F); DENG_DECLARE_API(Plug); DENG_DECLARE_API(W); -DENG_DECLARE_API(Uri); DENG_API_EXCHANGE( DENG_GET_API(DE_API_BASE, Base); @@ -182,6 +181,5 @@ DENG_API_EXCHANGE( DENG_GET_API(DE_API_DEFINITIONS, Def); DENG_GET_API(DE_API_FILE_SYSTEM, F); DENG_GET_API(DE_API_PLUGIN, Plug); - DENG_GET_API(DE_API_URI, Uri); DENG_GET_API(DE_API_WAD, W); ) diff --git a/doomsday/plugins/dehread/src/dehreader.cpp b/doomsday/plugins/dehread/src/dehreader.cpp index 3a9b0b25c4..dbcead61d2 100644 --- a/doomsday/plugins/dehread/src/dehreader.cpp +++ b/doomsday/plugins/dehread/src/dehreader.cpp @@ -1446,23 +1446,20 @@ class DehReader float parTime = float(String(args.at(arg++)).toInt(0, 10, String::AllowSuffix)); // Apply. - uri_s *uri = composeMapUri(episode, map); - AutoStr *path = Uri_ToString(uri); - + de::Uri const uri = composeMapUri(episode, map); ded_mapinfo_t *def; - int idx = mapInfoDefForUri(*uri, &def); + int idx = mapInfoDefForUri(uri, &def); if(idx >= 0) { def->parTime = parTime; LOG_DEBUG("MapInfo #%i \"%s\" parTime => %d") - << idx << Str_Text(path) << def->parTime; + << idx << uri << def->parTime; } else { LOG_WARNING("Failed locating MapInfo for \"%s\" (episode:%i, map:%i), ignoring.") - << Str_Text(path) << episode << map; + << uri << episode << map; } - Uri_Delete(uri); } } catch(SyntaxError const &er) diff --git a/doomsday/plugins/dehread/src/dehreader_util.cpp b/doomsday/plugins/dehread/src/dehreader_util.cpp index 236ea8be2b..fc35bdc096 100644 --- a/doomsday/plugins/dehread/src/dehreader_util.cpp +++ b/doomsday/plugins/dehread/src/dehreader_util.cpp @@ -1,9 +1,7 @@ -/** - * @file dehreader_util.cpp - * Miscellaneous utility routines. @ingroup dehread +/** @file dehreader_util.cpp Miscellaneous utility routines. * - * @author Copyright © 2003-2013 Jaakko Keränen - * @author Copyright © 2006-2013 Daniel Swanson + * @authors Copyright © 2003-2014 Jaakko Keränen + * @authors Copyright © 2006-2014 Daniel Swanson * * @par License * GPL: http://www.gnu.org/licenses/gpl.html @@ -20,32 +18,30 @@ * 02110-1301 USA */ -#include "dehreader.h" -#include -#include +#include "dehreader_util.h" #include -Uri* composeMapUri(int episode, int map) +using namespace de; + +de::Uri composeMapUri(int episode, int map) { if(episode > 0) // ExMy format. { - de::Block pathUtf8 = QString("E%1M%2").arg(episode).arg(map).toUtf8(); - return Uri_NewWithPath2(pathUtf8.constData(), RC_NULL); + return de::Uri(String("E%1M%2").arg(episode).arg(map), RC_NULL); } else // MAPxx format. { - de::Block pathUtf8 = QString("MAP%1").arg(map % 100, 2, 10, QChar('0')).toUtf8(); - return Uri_NewWithPath2(pathUtf8.constData(), RC_NULL); + return de::Uri(String("MAP%1").arg(map % 100, 2, 10, QChar('0')), RC_NULL); } } -int mapInfoDefForUri(const Uri& uri, ded_mapinfo_t** def) +int mapInfoDefForUri(de::Uri const &uri, ded_mapinfo_t **def) { - if(!Str_IsEmpty(Uri_Path(&uri))) + if(!uri.path().isEmpty()) for(int i = ded->mapInfo.size() - 1; i >= 0; i--) { - ded_mapinfo_t& info = ded->mapInfo[i]; - if(info.uri && Uri_Equality((uri_s *)info.uri, &uri)) + ded_mapinfo_t &info = ded->mapInfo[i]; + if(info.uri && *info.uri == uri) { if(def) *def = &info; return i; @@ -54,14 +50,14 @@ int mapInfoDefForUri(const Uri& uri, ded_mapinfo_t** def) return -1; // Not found. } -int valueDefForPath(const QString& id, ded_value_t** def) +int valueDefForPath(String const &id, ded_value_t **def) { if(!id.isEmpty()) { - de::Block idUtf8 = id.toUtf8(); + Block idUtf8 = id.toUtf8(); for(int i = ded->values.size() - 1; i >= 0; i--) { - ded_value_t& value = ded->values[i]; + ded_value_t &value = ded->values[i]; if(!qstricmp(value.id, idUtf8.constData())) { if(def) *def = &value; @@ -73,7 +69,7 @@ int valueDefForPath(const QString& id, ded_value_t** def) } /// @todo Reimplement with a regex? -QStringList splitMax(const QString& str, QChar sep, int max) +QStringList splitMax(QString const &str, QChar sep, int max) { if(max < 0) {