Skip to content

Commit

Permalink
libdoomsday: Removing Qt dependencies; cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Sep 1, 2019
1 parent 71b25dc commit 4591dbf
Show file tree
Hide file tree
Showing 85 changed files with 1,066 additions and 1,191 deletions.
25 changes: 1 addition & 24 deletions doomsday/apps/libdoomsday/include/doomsday/abstractsession.h
Expand Up @@ -25,7 +25,7 @@
#include <de/Error>
#include <de/Observers>
#include <de/String>
#include <QMap>
#include <de/Map>

class GameStateFolder;

Expand Down Expand Up @@ -95,29 +95,6 @@ class LIBDOOMSDAY_PUBLIC AbstractSession
*/
void setThinkerMapping(world::IThinkerMapping *mapping);

public:
// /**
// * Configuration profile.
// * @todo Remove this. Could just point to a GameProfile instead. -jk
// */
// struct Profile
// {
// // Unique identifier of the game this profile is used with.
// de::String gameId;

// // List of resource files (specified via the command line or in a cfg, or found using
// // the default search algorithm (e.g., /auto and DOOMWADDIR)).
// QStringList resourceFiles;
// };

/*
* Returns the current configuration profile for the game session.
*/
// static Profile &profile();

// Convenient method of looking up the game identity key from the game session profile.
// static de::String gameId() const;

protected:
void setMapUri(de::Uri const &uri);
void setInProgress(bool inProgress);
Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/libdoomsday/include/doomsday/busymode.h
Expand Up @@ -37,7 +37,7 @@ struct LIBDOOMSDAY_PUBLIC BusyTask
void *workerData; ///< Data context for the worker thread.

int mode; ///< Busy mode flags @ref busyModeFlags
char const *name; ///< Optional task name (drawn with the progress bar).
const char *name; ///< Optional task name (drawn with the progress bar).

/// Used with task lists:
int maxProgress;
Expand Down Expand Up @@ -134,7 +134,7 @@ class LIBDOOMSDAY_PUBLIC BusyMode
*
* @return Return value from the worker.
*/
int runNewTaskWithName(int mode, de::String const &taskName, std::function<int (void *)> worker);
int runNewTaskWithName(int mode, de::String const &taskName, const std::function<int (void *)>& worker);

/**
* Abnormally aborts the currently running task. Call this when the task encounters
Expand Down
Expand Up @@ -103,7 +103,7 @@ LIBDOOMSDAY_PUBLIC knownword_t const **Con_CollectKnownWordsMatchingWord(char co

LIBDOOMSDAY_PUBLIC AutoStr *Con_KnownWordToString(knownword_t const *word);

LIBDOOMSDAY_PUBLIC de::String Con_AnnotatedConsoleTerms(QStringList terms);
LIBDOOMSDAY_PUBLIC de::String Con_AnnotatedConsoleTerms(const de::StringList &terms);

/**
* Collects all the known words of the console into a Lexicon.
Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/libdoomsday/include/doomsday/defs/dedfile.h
Expand Up @@ -26,7 +26,7 @@
#include "ded.h"
#include <de/String>

LIBDOOMSDAY_PUBLIC void Def_ReadProcessDED(ded_t *defs, de::String path);
LIBDOOMSDAY_PUBLIC void Def_ReadProcessDED(ded_t *defs, const de::String& path);

/**
* Reads definitions from the given lump.
Expand All @@ -47,7 +47,7 @@ LIBDOOMSDAY_PUBLIC int DED_ReadData(ded_t *ded, char const *buffer, de::String s
/**
* @return @c true, if the file was successfully loaded.
*/
int DED_Read(ded_t *ded, de::String path);
int DED_Read(ded_t *ded, const de::String& path);

void DED_SetError(de::String const &message);

Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/libdoomsday/include/doomsday/defs/dedregister.h
Expand Up @@ -56,7 +56,7 @@ class LIBDOOMSDAY_PUBLIC DEDRegister

DefaultLookup = 0 ///< Latest in order, case insensitive, omitted from copies.
};
Q_DECLARE_FLAGS(LookupFlags, LookupFlag)
using LookupFlags = de::Flags;

public:
DEDRegister(de::Record &names);
Expand Down Expand Up @@ -104,7 +104,7 @@ class LIBDOOMSDAY_PUBLIC DEDRegister
de::Record const & operator [] (int index) const;

de::Record * tryFind(de::String const &key, de::String const &value);
de::Record const * tryFind(de::String const &key, de::String value) const;
de::Record const * tryFind(de::String const &key, de::String const &value) const;

