ok
git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant@1 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
7
plugins/mapxml/mapxml.def
Normal file
7
plugins/mapxml/mapxml.def
Normal file
@@ -0,0 +1,7 @@
|
||||
; mapxml.def : Declares the module parameters for the DLL.
|
||||
|
||||
LIBRARY "MAPXML"
|
||||
|
||||
EXPORTS
|
||||
; Explicit exports can go here
|
||||
Radiant_RegisterModules @1
|
||||
167
plugins/mapxml/mapxml.dsp
Normal file
167
plugins/mapxml/mapxml.dsp
Normal file
@@ -0,0 +1,167 @@
|
||||
# Microsoft Developer Studio Project File - Name="mapxml" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=mapxml - Win32 Release
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "mapxml.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "mapxml.mak" CFG="mapxml - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "mapxml - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "mapxml - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName "mapxml"
|
||||
# PROP Scc_LocalPath "..\.."
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "mapxml - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
F90=df.exe
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MAP_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /I "..\..\..\gtk2-win32\include\glib-2.0" /I "..\..\..\gtk2-win32\lib\glib-2.0\include" /I "..\common" /I "..\..\libs" /I "..\..\..\libxml2\include\\" /I "..\..\..\STLPort\stlport" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MAP_EXPORTS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x40c /d "NDEBUG"
|
||||
# ADD RSC /l 0x40c /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 /nologo /dll /machine:I386
|
||||
# ADD LINK32 cmdlib.lib glib-2.0.lib /nologo /dll /machine:I386 /def:".\mapxml.def" /libpath:"../../libs/cmdlib/release" /libpath:"..\..\..\libxml2\win32\libxml2\release_so" /libpath:"..\..\..\gtk2-win32\lib\\"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
# Begin Special Build Tool
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Desc=Copy to dir...
|
||||
PostBuild_Cmds=copy Release\mapxml.dll "../../install/modules"
|
||||
# End Special Build Tool
|
||||
|
||||
!ELSEIF "$(CFG)" == "mapxml - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
F90=df.exe
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MAP_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\include" /I "..\..\..\gtk2-win32\include\glib-2.0" /I "..\..\..\gtk2-win32\lib\glib-2.0\include" /I "..\common" /I "..\..\libs" /I "..\..\..\libxml2\include" /I "..\..\..\STLPort\stlport" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MAP_EXPORTS" /FR /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\libxml2\include" /I "..\..\include" /I "..\common" /I "..\..\libs" /I "..\..\..\STLPort\stlport" /I "..\..\..\gtk2-win32\include\glib-2.0" /I "..\..\..\gtk2-win32\lib\glib-2.0\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MAP_EXPORTS" /FR /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x40c /d "_DEBUG"
|
||||
# ADD RSC /l 0x40c /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 cmdlib.lib glib-2.0.lib /nologo /dll /debug /machine:I386 /def:".\mapxml.def" /pdbtype:sept /libpath:"../../libs/cmdlib/debug" /libpath:"..\..\..\gtk2-win32\lib\\"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
# Begin Special Build Tool
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Desc=Copy to dir...
|
||||
PostBuild_Cmds=copy Debug\mapxml.dll "../../install/modules"
|
||||
# End Special Build Tool
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "mapxml - Win32 Release"
|
||||
# Name "mapxml - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mapxml.def
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\plugin.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\xmlparse.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\xmlwrite.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Group "API"
|
||||
|
||||
# PROP Default_Filter "*.h"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\ifilesystem.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\ipatch.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\iscriplib.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\qerplugin.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\qertypes.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\plugin.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Conscript
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
216
plugins/mapxml/mapxml.vcproj
Normal file
216
plugins/mapxml/mapxml.vcproj
Normal file
@@ -0,0 +1,216 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="mapxml"
|
||||
ProjectGUID="{B43DBA9D-6EE0-421C-83D9-9776064B66B4}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../include;../../libs;"../../../STLPort-4.6/stlport";"../../../libxml2-2.6/include";"../../../gtk2-2.4/include/glib-2.0";"../../../gtk2-2.4/lib/glib-2.0/include""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MAPXML_EXPORTS"
|
||||
StringPooling="TRUE"
|
||||
MinimalRebuild="TRUE"
|
||||
ExceptionHandling="FALSE"
|
||||
BasicRuntimeChecks="0"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="FALSE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
BrowseInformation="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4610;4510;4512;4505;4100;4127"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libxml2.lib glib-2.0.lib"
|
||||
OutputFile="$(OutDir)/mapxml.dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""../../../libxml2-2.6/win32/lib";"../../../gtk2-2.4/lib""
|
||||
IgnoreDefaultLibraryNames="msvcprtd.lib"
|
||||
ModuleDefinitionFile="$(ProjectName).def"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/mapxml.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary="$(OutDir)/mapxml.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="copy "$(TargetPath)" "$(SolutionDir)install\modules"
|
||||
copy "$(TargetDir)$(TargetName).pdb" "$(SolutionDir)install\modules""/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="TRUE">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
GlobalOptimizations="TRUE"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OptimizeForWindowsApplication="FALSE"
|
||||
AdditionalIncludeDirectories="../../include;../../libs;"../../../STLPort-4.6/stlport";"../../../libxml2-2.6/include";"../../../gtk2-2.4/include/glib-2.0";"../../../gtk2-2.4/lib/glib-2.0/include""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MAPXML_EXPORTS"
|
||||
StringPooling="TRUE"
|
||||
ExceptionHandling="FALSE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4610;4510;4512;4505;4100;4127"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libxml2.lib glib-2.0.lib"
|
||||
OutputFile="$(OutDir)/mapxml.dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""../../../libxml2-2.6/win32/lib";"../../../gtk2-2.4/lib""
|
||||
IgnoreDefaultLibraryNames="msvcprt.lib"
|
||||
ModuleDefinitionFile="$(ProjectName).def"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
ImportLibrary="$(OutDir)/mapxml.lib"
|
||||
TargetMachine="1"
|
||||
FixedBaseAddress="0"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="copy "$(TargetPath)" "$(SolutionDir)install\modules"
|
||||
copy "$(TargetDir)$(TargetName).pdb" "$(SolutionDir)install\modules""/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="src"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath=".\plugin.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\plugin.h">
|
||||
</File>
|
||||
<Filter
|
||||
Name="modules"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath=".\xmlparse.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\xmlparse.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\xmlwrite.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\xmlwrite.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="..\..\debug.py">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="python "$(SolutionDir)debug.py""
|
||||
AdditionalDependencies=""$(SolutionDir)install\modules\$(TargetName).pdb""
|
||||
Outputs=""$(TargetDir)$(TargetName).pdb""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="python "$(SolutionDir)debug.py""
|
||||
AdditionalDependencies=""$(SolutionDir)install\modules\$(TargetName).pdb""
|
||||
Outputs=""$(TargetDir)$(TargetName).pdb""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\mapxml.def">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="python "$(SolutionDir)touch.py" "$(TargetPath)"
|
||||
"
|
||||
AdditionalDependencies=""$(SolutionDir)install\modules\$(TargetFileName)""
|
||||
Outputs=""$(TargetPath)""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="python "$(SolutionDir)touch.py" "$(TargetPath)"
|
||||
"
|
||||
AdditionalDependencies=""$(SolutionDir)install\modules\$(TargetFileName)""
|
||||
Outputs=""$(TargetPath)""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
93
plugins/mapxml/plugin.cpp
Normal file
93
plugins/mapxml/plugin.cpp
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
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 "ibrush.h"
|
||||
#include "ipatch.h"
|
||||
#include "ifiletypes.h"
|
||||
#include "ieclass.h"
|
||||
#include "qerplugin.h"
|
||||
|
||||
#include "modulesystem/singletonmodule.h"
|
||||
#include "typesystem.h"
|
||||
|
||||
#include "xmlparse.h"
|
||||
#include "xmlwrite.h"
|
||||
|
||||
|
||||
class MapXMLDependencies :
|
||||
public GlobalRadiantModuleRef,
|
||||
public GlobalBrushModuleRef,
|
||||
public GlobalPatchModuleRef,
|
||||
public GlobalFiletypesModuleRef,
|
||||
public GlobalEntityClassManagerModuleRef,
|
||||
public GlobalSceneGraphModuleRef
|
||||
{
|
||||
public:
|
||||
MapXMLDependencies() :
|
||||
GlobalBrushModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("brushtypes")),
|
||||
GlobalPatchModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("patchtypes")),
|
||||
GlobalEntityClassManagerModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("entityclass"))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class MapXMLAPI : public TypeSystemRef, public MapFormat
|
||||
{
|
||||
public:
|
||||
typedef MapFormat Type;
|
||||
STRING_CONSTANT(Name, "xmlq3");
|
||||
|
||||
MapXMLAPI()
|
||||
{
|
||||
GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("xml quake3 maps", "*.xmap"));
|
||||
}
|
||||
MapFormat* getTable()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
void readGraph(scene::Node& root, TextInputStream& inputStream, EntityCreator& entityTable) const
|
||||
{
|
||||
Map_Read(root, inputStream, entityTable);
|
||||
}
|
||||
void writeGraph(scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& outputStream) const
|
||||
{
|
||||
Map_Write(root, traverse, outputStream);
|
||||
}
|
||||
};
|
||||
|
||||
typedef SingletonModule<MapXMLAPI, MapXMLDependencies> MapXMLModule;
|
||||
|
||||
MapXMLModule g_MapXMLModule;
|
||||
|
||||
|
||||
|
||||
extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer& server)
|
||||
{
|
||||
GlobalErrorStream::instance().setOutputStream(server.getErrorStream());
|
||||
GlobalOutputStream::instance().setOutputStream(server.getOutputStream());
|
||||
GlobalDebugMessageHandler::instance().setHandler(server.getDebugMessageHandler());
|
||||
GlobalModuleServer::instance().set(server);
|
||||
|
||||
g_MapXMLModule.selfRegister();
|
||||
}
|
||||
25
plugins/mapxml/plugin.h
Normal file
25
plugins/mapxml/plugin.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_PLUGIN_H)
|
||||
#define INCLUDED_PLUGIN_H
|
||||
|
||||
#endif
|
||||
277
plugins/mapxml/xmlparse.cpp
Normal file
277
plugins/mapxml/xmlparse.cpp
Normal file
@@ -0,0 +1,277 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
//
|
||||
// parses xml tree format into internal objects
|
||||
//
|
||||
|
||||
#include "xmlparse.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "ientity.h"
|
||||
#include "ibrush.h"
|
||||
#include "ipatch.h"
|
||||
#include "ieclass.h"
|
||||
#include "eclasslib.h"
|
||||
|
||||
#include "xml/xmlparser.h"
|
||||
#include "scenelib.h"
|
||||
#include "generic/reference.h"
|
||||
#include "generic/object.h"
|
||||
|
||||
|
||||
#define PARSE_ERROR "XML PARSE ERROR"
|
||||
|
||||
|
||||
inline XMLImporter* Node_getXMLImporter(scene::Node& node)
|
||||
{
|
||||
return NodeTypeCast<XMLImporter>::cast(node);
|
||||
}
|
||||
|
||||
|
||||
scene::Node& createPrimitive(const char* name)
|
||||
{
|
||||
if(string_equal(name, "brush"))
|
||||
{
|
||||
return GlobalBrushCreator().createBrush();
|
||||
}
|
||||
else if(string_equal(name, "patch"))
|
||||
{
|
||||
return GlobalPatchCreator().createPatch();
|
||||
}
|
||||
|
||||
ASSERT_MESSAGE(0, PARSE_ERROR << ": primitive type not supported: \"" << name << "\"\n");
|
||||
scene::Node* node = 0;
|
||||
return *node;
|
||||
}
|
||||
|
||||
class TreeXMLImporter : public XMLImporter
|
||||
{
|
||||
public:
|
||||
virtual TreeXMLImporter& child() = 0;
|
||||
};
|
||||
|
||||
class SubPrimitiveImporter : public TreeXMLImporter
|
||||
{
|
||||
XMLImporter* m_importer;
|
||||
public:
|
||||
SubPrimitiveImporter(XMLImporter* importer) : m_importer(importer)
|
||||
{
|
||||
}
|
||||
void pushElement(const XMLElement& element)
|
||||
{
|
||||
m_importer->pushElement(element);
|
||||
}
|
||||
void popElement(const char* name)
|
||||
{
|
||||
m_importer->popElement(name);
|
||||
}
|
||||
std::size_t write(const char* buffer, std::size_t length)
|
||||
{
|
||||
return m_importer->write(buffer, length);
|
||||
}
|
||||
SubPrimitiveImporter& child()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
class PrimitiveImporter : public TreeXMLImporter
|
||||
{
|
||||
scene::Node& m_parent;
|
||||
XMLImporter* m_importer;
|
||||
char m_child[sizeof(SubPrimitiveImporter)];
|
||||
|
||||
SubPrimitiveImporter& subprimitive()
|
||||
{
|
||||
return *reinterpret_cast<SubPrimitiveImporter*>(m_child);
|
||||
}
|
||||
public:
|
||||
PrimitiveImporter(scene::Node& parent) : m_parent(parent), m_importer(0)
|
||||
{
|
||||
}
|
||||
void pushElement(const XMLElement& element)
|
||||
{
|
||||
if(string_equal(element.name(), "epair"))
|
||||
{
|
||||
ASSERT_MESSAGE(string_equal(element.name(), "epair"), PARSE_ERROR);
|
||||
Node_getEntity(m_parent)->setKeyValue(element.attribute("key"), element.attribute("value"));
|
||||
}
|
||||
else
|
||||
{
|
||||
NodeSmartReference node(createPrimitive(element.name()));
|
||||
|
||||
m_importer = Node_getXMLImporter(node);
|
||||
|
||||
constructor(subprimitive(), m_importer);
|
||||
|
||||
m_importer->pushElement(element);
|
||||
|
||||
Node_getTraversable(m_parent)->insert(node);
|
||||
}
|
||||
}
|
||||
void popElement(const char* name)
|
||||
{
|
||||
if(string_equal(name, "epair"))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
m_importer->popElement(name);
|
||||
|
||||
destructor(subprimitive());
|
||||
m_importer = 0;
|
||||
}
|
||||
}
|
||||
std::size_t write(const char* buffer, std::size_t length)
|
||||
{
|
||||
return m_importer->write(buffer, length);
|
||||
}
|
||||
TreeXMLImporter& child()
|
||||
{
|
||||
return subprimitive();
|
||||
}
|
||||
};
|
||||
|
||||
class EntityImporter : public TreeXMLImporter
|
||||
{
|
||||
scene::Node& m_parent;
|
||||
char m_node[sizeof(NodeSmartReference)];
|
||||
char m_child[sizeof(PrimitiveImporter)];
|
||||
EntityCreator& m_entityTable;
|
||||
|
||||
NodeSmartReference& node()
|
||||
{
|
||||
return *reinterpret_cast<NodeSmartReference*>(m_node);
|
||||
}
|
||||
PrimitiveImporter& primitive()
|
||||
{
|
||||
return *reinterpret_cast<PrimitiveImporter*>(m_child);
|
||||
}
|
||||
|
||||
public:
|
||||
EntityImporter(scene::Node& parent, EntityCreator& entityTable) : m_parent(parent), m_entityTable(entityTable)
|
||||
{
|
||||
}
|
||||
void pushElement(const XMLElement& element)
|
||||
{
|
||||
ASSERT_MESSAGE(string_equal(element.name(), "entity"), PARSE_ERROR);
|
||||
constructor(node(), NodeSmartReference(m_entityTable.createEntity(GlobalEntityClassManager().findOrInsert("", true))));
|
||||
constructor(primitive(), makeReference(node().get()));
|
||||
}
|
||||
void popElement(const char* name)
|
||||
{
|
||||
ASSERT_MESSAGE(string_equal(name, "entity"), PARSE_ERROR);
|
||||
NodeSmartReference entity(m_entityTable.createEntity(GlobalEntityClassManager().findOrInsert(Node_getEntity(node())->getKeyValue("classname"), node_is_group(node()))));
|
||||
|
||||
{
|
||||
EntityCopyingVisitor visitor(*Node_getEntity(entity));
|
||||
Node_getEntity(node())->forEachKeyValue(visitor);
|
||||
}
|
||||
|
||||
if(Node_getTraversable(entity) != 0 && !Node_getEntity(entity)->getEntityClass().fixedsize)
|
||||
{
|
||||
parentBrushes(node(), entity);
|
||||
}
|
||||
|
||||
Node_getTraversable(m_parent)->insert(entity);
|
||||
|
||||
destructor(primitive());
|
||||
destructor(node());
|
||||
}
|
||||
std::size_t write(const char* buffer, std::size_t length)
|
||||
{
|
||||
return length;
|
||||
}
|
||||
TreeXMLImporter& child()
|
||||
{
|
||||
return primitive();
|
||||
}
|
||||
};
|
||||
|
||||
class MapQ3Importer : public TreeXMLImporter
|
||||
{
|
||||
scene::Node& m_root;
|
||||
char m_child[sizeof(EntityImporter)];
|
||||
EntityCreator& m_entityTable;
|
||||
|
||||
EntityImporter& getEntity()
|
||||
{
|
||||
return *reinterpret_cast<EntityImporter*>(m_child);
|
||||
}
|
||||
public:
|
||||
MapQ3Importer(scene::Node& root, EntityCreator& entityTable) : m_root(root), m_entityTable(entityTable)
|
||||
{
|
||||
}
|
||||
void pushElement(const XMLElement& element)
|
||||
{
|
||||
ASSERT_MESSAGE(string_equal(element.name(), "mapq3"), PARSE_ERROR);
|
||||
constructor(getEntity(), makeReference(m_root), makeReference(m_entityTable));
|
||||
}
|
||||
void popElement(const char* name)
|
||||
{
|
||||
ASSERT_MESSAGE(string_equal(name, "mapq3"), PARSE_ERROR);
|
||||
destructor(getEntity());
|
||||
}
|
||||
std::size_t write(const char* data, std::size_t length)
|
||||
{
|
||||
return length;
|
||||
}
|
||||
TreeXMLImporter& child()
|
||||
{
|
||||
return getEntity();
|
||||
}
|
||||
};
|
||||
|
||||
class TreeXMLImporterStack : public XMLImporter
|
||||
{
|
||||
std::vector< Reference<TreeXMLImporter> > m_importers;
|
||||
public:
|
||||
TreeXMLImporterStack(TreeXMLImporter& importer)
|
||||
{
|
||||
m_importers.push_back(makeReference(importer));
|
||||
}
|
||||
void pushElement(const XMLElement& element)
|
||||
{
|
||||
m_importers.back().get().pushElement(element);
|
||||
m_importers.push_back(makeReference(m_importers.back().get().child()));
|
||||
}
|
||||
void popElement(const char* name)
|
||||
{
|
||||
m_importers.pop_back();
|
||||
m_importers.back().get().popElement(name);
|
||||
}
|
||||
std::size_t write(const char* buffer, std::size_t length)
|
||||
{
|
||||
return (*(m_importers.end() - 2)).get().write(buffer, length);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void Map_Read(scene::Node& root, TextInputStream& in, EntityCreator& entityTable)
|
||||
{
|
||||
XMLStreamParser parser(in);
|
||||
|
||||
MapQ3Importer importer(root, entityTable);
|
||||
TreeXMLImporterStack stack(importer);
|
||||
parser.exportXML(stack);
|
||||
}
|
||||
29
plugins/mapxml/xmlparse.h
Normal file
29
plugins/mapxml/xmlparse.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_XMLPARSE_H)
|
||||
#define INCLUDED_XMLPARSE_H
|
||||
|
||||
#include "imap.h"
|
||||
|
||||
void Map_Read(scene::Node& root, TextInputStream& in, EntityCreator& entityTable);
|
||||
|
||||
#endif
|
||||
91
plugins/mapxml/xmlwrite.cpp
Normal file
91
plugins/mapxml/xmlwrite.cpp
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
//
|
||||
// writes xml tree format from internal objects
|
||||
//
|
||||
|
||||
#include "xmlwrite.h"
|
||||
|
||||
#include "xml/xmlwriter.h"
|
||||
#include "scenelib.h"
|
||||
#include "entityxml.h"
|
||||
|
||||
inline XMLExporter* Node_getXMLExporter(scene::Node& node)
|
||||
{
|
||||
return NodeTypeCast<XMLExporter>::cast(node);
|
||||
}
|
||||
|
||||
|
||||
class write_all : public scene::Traversable::Walker
|
||||
{
|
||||
XMLImporter& m_importer;
|
||||
public:
|
||||
write_all(XMLImporter& importer) : m_importer(importer)
|
||||
{
|
||||
}
|
||||
bool pre(scene::Node& node) const
|
||||
{
|
||||
Entity* entity = Node_getEntity(node);
|
||||
if(entity != 0)
|
||||
{
|
||||
m_importer.write("\n", 1);
|
||||
StaticElement element("entity");
|
||||
m_importer.pushElement(element);
|
||||
entity_export exporter(*entity);
|
||||
exporter.exportXML(m_importer);
|
||||
}
|
||||
else
|
||||
{
|
||||
XMLExporter* exporter = Node_getXMLExporter(node);
|
||||
if(exporter != 0)
|
||||
{
|
||||
m_importer.write("\n", 1);
|
||||
exporter->exportXML(m_importer);
|
||||
m_importer.write("\n", 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void post(scene::Node& node) const
|
||||
{
|
||||
if(Node_getEntity(node) != 0)
|
||||
{
|
||||
m_importer.write("\n", 1);
|
||||
m_importer.popElement("entity");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void Map_Write(scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& out)
|
||||
{
|
||||
XMLStreamWriter writer(out);
|
||||
writer.write("\n", 1);
|
||||
{
|
||||
StaticElement element("mapq3");
|
||||
writer.pushElement(element);
|
||||
|
||||
traverse(root, write_all(writer));
|
||||
|
||||
writer.write("\n", 1);
|
||||
writer.popElement(element.name());
|
||||
}
|
||||
}
|
||||
29
plugins/mapxml/xmlwrite.h
Normal file
29
plugins/mapxml/xmlwrite.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_XMLWRITE_H)
|
||||
#define INCLUDED_XMLWRITE_H
|
||||
|
||||
#include "imap.h"
|
||||
|
||||
void Map_Write(scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& out);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user