mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-02 09:03:37 +00:00
GLideN64.sln: Add TinyXML++ and ts2lang projects
This will allow seamless translation from .ts to .Lang files compatible with the WTL GUI
This commit is contained in:
parent
97c8c0db78
commit
d7d68c4667
|
@ -16,6 +16,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GLideNUI", "GLideNUI.vcxpro
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GLideNUI-wtl", "GLideNUI-wtl.vcxproj", "{9E05B70F-A294-44A9-A151-B2CC95AA884E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ticpp", "ticpp.vcxproj", "{4F28B56B-F4B0-41B0-A785-597F6EF0163A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ts2lang", "ts2lang.vcxproj", "{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug_mupenplus|Win32 = Debug_mupenplus|Win32
|
||||
|
@ -136,6 +140,38 @@ Global
|
|||
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_wtl|Win32.Build.0 = Release|Win32
|
||||
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_wtl|x64.ActiveCfg = Release|x64
|
||||
{9E05B70F-A294-44A9-A151-B2CC95AA884E}.Release_wtl|x64.Build.0 = Release|x64
|
||||
{4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Debug_mupenplus|Win32.ActiveCfg = Debug|Win32
|
||||
{4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Debug_mupenplus|x64.ActiveCfg = Debug|x64
|
||||
{4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Debug_qt|Win32.ActiveCfg = Debug|Win32
|
||||
{4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Debug_qt|x64.ActiveCfg = Debug|x64
|
||||
{4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Debug_wtl|Win32.ActiveCfg = Debug|Win32
|
||||
{4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Debug_wtl|Win32.Build.0 = Debug|Win32
|
||||
{4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Debug_wtl|x64.ActiveCfg = Debug|x64
|
||||
{4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Debug_wtl|x64.Build.0 = Debug|x64
|
||||
{4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Release_mupenplus|Win32.ActiveCfg = Release|Win32
|
||||
{4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Release_mupenplus|x64.ActiveCfg = Release|x64
|
||||
{4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Release_qt|Win32.ActiveCfg = Release|Win32
|
||||
{4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Release_qt|x64.ActiveCfg = Release|x64
|
||||
{4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Release_wtl|Win32.ActiveCfg = Release|Win32
|
||||
{4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Release_wtl|Win32.Build.0 = Release|Win32
|
||||
{4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Release_wtl|x64.ActiveCfg = Release|x64
|
||||
{4F28B56B-F4B0-41B0-A785-597F6EF0163A}.Release_wtl|x64.Build.0 = Release|x64
|
||||
{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Debug_mupenplus|Win32.ActiveCfg = Debug|Win32
|
||||
{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Debug_mupenplus|x64.ActiveCfg = Debug|x64
|
||||
{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Debug_qt|Win32.ActiveCfg = Debug|Win32
|
||||
{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Debug_qt|x64.ActiveCfg = Debug|x64
|
||||
{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Debug_wtl|Win32.ActiveCfg = Debug|Win32
|
||||
{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Debug_wtl|Win32.Build.0 = Debug|Win32
|
||||
{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Debug_wtl|x64.ActiveCfg = Debug|x64
|
||||
{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Debug_wtl|x64.Build.0 = Debug|x64
|
||||
{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Release_mupenplus|Win32.ActiveCfg = Release|Win32
|
||||
{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Release_mupenplus|x64.ActiveCfg = Release|x64
|
||||
{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Release_qt|Win32.ActiveCfg = Release|Win32
|
||||
{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Release_qt|x64.ActiveCfg = Release|x64
|
||||
{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Release_wtl|Win32.ActiveCfg = Release|Win32
|
||||
{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Release_wtl|Win32.Build.0 = Release|Win32
|
||||
{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Release_wtl|x64.ActiveCfg = Release|x64
|
||||
{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}.Release_wtl|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
118
projects/msvc/ticpp.vcxproj
Normal file
118
projects/msvc/ticpp.vcxproj
Normal file
|
@ -0,0 +1,118 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\ticpp\ticpp.cpp" />
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\ticpp\tinystr.cpp" />
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\ticpp\tinyxml.cpp" />
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\ticpp\tinyxmlerror.cpp" />
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\ticpp\tinyxmlparser.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\GLideNUI-wtl\ticpp\ticpp.h" />
|
||||
<ClInclude Include="..\..\src\GLideNUI-wtl\ticpp\ticppapi.h" />
|
||||
<ClInclude Include="..\..\src\GLideNUI-wtl\ticpp\ticpprc.h" />
|
||||
<ClInclude Include="..\..\src\GLideNUI-wtl\ticpp\tinystr.h" />
|
||||
<ClInclude Include="..\..\src\GLideNUI-wtl\ticpp\tinyxml.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{4F28B56B-F4B0-41B0-A785-597F6EF0163A}</ProjectGuid>
|
||||
<RootNamespace>ticpp</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'=='' and '$(VisualStudioVersion)' != '12.0' and '$(VisualStudioVersion)' != '14.0'">
|
||||
<LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
|
||||
<TargetPlatformVersion>$(WindowsTargetPlatformVersion)</TargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolSet>$(DefaultPlatformToolset)</PlatformToolSet>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\lib\</OutDir>
|
||||
<IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>TIXML_USE_TICPP;_WINDOWS;WIN32;_DEBUG;_LIB;TIXML_USE_TICPP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>TIXML_USE_TICPP;_WINDOWS;WIN32;_DEBUG;_LIB;TIXML_USE_TICPP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>TIXML_USE_TICPP;_WINDOWS;WIN32;NDEBUG;_LIB;TIXML_USE_TICPP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>TIXML_USE_TICPP;_WINDOWS;WIN32;NDEBUG;_LIB;TIXML_USE_TICPP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
51
projects/msvc/ticpp.vcxproj.filters
Normal file
51
projects/msvc/ticpp.vcxproj.filters
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\ticpp\ticpp.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\ticpp\tinystr.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\ticpp\tinyxml.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\ticpp\tinyxmlerror.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\ticpp\tinyxmlparser.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\GLideNUI-wtl\ticpp\ticpp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\GLideNUI-wtl\ticpp\ticppapi.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\GLideNUI-wtl\ticpp\ticpprc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\GLideNUI-wtl\ticpp\tinystr.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\GLideNUI-wtl\ticpp\tinyxml.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
129
projects/msvc/ts2lang.vcxproj
Normal file
129
projects/msvc/ts2lang.vcxproj
Normal file
|
@ -0,0 +1,129 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{5480BC17-9C40-4E41-8AD4-AE12316D4CA4}</ProjectGuid>
|
||||
<RootNamespace>ts2lang</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'=='' and '$(VisualStudioVersion)' != '12.0' and '$(VisualStudioVersion)' != '14.0'">
|
||||
<LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
|
||||
<TargetPlatformVersion>$(WindowsTargetPlatformVersion)</TargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolSet>$(DefaultPlatformToolset)</PlatformToolSet>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)build\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<PostBuildEvent>
|
||||
<Command>if not exist "../../translations/wtl" mkdir "../../translations/wtl"
|
||||
"$(TargetDir)ts2lang.exe" "../../translations" "../../translations/wtl"</Command>
|
||||
<Message>Converting .ts translations to .Lang...</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\Language.cpp" />
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\util\ts2lang.cpp" />
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\util\md5.cpp" />
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\util\path.cpp" />
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\util\StdString.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="ticpp.vcxproj">
|
||||
<Project>{4f28b56b-f4b0-41b0-a785-597f6ef0163a}</Project>
|
||||
<UseLibraryDependencyInputs>true</UseLibraryDependencyInputs>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\GLideNUI-wtl\Language.h" />
|
||||
<ClInclude Include="..\..\src\GLideNUI-wtl\util\md5.h" />
|
||||
<ClInclude Include="..\..\src\GLideNUI-wtl\util\path.h" />
|
||||
<ClInclude Include="..\..\src\GLideNUI-wtl\util\StdString.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
42
projects/msvc/ts2lang.vcxproj.filters
Normal file
42
projects/msvc/ts2lang.vcxproj.filters
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\util\md5.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\util\path.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\util\StdString.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\util\ts2lang.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\GLideNUI-wtl\Language.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\GLideNUI-wtl\util\md5.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\GLideNUI-wtl\util\path.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\GLideNUI-wtl\util\StdString.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\GLideNUI-wtl\Language.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{3f27dc7e-8d4f-4179-815f-f9af8ff8d7c3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{243e9857-b78f-490f-8b77-f3a387040f09}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
1084
src/GLideNUI-wtl/ticpp/ticpp.cpp
Normal file
1084
src/GLideNUI-wtl/ticpp/ticpp.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1862
src/GLideNUI-wtl/ticpp/ticpp.h
Normal file
1862
src/GLideNUI-wtl/ticpp/ticpp.h
Normal file
File diff suppressed because it is too large
Load Diff
52
src/GLideNUI-wtl/ticpp/ticppapi.h
Normal file
52
src/GLideNUI-wtl/ticpp/ticppapi.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
Copyright (c) 2012 Matt Janisz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef TICPP_API_INCLUDED
|
||||
#define TICPP_API_INCLUDED
|
||||
|
||||
#undef TICPP_API
|
||||
|
||||
#if defined(_WIN32) | defined(WIN32) | defined(WINDOWS) | defined(_WINDOWS)
|
||||
// define BUILD_TICPP_DLL when building TiCPP dll.
|
||||
#ifdef BUILD_TICPP_DLL
|
||||
#define TICPP_API __declspec(dllexport)
|
||||
#endif
|
||||
|
||||
// define TICPP_DLL when linking TiCPP dll.
|
||||
#ifdef TICPP_DLL
|
||||
#define TICPP_API __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
// Disable dll-interface warning
|
||||
#ifdef TICPP_API
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4251 ) // X needs to have dll-interface to be used by clients of class Y
|
||||
#pragma warning( disable : 4275 ) // X is derived from class Y but only X is exported
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef TICPP_API
|
||||
//linux or windows-static library defines
|
||||
#define TICPP_API
|
||||
#endif
|
||||
|
||||
#endif // TICPP_API_INCLUDED
|
129
src/GLideNUI-wtl/ticpp/ticpprc.h
Normal file
129
src/GLideNUI-wtl/ticpp/ticpprc.h
Normal file
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
http://code.google.com/p/ticpp/
|
||||
Copyright (c) 2006 Ryan Pusztai, Ryan Mulder
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS FILE WAS ALTERED BY Matt Janisz, 12. October 2012.
|
||||
*
|
||||
* - added ticppapi.h include and TICPP_API dll-interface to support building DLL using VS200X
|
||||
*/
|
||||
|
||||
#ifdef TIXML_USE_TICPP
|
||||
|
||||
#ifndef TICPPRC_INCLUDED
|
||||
#define TICPPRC_INCLUDED
|
||||
|
||||
#include "ticppapi.h"
|
||||
#include <vector>
|
||||
|
||||
// Forward declare ticpp::Node, so it can be made a friend of TiCppRC
|
||||
namespace ticpp
|
||||
{
|
||||
class TICPP_API Base;
|
||||
}
|
||||
|
||||
// Forward declare TiCppRCImp so TiCppRC can hold a pointer to it
|
||||
class TICPP_API TiCppRCImp;
|
||||
|
||||
/**
|
||||
Base class for reference counting functionality
|
||||
*/
|
||||
class TICPP_API TiCppRC
|
||||
{
|
||||
// Allow ticpp::Node to directly modify reference count
|
||||
friend class ticpp::Base;
|
||||
|
||||
private:
|
||||
|
||||
TiCppRCImp* m_tiRC; /**< Pointer to reference counter */
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
Constructor
|
||||
Spawns new reference counter with a pointer to this
|
||||
*/
|
||||
TiCppRC();
|
||||
|
||||
/**
|
||||
Destructor
|
||||
Nullifies the pointer to this held by the reference counter
|
||||
Decrements reference count
|
||||
*/
|
||||
virtual ~TiCppRC();
|
||||
|
||||
std::vector< ticpp::Base* > m_spawnedWrappers; /**< Remember all wrappers that we've created with 'new' - ( e.g. NodeFactory, FirstChildElement, etc. )*/
|
||||
|
||||
/**
|
||||
Delete all container objects we've spawned with 'new'.
|
||||
*/
|
||||
void DeleteSpawnedWrappers();
|
||||
};
|
||||
|
||||
class TICPP_API TiCppRCImp
|
||||
{
|
||||
private:
|
||||
|
||||
int m_count; /**< Holds reference count to me, and to the node I point to */
|
||||
|
||||
TiCppRC* m_tiCppRC; /**< Holds pointer to an object inheriting TiCppRC */
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
Initializes m_tiCppRC pointer, and set reference count to 1
|
||||
*/
|
||||
TiCppRCImp( TiCppRC* tiCppRC );
|
||||
|
||||
/**
|
||||
Allows the TiCppRC object to set the pointer to itself ( m_tiCppRc ) to NULL when the TiCppRC object is deleted
|
||||
*/
|
||||
void Nullify();
|
||||
|
||||
/**
|
||||
Increment Reference Count
|
||||
*/
|
||||
void IncRef();
|
||||
|
||||
/**
|
||||
Decrement Reference Count
|
||||
*/
|
||||
void DecRef();
|
||||
|
||||
/**
|
||||
Set Reference Count to 1 - dangerous! - Use only if you are sure of the consequences
|
||||
*/
|
||||
void InitRef();
|
||||
|
||||
/**
|
||||
Get internal pointer to the TiCppRC object - not reference counted, use at your own risk
|
||||
*/
|
||||
TiCppRC* Get();
|
||||
|
||||
/**
|
||||
Returns state of internal pointer - will be null if the object was deleted
|
||||
*/
|
||||
bool IsNull();
|
||||
};
|
||||
|
||||
#endif // TICPP_INCLUDED
|
||||
|
||||
#endif // TIXML_USE_TICPP
|
116
src/GLideNUI-wtl/ticpp/tinystr.cpp
Normal file
116
src/GLideNUI-wtl/ticpp/tinystr.cpp
Normal file
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
www.sourceforge.net/projects/tinyxml
|
||||
Original file by Yves Berquin.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS FILE WAS ALTERED BY Tyge Løvset, 7. April 2005.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TIXML_USE_STL
|
||||
|
||||
#include "tinystr.h"
|
||||
|
||||
// Error value for find primitive
|
||||
const TiXmlString::size_type TiXmlString::npos = static_cast< TiXmlString::size_type >(-1);
|
||||
|
||||
|
||||
// Null rep.
|
||||
TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, { '\0' } };
|
||||
|
||||
|
||||
void TiXmlString::reserve (size_type cap)
|
||||
{
|
||||
if (cap > capacity())
|
||||
{
|
||||
TiXmlString tmp;
|
||||
tmp.init(length(), cap);
|
||||
memcpy(tmp.start(), data(), length());
|
||||
swap(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TiXmlString& TiXmlString::assign(const char* str, size_type len)
|
||||
{
|
||||
size_type cap = capacity();
|
||||
if (len > cap || cap > 3*(len + 8))
|
||||
{
|
||||
TiXmlString tmp;
|
||||
tmp.init(len);
|
||||
memcpy(tmp.start(), str, len);
|
||||
swap(tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
memmove(start(), str, len);
|
||||
set_size(len);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
TiXmlString& TiXmlString::append(const char* str, size_type len)
|
||||
{
|
||||
size_type newsize = length() + len;
|
||||
if (newsize > capacity())
|
||||
{
|
||||
reserve (newsize + capacity());
|
||||
}
|
||||
memmove(finish(), str, len);
|
||||
set_size(newsize);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
TiXmlString operator + (const TiXmlString & a, const TiXmlString & b)
|
||||
{
|
||||
TiXmlString tmp;
|
||||
tmp.reserve(a.length() + b.length());
|
||||
tmp += a;
|
||||
tmp += b;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
TiXmlString operator + (const TiXmlString & a, const char* b)
|
||||
{
|
||||
TiXmlString tmp;
|
||||
TiXmlString::size_type b_len = static_cast<TiXmlString::size_type>( strlen(b) );
|
||||
tmp.reserve(a.length() + b_len);
|
||||
tmp += a;
|
||||
tmp.append(b, b_len);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
TiXmlString operator + (const char* a, const TiXmlString & b)
|
||||
{
|
||||
TiXmlString tmp;
|
||||
TiXmlString::size_type a_len = static_cast<TiXmlString::size_type>( strlen(a) );
|
||||
tmp.reserve(a_len + b.length());
|
||||
tmp.append(a, a_len);
|
||||
tmp += b;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
#endif // TIXML_USE_STL
|
326
src/GLideNUI-wtl/ticpp/tinystr.h
Normal file
326
src/GLideNUI-wtl/ticpp/tinystr.h
Normal file
|
@ -0,0 +1,326 @@
|
|||
/*
|
||||
www.sourceforge.net/projects/tinyxml
|
||||
Original file by Yves Berquin.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS FILE WAS ALTERED BY Tyge Lovset, 7. April 2005.
|
||||
*
|
||||
* - completely rewritten. compact, clean, and fast implementation.
|
||||
* - sizeof(TiXmlString) = pointer size (4 bytes on 32-bit systems)
|
||||
* - fixed reserve() to work as per specification.
|
||||
* - fixed buggy compares operator==(), operator<(), and operator>()
|
||||
* - fixed operator+=() to take a const ref argument, following spec.
|
||||
* - added "copy" constructor with length, and most compare operators.
|
||||
* - added swap(), clear(), size(), capacity(), operator+().
|
||||
*/
|
||||
|
||||
/*
|
||||
* THIS FILE WAS ALTERED BY Matt Janisz, 12. October 2012.
|
||||
*
|
||||
* - added ticppapi.h include and TICPP_API dll-interface to support building DLL using VS200X
|
||||
*/
|
||||
|
||||
#ifndef TIXML_USE_STL
|
||||
|
||||
#ifndef TIXML_STRING_INCLUDED
|
||||
#define TIXML_STRING_INCLUDED
|
||||
|
||||
#include "ticppapi.h"
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
/* The support for explicit isn't that universal, and it isn't really
|
||||
required - it is used to check that the TiXmlString class isn't incorrectly
|
||||
used. Be nice to old compilers and macro it here:
|
||||
*/
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200 )
|
||||
// Microsoft visual studio, version 6 and higher.
|
||||
#define TIXML_EXPLICIT explicit
|
||||
#elif defined(__GNUC__) && (__GNUC__ >= 3 )
|
||||
// GCC version 3 and higher.s
|
||||
#define TIXML_EXPLICIT explicit
|
||||
#else
|
||||
#define TIXML_EXPLICIT
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
TiXmlString is an emulation of a subset of the std::string template.
|
||||
Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.
|
||||
Only the member functions relevant to the TinyXML project have been implemented.
|
||||
The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
|
||||
a string and there's no more room, we allocate a buffer twice as big as we need.
|
||||
*/
|
||||
class TICPP_API TiXmlString
|
||||
{
|
||||
public :
|
||||
// The size type used
|
||||
typedef size_t size_type;
|
||||
|
||||
// Error value for find primitive
|
||||
static const size_type npos; // = -1;
|
||||
|
||||
|
||||
// TiXmlString empty constructor
|
||||
TiXmlString () : rep_(&nullrep_)
|
||||
{
|
||||
}
|
||||
|
||||
// TiXmlString copy constructor
|
||||
TiXmlString ( const TiXmlString & copy) : rep_(0)
|
||||
{
|
||||
init(copy.length());
|
||||
memcpy(start(), copy.data(), length());
|
||||
}
|
||||
|
||||
// TiXmlString constructor, based on a string
|
||||
TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0)
|
||||
{
|
||||
init( static_cast<size_type>( strlen(copy) ));
|
||||
memcpy(start(), copy, length());
|
||||
}
|
||||
|
||||
// TiXmlString constructor, based on a string
|
||||
TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0)
|
||||
{
|
||||
init(len);
|
||||
memcpy(start(), str, len);
|
||||
}
|
||||
|
||||
// TiXmlString destructor
|
||||
~TiXmlString ()
|
||||
{
|
||||
quit();
|
||||
}
|
||||
|
||||
// = operator
|
||||
TiXmlString& operator = (const char * copy)
|
||||
{
|
||||
return assign( copy, (size_type)strlen(copy));
|
||||
}
|
||||
|
||||
// = operator
|
||||
TiXmlString& operator = (const TiXmlString & copy)
|
||||
{
|
||||
return assign(copy.start(), copy.length());
|
||||
}
|
||||
|
||||
|
||||
// += operator. Maps to append
|
||||
TiXmlString& operator += (const char * suffix)
|
||||
{
|
||||
return append(suffix, static_cast<size_type>( strlen(suffix) ));
|
||||
}
|
||||
|
||||
// += operator. Maps to append
|
||||
TiXmlString& operator += (char single)
|
||||
{
|
||||
return append(&single, 1);
|
||||
}
|
||||
|
||||
// += operator. Maps to append
|
||||
TiXmlString& operator += (const TiXmlString & suffix)
|
||||
{
|
||||
return append(suffix.data(), suffix.length());
|
||||
}
|
||||
|
||||
|
||||
// Convert a TiXmlString into a null-terminated char *
|
||||
const char * c_str () const { return rep_->str; }
|
||||
|
||||
// Convert a TiXmlString into a char * (need not be null terminated).
|
||||
const char * data () const { return rep_->str; }
|
||||
|
||||
// Return the length of a TiXmlString
|
||||
size_type length () const { return rep_->size; }
|
||||
|
||||
// Alias for length()
|
||||
size_type size () const { return rep_->size; }
|
||||
|
||||
// Checks if a TiXmlString is empty
|
||||
bool empty () const { return rep_->size == 0; }
|
||||
|
||||
// Return capacity of string
|
||||
size_type capacity () const { return rep_->capacity; }
|
||||
|
||||
|
||||
// single char extraction
|
||||
const char& at (size_type index) const
|
||||
{
|
||||
assert( index < length() );
|
||||
return rep_->str[ index ];
|
||||
}
|
||||
|
||||
// [] operator
|
||||
char& operator [] (size_type index) const
|
||||
{
|
||||
assert( index < length() );
|
||||
return rep_->str[ index ];
|
||||
}
|
||||
|
||||
// find a char in a string. Return TiXmlString::npos if not found
|
||||
size_type find (char lookup) const
|
||||
{
|
||||
return find(lookup, 0);
|
||||
}
|
||||
|
||||
// find a char in a string from an offset. Return TiXmlString::npos if not found
|
||||
size_type find (char tofind, size_type offset) const
|
||||
{
|
||||
if (offset >= length()) return npos;
|
||||
|
||||
for (const char* p = c_str() + offset; *p != '\0'; ++p)
|
||||
{
|
||||
if (*p == tofind) return static_cast< size_type >( p - c_str() );
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
void clear ()
|
||||
{
|
||||
//Lee:
|
||||
//The original was just too strange, though correct:
|
||||
// TiXmlString().swap(*this);
|
||||
//Instead use the quit & re-init:
|
||||
quit();
|
||||
init(0,0);
|
||||
}
|
||||
|
||||
/* Function to reserve a big amount of data when we know we'll need it. Be aware that this
|
||||
function DOES NOT clear the content of the TiXmlString if any exists.
|
||||
*/
|
||||
void reserve (size_type cap);
|
||||
|
||||
TiXmlString& assign (const char* str, size_type len);
|
||||
|
||||
TiXmlString& append (const char* str, size_type len);
|
||||
|
||||
void swap (TiXmlString& other)
|
||||
{
|
||||
Rep* r = rep_;
|
||||
rep_ = other.rep_;
|
||||
other.rep_ = r;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void init(size_type sz) { init(sz, sz); }
|
||||
void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; }
|
||||
char* start() const { return rep_->str; }
|
||||
char* finish() const { return rep_->str + rep_->size; }
|
||||
|
||||
struct Rep
|
||||
{
|
||||
size_type size, capacity;
|
||||
char str[1];
|
||||
};
|
||||
|
||||
void init(size_type sz, size_type cap)
|
||||
{
|
||||
if (cap)
|
||||
{
|
||||
// Lee: the original form:
|
||||
// rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap));
|
||||
// doesn't work in some cases of new being overloaded. Switching
|
||||
// to the normal allocation, although use an 'int' for systems
|
||||
// that are overly picky about structure alignment.
|
||||
const size_type bytesNeeded = sizeof(Rep) + cap;
|
||||
const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int );
|
||||
rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] );
|
||||
|
||||
rep_->str[ rep_->size = sz ] = '\0';
|
||||
rep_->capacity = cap;
|
||||
}
|
||||
else
|
||||
{
|
||||
rep_ = &nullrep_;
|
||||
}
|
||||
}
|
||||
|
||||
void quit()
|
||||
{
|
||||
if (rep_ != &nullrep_)
|
||||
{
|
||||
// The rep_ is really an array of ints. (see the allocator, above).
|
||||
// Cast it back before delete, so the compiler won't incorrectly call destructors.
|
||||
delete [] ( reinterpret_cast<int*>( rep_ ) );
|
||||
}
|
||||
}
|
||||
|
||||
Rep * rep_;
|
||||
static Rep nullrep_;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
inline bool operator == (const TiXmlString & a, const TiXmlString & b)
|
||||
{
|
||||
return ( a.length() == b.length() ) // optimization on some platforms
|
||||
&& ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare
|
||||
}
|
||||
inline bool operator < (const TiXmlString & a, const TiXmlString & b)
|
||||
{
|
||||
return strcmp(a.c_str(), b.c_str()) < 0;
|
||||
}
|
||||
|
||||
inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); }
|
||||
inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; }
|
||||
inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); }
|
||||
inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); }
|
||||
|
||||
inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; }
|
||||
inline bool operator == (const char* a, const TiXmlString & b) { return b == a; }
|
||||
inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); }
|
||||
inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); }
|
||||
|
||||
TiXmlString operator + (const TiXmlString & a, const TiXmlString & b);
|
||||
TiXmlString operator + (const TiXmlString & a, const char* b);
|
||||
TiXmlString operator + (const char* a, const TiXmlString & b);
|
||||
|
||||
|
||||
/*
|
||||
TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString.
|
||||
Only the operators that we need for TinyXML have been developped.
|
||||
*/
|
||||
class TICPP_API TiXmlOutStream : public TiXmlString
|
||||
{
|
||||
public :
|
||||
|
||||
// TiXmlOutStream << operator.
|
||||
TiXmlOutStream & operator << (const TiXmlString & in)
|
||||
{
|
||||
*this += in;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// TiXmlOutStream << operator.
|
||||
TiXmlOutStream & operator << (const char * in)
|
||||
{
|
||||
*this += in;
|
||||
return *this;
|
||||
}
|
||||
|
||||
} ;
|
||||
|
||||
#endif // TIXML_STRING_INCLUDED
|
||||
#endif // TIXML_USE_STL
|
1969
src/GLideNUI-wtl/ticpp/tinyxml.cpp
Normal file
1969
src/GLideNUI-wtl/ticpp/tinyxml.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1889
src/GLideNUI-wtl/ticpp/tinyxml.h
Normal file
1889
src/GLideNUI-wtl/ticpp/tinyxml.h
Normal file
File diff suppressed because it is too large
Load Diff
53
src/GLideNUI-wtl/ticpp/tinyxmlerror.cpp
Normal file
53
src/GLideNUI-wtl/ticpp/tinyxmlerror.cpp
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
www.sourceforge.net/projects/tinyxml
|
||||
Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
*/
|
||||
|
||||
#include "tinyxml.h"
|
||||
|
||||
// The goal of the seperate error file is to make the first
|
||||
// step towards localization. tinyxml (currently) only supports
|
||||
// english error messages, but the could now be translated.
|
||||
//
|
||||
// It also cleans up the code a bit.
|
||||
//
|
||||
|
||||
const char* TiXmlBase::errorString[ TIXML_ERROR_STRING_COUNT ] =
|
||||
{
|
||||
"No error",
|
||||
"Error",
|
||||
"Failed to open file",
|
||||
"Memory allocation failed.",
|
||||
"Error parsing Element.",
|
||||
"Failed to read Element name",
|
||||
"Error reading Element value.",
|
||||
"Error reading Attributes.",
|
||||
"Error: empty tag.",
|
||||
"Error reading end tag.",
|
||||
"Error parsing Unknown.",
|
||||
"Error parsing Comment.",
|
||||
"Error parsing Declaration.",
|
||||
"Error document empty.",
|
||||
"Error null (0) or unexpected EOF found in input stream.",
|
||||
"Error parsing CDATA.",
|
||||
"Error when TiXmlDocument added to document, because TiXmlDocument can only be at the root.",
|
||||
};
|
1720
src/GLideNUI-wtl/ticpp/tinyxmlparser.cpp
Normal file
1720
src/GLideNUI-wtl/ticpp/tinyxmlparser.cpp
Normal file
File diff suppressed because it is too large
Load Diff
481
src/GLideNUI-wtl/util/md5.cpp
Normal file
481
src/GLideNUI-wtl/util/md5.cpp
Normal file
|
@ -0,0 +1,481 @@
|
|||
// MD5.CC - source code for the C++/object oriented translation and
|
||||
// modification of MD5.
|
||||
|
||||
// Translation and modification (c) 1995 by Mordechai T. Abzug
|
||||
|
||||
// This translation/ modification is provided "as is," without express or
|
||||
// implied warranty of any kind.
|
||||
|
||||
// The translator/ modifier does not claim (1) that MD5 will do what you think
|
||||
// it does; (2) that this translation/ modification is accurate; or (3) that
|
||||
// this software is "merchantible." (Language for this disclaimer partially
|
||||
// copied from the disclaimer below).
|
||||
|
||||
/* based on:
|
||||
|
||||
MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
|
||||
MDDRIVER.C - test driver for MD2, MD4 and MD5
|
||||
|
||||
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
|
||||
rights reserved.
|
||||
|
||||
License to copy and use this software is granted provided that it
|
||||
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
|
||||
Algorithm" in all material mentioning or referencing this software
|
||||
or this function.
|
||||
|
||||
License is also granted to make and use derivative works provided
|
||||
that such works are identified as "derived from the RSA Data
|
||||
Security, Inc. MD5 Message-Digest Algorithm" in all material
|
||||
mentioning or referencing the derived work.
|
||||
|
||||
RSA Data Security, Inc. makes no representations concerning either
|
||||
the merchantability of this software or the suitability of this
|
||||
software for any particular purpose. It is provided "as is"
|
||||
without express or implied warranty of any kind.
|
||||
|
||||
These notices must be retained in any copies of any part of this
|
||||
documentation and/or software.
|
||||
|
||||
*/
|
||||
#include "md5.h"
|
||||
|
||||
// MD5 simple initialization method
|
||||
MD5::MD5()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
MD5::~MD5()
|
||||
{
|
||||
}
|
||||
|
||||
// MD5 block update operation. Continues an MD5 message-digest
|
||||
// operation, processing another message block, and updating the
|
||||
// context.
|
||||
void MD5::update(const uint1 *input, uint4 input_length)
|
||||
{
|
||||
uint4 input_index, buffer_index;
|
||||
uint4 buffer_space; // how much space is left in buffer
|
||||
|
||||
if (finalized) // so we can't update!
|
||||
{
|
||||
//WriteTrace(TraceMD5, TraceError, "Can't update a finalized digest!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Compute number of bytes mod 64
|
||||
buffer_index = (unsigned int)((count[0] >> 3) & 0x3F);
|
||||
|
||||
// Update number of bits
|
||||
if ((count[0] += ((uint4)input_length << 3)) < ((uint4)input_length << 3))
|
||||
{
|
||||
count[1]++;
|
||||
}
|
||||
|
||||
count[1] += ((uint4)input_length >> 29);
|
||||
|
||||
buffer_space = 64 - buffer_index; // how much space is left in buffer
|
||||
|
||||
// Transform as many times as possible.
|
||||
if (input_length >= buffer_space) // ie. we have enough to fill the buffer
|
||||
{
|
||||
// fill the rest of the buffer and transform
|
||||
memcpy(buffer + buffer_index, (unsigned char *)input, buffer_space);
|
||||
transform(buffer);
|
||||
|
||||
// now, transform each 64-byte piece of the input, bypassing the buffer
|
||||
for (input_index = buffer_space; input_index + 63 < input_length; input_index += 64)
|
||||
{
|
||||
transform((unsigned char *)(input + input_index));
|
||||
}
|
||||
|
||||
buffer_index = 0; // so we can buffer remaining
|
||||
}
|
||||
else
|
||||
{
|
||||
input_index = 0; // so we can buffer the whole input
|
||||
}
|
||||
|
||||
// and here we do the buffering:
|
||||
memcpy(buffer + buffer_index, (unsigned char *)(input + input_index), input_length - input_index);
|
||||
}
|
||||
|
||||
// MD5 update for files.
|
||||
// Like above, except that it works on files (and uses above as a primitive.)
|
||||
|
||||
void MD5::update(FILE *file)
|
||||
{
|
||||
unsigned char buffer[1024];
|
||||
int len;
|
||||
|
||||
do
|
||||
{
|
||||
len = (int)fread(buffer, 1, 1024, file);
|
||||
if (len)
|
||||
{
|
||||
update(buffer, len);
|
||||
}
|
||||
} while (len);
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
// MD5 finalization. Ends an MD5 message-digest operation, writing the
|
||||
// the message digest and zeroizing the context.
|
||||
|
||||
void MD5::finalize()
|
||||
{
|
||||
unsigned char bits[8];
|
||||
unsigned int index, padLen;
|
||||
static uint1 PADDING[64] =
|
||||
{
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
if (finalized)
|
||||
{
|
||||
//WriteTrace(TraceMD5, TraceError, "Already finalized this digest!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Save number of bits
|
||||
encode(bits, count, 8);
|
||||
|
||||
// Pad out to 56 mod 64.
|
||||
index = (uint4)((count[0] >> 3) & 0x3f);
|
||||
padLen = (index < 56) ? (56 - index) : (120 - index);
|
||||
update(PADDING, padLen);
|
||||
|
||||
// Append length (before padding)
|
||||
update(bits, 8);
|
||||
|
||||
// Store state in digest
|
||||
encode(digest, state, 16);
|
||||
|
||||
// Zeroize sensitive information
|
||||
memset(buffer, 0, sizeof(*buffer));
|
||||
|
||||
finalized = 1;
|
||||
}
|
||||
|
||||
MD5::MD5(CPath File)
|
||||
{
|
||||
init(); // must be called be all constructors
|
||||
if (File.Exists())
|
||||
{
|
||||
FILE * fp = fopen((const char *)File, "rb");
|
||||
if (fp)
|
||||
{
|
||||
update(fp);
|
||||
}
|
||||
}
|
||||
finalize();
|
||||
}
|
||||
|
||||
MD5::MD5(FILE *file)
|
||||
{
|
||||
init(); // must be called be all constructors
|
||||
update(file);
|
||||
finalize();
|
||||
}
|
||||
|
||||
MD5::MD5(const unsigned char *input, unsigned int input_length)
|
||||
{
|
||||
init(); // must called by all constructors
|
||||
update(input, input_length);
|
||||
finalize();
|
||||
}
|
||||
|
||||
MD5::MD5(const stdstr & string)
|
||||
{
|
||||
init(); // must called by all constructors
|
||||
update((const unsigned char *)string.c_str(), string.length());
|
||||
finalize();
|
||||
}
|
||||
|
||||
const unsigned char *MD5::raw_digest()
|
||||
{
|
||||
if (!finalized)
|
||||
{
|
||||
//WriteTrace(TraceMD5, TraceError, "Can't get digest if you haven't finalized the digest!");
|
||||
return ((unsigned char*) "");
|
||||
}
|
||||
return digest;
|
||||
}
|
||||
|
||||
void MD5::get_digest(MD5Digest& extdigest)
|
||||
{
|
||||
if (!finalized)
|
||||
{
|
||||
//WriteTrace(TraceMD5, TraceError, "Can't get digest if you haven't finalized the digest!");
|
||||
memset(extdigest.digest, 0, sizeof(extdigest.digest));
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(extdigest.digest, digest, 16);
|
||||
}
|
||||
|
||||
const char *MD5::hex_digest()
|
||||
{
|
||||
if (m_hex_digest.length())
|
||||
{
|
||||
return m_hex_digest.c_str();
|
||||
}
|
||||
|
||||
if (!finalized)
|
||||
{
|
||||
//WriteTrace(TraceMD5, TraceError, "Can't get digest if you haven't finalized the digest!");
|
||||
return "";
|
||||
}
|
||||
char c[33];
|
||||
memset((unsigned char *)c, 0, 33);
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
sprintf(c + i * 2, "%02X", digest[i]);
|
||||
}
|
||||
|
||||
c[32] = '\0';
|
||||
m_hex_digest = c;
|
||||
|
||||
return m_hex_digest.c_str();
|
||||
}
|
||||
|
||||
// PRIVATE METHODS:
|
||||
void MD5::init()
|
||||
{
|
||||
finalized = 0; // we just started!
|
||||
|
||||
// Nothing counted, so count=0
|
||||
count[0] = 0;
|
||||
count[1] = 0;
|
||||
|
||||
// Load magic initialization constants.
|
||||
state[0] = 0x67452301;
|
||||
state[1] = 0xefcdab89;
|
||||
state[2] = 0x98badcfe;
|
||||
state[3] = 0x10325476;
|
||||
|
||||
::memset(digest, 0, sizeof(digest));
|
||||
::memset(buffer, 0, sizeof(buffer));
|
||||
|
||||
m_hex_digest = NULL;
|
||||
}
|
||||
|
||||
// Constants for MD5Transform routine.
|
||||
// Although we could use C++ style constants, defines are actually better,
|
||||
// since they let us easily evade scope clashes.
|
||||
|
||||
#define S11 7
|
||||
#define S12 12
|
||||
#define S13 17
|
||||
#define S14 22
|
||||
#define S21 5
|
||||
#define S22 9
|
||||
#define S23 14
|
||||
#define S24 20
|
||||
#define S31 4
|
||||
#define S32 11
|
||||
#define S33 16
|
||||
#define S34 23
|
||||
#define S41 6
|
||||
#define S42 10
|
||||
#define S43 15
|
||||
#define S44 21
|
||||
|
||||
// MD5 basic transformation. Transforms state based on block.
|
||||
void MD5::transform(uint1 block[64])
|
||||
{
|
||||
uint4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
|
||||
|
||||
decode(x, block, 64);
|
||||
|
||||
//ATLASSERT(!finalized); // not just a user error, since the method is private
|
||||
|
||||
/* Round 1 */
|
||||
FF(a, b, c, d, x[0], S11, 0xd76aa478); /* 1 */
|
||||
FF(d, a, b, c, x[1], S12, 0xe8c7b756); /* 2 */
|
||||
FF(c, d, a, b, x[2], S13, 0x242070db); /* 3 */
|
||||
FF(b, c, d, a, x[3], S14, 0xc1bdceee); /* 4 */
|
||||
FF(a, b, c, d, x[4], S11, 0xf57c0faf); /* 5 */
|
||||
FF(d, a, b, c, x[5], S12, 0x4787c62a); /* 6 */
|
||||
FF(c, d, a, b, x[6], S13, 0xa8304613); /* 7 */
|
||||
FF(b, c, d, a, x[7], S14, 0xfd469501); /* 8 */
|
||||
FF(a, b, c, d, x[8], S11, 0x698098d8); /* 9 */
|
||||
FF(d, a, b, c, x[9], S12, 0x8b44f7af); /* 10 */
|
||||
FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
|
||||
FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
|
||||
FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
|
||||
FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
|
||||
FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
|
||||
FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
|
||||
|
||||
/* Round 2 */
|
||||
GG(a, b, c, d, x[1], S21, 0xf61e2562); /* 17 */
|
||||
GG(d, a, b, c, x[6], S22, 0xc040b340); /* 18 */
|
||||
GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
|
||||
GG(b, c, d, a, x[0], S24, 0xe9b6c7aa); /* 20 */
|
||||
GG(a, b, c, d, x[5], S21, 0xd62f105d); /* 21 */
|
||||
GG(d, a, b, c, x[10], S22, 0x2441453); /* 22 */
|
||||
GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
|
||||
GG(b, c, d, a, x[4], S24, 0xe7d3fbc8); /* 24 */
|
||||
GG(a, b, c, d, x[9], S21, 0x21e1cde6); /* 25 */
|
||||
GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
|
||||
GG(c, d, a, b, x[3], S23, 0xf4d50d87); /* 27 */
|
||||
GG(b, c, d, a, x[8], S24, 0x455a14ed); /* 28 */
|
||||
GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
|
||||
GG(d, a, b, c, x[2], S22, 0xfcefa3f8); /* 30 */
|
||||
GG(c, d, a, b, x[7], S23, 0x676f02d9); /* 31 */
|
||||
GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
|
||||
|
||||
/* Round 3 */
|
||||
HH(a, b, c, d, x[5], S31, 0xfffa3942); /* 33 */
|
||||
HH(d, a, b, c, x[8], S32, 0x8771f681); /* 34 */
|
||||
HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
|
||||
HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
|
||||
HH(a, b, c, d, x[1], S31, 0xa4beea44); /* 37 */
|
||||
HH(d, a, b, c, x[4], S32, 0x4bdecfa9); /* 38 */
|
||||
HH(c, d, a, b, x[7], S33, 0xf6bb4b60); /* 39 */
|
||||
HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
|
||||
HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
|
||||
HH(d, a, b, c, x[0], S32, 0xeaa127fa); /* 42 */
|
||||
HH(c, d, a, b, x[3], S33, 0xd4ef3085); /* 43 */
|
||||
HH(b, c, d, a, x[6], S34, 0x4881d05); /* 44 */
|
||||
HH(a, b, c, d, x[9], S31, 0xd9d4d039); /* 45 */
|
||||
HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
|
||||
HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
|
||||
HH(b, c, d, a, x[2], S34, 0xc4ac5665); /* 48 */
|
||||
|
||||
/* Round 4 */
|
||||
II(a, b, c, d, x[0], S41, 0xf4292244); /* 49 */
|
||||
II(d, a, b, c, x[7], S42, 0x432aff97); /* 50 */
|
||||
II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
|
||||
II(b, c, d, a, x[5], S44, 0xfc93a039); /* 52 */
|
||||
II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
|
||||
II(d, a, b, c, x[3], S42, 0x8f0ccc92); /* 54 */
|
||||
II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
|
||||
II(b, c, d, a, x[1], S44, 0x85845dd1); /* 56 */
|
||||
II(a, b, c, d, x[8], S41, 0x6fa87e4f); /* 57 */
|
||||
II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
|
||||
II(c, d, a, b, x[6], S43, 0xa3014314); /* 59 */
|
||||
II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
|
||||
II(a, b, c, d, x[4], S41, 0xf7537e82); /* 61 */
|
||||
II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
|
||||
II(c, d, a, b, x[2], S43, 0x2ad7d2bb); /* 63 */
|
||||
II(b, c, d, a, x[9], S44, 0xeb86d391); /* 64 */
|
||||
|
||||
state[0] += a;
|
||||
state[1] += b;
|
||||
state[2] += c;
|
||||
state[3] += d;
|
||||
|
||||
// Zeroize sensitive information.
|
||||
memset((uint1 *)x, 0, sizeof(x));
|
||||
}
|
||||
|
||||
// Encodes input (UINT4) into output (unsigned char). Assumes len is
|
||||
// a multiple of 4.
|
||||
void MD5::encode(uint1 *output, uint4 *input, uint4 len)
|
||||
{
|
||||
unsigned int i, j;
|
||||
|
||||
for (i = 0, j = 0; j < len; i++, j += 4)
|
||||
{
|
||||
output[j] = (uint1)(input[i] & 0xff);
|
||||
output[j + 1] = (uint1)((input[i] >> 8) & 0xff);
|
||||
output[j + 2] = (uint1)((input[i] >> 16) & 0xff);
|
||||
output[j + 3] = (uint1)((input[i] >> 24) & 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
// Decodes input (unsigned char) into output (UINT4). Assumes len is
|
||||
// a multiple of 4.
|
||||
void MD5::decode(uint4 *output, uint1 *input, uint4 len)
|
||||
{
|
||||
unsigned int i, j;
|
||||
|
||||
for (i = 0, j = 0; j < len; i++, j += 4)
|
||||
{
|
||||
output[i] = ((uint4)input[j]) | (((uint4)input[j + 1]) << 8) | (((uint4)input[j + 2]) << 16) | (((uint4)input[j + 3]) << 24);
|
||||
}
|
||||
}
|
||||
|
||||
// Note: Replace "for loop" with standard memcpy if possible.
|
||||
void MD5::memcpy(uint1 *output, uint1 *input, uint4 len)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
output[i] = input[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Note: Replace "for loop" with standard memset if possible.
|
||||
void MD5::memset(uint1 *output, uint1 value, uint4 len)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
output[i] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// ROTATE_LEFT rotates x left n bits.
|
||||
|
||||
inline unsigned int MD5::rotate_left(uint4 x, uint4 n)
|
||||
{
|
||||
return (x << n) | (x >> (32 - n));
|
||||
}
|
||||
|
||||
// F, G, H and I are basic MD5 functions.
|
||||
|
||||
inline unsigned int MD5::F(uint4 x, uint4 y, uint4 z)
|
||||
{
|
||||
return (x & y) | (~x & z);
|
||||
}
|
||||
|
||||
inline unsigned int MD5::G(uint4 x, uint4 y, uint4 z)
|
||||
{
|
||||
return (x & z) | (y & ~z);
|
||||
}
|
||||
|
||||
inline unsigned int MD5::H(uint4 x, uint4 y, uint4 z)
|
||||
{
|
||||
return x ^ y ^ z;
|
||||
}
|
||||
|
||||
inline unsigned int MD5::I(uint4 x, uint4 y, uint4 z)
|
||||
{
|
||||
return y ^ (x | ~z);
|
||||
}
|
||||
|
||||
// FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
|
||||
// Rotation is separate from addition to prevent recomputation.
|
||||
|
||||
inline void MD5::FF(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac)
|
||||
{
|
||||
a += F(b, c, d) + x + ac;
|
||||
a = rotate_left(a, s) + b;
|
||||
}
|
||||
|
||||
inline void MD5::GG(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac)
|
||||
{
|
||||
a += G(b, c, d) + x + ac;
|
||||
a = rotate_left(a, s) + b;
|
||||
}
|
||||
|
||||
inline void MD5::HH(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac)
|
||||
{
|
||||
a += H(b, c, d) + x + ac;
|
||||
a = rotate_left(a, s) + b;
|
||||
}
|
||||
|
||||
inline void MD5::II(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac)
|
||||
{
|
||||
a += I(b, c, d) + x + ac;
|
||||
a = rotate_left(a, s) + b;
|
||||
}
|
150
src/GLideNUI-wtl/util/md5.h
Normal file
150
src/GLideNUI-wtl/util/md5.h
Normal file
|
@ -0,0 +1,150 @@
|
|||
// MD5.CC - source code for the C++/object oriented translation and
|
||||
// modification of MD5.
|
||||
|
||||
// Translation and modification (c) 1995 by Mordechai T. Abzug
|
||||
|
||||
// This translation/ modification is provided "as is," without express or
|
||||
// implied warranty of any kind.
|
||||
|
||||
// The translator/ modifier does not claim (1) that MD5 will do what you think
|
||||
// it does; (2) that this translation/ modification is accurate; or (3) that
|
||||
// this software is "merchantible." (Language for this disclaimer partially
|
||||
// copied from the disclaimer below).
|
||||
|
||||
/* based on:
|
||||
|
||||
MD5.H - header file for MD5C.C
|
||||
MDDRIVER.C - test driver for MD2, MD4 and MD5
|
||||
|
||||
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
|
||||
rights reserved.
|
||||
|
||||
License to copy and use this software is granted provided that it
|
||||
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
|
||||
Algorithm" in all material mentioning or referencing this software
|
||||
or this function.
|
||||
|
||||
License is also granted to make and use derivative works provided
|
||||
that such works are identified as "derived from the RSA Data
|
||||
Security, Inc. MD5 Message-Digest Algorithm" in all material
|
||||
mentioning or referencing the derived work.
|
||||
|
||||
RSA Data Security, Inc. makes no representations concerning either
|
||||
the merchantability of this software or the suitability of this
|
||||
software for any particular purpose. It is provided "as is"
|
||||
without express or implied warranty of any kind.
|
||||
|
||||
These notices must be retained in any copies of any part of this
|
||||
documentation and/or software.
|
||||
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include "path.h"
|
||||
|
||||
struct MD5Digest
|
||||
{
|
||||
MD5Digest() { Reset(); }
|
||||
unsigned char digest[16];
|
||||
|
||||
void Reset() { ::memset(digest, 0, sizeof(digest)); }
|
||||
bool IsClear()
|
||||
{
|
||||
int isClear = 0;
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
isClear += digest[i];
|
||||
}
|
||||
return (isClear == 0);
|
||||
}
|
||||
std::string String(void)
|
||||
{
|
||||
char s[33];
|
||||
|
||||
::memset(s, 0, sizeof(s));
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
sprintf(s + i * 2, "%02X", digest[i]);
|
||||
}
|
||||
s[32] = '\0';
|
||||
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
struct MD5Digest_less : std::binary_function < MD5Digest, MD5Digest, bool >
|
||||
{
|
||||
bool operator()(const MD5Digest& x, const MD5Digest& y) const
|
||||
{
|
||||
return (memcmp(x.digest, y.digest, sizeof(x.digest)) < 0);
|
||||
}
|
||||
};
|
||||
|
||||
class MD5
|
||||
{
|
||||
public:
|
||||
// methods for controlled operation:
|
||||
MD5(); // simple initializer
|
||||
~MD5();
|
||||
void update(const unsigned char *input, unsigned int input_length);
|
||||
void update(FILE *file);
|
||||
void finalize();
|
||||
|
||||
// constructors for special circumstances. All these constructors finalize
|
||||
// the MD5 context.
|
||||
MD5(CPath File); // digest File, finalize
|
||||
MD5(const unsigned char *string); // digest string, finalize
|
||||
MD5(FILE *file); // digest file, close, finalize
|
||||
MD5(const unsigned char *input, unsigned int input_length);
|
||||
MD5(const stdstr & string);
|
||||
|
||||
// methods to acquire finalized result
|
||||
void get_digest(MD5Digest& extdigest); //Digest into a digest structure
|
||||
const unsigned char *raw_digest(); // digest as a 16-byte binary array
|
||||
const char * hex_digest(); // digest as a 33-byte ascii-hex string
|
||||
|
||||
private:
|
||||
|
||||
// first, some types:
|
||||
typedef unsigned int uint4; // assumes integer is 4 words long
|
||||
typedef unsigned short int uint2; // assumes short integer is 2 words long
|
||||
typedef unsigned char uint1; // assumes char is 1 word long
|
||||
|
||||
// next, the private data:
|
||||
uint4 state[4];
|
||||
uint4 count[2]; // number of *bits*, mod 2^64
|
||||
uint1 buffer[64]; // input buffer
|
||||
uint1 digest[16];
|
||||
uint1 finalized;
|
||||
stdstr m_hex_digest;
|
||||
|
||||
// last, the private methods, mostly static:
|
||||
void init(); // called by all constructors
|
||||
void transform(uint1 *buffer); // does the real update work. Note
|
||||
// that length is implied to be 64.
|
||||
|
||||
static void encode(uint1 *dest, uint4 *src, uint4 length);
|
||||
static void decode(uint4 *dest, uint1 *src, uint4 length);
|
||||
static void memcpy(uint1 *dest, uint1 *src, uint4 length);
|
||||
static void memset(uint1 *start, uint1 val, uint4 length);
|
||||
|
||||
static inline uint4 rotate_left(uint4 x, uint4 n);
|
||||
static inline uint4 F(uint4 x, uint4 y, uint4 z);
|
||||
static inline uint4 G(uint4 x, uint4 y, uint4 z);
|
||||
static inline uint4 H(uint4 x, uint4 y, uint4 z);
|
||||
static inline uint4 I(uint4 x, uint4 y, uint4 z);
|
||||
static inline void FF(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
|
||||
uint4 s, uint4 ac);
|
||||
static inline void GG(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
|
||||
uint4 s, uint4 ac);
|
||||
static inline void HH(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
|
||||
uint4 s, uint4 ac);
|
||||
static inline void II(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
|
||||
uint4 s, uint4 ac);
|
||||
};
|
1668
src/GLideNUI-wtl/util/path.cpp
Normal file
1668
src/GLideNUI-wtl/util/path.cpp
Normal file
File diff suppressed because it is too large
Load Diff
165
src/GLideNUI-wtl/util/path.h
Normal file
165
src/GLideNUI-wtl/util/path.h
Normal file
|
@ -0,0 +1,165 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
#include "StdString.h"
|
||||
|
||||
class CPath
|
||||
{
|
||||
//Enums
|
||||
public:
|
||||
|
||||
enum DIR_CURRENT_DIRECTORY { CURRENT_DIRECTORY = 1 };
|
||||
#ifdef _WIN32
|
||||
enum DIR_MODULE_DIRECTORY { MODULE_DIRECTORY = 2 };
|
||||
enum DIR_MODULE_FILE { MODULE_FILE = 3 };
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
FIND_ATTRIBUTE_ALLFILES = 0xFFFF, // Search Include all files
|
||||
FIND_ATTRIBUTE_FILES = 0x0000, // File can be read or written to without restriction
|
||||
FIND_ATTRIBUTE_SUBDIR = 0x0010, // Subdirectories
|
||||
};
|
||||
|
||||
//Attributes
|
||||
private:
|
||||
std::string m_strPath;
|
||||
#ifdef _WIN32
|
||||
void * m_hFindFile;
|
||||
static void * m_hInst;
|
||||
#else
|
||||
void * m_OpenedDir;
|
||||
std::string m_FindWildcard;
|
||||
#endif
|
||||
uint32_t m_dwFindFileAttributes;
|
||||
|
||||
public:
|
||||
//Methods
|
||||
|
||||
//Construction / destruction
|
||||
CPath();
|
||||
CPath(const CPath& rPath);
|
||||
CPath(const char * lpszPath);
|
||||
CPath(const char * lpszPath, const char * NameExten);
|
||||
CPath(const std::string& strPath);
|
||||
CPath(const std::string& strPath, const char * NameExten);
|
||||
CPath(const std::string& strPath, const std::string& NameExten);
|
||||
|
||||
CPath(DIR_CURRENT_DIRECTORY sdt, const char * NameExten = NULL);
|
||||
#ifdef _WIN32
|
||||
CPath(DIR_MODULE_DIRECTORY sdt, const char * NameExten = NULL);
|
||||
CPath(DIR_MODULE_FILE sdt);
|
||||
#endif
|
||||
virtual ~CPath();
|
||||
|
||||
//Operators
|
||||
CPath& operator = (const CPath& rPath);
|
||||
CPath& operator = (const char * lpszPath);
|
||||
CPath& operator = (const std::string & strPath);
|
||||
bool operator == (const CPath& rPath) const;
|
||||
bool operator != (const CPath& rPath) const;
|
||||
operator const char *() const;
|
||||
operator const std::string &() { return m_strPath; }
|
||||
|
||||
//Get path components
|
||||
#ifdef _WIN32
|
||||
void GetDriveDirectory(std::string & rDriveDirectory) const;
|
||||
std::string GetDriveDirectory(void) const;
|
||||
#endif
|
||||
void GetDirectory(std::string& rDirectory) const;
|
||||
std::string GetDirectory(void) const;
|
||||
void GetName(std::string& rName) const;
|
||||
std::string GetName(void) const;
|
||||
void GetNameExtension(std::string& rNameExtension) const;
|
||||
std::string GetNameExtension(void) const;
|
||||
void GetExtension(std::string& rExtension) const;
|
||||
std::string GetExtension(void) const;
|
||||
void GetLastDirectory(std::string& rDirectory) const;
|
||||
std::string GetLastDirectory(void) const;
|
||||
void GetFullyQualified(std::string& rFullyQualified) const;
|
||||
#ifdef _WIN32
|
||||
void GetComponents(std::string* pDrive = NULL, std::string* pDirectory = NULL, std::string* pName = NULL, std::string* pExtension = NULL) const;
|
||||
#else
|
||||
void GetComponents(std::string* pDirectory = NULL, std::string* pName = NULL, std::string* pExtension = NULL) const;
|
||||
#endif
|
||||
//Get other state
|
||||
bool IsEmpty() const { return m_strPath.empty(); }
|
||||
bool IsRelative() const;
|
||||
|
||||
//Set path components
|
||||
#ifdef _WIN32
|
||||
void SetDrive(char chDrive);
|
||||
void SetDriveDirectory(const char * lpszDriveDirectory);
|
||||
#endif
|
||||
void SetDirectory(const char * lpszDirectory, bool bEnsureAbsolute = false);
|
||||
void SetName(const char * lpszName);
|
||||
void SetName(int iName);
|
||||
void SetNameExtension(const char * lpszNameExtension);
|
||||
void SetExtension(const char * lpszExtension);
|
||||
void SetExtension(int iExtension);
|
||||
void AppendDirectory(const char * lpszSubDirectory);
|
||||
void UpDirectory(std::string* pLastDirectory = NULL);
|
||||
#ifdef _WIN32
|
||||
void SetComponents(const char * lpszDrive, const char * lpszDirectory, const char * lpszName, const char * lpszExtension);
|
||||
#else
|
||||
void SetComponents(const char * lpszDirectory, const char * lpszName, const char * lpszExtension);
|
||||
#endif
|
||||
//Set whole path
|
||||
void Empty() { m_strPath.erase(); }
|
||||
void CurrentDirectory();
|
||||
#ifdef _WIN32
|
||||
void Module();
|
||||
void Module(void * hInstance);
|
||||
void ModuleDirectory();
|
||||
void ModuleDirectory(void * hInstance);
|
||||
#endif
|
||||
|
||||
//Directory information
|
||||
bool IsDirectory() const;
|
||||
bool DirectoryExists() const;
|
||||
|
||||
//File Information
|
||||
bool IsFile() const { return !IsDirectory(); }
|
||||
bool Exists() const;
|
||||
#ifdef _WIN32
|
||||
bool SelectFile(void * hwndOwner, const char * InitialDir, const char * FileFilter, bool FileMustExist);
|
||||
#endif
|
||||
|
||||
//Directory operations
|
||||
bool DirectoryCreate(bool bCreateIntermediates = true);
|
||||
bool ChangeDirectory();
|
||||
void NormalizePath(CPath BaseDir);
|
||||
|
||||
//File operations
|
||||
bool Delete(bool bEvenIfReadOnly = true) const;
|
||||
bool CopyTo(const char * lpcszTargetFile, bool bOverwrite = true);
|
||||
bool MoveTo(const char * lpcszTargetFile, bool bOverwrite = true);
|
||||
|
||||
//Finders
|
||||
bool FindFirst(uint32_t dwAttributes = 0);
|
||||
bool FindNext();
|
||||
|
||||
// Helpers
|
||||
#ifdef _WIN32
|
||||
static void SethInst(void * hInst);
|
||||
static void * GethInst();
|
||||
#endif
|
||||
|
||||
private:
|
||||
//Setup & Cleanup
|
||||
inline void Init();
|
||||
inline void Exit();
|
||||
|
||||
bool AttributesMatch(uint32_t dwTargetAttributes, uint32_t dwFileAttributes);
|
||||
|
||||
void cleanPathString(std::string& rDirectory) const;
|
||||
void StripLeadingChar(std::string& rText, char chLeading) const;
|
||||
void StripLeadingBackslash(std::string& Directory) const;
|
||||
void StripTrailingChar(std::string& rText, char chTrailing) const;
|
||||
void StripTrailingBackslash(std::string& rDirectory) const;
|
||||
void EnsureTrailingBackslash(std::string& Directory) const;
|
||||
void EnsureLeadingBackslash(std::string& Directory) const;
|
||||
#ifndef _WIN32
|
||||
bool wildcmp(const char *wild, const char *string);
|
||||
#endif
|
||||
};
|
239
src/GLideNUI-wtl/util/ts2lang.cpp
Normal file
239
src/GLideNUI-wtl/util/ts2lang.cpp
Normal file
|
@ -0,0 +1,239 @@
|
|||
#include <windows.h>
|
||||
#include "../Language.h"
|
||||
#include "../ticpp/ticpp.h"
|
||||
#include "path.h"
|
||||
#include "md5.h"
|
||||
#include "StdString.h"
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <regex>
|
||||
|
||||
//#define DEBUG_LANG
|
||||
typedef std::map<stdstr, stdstr> Translations;
|
||||
|
||||
std::string CleanString(std::string source)
|
||||
{
|
||||
stdstr value = source;
|
||||
value.Replace("</p><p>", "\\n\\n");
|
||||
value.Replace("<br/>", "\\n");
|
||||
value.Replace(""", "\\\"");
|
||||
const std::regex re("<[^>]*>");
|
||||
while (std::regex_search(value, re)) {
|
||||
value = std::regex_replace(value, re, "");
|
||||
}
|
||||
value.Replace("\\n\\n\"", "\"");
|
||||
value.Replace(stdstr().FromUTF16(L"–"), "-");
|
||||
return value;
|
||||
}
|
||||
|
||||
bool GetLangInfo(const char * filename, std::string & version, std::string & langCode, Translations & translations)
|
||||
{
|
||||
ticpp::Document doc(filename);
|
||||
doc.LoadFile();
|
||||
|
||||
ticpp::Element * pElem = doc.FirstChildElement();
|
||||
if (pElem == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (pElem->Value() != "TS")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
std::string text = pElem->GetText(false);
|
||||
std::string elmValue = pElem->Value();
|
||||
for (ticpp::Attribute* child = pElem->FirstAttribute(false); child; child = child->Next(false))
|
||||
{
|
||||
if (child->Name() == "version")
|
||||
{
|
||||
version = child->Value();
|
||||
}
|
||||
else if (child->Name() == "language")
|
||||
{
|
||||
langCode = child->Value();
|
||||
}
|
||||
}
|
||||
|
||||
if (version.empty() || langCode.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (ticpp::Element* childElement = pElem->FirstChildElement(false); childElement; childElement = childElement->NextSiblingElement(false))
|
||||
{
|
||||
if (childElement->Value() != "context")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (ticpp::Element* contextElement = childElement->FirstChildElement(false); contextElement; contextElement = contextElement->NextSiblingElement(false))
|
||||
{
|
||||
if (contextElement->Value() != "message")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
stdstr source, translation;
|
||||
for (ticpp::Element* messageElement = contextElement->FirstChildElement(false); messageElement; messageElement = messageElement->NextSiblingElement(false))
|
||||
{
|
||||
if (messageElement->Value() == "source")
|
||||
{
|
||||
source = CleanString(messageElement->GetText());
|
||||
}
|
||||
else if (messageElement->Value() == "translation")
|
||||
{
|
||||
translation = CleanString(messageElement->GetText(false));
|
||||
}
|
||||
}
|
||||
if (source.length() > 0 && translation.length() > 0)
|
||||
{
|
||||
translations.insert(Translations::value_type(source, translation));
|
||||
}
|
||||
}
|
||||
}
|
||||
return translations.size() > 0;
|
||||
}
|
||||
|
||||
typedef std::map<int32_t, stdstr> ID_MAP;
|
||||
typedef std::set<stdstr> ID_USED;
|
||||
void WriteSection(FILE * file, const ID_MAP & defaultStrings, const Translations & hashedTranslations, ID_USED &usedTranslations, const char * sectionName, int32_t start, int32_t end)
|
||||
{
|
||||
std::string section;
|
||||
for (int32_t id = start; id <= end; id++)
|
||||
{
|
||||
ID_MAP::const_iterator defaultStr_itr = defaultStrings.find(id);
|
||||
if (defaultStr_itr == defaultStrings.end())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
stdstr defaultStr = defaultStr_itr->second;
|
||||
defaultStr.Replace("\n", "\\n"); //escape characters for comparison
|
||||
defaultStr.Replace("\"", "\\\"");
|
||||
stdstr matchingHash = MD5(defaultStr).hex_digest();
|
||||
Translations::const_iterator translation_itr = hashedTranslations.find(matchingHash);
|
||||
if (translation_itr == hashedTranslations.end())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
usedTranslations.insert(matchingHash);
|
||||
stdstr_f line("#%04d# \"%s\"\n", id, translation_itr->second.c_str());
|
||||
section += line;
|
||||
}
|
||||
if (section.length() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
fprintf(file, "/*********************************************************************************\n");
|
||||
fprintf(file, "* %-78s *\n", sectionName);
|
||||
fprintf(file, "*********************************************************************************/\n");
|
||||
fprintf(file, "%s\n", section.c_str());
|
||||
}
|
||||
|
||||
bool WriteLangFile(const char * dstFile, const char * language, const Translations & translations, bool debugEnglish)
|
||||
{
|
||||
ID_MAP defaultStrings = (ID_MAP)GetDefaultStrings();
|
||||
Translations hashedTranslations;
|
||||
ID_USED usedTranslations;
|
||||
for (Translations::const_iterator translation_itr = translations.begin(); translation_itr != translations.end(); translation_itr++)
|
||||
{
|
||||
std::string translation = debugEnglish ? translation_itr->first : translation_itr->second;
|
||||
std::string key = MD5(translation_itr->first).hex_digest();
|
||||
hashedTranslations.insert(Translations::value_type(key, translation));
|
||||
}
|
||||
|
||||
FILE * file = NULL;
|
||||
fopen_s(&file, dstFile, "wb");
|
||||
if (file == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
uint8_t utf_bom[3] = { 0xEF, 0xBB, 0xBF };
|
||||
fwrite(utf_bom, sizeof(utf_bom), 1, file);
|
||||
|
||||
fprintf(file, "/*********************************************************************************\n");
|
||||
fprintf(file, "* Meta Information *\n");
|
||||
fprintf(file, "*********************************************************************************/\n");
|
||||
fprintf(file, "#0001# \"%s\"\n\n", language);
|
||||
WriteSection(file, defaultStrings, hashedTranslations, usedTranslations, "Config Dialog", 1000, 1999);
|
||||
WriteSection(file, defaultStrings, hashedTranslations, usedTranslations, "Video Tab", 2000, 2999);
|
||||
WriteSection(file, defaultStrings, hashedTranslations, usedTranslations, "Emulation Tab", 3000, 3999);
|
||||
WriteSection(file, defaultStrings, hashedTranslations, usedTranslations, "Frame Buffer Tab", 4000, 4999);
|
||||
WriteSection(file, defaultStrings, hashedTranslations, usedTranslations, "Texture enhancement", 5000, 5999);
|
||||
WriteSection(file, defaultStrings, hashedTranslations, usedTranslations, "On-screen display", 6000, 6999);
|
||||
WriteSection(file, defaultStrings, hashedTranslations, usedTranslations, "Debug", 7000, 7999);
|
||||
WriteSection(file, defaultStrings, hashedTranslations, usedTranslations, "About", 9000, 9999);
|
||||
|
||||
for (ID_USED::const_iterator usedTranslation_itr = usedTranslations.begin(); usedTranslation_itr != usedTranslations.end(); usedTranslation_itr++)
|
||||
{
|
||||
Translations::iterator translation_itr = hashedTranslations.find(usedTranslation_itr->c_str());
|
||||
if (translation_itr != hashedTranslations.end())
|
||||
{
|
||||
hashedTranslations.erase(translation_itr);
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG_LANG
|
||||
if (hashedTranslations.size() > 0)
|
||||
{
|
||||
fprintf(file, "/*********************************************************************************\n");
|
||||
fprintf(file, "* Untranslated Strings *\n");
|
||||
fprintf(file, "*********************************************************************************/\n");
|
||||
for (Translations::const_iterator translation_itr = hashedTranslations.begin(); translation_itr != hashedTranslations.end(); translation_itr++)
|
||||
{
|
||||
fprintf(file, "%s=\"%s\"\n", translation_itr->first.c_str(), translation_itr->second.c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
fclose(file);
|
||||
return true;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
if (__argc < 2)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
CPath src(__argv[1], "*.ts");
|
||||
CPath dst(__argv[2], "");
|
||||
|
||||
if (!src.Exists())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::map<std::string, std::wstring> languages = {
|
||||
{ "de_DE", L"Deutsch" },
|
||||
{ "es_ES", L"Español" },
|
||||
{ "fr_FR", L"Français" },
|
||||
{ "it_IT", L"Italiano" },
|
||||
{ "ja_JP", L"日本語" },
|
||||
{ "pl_PL", L"Polski" },
|
||||
{ "pt_BR", L"Português do Brasil" }
|
||||
};
|
||||
|
||||
if (src.FindFirst())
|
||||
{
|
||||
do
|
||||
{
|
||||
Translations translations;
|
||||
std::string version, langCode, language;
|
||||
if (GetLangInfo(src, version, langCode, translations))
|
||||
{
|
||||
language = stdstr().FromUTF16(languages[langCode].c_str());
|
||||
dst.SetName(src.GetName().c_str());
|
||||
dst.SetExtension("Lang");
|
||||
if (!WriteLangFile(dst, language.c_str(), translations, 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#ifdef DEBUG_LANG
|
||||
if (langCode == "es_ES")
|
||||
{
|
||||
dst.SetName("gliden64_en");
|
||||
dst.SetExtension("Lang");
|
||||
WriteLangFile(dst, "English", translations, 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (src.FindNext());
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user