de::Record & find(de::String const &key, de::String const &value);
de::Record const & find(de::String const &key, de::String const &value) const;
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/libdoomsday/include/doomsday/defs/sprite.h
Expand Up @@ -42,7 +42,7 @@ struct LIBDOOMSDAY_PUBLIC CompiledSprite
de::Uri uri;
bool mirrorX = false;
};
QVector<View> views; // missing ones have an empty Uri
de::List<View> views; // missing ones have an empty Uri
int viewCount = 0; // number of non-missing views

CompiledSprite();
Expand Down
18 changes: 7 additions & 11 deletions doomsday/apps/libdoomsday/include/doomsday/doomsdayapp.h
Expand Up @@ -30,7 +30,6 @@
#include <de/Info>
#include <de/shell/PackageDownloader>

#include <QFlags>
#include <string>

namespace res { class Bundles; }
Expand Down Expand Up @@ -98,7 +97,7 @@ class LIBDOOMSDAY_PUBLIC DoomsdayApp
* Lists all the files found on the command line "-file" option (and its aliases).
* @return List of files.
*/
QList<de::File *> filesFromCommandLine() const;
de::List<de::File *> filesFromCommandLine() const;

/**
* Release all cached uncompressed entries. If the contents of the compressed
Expand All @@ -111,12 +110,11 @@ class LIBDOOMSDAY_PUBLIC DoomsdayApp
*/
void clearCache();

enum Behavior
{
AllowReload = 0x1,
enum Behavior {
AllowReload = 0x1,
DefaultBehavior = 0,
};
Q_DECLARE_FLAGS(Behaviors, Behavior)
using Behaviors = de::Flags;

/**
* Switch to/activate the specified game.
Expand All @@ -127,7 +125,7 @@ class LIBDOOMSDAY_PUBLIC DoomsdayApp
* @param behaviors Change behavior flags.
*/
bool changeGame(GameProfile const &profile,
std::function<int (void *)> gameActivationFunc,
const std::function<int (void *)> &gameActivationFunc,
Behaviors behaviors = DefaultBehavior);

static bool isGameBeingChanged();
Expand Down Expand Up @@ -199,8 +197,8 @@ class LIBDOOMSDAY_PUBLIC DoomsdayApp
static BusyMode & busyMode();
static SaveGames & saveGames();

static de::NativePath steamBasePath();
static QList<de::NativePath> gogComPaths();
static de::NativePath steamBasePath();
static de::List<de::NativePath> gogComPaths();

/**
* Sets the currently active game. DoomsdayApp does not take ownership of
Expand Down Expand Up @@ -256,6 +254,4 @@ class LIBDOOMSDAY_PUBLIC DoomsdayApp
*/
LIBDOOMSDAY_PUBLIC bool App_GameLoaded();

Q_DECLARE_OPERATORS_FOR_FLAGS(DoomsdayApp::Behaviors)

#endif // LIBDOOMSDAY_DOOMSDAYAPP_H
4 changes: 4 additions & 0 deletions doomsday/apps/libdoomsday/include/doomsday/dualstring.h
@@ -1,3 +1,5 @@
#if 0 /* obsolete */

/**
* @file dualstring.h
* Utility class for strings that need both Unicode and C-string access.
Expand Down Expand Up @@ -114,3 +116,5 @@ class LIBDOOMSDAY_PUBLIC DualString : public de::String
#endif // __cplusplus

#endif // LIBDOOMSDAY_DUALSTRING_H

#endif // 0
7 changes: 2 additions & 5 deletions doomsday/apps/libdoomsday/include/doomsday/filesys/file.h
Expand Up @@ -61,7 +61,6 @@ class LIBDOOMSDAY_PUBLIC File1
/// All resources are by default flagged as "custom".
DefaultFlags = Custom
};
Q_DECLARE_FLAGS(Flags, Flag)

/// This file is not contained. @ingroup errors
DE_ERROR(NotContainedError);
Expand Down Expand Up @@ -95,7 +94,7 @@ class LIBDOOMSDAY_PUBLIC File1
*
* @return The composed URI.
*/
virtual de::Uri composeUri(QChar delimiter = '/') const;
virtual de::Uri composeUri(Char delimiter = '/') const;

/**
* Compose the absolute VFS path to this file.
Expand All @@ -106,7 +105,7 @@ class LIBDOOMSDAY_PUBLIC File1
*
* @deprecated Prefer to use composeUri() instead.
*/
String composePath(QChar delimiter = '/') const {
String composePath(Char delimiter = '/') const {
return composeUri(delimiter).compose();
}

Expand Down Expand Up @@ -270,8 +269,6 @@ class LIBDOOMSDAY_PUBLIC File1
uint order;
};

Q_DECLARE_OPERATORS_FOR_FLAGS(File1::Flags)

} // namespace de

