Skip to content

Commit

Permalink
Cleanup PK4 archive module a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Aug 28, 2017
1 parent 7cdeabb commit 290b5e8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 74 deletions.
66 changes: 21 additions & 45 deletions plugins/archivezip/plugin.cpp
@@ -1,75 +1,51 @@
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "plugin.h"

#include "imodule.h"
#include "iarchive.h"
#include "debugging/debugging.h"
#include "iregistry.h"

#include <iostream>

#include "itextstream.h"
#include "ZipArchive.h"

class ArchivePK4API :
namespace archive
{

class Pk4ArchiveLoader :
public ArchiveLoader
{
public:
// greebo: Returns the opened file or NULL if failed.
virtual ArchivePtr openArchive(const std::string& name) {
return ZipArchivePtr(new ZipArchive(name));
virtual ArchivePtr openArchive(const std::string& name) override
{
return std::make_shared<ZipArchive>(name);
}

virtual const std::string& getExtension() {
virtual const std::string& getExtension() override
{
static std::string _ext("pk4");
return _ext;
}

// RegisterableModule implementation
virtual const std::string& getName() const {
static std::string _name("ArchivePK4");
const std::string& getName() const override
{
static std::string _name(MODULE_ARCHIVE + "PK4");
return _name;
}

virtual const StringSet& getDependencies() const {
const StringSet& getDependencies() const override
{
static StringSet _dependencies;

if (_dependencies.empty())
{
_dependencies.insert(MODULE_XMLREGISTRY);
}

return _dependencies;
}

virtual void initialiseModule(const ApplicationContext& ctx) {
rMessage() << "ArchivePK4::initialiseModule called\n";
void initialiseModule(const ApplicationContext& ctx) override
{
rMessage() << getName() << "::initialiseModule called" << std::endl;
}
};
typedef std::shared_ptr<ArchivePK4API> ArchivePK4APIPtr;

}

extern "C" void DARKRADIANT_DLLEXPORT RegisterModule(IModuleRegistry& registry)
{
module::performDefaultInitialisation(registry);

registry.registerModule(ArchivePK4APIPtr(new ArchivePK4API));
registry.registerModule(std::make_shared<archive::Pk4ArchiveLoader>());
}
25 changes: 0 additions & 25 deletions plugins/archivezip/plugin.h

This file was deleted.

1 change: 0 additions & 1 deletion tools/msvc/archivezip.vcxproj
Expand Up @@ -310,7 +310,6 @@
<ClInclude Include="..\..\plugins\archivezip\DeflatedArchiveFile.h" />
<ClInclude Include="..\..\plugins\archivezip\DeflatedArchiveTextFile.h" />
<ClInclude Include="..\..\plugins\archivezip\pkzip.h" />
<ClInclude Include="..\..\plugins\archivezip\plugin.h" />
<ClInclude Include="..\..\plugins\archivezip\ZipArchive.h" />
<ClInclude Include="..\..\plugins\archivezip\zlibstream.h" />
</ItemGroup>
Expand Down
3 changes: 0 additions & 3 deletions tools/msvc/archivezip.vcxproj.filters
Expand Up @@ -16,9 +16,6 @@
<ClInclude Include="..\..\plugins\archivezip\pkzip.h">
<Filter>src</Filter>
</ClInclude>
<ClInclude Include="..\..\plugins\archivezip\plugin.h">
<Filter>src</Filter>
</ClInclude>
<ClInclude Include="..\..\plugins\archivezip\ZipArchive.h">
<Filter>src</Filter>
</ClInclude>
Expand Down

0 comments on commit 290b5e8

Please sign in to comment.