#endif /* DE_FILESYS_FILE_H */
17 changes: 5 additions & 12 deletions doomsday/apps/libdoomsday/include/doomsday/filesys/fileid.h
Expand Up @@ -29,7 +29,7 @@
#define DE_FILEID_H

#include "../libdoomsday.h"
#include <QByteArray>
#include <de/Block>
#include <de/Log>
#include <de/String>

Expand All @@ -41,10 +41,10 @@ namespace de {
class LIBDOOMSDAY_PUBLIC FileId : public LogEntry::Arg::Base
{
public:
typedef QByteArray Md5Hash;
typedef Block Md5Hash;

public:
explicit FileId(Md5Hash _md5);
explicit FileId(const Md5Hash& _md5);

FileId(FileId const& other);

Expand All @@ -61,16 +61,9 @@ class LIBDOOMSDAY_PUBLIC FileId : public LogEntry::Arg::Base

friend void swap(FileId& first, FileId& second) // nothrow
{
#ifdef DE_QT_4_8_OR_NEWER
first.md5_.swap(second.md5_);
# ifdef DE_DEBUG
first.path_.swap(second.path_);
# endif
#else
std::swap(first.md5_, second.md5_);
# ifdef DE_DEBUG
#ifdef DE_DEBUG
std::swap(first.path_, second.path_);
# endif
#endif
}

Expand Down Expand Up @@ -103,7 +96,7 @@ class LIBDOOMSDAY_PUBLIC FileId : public LogEntry::Arg::Base
* @param path Path to be hashed.
* @return Newly construced FileId.
*/
static FileId fromPath(String path);
static FileId fromPath(const String& path);

/**
* Calculate an MD5 identifier for the absolute @a path.
Expand Down
20 changes: 10 additions & 10 deletions doomsday/apps/libdoomsday/include/doomsday/filesys/filetype.h
Expand Up @@ -30,8 +30,8 @@
#ifdef __cplusplus
#ifndef DE_C_API_ONLY

#include <QStringList>
#include <QMap>
#include <de/String>
#include <de/Map>
#include <de/Log>
#include <de/NativePath>
#include <de/String>
Expand All @@ -50,7 +50,7 @@ namespace de
class LIBDOOMSDAY_PUBLIC FileType
{
public:
FileType(String _name, resourceclassid_t _defaultClass)
FileType(const String& _name, resourceclassid_t _defaultClass)
: name_(_name), defaultClass_(_defaultClass)
{}

Expand All @@ -75,7 +75,7 @@ namespace de
* @param ext Extension to add (including period).
* @return This instance.
*/
FileType& addKnownExtension(String ext)
FileType& addKnownExtension(const String& ext)
{
knownFileNameExtensions_.push_back(ext);
return *this;
Expand All @@ -87,7 +87,7 @@ namespace de
*
* @return List of known extensions.
*/
QStringList const& knownFileNameExtensions() const
StringList const& knownFileNameExtensions() const
{
return knownFileNameExtensions_;
}
Expand All @@ -98,13 +98,13 @@ namespace de
* @param path File name/path to test.
* @return @c true if matched.
*/
bool fileNameIsKnown(String path) const
bool fileNameIsKnown(const String& path) const
{
// We require an extension for this.
String ext = path.fileNameExtension();
if (!ext.isEmpty())
{
return knownFileNameExtensions_.contains(ext, Qt::CaseInsensitive);
return String::contains(knownFileNameExtensions_, ext, CaseInsensitive);
}
return false;
}
Expand All @@ -117,7 +117,7 @@ namespace de
resourceclassid_t defaultClass_;

/// List of known extensions for this file type.
QStringList knownFileNameExtensions_;
StringList knownFileNameExtensions_;
};

/**
Expand All @@ -143,7 +143,7 @@ namespace de
class LIBDOOMSDAY_PUBLIC NativeFileType : public FileType
{
public:
NativeFileType(String name, resourceclassid_t rclassId)
NativeFileType(const String& name, resourceclassid_t rclassId)
: FileType(name, rclassId)
{}

Expand All @@ -165,7 +165,7 @@ namespace de
}

/// Map of symbolic file type names to file types (not owned).
typedef QMap<String, FileType const *> FileTypes;
typedef Map<String, FileType const *> FileTypes;

} // namespace de

Expand Down

0 comments on commit 4591dbf

Please sign in to comment.