diff --git a/projects/3rd-party/StackWalker/libStackWalker.vcxproj b/projects/3rd-party/StackWalker/libStackWalker.vcxproj new file mode 100644 index 00000000..8907d076 --- /dev/null +++ b/projects/3rd-party/StackWalker/libStackWalker.vcxproj @@ -0,0 +1,97 @@ + + + + + + + + + + + Debug + Win32 + + + Release + Win32 + + + + {3A3948DC-9865-46B3-B7B9-7E5572704ED2} + libStackWalker + + + + StaticLibrary + true + Unicode + $(DefaultPlatformToolset) + + + StaticLibrary + false + false + Unicode + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + $(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\ + true + + + $(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\ + true + + + + Level3 + Disabled + true + None + true + ../../../src/3rd-party; + false + + + Windows + true + + + + + Level3 + MaxSpeed + true + true + false + true + None + true + ../../../src/3rd-party; + false + + + Windows + false + true + true + + + + + + \ No newline at end of file diff --git a/projects/3rd-party/StackWalker/libStackWalker.vcxproj.filters b/projects/3rd-party/StackWalker/libStackWalker.vcxproj.filters new file mode 100644 index 00000000..08a3c777 --- /dev/null +++ b/projects/3rd-party/StackWalker/libStackWalker.vcxproj.filters @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/projects/3rd-party/curl/libcurl.vcxproj b/projects/3rd-party/curl/libcurl.vcxproj new file mode 100644 index 00000000..9a4c7664 --- /dev/null +++ b/projects/3rd-party/curl/libcurl.vcxproj @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + Debug + Win32 + + + Release + Win32 + + + + {A9ABACC7-75A1-46BA-8E48-4105346D9719} + libcurl + + + + StaticLibrary + true + Unicode + $(DefaultPlatformToolset) + + + StaticLibrary + false + false + Unicode + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + $(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\ + true + + + $(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\ + true + + + + Level3 + Disabled + true + None + true + ../../../src/3rd-party; + false + + + Windows + true + + + + + Level3 + MaxSpeed + true + true + false + true + None + true + ../../../src/3rd-party; + false + + + Windows + false + true + true + + + + + + \ No newline at end of file diff --git a/projects/3rd-party/curl/libcurl.vcxproj.filters b/projects/3rd-party/curl/libcurl.vcxproj.filters new file mode 100644 index 00000000..6c4e394b --- /dev/null +++ b/projects/3rd-party/curl/libcurl.vcxproj.filters @@ -0,0 +1,43 @@ + + + + + {C9C8ABBE-E2ED-4990-854D-3F343C451180} + + + {579bb80d-1063-46e7-97d1-9a5adb38c9eb} + + + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + + + + libs + + + \ No newline at end of file diff --git a/projects/3rd-party/imgui/libimgui.vcxproj b/projects/3rd-party/imgui/libimgui.vcxproj new file mode 100644 index 00000000..0912e006 --- /dev/null +++ b/projects/3rd-party/imgui/libimgui.vcxproj @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + Debug + Win32 + + + Release + Win32 + + + + {7FA1E56D-62AC-47D1-97D1-40B302724198} + libimgui + + + + StaticLibrary + true + Unicode + $(DefaultPlatformToolset) + + + StaticLibrary + false + false + Unicode + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + $(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\ + true + + + $(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\ + true + + + + Level3 + Disabled + true + None + true + ../../../src/3rd-party; + false + + + Windows + true + + + + + Level3 + MaxSpeed + true + true + false + true + None + true + ../../../src/3rd-party; + false + + + Windows + false + true + true + + + + + + \ No newline at end of file diff --git a/projects/3rd-party/imgui/libimgui.vcxproj.filters b/projects/3rd-party/imgui/libimgui.vcxproj.filters new file mode 100644 index 00000000..84c7cf5d --- /dev/null +++ b/projects/3rd-party/imgui/libimgui.vcxproj.filters @@ -0,0 +1,45 @@ + + + + + {6160FE38-37E6-41B0-9EAC-17047E5FB604} + + + {679F9030-0259-4621-87DD-08D71081C409} + + + + + include + + + include + + + include + + + include + + + include + + + include + + + + + src + + + src + + + src + + + src + + + \ No newline at end of file diff --git a/projects/3rd-party/tinyxml2/libtinyxml2.vcxproj b/projects/3rd-party/tinyxml2/libtinyxml2.vcxproj new file mode 100644 index 00000000..d6ba3b24 --- /dev/null +++ b/projects/3rd-party/tinyxml2/libtinyxml2.vcxproj @@ -0,0 +1,97 @@ + + + + + + + + + + + Debug + Win32 + + + Release + Win32 + + + + {AB47E875-85E5-4105-A71E-88930EAAB910} + libtinyxml2 + + + + StaticLibrary + true + Unicode + $(DefaultPlatformToolset) + + + StaticLibrary + false + false + Unicode + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + $(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\ + true + + + $(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\ + true + + + + Level3 + Disabled + true + None + true + ../../../src/3rd-party; + false + + + Windows + true + + + + + Level3 + MaxSpeed + true + true + false + true + None + true + ../../../src/3rd-party; + false + + + Windows + false + true + true + + + + + + \ No newline at end of file diff --git a/projects/3rd-party/tinyxml2/libtinyxml2.vcxproj.filters b/projects/3rd-party/tinyxml2/libtinyxml2.vcxproj.filters new file mode 100644 index 00000000..71b75fa1 --- /dev/null +++ b/projects/3rd-party/tinyxml2/libtinyxml2.vcxproj.filters @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/projects/Kiwano.sln b/projects/Kiwano.sln index 4047e40b..71f08856 100644 --- a/projects/Kiwano.sln +++ b/projects/Kiwano.sln @@ -2,13 +2,23 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.28729.10 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kiwano", "kiwano.vcxproj", "{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kiwano", "kiwano\kiwano.vcxproj", "{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kiwano-audio", "kiwano-audio.vcxproj", "{1B97937D-8184-426C-BE71-29A163DC76C9}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kiwano-audio", "kiwano-audio\kiwano-audio.vcxproj", "{1B97937D-8184-426C-BE71-29A163DC76C9}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kiwano-network", "kiwano-network.vcxproj", "{69DFBE92-C06F-4CF8-9495-CA9BF2E3BAF2}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kiwano-network", "kiwano-network\kiwano-network.vcxproj", "{69DFBE92-C06F-4CF8-9495-CA9BF2E3BAF2}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kiwano-imgui", "kiwano-imgui.vcxproj", "{A7062ED8-8910-48A5-A3BC-C1612672571F}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kiwano-imgui", "kiwano-imgui\kiwano-imgui.vcxproj", "{A7062ED8-8910-48A5-A3BC-C1612672571F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3rd-party", "3rd-party", "{2D8919F2-8922-4B3F-8F68-D4127C6BCBB7}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libStackWalker", "3rd-party\StackWalker\libStackWalker.vcxproj", "{3A3948DC-9865-46B3-B7B9-7E5572704ED2}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtinyxml2", "3rd-party\tinyxml2\libtinyxml2.vcxproj", "{AB47E875-85E5-4105-A71E-88930EAAB910}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libimgui", "3rd-party\imgui\libimgui.vcxproj", "{7FA1E56D-62AC-47D1-97D1-40B302724198}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcurl", "3rd-party\curl\libcurl.vcxproj", "{A9ABACC7-75A1-46BA-8E48-4105346D9719}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -33,10 +43,32 @@ Global {A7062ED8-8910-48A5-A3BC-C1612672571F}.Debug|Win32.Build.0 = Debug|Win32 {A7062ED8-8910-48A5-A3BC-C1612672571F}.Release|Win32.ActiveCfg = Release|Win32 {A7062ED8-8910-48A5-A3BC-C1612672571F}.Release|Win32.Build.0 = Release|Win32 + {3A3948DC-9865-46B3-B7B9-7E5572704ED2}.Debug|Win32.ActiveCfg = Debug|Win32 + {3A3948DC-9865-46B3-B7B9-7E5572704ED2}.Debug|Win32.Build.0 = Debug|Win32 + {3A3948DC-9865-46B3-B7B9-7E5572704ED2}.Release|Win32.ActiveCfg = Release|Win32 + {3A3948DC-9865-46B3-B7B9-7E5572704ED2}.Release|Win32.Build.0 = Release|Win32 + {AB47E875-85E5-4105-A71E-88930EAAB910}.Debug|Win32.ActiveCfg = Debug|Win32 + {AB47E875-85E5-4105-A71E-88930EAAB910}.Debug|Win32.Build.0 = Debug|Win32 + {AB47E875-85E5-4105-A71E-88930EAAB910}.Release|Win32.ActiveCfg = Release|Win32 + {AB47E875-85E5-4105-A71E-88930EAAB910}.Release|Win32.Build.0 = Release|Win32 + {7FA1E56D-62AC-47D1-97D1-40B302724198}.Debug|Win32.ActiveCfg = Debug|Win32 + {7FA1E56D-62AC-47D1-97D1-40B302724198}.Debug|Win32.Build.0 = Debug|Win32 + {7FA1E56D-62AC-47D1-97D1-40B302724198}.Release|Win32.ActiveCfg = Release|Win32 + {7FA1E56D-62AC-47D1-97D1-40B302724198}.Release|Win32.Build.0 = Release|Win32 + {A9ABACC7-75A1-46BA-8E48-4105346D9719}.Debug|Win32.ActiveCfg = Debug|Win32 + {A9ABACC7-75A1-46BA-8E48-4105346D9719}.Debug|Win32.Build.0 = Debug|Win32 + {A9ABACC7-75A1-46BA-8E48-4105346D9719}.Release|Win32.ActiveCfg = Release|Win32 + {A9ABACC7-75A1-46BA-8E48-4105346D9719}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {3A3948DC-9865-46B3-B7B9-7E5572704ED2} = {2D8919F2-8922-4B3F-8F68-D4127C6BCBB7} + {AB47E875-85E5-4105-A71E-88930EAAB910} = {2D8919F2-8922-4B3F-8F68-D4127C6BCBB7} + {7FA1E56D-62AC-47D1-97D1-40B302724198} = {2D8919F2-8922-4B3F-8F68-D4127C6BCBB7} + {A9ABACC7-75A1-46BA-8E48-4105346D9719} = {2D8919F2-8922-4B3F-8F68-D4127C6BCBB7} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {FAC2BE2F-19AF-477A-8DC6-4645E66868A4} EndGlobalSection diff --git a/projects/kiwano-audio.vcxproj.filters b/projects/kiwano-audio.vcxproj.filters deleted file mode 100644 index b6974b55..00000000 --- a/projects/kiwano-audio.vcxproj.filters +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - src - - - src - - - src - - - src - - - src - - - - - src - - - src - - - src - - - src - - - src - - - - - {331b453a-33de-4e2a-9c06-19a3fc9d43f3} - - - \ No newline at end of file diff --git a/projects/kiwano-audio.vcxproj b/projects/kiwano-audio/kiwano-audio.vcxproj similarity index 81% rename from projects/kiwano-audio.vcxproj rename to projects/kiwano-audio/kiwano-audio.vcxproj index fdaf9844..594cbc23 100644 --- a/projects/kiwano-audio.vcxproj +++ b/projects/kiwano-audio/kiwano-audio.vcxproj @@ -1,19 +1,12 @@ - - - - - - - - - - - - - + + + + + + @@ -26,10 +19,17 @@ - + {ff7f943d-a89c-4e6c-97cf-84f7d8ff8edf} + + + + + + + {1B97937D-8184-426C-BE71-29A163DC76C9} kiwano-audio @@ -68,7 +68,7 @@ $(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\ $(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\ - false + true @@ -77,7 +77,7 @@ true EditAndContinue true - ../src/ + ../../src; false @@ -93,9 +93,9 @@ true false true - EditAndContinue + ProgramDatabase true - ../src/ + ../../src; false diff --git a/projects/kiwano-audio/kiwano-audio.vcxproj.filters b/projects/kiwano-audio/kiwano-audio.vcxproj.filters new file mode 100644 index 00000000..2e5726c2 --- /dev/null +++ b/projects/kiwano-audio/kiwano-audio.vcxproj.filters @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/projects/kiwano-imgui.vcxproj.filters b/projects/kiwano-imgui.vcxproj.filters deleted file mode 100644 index 6bca8291..00000000 --- a/projects/kiwano-imgui.vcxproj.filters +++ /dev/null @@ -1,76 +0,0 @@ - - - - - {ed21cd51-048d-4bbc-804a-d09a8afa1423} - - - {f737b6d4-4462-49c1-8e9d-5c834bed598f} - - - {5b9d2eaa-0247-4ef5-8410-3221821b1221} - - - - - src - - - src - - - src - - - third-party\ImGui - - - third-party\ImGui - - - third-party\ImGui - - - third-party\ImGui - - - third-party\ImGui - - - third-party\ImGui - - - - src - - - src - - - - - src - - - src - - - src - - - third-party\ImGui - - - third-party\ImGui - - - third-party\ImGui - - - third-party\ImGui - - - src - - - \ No newline at end of file diff --git a/projects/kiwano-imgui.vcxproj b/projects/kiwano-imgui/kiwano-imgui.vcxproj similarity index 71% rename from projects/kiwano-imgui.vcxproj rename to projects/kiwano-imgui/kiwano-imgui.vcxproj index 5416cc13..b06b2045 100644 --- a/projects/kiwano-imgui.vcxproj +++ b/projects/kiwano-imgui/kiwano-imgui.vcxproj @@ -1,28 +1,12 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + @@ -35,10 +19,19 @@ - + + {7fa1e56d-62ac-47d1-97d1-40b302724198} + + {ff7f943d-a89c-4e6c-97cf-84f7d8ff8edf} + + + + + + {A7062ED8-8910-48A5-A3BC-C1612672571F} kiwano-imgui @@ -69,12 +62,12 @@ - + $(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\ $(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\ - false + true - + $(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\ $(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\ true @@ -86,7 +79,7 @@ true EditAndContinue true - ../src/ + ../../src; false @@ -102,9 +95,9 @@ true false true - EditAndContinue + ProgramDatabase true - ../src/ + ../../src; false diff --git a/projects/kiwano-imgui/kiwano-imgui.vcxproj.filters b/projects/kiwano-imgui/kiwano-imgui.vcxproj.filters new file mode 100644 index 00000000..7a6139eb --- /dev/null +++ b/projects/kiwano-imgui/kiwano-imgui.vcxproj.filters @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/projects/kiwano-network.vcxproj.filters b/projects/kiwano-network.vcxproj.filters deleted file mode 100644 index d7c1c07b..00000000 --- a/projects/kiwano-network.vcxproj.filters +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - src - - - src - - - src - - - src - - - - - {702f4435-7612-4ce6-86c8-744d1868c19a} - - - {4b536a1f-2907-4b85-baad-074d7274a5eb} - - - - - src - - - - - libs - - - \ No newline at end of file diff --git a/projects/kiwano-network.vcxproj b/projects/kiwano-network/kiwano-network.vcxproj similarity index 84% rename from projects/kiwano-network.vcxproj rename to projects/kiwano-network/kiwano-network.vcxproj index 1568fb4e..ae3116da 100644 --- a/projects/kiwano-network.vcxproj +++ b/projects/kiwano-network/kiwano-network.vcxproj @@ -1,14 +1,10 @@ - - - - - - - - + + + + @@ -21,13 +17,17 @@ - - - - + + {a9abacc7-75a1-46ba-8e48-4105346d9719} + + {ff7f943d-a89c-4e6c-97cf-84f7d8ff8edf} + + + + {69DFBE92-C06F-4CF8-9495-CA9BF2E3BAF2} kiwano-network @@ -66,7 +66,7 @@ $(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\ $(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\ - false + true @@ -75,7 +75,7 @@ true EditAndContinue true - ../src/ + ../../src; false @@ -91,9 +91,9 @@ true false true - EditAndContinue + ProgramDatabase true - ../src/ + ../../src; false diff --git a/projects/kiwano-network/kiwano-network.vcxproj.filters b/projects/kiwano-network/kiwano-network.vcxproj.filters new file mode 100644 index 00000000..6b32af09 --- /dev/null +++ b/projects/kiwano-network/kiwano-network.vcxproj.filters @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/projects/kiwano.vcxproj b/projects/kiwano.vcxproj deleted file mode 100644 index 5471ccdc..00000000 --- a/projects/kiwano.vcxproj +++ /dev/null @@ -1,241 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Debug - Win32 - - - Release - Win32 - - - - {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF} - kiwano - - - - StaticLibrary - true - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - false - false - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - $(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\ - $(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\ - true - - - $(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\ - $(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\ - false - - - - Level3 - Disabled - true - EditAndContinue - true - false - - - Windows - true - - - - - Level3 - MaxSpeed - true - true - false - true - EditAndContinue - true - false - - - Windows - false - true - true - - - - - - \ No newline at end of file diff --git a/projects/kiwano.vcxproj.filters b/projects/kiwano.vcxproj.filters deleted file mode 100644 index 84c50126..00000000 --- a/projects/kiwano.vcxproj.filters +++ /dev/null @@ -1,492 +0,0 @@ - - - - - {80bc6386-2b70-4bae-993c-649a55163a1b} - - - {68eac919-ee87-4030-a033-c251731928f5} - - - {07b6d541-4a1b-472a-aae0-daf9d082fe84} - - - {c2654ccc-59f6-4c17-bb6b-99b07fc78702} - - - {896bdedf-6e82-449b-9b6e-0bc69f3699b1} - - - {2e18d99a-e906-499a-9e29-4e0783202644} - - - {7897afce-24cb-42b4-9443-56508e4ec89c} - - - {91029e1e-40c2-40d9-bfc4-a51d9df02b80} - - - {1fec4835-63a1-4612-80b5-828dadf0ac63} - - - {0cae76f7-7016-4a45-bb26-a130fbce8024} - - - {9314f30d-5742-48b6-94e5-e3b4284106f6} - - - {86e2d0f2-a9d0-4456-b6a5-d480228bbf82} - - - {30333461-e9bc-4709-84bd-ce6e0e1a3079} - - - - - ui - - - ui - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - math - - - math - - - math - - - math - - - math - - - math - - - platform - - - platform - - - utils - - - - - math - - - base - - - base - - - - utils - - - base - - - base - - - base - - - third-party\StackWalker - - - utils - - - 2d - - - third-party\tinyxml2 - - - base - - - 2d - - - 2d - - - 2d - - - 2d\action - - - 2d\action - - - 2d\action - - - 2d\action - - - 2d\action - - - 2d\action - - - utils - - - 2d - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - core - - - 2d - - - 2d - - - 2d\action - - - 2d\action - - - base - - - base - - - math - - - base - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer\win32 - - - renderer\win32 - - - renderer\win32 - - - renderer\win32 - - - renderer\win32 - - - renderer\win32 - - - renderer\win32 - - - renderer - - - renderer - - - core - - - 2d - - - renderer - - - renderer - - - renderer - - - renderer - - - - - ui - - - ui - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - base - - - base - - - base - - - base - - - platform - - - platform - - - utils - - - base - - - utils - - - base - - - base - - - base - - - third-party\StackWalker - - - utils - - - 2d - - - third-party\tinyxml2 - - - base - - - 2d - - - 2d - - - 2d - - - 2d\action - - - 2d\action - - - 2d\action - - - 2d\action - - - 2d\action - - - utils - - - 2d - - - 2d - - - 2d - - - 2d\action - - - 2d\action - - - base - - - base - - - base - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer\win32 - - - renderer\win32 - - - renderer\win32 - - - renderer\win32 - - - renderer\win32 - - - renderer - - - renderer - - - 2d - - - renderer - - - renderer - - - renderer - - - \ No newline at end of file diff --git a/projects/kiwano/kiwano.vcxproj b/projects/kiwano/kiwano.vcxproj new file mode 100644 index 00000000..57b8f114 --- /dev/null +++ b/projects/kiwano/kiwano.vcxproj @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Debug + Win32 + + + Release + Win32 + + + + + {3a3948dc-9865-46b3-b7b9-7e5572704ed2} + + + {ab47e875-85e5-4105-a71e-88930eaab910} + + + + {FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF} + kiwano + + + + StaticLibrary + true + Unicode + $(DefaultPlatformToolset) + + + StaticLibrary + false + false + Unicode + $(DefaultPlatformToolset) + + + + + + + + + + + + + $(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\ + true + + + $(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\ + true + + + + Level3 + Disabled + true + EditAndContinue + true + false + ../../src; + + + Windows + true + + + + + Level3 + MaxSpeed + true + true + false + true + ProgramDatabase + true + false + ../../src; + + + Windows + false + true + true + + + + + + \ No newline at end of file diff --git a/projects/kiwano/kiwano.vcxproj.filters b/projects/kiwano/kiwano.vcxproj.filters new file mode 100644 index 00000000..24b70a35 --- /dev/null +++ b/projects/kiwano/kiwano.vcxproj.filters @@ -0,0 +1,480 @@ + + + + + {80bc6386-2b70-4bae-993c-649a55163a1b} + + + {68eac919-ee87-4030-a033-c251731928f5} + + + {07b6d541-4a1b-472a-aae0-daf9d082fe84} + + + {c2654ccc-59f6-4c17-bb6b-99b07fc78702} + + + {896bdedf-6e82-449b-9b6e-0bc69f3699b1} + + + {2e18d99a-e906-499a-9e29-4e0783202644} + + + {7897afce-24cb-42b4-9443-56508e4ec89c} + + + {9314f30d-5742-48b6-94e5-e3b4284106f6} + + + {86e2d0f2-a9d0-4456-b6a5-d480228bbf82} + + + {30333461-e9bc-4709-84bd-ce6e0e1a3079} + + + {192a47a9-9df6-4f40-a7d3-888eb00c53ac} + + + + + ui + + + ui + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + math + + + math + + + math + + + platform + + + platform + + + + + math + + + base + + + base + + + + base + + + base + + + base + + + 2d + + + base + + + 2d + + + 2d + + + 2d + + + 2d\action + + + 2d\action + + + 2d\action + + + 2d\action + + + 2d\action + + + 2d\action + + + utils + + + 2d + + + core + + + core + + + core + + + core + + + core + + + core + + + core + + + core + + + core + + + 2d + + + 2d + + + 2d\action + + + 2d\action + + + base + + + base + + + math + + + base + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer\win32 + + + renderer\win32 + + + renderer\win32 + + + renderer\win32 + + + renderer\win32 + + + renderer\win32 + + + renderer + + + renderer + + + 2d + + + renderer + + + renderer + + + renderer + + + renderer + + + math + + + math + + + math + + + base\win32 + + + base\win32 + + + utils + + + utils + + + core + + + utils + + + + + ui + + + ui + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + base + + + base + + + base + + + base + + + platform + + + platform + + + base + + + base + + + base + + + base + + + 2d + + + base + + + 2d + + + 2d + + + 2d + + + 2d\action + + + 2d\action + + + 2d\action + + + 2d\action + + + 2d\action + + + utils + + + 2d + + + 2d + + + 2d + + + 2d\action + + + 2d\action + + + base + + + base + + + base + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer\win32 + + + renderer\win32 + + + renderer\win32 + + + renderer\win32 + + + renderer\win32 + + + renderer + + + renderer + + + 2d + + + renderer + + + renderer + + + renderer + + + base + + + utils + + + utils + + + utils + + + \ No newline at end of file diff --git a/scripts/appveyor/clear_project_configuration.ps1 b/scripts/appveyor/clear_project_configuration.ps1 index 2cb25d9e..05b9fba9 100644 --- a/scripts/appveyor/clear_project_configuration.ps1 +++ b/scripts/appveyor/clear_project_configuration.ps1 @@ -1,8 +1,10 @@ -$replace = "EditAndContinue" -$replaceTo = "None" +function Set-FileConfiguration { + param( + [string]$filePath + ) -Get-ChildItem -Path 'projects\' *.vcxproj | ForEach-Object { - $filePath = 'projects\' + $_ + $replace = "(EditAndContinue|ProgramDatabase)" + $replaceTo = "None" # Create a copy of .vcxproj file Copy-Item -Path $filePath -Destination ($filePath + '.template') @@ -13,3 +15,12 @@ Get-ChildItem -Path 'projects\' *.vcxproj | ForEach-Object { # Delete the copy file Remove-Item -Path ($filePath + '.template') } + +Get-ChildItem -Path 'projects\' -Directory | ForEach-Object { + $dirPath = "projects\$($_)" + + # Search all vcxproj files + Get-ChildItem -Path $dirPath *.vcxproj -File | ForEach-Object { + Set-FileConfiguration ($dirPath + '\' + $_) + } +} diff --git a/scripts/coapp/kiwano.autopkg b/scripts/coapp/kiwano.autopkg index 8e763bcb..8a480ef2 100644 --- a/scripts/coapp/kiwano.autopkg +++ b/scripts/coapp/kiwano.autopkg @@ -95,8 +95,8 @@ nuget { ${SRC_ROOT}\**\*.hpp }; - // kiwano-network 3-rd patry - bin: { ${SRC_ROOT}\kiwano-network\dlls\*.dll }; + // third patry + bin: { ${SRC_ROOT}\3rd-party\**\*.dll }; ("v140,v141,v142", "Win32", "Debug") => { [${0},${1},${2}] { diff --git a/src/kiwano/third-party/StackWalker/StackWalker.cpp b/src/3rd-party/StackWalker/StackWalker.cpp similarity index 100% rename from src/kiwano/third-party/StackWalker/StackWalker.cpp rename to src/3rd-party/StackWalker/StackWalker.cpp diff --git a/src/kiwano/third-party/StackWalker/StackWalker.h b/src/3rd-party/StackWalker/StackWalker.h similarity index 99% rename from src/kiwano/third-party/StackWalker/StackWalker.h rename to src/3rd-party/StackWalker/StackWalker.h index 096d63bc..67498217 100644 --- a/src/kiwano/third-party/StackWalker/StackWalker.h +++ b/src/3rd-party/StackWalker/StackWalker.h @@ -12,8 +12,6 @@ // so we need not to check the version (because we only support _MSC_VER >= 1100)! #pragma once -#include "../../macros.h" - // special defines for VC5/6 (if no actual PSDK is installed): #if _MSC_VER < 1300 typedef unsigned __int64 DWORD64, *PDWORD64; @@ -25,7 +23,7 @@ typedef unsigned long SIZE_T, *PSIZE_T; #endif // _MSC_VER < 1300 class StackWalkerInternal; // forward -class KGE_API StackWalker +class StackWalker { public: typedef enum StackWalkOptions diff --git a/src/kiwano-network/third-party/curl/curl.h b/src/3rd-party/curl/curl.h similarity index 100% rename from src/kiwano-network/third-party/curl/curl.h rename to src/3rd-party/curl/curl.h diff --git a/src/kiwano-network/third-party/curl/curlbuild.h b/src/3rd-party/curl/curlbuild.h similarity index 100% rename from src/kiwano-network/third-party/curl/curlbuild.h rename to src/3rd-party/curl/curlbuild.h diff --git a/src/kiwano-network/third-party/curl/curlrules.h b/src/3rd-party/curl/curlrules.h similarity index 100% rename from src/kiwano-network/third-party/curl/curlrules.h rename to src/3rd-party/curl/curlrules.h diff --git a/src/kiwano-network/third-party/curl/curlver.h b/src/3rd-party/curl/curlver.h similarity index 100% rename from src/kiwano-network/third-party/curl/curlver.h rename to src/3rd-party/curl/curlver.h diff --git a/src/kiwano-network/third-party/curl/easy.h b/src/3rd-party/curl/easy.h similarity index 100% rename from src/kiwano-network/third-party/curl/easy.h rename to src/3rd-party/curl/easy.h diff --git a/src/kiwano-network/dlls/libcrypto-1_1.dll b/src/3rd-party/curl/libs/libcrypto-1_1.dll similarity index 100% rename from src/kiwano-network/dlls/libcrypto-1_1.dll rename to src/3rd-party/curl/libs/libcrypto-1_1.dll diff --git a/src/kiwano-network/dlls/libcurl.dll b/src/3rd-party/curl/libs/libcurl.dll similarity index 100% rename from src/kiwano-network/dlls/libcurl.dll rename to src/3rd-party/curl/libs/libcurl.dll diff --git a/src/kiwano-network/third-party/libs/libcurl.lib b/src/3rd-party/curl/libs/libcurl.lib similarity index 100% rename from src/kiwano-network/third-party/libs/libcurl.lib rename to src/3rd-party/curl/libs/libcurl.lib diff --git a/src/kiwano-network/dlls/libssl-1_1.dll b/src/3rd-party/curl/libs/libssl-1_1.dll similarity index 100% rename from src/kiwano-network/dlls/libssl-1_1.dll rename to src/3rd-party/curl/libs/libssl-1_1.dll diff --git a/src/kiwano-network/third-party/curl/mprintf.h b/src/3rd-party/curl/mprintf.h similarity index 100% rename from src/kiwano-network/third-party/curl/mprintf.h rename to src/3rd-party/curl/mprintf.h diff --git a/src/kiwano-network/third-party/curl/multi.h b/src/3rd-party/curl/multi.h similarity index 100% rename from src/kiwano-network/third-party/curl/multi.h rename to src/3rd-party/curl/multi.h diff --git a/src/kiwano-network/third-party/curl/stdcheaders.h b/src/3rd-party/curl/stdcheaders.h similarity index 100% rename from src/kiwano-network/third-party/curl/stdcheaders.h rename to src/3rd-party/curl/stdcheaders.h diff --git a/src/kiwano-network/third-party/curl/typecheck-gcc.h b/src/3rd-party/curl/typecheck-gcc.h similarity index 100% rename from src/kiwano-network/third-party/curl/typecheck-gcc.h rename to src/3rd-party/curl/typecheck-gcc.h diff --git a/src/kiwano-imgui/third-party/ImGui/LICENSE.txt b/src/3rd-party/imgui/LICENSE.txt similarity index 100% rename from src/kiwano-imgui/third-party/ImGui/LICENSE.txt rename to src/3rd-party/imgui/LICENSE.txt diff --git a/src/kiwano-imgui/third-party/ImGui/imconfig.h b/src/3rd-party/imgui/imconfig.h similarity index 100% rename from src/kiwano-imgui/third-party/ImGui/imconfig.h rename to src/3rd-party/imgui/imconfig.h diff --git a/src/kiwano-imgui/third-party/ImGui/imgui.cpp b/src/3rd-party/imgui/imgui.cpp similarity index 100% rename from src/kiwano-imgui/third-party/ImGui/imgui.cpp rename to src/3rd-party/imgui/imgui.cpp diff --git a/src/kiwano-imgui/third-party/ImGui/imgui.h b/src/3rd-party/imgui/imgui.h similarity index 100% rename from src/kiwano-imgui/third-party/ImGui/imgui.h rename to src/3rd-party/imgui/imgui.h diff --git a/src/kiwano-imgui/third-party/ImGui/imgui_demo.cpp b/src/3rd-party/imgui/imgui_demo.cpp similarity index 100% rename from src/kiwano-imgui/third-party/ImGui/imgui_demo.cpp rename to src/3rd-party/imgui/imgui_demo.cpp diff --git a/src/kiwano-imgui/third-party/ImGui/imgui_draw.cpp b/src/3rd-party/imgui/imgui_draw.cpp similarity index 100% rename from src/kiwano-imgui/third-party/ImGui/imgui_draw.cpp rename to src/3rd-party/imgui/imgui_draw.cpp diff --git a/src/kiwano-imgui/third-party/ImGui/imgui_internal.h b/src/3rd-party/imgui/imgui_internal.h similarity index 100% rename from src/kiwano-imgui/third-party/ImGui/imgui_internal.h rename to src/3rd-party/imgui/imgui_internal.h diff --git a/src/kiwano-imgui/third-party/ImGui/imgui_widgets.cpp b/src/3rd-party/imgui/imgui_widgets.cpp similarity index 100% rename from src/kiwano-imgui/third-party/ImGui/imgui_widgets.cpp rename to src/3rd-party/imgui/imgui_widgets.cpp diff --git a/src/kiwano-imgui/third-party/ImGui/imstb_rectpack.h b/src/3rd-party/imgui/imstb_rectpack.h similarity index 100% rename from src/kiwano-imgui/third-party/ImGui/imstb_rectpack.h rename to src/3rd-party/imgui/imstb_rectpack.h diff --git a/src/kiwano-imgui/third-party/ImGui/imstb_textedit.h b/src/3rd-party/imgui/imstb_textedit.h similarity index 100% rename from src/kiwano-imgui/third-party/ImGui/imstb_textedit.h rename to src/3rd-party/imgui/imstb_textedit.h diff --git a/src/kiwano-imgui/third-party/ImGui/imstb_truetype.h b/src/3rd-party/imgui/imstb_truetype.h similarity index 100% rename from src/kiwano-imgui/third-party/ImGui/imstb_truetype.h rename to src/3rd-party/imgui/imstb_truetype.h diff --git a/src/kiwano/third-party/tinyxml2/LICENSE.txt b/src/3rd-party/tinyxml2/LICENSE.txt similarity index 100% rename from src/kiwano/third-party/tinyxml2/LICENSE.txt rename to src/3rd-party/tinyxml2/LICENSE.txt diff --git a/src/kiwano/third-party/tinyxml2/tinyxml2.cpp b/src/3rd-party/tinyxml2/tinyxml2.cpp similarity index 80% rename from src/kiwano/third-party/tinyxml2/tinyxml2.cpp rename to src/3rd-party/tinyxml2/tinyxml2.cpp index 77278ff6..644c4e3e 100644 --- a/src/kiwano/third-party/tinyxml2/tinyxml2.cpp +++ b/src/3rd-party/tinyxml2/tinyxml2.cpp @@ -35,24 +35,34 @@ distribution. #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE) // Microsoft Visual Studio, version 2005 and higher. Not WinCE. /*int _snprintf_s( - wchar_t *buffer, + TCHAR *buffer, size_t sizeOfBuffer, size_t count, - const wchar_t *format [, + const TCHAR *format [, argument] ... );*/ + + /* + Add by Nomango 2019.10.12 + */ +#ifdef _UNICODE #define vsnprintf_s _vsnwprintf_s #define _vsnprintf _vsnwprintf #define strlen wcslen #define strncmp wcsncmp #define strchr wcschr #define fopen_s _wfopen_s + #define printf wprintf #define vfprintf vfwprintf #define TIXML_VSCPRINTF _vscwprintf #define TIXML_SSCANF swscanf_s +#else + #define TIXML_VSCPRINTF _vscprintf + #define TIXML_SSCANF sscanf_s +#endif - static inline int TIXML_SNPRINTF( wchar_t* buffer, size_t size, const wchar_t* format, ... ) + static inline int TIXML_SNPRINTF( tinyxml2::TCHAR* buffer, size_t size, const tinyxml2::TCHAR* format, ... ) { va_list va; va_start( va, format ); @@ -61,7 +71,7 @@ distribution. return result; } - static inline int TIXML_VSNPRINTF( wchar_t* buffer, size_t size, const wchar_t* format, va_list va ) + static inline int TIXML_VSNPRINTF( tinyxml2::TCHAR* buffer, size_t size, const tinyxml2::TCHAR* format, va_list va ) { const int result = vsnprintf_s( buffer, size, _TRUNCATE, format, va ); return result; @@ -77,12 +87,12 @@ distribution. #define TIXML_VSCPRINTF _vscprintf // VS2003's C runtime has this, but VC6 C runtime or WinCE SDK doesn't have. #else // Microsoft Visual Studio 2003 and earlier or WinCE. - static inline int TIXML_VSCPRINTF( const wchar_t* format, va_list va ) + static inline int TIXML_VSCPRINTF( const tinyxml2::TCHAR* format, va_list va ) { int len = 512; for (;;) { len = len*2; - wchar_t* str = new wchar_t[len](); + tinyxml2::TCHAR* str = new tinyxml2::TCHAR[len](); const int required = _vsnprintf(str, len, format, va); delete[] str; if ( required != -1 ) { @@ -97,10 +107,10 @@ distribution. #endif #else // GCC version 3 and higher - //#warning( TINYXML2_STR("Using sn* functions.") ) + //#warning( "Using sn* functions." ) #define TIXML_SNPRINTF snprintf #define TIXML_VSNPRINTF vsnprintf - static inline int TIXML_VSCPRINTF( const wchar_t* format, va_list va ) + static inline int TIXML_VSCPRINTF( const tinyxml2::TCHAR* format, va_list va ) { int len = vsnprintf( 0, 0, format, va ); TIXMLASSERT( len >= 0 ); @@ -110,37 +120,37 @@ distribution. #endif -static const wchar_t LINE_FEED = (wchar_t)0x0a; // all line endings are normalized to LF -static const wchar_t LF = LINE_FEED; -static const wchar_t CARRIAGE_RETURN = (wchar_t)0x0d; // CR gets filtered out -static const wchar_t CR = CARRIAGE_RETURN; -static const wchar_t SINGLE_QUOTE = TINYXML2_CHAR('\''); -static const wchar_t DOUBLE_QUOTE = TINYXML2_CHAR('\"'); +static const tinyxml2::TCHAR LINE_FEED = static_cast(0x0a); // all line endings are normalized to LF +static const tinyxml2::TCHAR LF = LINE_FEED; +static const tinyxml2::TCHAR CARRIAGE_RETURN = static_cast(0x0d); // CR gets filtered out +static const tinyxml2::TCHAR CR = CARRIAGE_RETURN; +static const tinyxml2::TCHAR SINGLE_QUOTE = '\''; +static const tinyxml2::TCHAR DOUBLE_QUOTE = '\"'; // Bunch of unicode info at: // http://www.unicode.org/faq/utf_bom.html -// ef bb bf (Microsoft TINYXML2_STR("lead bytes")) - designates UTF-8 +// ef bb bf (Microsoft "lead bytes") - designates UTF-8 -static const TINYXML2_UNSIGNED_CHAR TIXML_UTF_LEAD_0 = 0xefU; -static const TINYXML2_UNSIGNED_CHAR TIXML_UTF_LEAD_1 = 0xbbU; -static const TINYXML2_UNSIGNED_CHAR TIXML_UTF_LEAD_2 = 0xbfU; +static const tinyxml2::TUCHAR TIXML_UTF_LEAD_0 = 0xefU; +static const tinyxml2::TUCHAR TIXML_UTF_LEAD_1 = 0xbbU; +static const tinyxml2::TUCHAR TIXML_UTF_LEAD_2 = 0xbfU; namespace tinyxml2 { struct Entity { - const wchar_t* pattern; + const TCHAR* pattern; int length; - wchar_t value; + TCHAR value; }; static const int NUM_ENTITIES = 5; static const Entity entities[NUM_ENTITIES] = { { TINYXML2_STR("quot"), 4, DOUBLE_QUOTE }, - { TINYXML2_STR("amp"), 3, TINYXML2_CHAR('&') }, + { TINYXML2_STR("amp"), 3, '&' }, { TINYXML2_STR("apos"), 4, SINGLE_QUOTE }, - { TINYXML2_STR("lt"), 2, TINYXML2_CHAR('<') }, - { TINYXML2_STR("gt"), 2, TINYXML2_CHAR('>') } + { TINYXML2_STR("lt"), 2, '<' }, + { TINYXML2_STR("gt"), 2, '>' } }; @@ -155,7 +165,7 @@ void StrPair::TransferTo( StrPair* other ) if ( this == other ) { return; } - // This in effect implements the assignment operator by TINYXML2_STR("moving") + // This in effect implements the assignment operator by "moving" // ownership (as in auto_ptr). TIXMLASSERT( other != 0 ); @@ -186,27 +196,27 @@ void StrPair::Reset() } -void StrPair::SetStr( const wchar_t* str, int flags ) +void StrPair::SetStr( const TCHAR* str, int flags ) { TIXMLASSERT( str ); Reset(); size_t len = strlen( str ); TIXMLASSERT( _start == 0 ); - _start = new wchar_t[ len+1 ]; - memcpy( _start, str, (len+1) * sizeof(wchar_t)); + _start = new TCHAR[ len+1 ]; + memcpy( _start, str, (len+1) * sizeof(TCHAR)); _end = _start + len; _flags = flags | NEEDS_DELETE; } -wchar_t* StrPair::ParseText( wchar_t* p, const wchar_t* endTag, int strFlags, int* curLineNumPtr ) +TCHAR* StrPair::ParseText( TCHAR* p, const TCHAR* endTag, int strFlags, int* curLineNumPtr ) { TIXMLASSERT( p ); TIXMLASSERT( endTag && *endTag ); TIXMLASSERT(curLineNumPtr); - wchar_t* start = p; - const wchar_t endChar = *endTag; + TCHAR* start = p; + const TCHAR endChar = *endTag; size_t length = strlen( endTag ); // Inner loop of text parsing. @@ -214,7 +224,7 @@ wchar_t* StrPair::ParseText( wchar_t* p, const wchar_t* endTag, int strFlags, in if ( *p == endChar && strncmp( p, endTag, length ) == 0 ) { Set( start, p, strFlags ); return p + length; - } else if (*p == TINYXML2_CHAR('\n')) { + } else if (*p == '\n') { ++(*curLineNumPtr); } ++p; @@ -224,7 +234,7 @@ wchar_t* StrPair::ParseText( wchar_t* p, const wchar_t* endTag, int strFlags, in } -wchar_t* StrPair::ParseName( wchar_t* p ) +TCHAR* StrPair::ParseName( TCHAR* p ) { if ( !p || !(*p) ) { return 0; @@ -233,7 +243,7 @@ wchar_t* StrPair::ParseName( wchar_t* p ) return 0; } - wchar_t* const start = p; + TCHAR* const start = p; ++p; while ( *p && XMLUtil::IsNameChar( *p ) ) { ++p; @@ -252,8 +262,8 @@ void StrPair::CollapseWhitespace() _start = XMLUtil::SkipWhiteSpace( _start, 0 ); if ( *_start ) { - const wchar_t* p = _start; // the read pointer - wchar_t* q = _start; // the write pointer + const TCHAR* p = _start; // the read pointer + TCHAR* q = _start; // the write pointer while( *p ) { if ( XMLUtil::IsWhiteSpace( *p )) { @@ -261,7 +271,7 @@ void StrPair::CollapseWhitespace() if ( *p == 0 ) { break; // don't write to q; this trims the trailing space. } - *q = TINYXML2_CHAR(' '); + *q = ' '; ++q; } *q = *p; @@ -273,7 +283,7 @@ void StrPair::CollapseWhitespace() } -const wchar_t* StrPair::GetStr() +const TCHAR* StrPair::GetStr() { TIXMLASSERT( _start ); TIXMLASSERT( _end ); @@ -282,8 +292,8 @@ const wchar_t* StrPair::GetStr() _flags ^= NEEDS_FLUSH; if ( _flags ) { - const wchar_t* p = _start; // the read pointer - wchar_t* q = _start; // the write pointer + const TCHAR* p = _start; // the read pointer + TCHAR* q = _start; // the write pointer while( p < _end ) { if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == CR ) { @@ -309,17 +319,17 @@ const wchar_t* StrPair::GetStr() *q = LF; ++q; } - else if ( (_flags & NEEDS_ENTITY_PROCESSING) && *p == TINYXML2_CHAR('&') ) { + else if ( (_flags & NEEDS_ENTITY_PROCESSING) && *p == '&' ) { // Entities handled by tinyXML2: // - special entities in the entity table [in/out] - // - numeric wchar_tacter reference [in] + // - numeric character reference [in] // 中 or 中 - if ( *(p+1) == TINYXML2_CHAR('#') ) { + if ( *(p+1) == '#' ) { const int buflen = 10; - wchar_t buf[buflen] = { 0 }; + TCHAR buf[buflen] = { 0 }; int len = 0; - const wchar_t* adjusted = const_cast( XMLUtil::GetCharacterRef( p, buf, &len ) ); + const TCHAR* adjusted = const_cast( XMLUtil::GetCharacterRef( p, buf, &len ) ); if ( adjusted == 0 ) { *q = *p; ++p; @@ -329,7 +339,7 @@ const wchar_t* StrPair::GetStr() TIXMLASSERT( 0 <= len && len <= buflen ); TIXMLASSERT( q + len <= adjusted ); p = adjusted; - memcpy( q, buf, len * sizeof(wchar_t)); + memcpy( q, buf, len * sizeof(TCHAR)); q += len; } } @@ -338,7 +348,7 @@ const wchar_t* StrPair::GetStr() for( int i = 0; i < NUM_ENTITIES; ++i ) { const Entity& entity = entities[i]; if ( strncmp( p + 1, entity.pattern, entity.length ) == 0 - && *( p + entity.length + 1 ) == TINYXML2_CHAR(';') ) { + && *( p + entity.length + 1 ) == ';' ) { // Found an entity - convert. *q = entity.value; ++q; @@ -378,25 +388,25 @@ const wchar_t* StrPair::GetStr() // --------- XMLUtil ----------- // -const wchar_t* XMLUtil::writeBoolTrue = TINYXML2_STR("true"); -const wchar_t* XMLUtil::writeBoolFalse = TINYXML2_STR("false"); +const TCHAR* XMLUtil::writeBoolTrue = TINYXML2_STR("true"); +const TCHAR* XMLUtil::writeBoolFalse = TINYXML2_STR("false"); -void XMLUtil::SetBoolSerialization(const wchar_t* writeTrue, const wchar_t* writeFalse) +void XMLUtil::SetBoolSerialization(const TCHAR* writeTrue, const TCHAR* writeFalse) { - static const wchar_t* defTrue = TINYXML2_STR("true"); - static const wchar_t* defFalse = TINYXML2_STR("false"); + static const TCHAR* defTrue = TINYXML2_STR("true"); + static const TCHAR* defFalse = TINYXML2_STR("false"); writeBoolTrue = (writeTrue) ? writeTrue : defTrue; writeBoolFalse = (writeFalse) ? writeFalse : defFalse; } -const wchar_t* XMLUtil::ReadBOM( const wchar_t* p, bool* bom ) +const TCHAR* XMLUtil::ReadBOM( const TCHAR* p, bool* bom ) { TIXMLASSERT( p ); TIXMLASSERT( bom ); *bom = false; - const TINYXML2_UNSIGNED_CHAR* pu = reinterpret_cast(p); + const TUCHAR* pu = reinterpret_cast(p); // Check for BOM: if ( *(pu+0) == TIXML_UTF_LEAD_0 && *(pu+1) == TIXML_UTF_LEAD_1 @@ -409,7 +419,7 @@ const wchar_t* XMLUtil::ReadBOM( const wchar_t* p, bool* bom ) } -void XMLUtil::ConvertUTF32ToUTF8( unsigned long input, wchar_t* output, int* length ) +void XMLUtil::ConvertUTF32ToUTF8( unsigned long input, TCHAR* output, int* length ) { const unsigned long BYTE_MASK = 0xBF; const unsigned long BYTE_MARK = 0x80; @@ -439,22 +449,22 @@ void XMLUtil::ConvertUTF32ToUTF8( unsigned long input, wchar_t* output, int* len switch (*length) { case 4: --output; - *output = (wchar_t)((input | BYTE_MARK) & BYTE_MASK); + *output = static_cast((input | BYTE_MARK) & BYTE_MASK); input >>= 6; //fall through case 3: --output; - *output = (wchar_t)((input | BYTE_MARK) & BYTE_MASK); + *output = static_cast((input | BYTE_MARK) & BYTE_MASK); input >>= 6; //fall through case 2: --output; - *output = (wchar_t)((input | BYTE_MARK) & BYTE_MASK); + *output = static_cast((input | BYTE_MARK) & BYTE_MASK); input >>= 6; //fall through case 1: --output; - *output = (wchar_t)(input | FIRST_BYTE_MARK[*length]); + *output = static_cast(input | FIRST_BYTE_MARK[*length]); break; default: TIXMLASSERT( false ); @@ -462,21 +472,21 @@ void XMLUtil::ConvertUTF32ToUTF8( unsigned long input, wchar_t* output, int* len } -const wchar_t* XMLUtil::GetCharacterRef( const wchar_t* p, wchar_t* value, int* length ) +const TCHAR* XMLUtil::GetCharacterRef( const TCHAR* p, TCHAR* value, int* length ) { // Presume an entity, and pull it out. *length = 0; - if ( *(p+1) == TINYXML2_CHAR('#') && *(p+2) ) { + if ( *(p+1) == '#' && *(p+2) ) { unsigned long ucs = 0; TIXMLASSERT( sizeof( ucs ) >= 4 ); ptrdiff_t delta = 0; unsigned mult = 1; - static const wchar_t SEMICOLON = TINYXML2_CHAR(';'); + static const TCHAR SEMICOLON = ';'; - if ( *(p+2) == TINYXML2_CHAR('x') ) { + if ( *(p+2) == 'x' ) { // Hexadecimal. - const wchar_t* q = p+3; + const TCHAR* q = p+3; if ( !(*q) ) { return 0; } @@ -491,17 +501,17 @@ const wchar_t* XMLUtil::GetCharacterRef( const wchar_t* p, wchar_t* value, int* delta = q-p; --q; - while ( *q != TINYXML2_CHAR('x') ) { + while ( *q != 'x' ) { unsigned int digit = 0; - if ( *q >= TINYXML2_CHAR('0') && *q <= TINYXML2_CHAR('9') ) { - digit = *q - TINYXML2_CHAR('0'); + if ( *q >= '0' && *q <= '9' ) { + digit = *q - '0'; } - else if ( *q >= TINYXML2_CHAR('a') && *q <= TINYXML2_CHAR('f') ) { - digit = *q - TINYXML2_CHAR('a') + 10; + else if ( *q >= 'a' && *q <= 'f' ) { + digit = *q - 'a' + 10; } - else if ( *q >= TINYXML2_CHAR('A') && *q <= TINYXML2_CHAR('F') ) { - digit = *q - TINYXML2_CHAR('A') + 10; + else if ( *q >= 'A' && *q <= 'F' ) { + digit = *q - 'A' + 10; } else { return 0; @@ -518,7 +528,7 @@ const wchar_t* XMLUtil::GetCharacterRef( const wchar_t* p, wchar_t* value, int* } else { // Decimal. - const wchar_t* q = p+2; + const TCHAR* q = p+2; if ( !(*q) ) { return 0; } @@ -533,9 +543,9 @@ const wchar_t* XMLUtil::GetCharacterRef( const wchar_t* p, wchar_t* value, int* delta = q-p; --q; - while ( *q != TINYXML2_CHAR('#') ) { - if ( *q >= TINYXML2_CHAR('0') && *q <= TINYXML2_CHAR('9') ) { - const unsigned int digit = *q - TINYXML2_CHAR('0'); + while ( *q != '#' ) { + if ( *q >= '0' && *q <= '9' ) { + const unsigned int digit = *q - '0'; TIXMLASSERT( digit < 10 ); TIXMLASSERT( digit == 0 || mult <= UINT_MAX / digit ); const unsigned int digitScaled = mult * digit; @@ -558,19 +568,19 @@ const wchar_t* XMLUtil::GetCharacterRef( const wchar_t* p, wchar_t* value, int* } -void XMLUtil::ToStr( int v, wchar_t* buffer, int bufferSize ) +void XMLUtil::ToStr( int v, TCHAR* buffer, int bufferSize ) { TIXML_SNPRINTF( buffer, bufferSize, TINYXML2_STR("%d"), v ); } -void XMLUtil::ToStr( unsigned v, wchar_t* buffer, int bufferSize ) +void XMLUtil::ToStr( unsigned v, TCHAR* buffer, int bufferSize ) { TIXML_SNPRINTF( buffer, bufferSize, TINYXML2_STR("%u"), v ); } -void XMLUtil::ToStr( bool v, wchar_t* buffer, int bufferSize ) +void XMLUtil::ToStr( bool v, TCHAR* buffer, int bufferSize ) { TIXML_SNPRINTF( buffer, bufferSize, TINYXML2_STR("%s"), v ? writeBoolTrue : writeBoolFalse); } @@ -579,26 +589,31 @@ void XMLUtil::ToStr( bool v, wchar_t* buffer, int bufferSize ) ToStr() of a number is a very tricky topic. https://github.com/leethomason/tinyxml2/issues/106 */ -void XMLUtil::ToStr( float v, wchar_t* buffer, int bufferSize ) +void XMLUtil::ToStr( float v, TCHAR* buffer, int bufferSize ) { TIXML_SNPRINTF( buffer, bufferSize, TINYXML2_STR("%.8g"), v ); } -void XMLUtil::ToStr( double v, wchar_t* buffer, int bufferSize ) +void XMLUtil::ToStr( double v, TCHAR* buffer, int bufferSize ) { TIXML_SNPRINTF( buffer, bufferSize, TINYXML2_STR("%.17g"), v ); } -void XMLUtil::ToStr(int64_t v, wchar_t* buffer, int bufferSize) +void XMLUtil::ToStr( int64_t v, TCHAR* buffer, int bufferSize ) { // horrible syntax trick to make the compiler happy about %lld - TIXML_SNPRINTF(buffer, bufferSize, TINYXML2_STR("%lld"), (long long)v); + TIXML_SNPRINTF(buffer, bufferSize, TINYXML2_STR("%lld"), static_cast(v)); } +void XMLUtil::ToStr( uint64_t v, TCHAR* buffer, int bufferSize ) +{ + // horrible syntax trick to make the compiler happy about %llu + TIXML_SNPRINTF(buffer, bufferSize, TINYXML2_STR("%llu"), (long long)v); +} -bool XMLUtil::ToInt( const wchar_t* str, int* value ) +bool XMLUtil::ToInt( const TCHAR* str, int* value ) { if ( TIXML_SSCANF( str, TINYXML2_STR("%d"), value ) == 1 ) { return true; @@ -606,7 +621,7 @@ bool XMLUtil::ToInt( const wchar_t* str, int* value ) return false; } -bool XMLUtil::ToUnsigned( const wchar_t* str, unsigned *value ) +bool XMLUtil::ToUnsigned( const TCHAR* str, unsigned *value ) { if ( TIXML_SSCANF( str, TINYXML2_STR("%u"), value ) == 1 ) { return true; @@ -614,26 +629,33 @@ bool XMLUtil::ToUnsigned( const wchar_t* str, unsigned *value ) return false; } -bool XMLUtil::ToBool( const wchar_t* str, bool* value ) +bool XMLUtil::ToBool( const TCHAR* str, bool* value ) { int ival = 0; if ( ToInt( str, &ival )) { *value = (ival==0) ? false : true; return true; } - if ( StringEqual( str, TINYXML2_STR("true") ) ) { - *value = true; - return true; + static const TCHAR* TRUE[] = { TINYXML2_STR("true"), TINYXML2_STR("True"), TINYXML2_STR("TRUE"), 0 }; + static const TCHAR* FALSE[] = { TINYXML2_STR("false"), TINYXML2_STR("False"), TINYXML2_STR("FALSE"), 0 }; + + for (int i = 0; TRUE[i]; ++i) { + if (StringEqual(str, TRUE[i])) { + *value = true; + return true; + } } - else if ( StringEqual( str, TINYXML2_STR("false") ) ) { - *value = false; - return true; + for (int i = 0; FALSE[i]; ++i) { + if (StringEqual(str, FALSE[i])) { + *value = false; + return true; + } } return false; } -bool XMLUtil::ToFloat( const wchar_t* str, float* value ) +bool XMLUtil::ToFloat( const TCHAR* str, float* value ) { if ( TIXML_SSCANF( str, TINYXML2_STR("%f"), value ) == 1 ) { return true; @@ -642,7 +664,7 @@ bool XMLUtil::ToFloat( const wchar_t* str, float* value ) } -bool XMLUtil::ToDouble( const wchar_t* str, double* value ) +bool XMLUtil::ToDouble( const TCHAR* str, double* value ) { if ( TIXML_SSCANF( str, TINYXML2_STR("%lf"), value ) == 1 ) { return true; @@ -651,22 +673,32 @@ bool XMLUtil::ToDouble( const wchar_t* str, double* value ) } -bool XMLUtil::ToInt64(const wchar_t* str, int64_t* value) +bool XMLUtil::ToInt64(const TCHAR* str, int64_t* value) { long long v = 0; // horrible syntax trick to make the compiler happy about %lld if (TIXML_SSCANF(str, TINYXML2_STR("%lld"), &v) == 1) { - *value = (int64_t)v; + *value = static_cast(v); return true; } return false; } -wchar_t* XMLDocument::Identify( wchar_t* p, XMLNode** node ) +bool XMLUtil::ToUnsigned64(const TCHAR* str, uint64_t* value) { + unsigned long long v = 0; // horrible syntax trick to make the compiler happy about %llu + if(TIXML_SSCANF(str, TINYXML2_STR("%llu"), &v) == 1) { + *value = (uint64_t)v; + return true; + } + return false; +} + + +TCHAR* XMLDocument::Identify( TCHAR* p, XMLNode** node ) { TIXMLASSERT( node ); TIXMLASSERT( p ); - wchar_t* const start = p; + TCHAR* const start = p; int const startLine = _parseCurLineNum; p = XMLUtil::SkipWhiteSpace( p, &_parseCurLineNum ); if( !*p ) { @@ -676,11 +708,11 @@ wchar_t* XMLDocument::Identify( wchar_t* p, XMLNode** node ) } // These strings define the matching patterns: - static const wchar_t* xmlHeader = { TINYXML2_STR("( _textPool ); - returnNode->_parseLineNum = _parseCurLineNum; // Report line of first non-whitespace wchar_tacter + returnNode->_parseLineNum = _parseCurLineNum; // Report line of first non-whitespace character p = start; // Back it up, all the text counts. _parseCurLineNum = startLine; } @@ -769,7 +801,7 @@ XMLNode::~XMLNode() } } -const wchar_t* XMLNode::Value() const +const TCHAR* XMLNode::Value() const { // Edge case: XMLDocuments don't have a Value. Return null. if ( this->ToDocument() ) @@ -777,7 +809,7 @@ const wchar_t* XMLNode::Value() const return _value.GetStr(); } -void XMLNode::SetValue( const wchar_t* str, bool staticMem ) +void XMLNode::SetValue( const TCHAR* str, bool staticMem ) { if ( staticMem ) { _value.SetInternedStr( str ); @@ -946,7 +978,7 @@ XMLNode* XMLNode::InsertAfterChild( XMLNode* afterThis, XMLNode* addThis ) -const XMLElement* XMLNode::FirstChildElement( const wchar_t* name ) const +const XMLElement* XMLNode::FirstChildElement( const TCHAR* name ) const { for( const XMLNode* node = _firstChild; node; node = node->_next ) { const XMLElement* element = node->ToElementWithName( name ); @@ -958,7 +990,7 @@ const XMLElement* XMLNode::FirstChildElement( const wchar_t* name ) const } -const XMLElement* XMLNode::LastChildElement( const wchar_t* name ) const +const XMLElement* XMLNode::LastChildElement( const TCHAR* name ) const { for( const XMLNode* node = _lastChild; node; node = node->_prev ) { const XMLElement* element = node->ToElementWithName( name ); @@ -970,7 +1002,7 @@ const XMLElement* XMLNode::LastChildElement( const wchar_t* name ) const } -const XMLElement* XMLNode::NextSiblingElement( const wchar_t* name ) const +const XMLElement* XMLNode::NextSiblingElement( const TCHAR* name ) const { for( const XMLNode* node = _next; node; node = node->_next ) { const XMLElement* element = node->ToElementWithName( name ); @@ -982,7 +1014,7 @@ const XMLElement* XMLNode::NextSiblingElement( const wchar_t* name ) const } -const XMLElement* XMLNode::PreviousSiblingElement( const wchar_t* name ) const +const XMLElement* XMLNode::PreviousSiblingElement( const TCHAR* name ) const { for( const XMLNode* node = _prev; node; node = node->_prev ) { const XMLElement* element = node->ToElementWithName( name ); @@ -994,7 +1026,7 @@ const XMLElement* XMLNode::PreviousSiblingElement( const wchar_t* name ) const } -wchar_t* XMLNode::ParseDeep( wchar_t* p, StrPair* parentEndTag, int* curLineNumPtr ) +TCHAR* XMLNode::ParseDeep( TCHAR* p, StrPair* parentEndTag, int* curLineNumPtr ) { // This is a recursive method, but thinking about it TINYXML2_STR("at the current level") // it is a pretty simple flat list: @@ -1137,7 +1169,7 @@ void XMLNode::InsertChildPreamble( XMLNode* insertThis ) const } } -const XMLElement* XMLNode::ToElementWithName( const wchar_t* name ) const +const XMLElement* XMLNode::ToElementWithName( const TCHAR* name ) const { const XMLElement* element = this->ToElement(); if ( element == 0 ) { @@ -1153,7 +1185,7 @@ const XMLElement* XMLNode::ToElementWithName( const wchar_t* name ) const } // --------- XMLText ---------- // -wchar_t* XMLText::ParseDeep( wchar_t* p, StrPair*, int* curLineNumPtr ) +TCHAR* XMLText::ParseDeep( TCHAR* p, StrPair*, int* curLineNumPtr ) { if ( this->CData() ) { p = _value.ParseText( p, TINYXML2_STR("]]>"), StrPair::NEEDS_NEWLINE_NORMALIZATION, curLineNumPtr ); @@ -1218,7 +1250,7 @@ XMLComment::~XMLComment() } -wchar_t* XMLComment::ParseDeep( wchar_t* p, StrPair*, int* curLineNumPtr ) +TCHAR* XMLComment::ParseDeep( TCHAR* p, StrPair*, int* curLineNumPtr ) { // Comment parses as text. p = _value.ParseText( p, TINYXML2_STR("-->"), StrPair::COMMENT, curLineNumPtr ); @@ -1267,7 +1299,7 @@ XMLDeclaration::~XMLDeclaration() } -wchar_t* XMLDeclaration::ParseDeep( wchar_t* p, StrPair*, int* curLineNumPtr ) +TCHAR* XMLDeclaration::ParseDeep( TCHAR* p, StrPair*, int* curLineNumPtr ) { // Declaration parses as text. p = _value.ParseText( p, TINYXML2_STR("?>"), StrPair::NEEDS_NEWLINE_NORMALIZATION, curLineNumPtr ); @@ -1315,7 +1347,7 @@ XMLUnknown::~XMLUnknown() } -wchar_t* XMLUnknown::ParseDeep( wchar_t* p, StrPair*, int* curLineNumPtr ) +TCHAR* XMLUnknown::ParseDeep( TCHAR* p, StrPair*, int* curLineNumPtr ) { // Unknown parses as text. p = _value.ParseText( p, TINYXML2_STR(">"), StrPair::NEEDS_NEWLINE_NORMALIZATION, curLineNumPtr ); @@ -1352,17 +1384,17 @@ bool XMLUnknown::Accept( XMLVisitor* visitor ) const // --------- XMLAttribute ---------- // -const wchar_t* XMLAttribute::Name() const +const TCHAR* XMLAttribute::Name() const { return _name.GetStr(); } -const wchar_t* XMLAttribute::Value() const +const TCHAR* XMLAttribute::Value() const { return _value.GetStr(); } -wchar_t* XMLAttribute::ParseDeep( wchar_t* p, bool processEntities, int* curLineNumPtr ) +TCHAR* XMLAttribute::ParseDeep( TCHAR* p, bool processEntities, int* curLineNumPtr ) { // Parse using the name rules: bug fix, was using ParseText before p = _name.ParseName( p ); @@ -1372,17 +1404,17 @@ wchar_t* XMLAttribute::ParseDeep( wchar_t* p, bool processEntities, int* curLine // Skip white space before = p = XMLUtil::SkipWhiteSpace( p, curLineNumPtr ); - if ( *p != TINYXML2_CHAR('=') ) { + if ( *p != '=' ) { return 0; } ++p; // move up to opening quote p = XMLUtil::SkipWhiteSpace( p, curLineNumPtr ); - if ( *p != TINYXML2_CHAR('\"') && *p != TINYXML2_CHAR('\'') ) { + if ( *p != '\"' && *p != '\'' ) { return 0; } - const wchar_t endTag[2] = { *p, 0 }; + const TCHAR endTag[2] = { *p, 0 }; ++p; // move past opening quote p = _value.ParseText( p, endTag, processEntities ? StrPair::ATTRIBUTE_VALUE : StrPair::ATTRIBUTE_VALUE_LEAVE_ENTITIES, curLineNumPtr ); @@ -1390,7 +1422,7 @@ wchar_t* XMLAttribute::ParseDeep( wchar_t* p, bool processEntities, int* curLine } -void XMLAttribute::SetName( const wchar_t* n ) +void XMLAttribute::SetName( const TCHAR* n ) { _name.SetStr( n ); } @@ -1423,6 +1455,15 @@ XMLError XMLAttribute::QueryInt64Value(int64_t* value) const } +XMLError XMLAttribute::QueryUnsigned64Value(uint64_t* value) const +{ + if(XMLUtil::ToUnsigned64(Value(), value)) { + return XML_SUCCESS; + } + return XML_WRONG_ATTRIBUTE_TYPE; +} + + XMLError XMLAttribute::QueryBoolValue( bool* value ) const { if ( XMLUtil::ToBool( Value(), value )) { @@ -1450,7 +1491,7 @@ XMLError XMLAttribute::QueryDoubleValue( double* value ) const } -void XMLAttribute::SetAttribute( const wchar_t* v ) +void XMLAttribute::SetAttribute( const TCHAR* v ) { _value.SetStr( v ); } @@ -1458,7 +1499,7 @@ void XMLAttribute::SetAttribute( const wchar_t* v ) void XMLAttribute::SetAttribute( int v ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); _value.SetStr( buf ); } @@ -1466,7 +1507,7 @@ void XMLAttribute::SetAttribute( int v ) void XMLAttribute::SetAttribute( unsigned v ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); _value.SetStr( buf ); } @@ -1474,30 +1515,36 @@ void XMLAttribute::SetAttribute( unsigned v ) void XMLAttribute::SetAttribute(int64_t v) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr(v, buf, BUF_SIZE); _value.SetStr(buf); } +void XMLAttribute::SetAttribute(uint64_t v) +{ + TCHAR buf[BUF_SIZE]; + XMLUtil::ToStr(v, buf, BUF_SIZE); + _value.SetStr(buf); +} void XMLAttribute::SetAttribute( bool v ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); _value.SetStr( buf ); } void XMLAttribute::SetAttribute( double v ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); _value.SetStr( buf ); } void XMLAttribute::SetAttribute( float v ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); _value.SetStr( buf ); } @@ -1521,7 +1568,7 @@ XMLElement::~XMLElement() } -const XMLAttribute* XMLElement::FindAttribute( const wchar_t* name ) const +const XMLAttribute* XMLElement::FindAttribute( const TCHAR* name ) const { for( XMLAttribute* a = _rootAttribute; a; a = a->_next ) { if ( XMLUtil::StringEqual( a->Name(), name ) ) { @@ -1532,7 +1579,7 @@ const XMLAttribute* XMLElement::FindAttribute( const wchar_t* name ) const } -const wchar_t* XMLElement::Attribute( const wchar_t* name, const wchar_t* value ) const +const TCHAR* XMLElement::Attribute( const TCHAR* name, const TCHAR* value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) { @@ -1544,49 +1591,56 @@ const wchar_t* XMLElement::Attribute( const wchar_t* name, const wchar_t* value return 0; } -int XMLElement::IntAttribute(const wchar_t* name, int defaultValue) const +int XMLElement::IntAttribute(const TCHAR* name, int defaultValue) const { int i = defaultValue; QueryIntAttribute(name, &i); return i; } -unsigned XMLElement::UnsignedAttribute(const wchar_t* name, unsigned defaultValue) const +unsigned XMLElement::UnsignedAttribute(const TCHAR* name, unsigned defaultValue) const { unsigned i = defaultValue; QueryUnsignedAttribute(name, &i); return i; } -int64_t XMLElement::Int64Attribute(const wchar_t* name, int64_t defaultValue) const +int64_t XMLElement::Int64Attribute(const TCHAR* name, int64_t defaultValue) const { int64_t i = defaultValue; QueryInt64Attribute(name, &i); return i; } -bool XMLElement::BoolAttribute(const wchar_t* name, bool defaultValue) const +uint64_t XMLElement::Unsigned64Attribute(const TCHAR* name, uint64_t defaultValue) const +{ + uint64_t i = defaultValue; + QueryUnsigned64Attribute(name, &i); + return i; +} + +bool XMLElement::BoolAttribute(const TCHAR* name, bool defaultValue) const { bool b = defaultValue; QueryBoolAttribute(name, &b); return b; } -double XMLElement::DoubleAttribute(const wchar_t* name, double defaultValue) const +double XMLElement::DoubleAttribute(const TCHAR* name, double defaultValue) const { double d = defaultValue; QueryDoubleAttribute(name, &d); return d; } -float XMLElement::FloatAttribute(const wchar_t* name, float defaultValue) const +float XMLElement::FloatAttribute(const TCHAR* name, float defaultValue) const { float f = defaultValue; QueryFloatAttribute(name, &f); return f; } -const wchar_t* XMLElement::GetText() const +const TCHAR* XMLElement::GetText() const { if ( FirstChild() && FirstChild()->ToText() ) { return FirstChild()->Value(); @@ -1595,7 +1649,7 @@ const wchar_t* XMLElement::GetText() const } -void XMLElement::SetText( const wchar_t* inText ) +void XMLElement::SetText( const TCHAR* inText ) { if ( FirstChild() && FirstChild()->ToText() ) FirstChild()->SetValue( inText ); @@ -1608,7 +1662,7 @@ void XMLElement::SetText( const wchar_t* inText ) void XMLElement::SetText( int v ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); SetText( buf ); } @@ -1616,7 +1670,7 @@ void XMLElement::SetText( int v ) void XMLElement::SetText( unsigned v ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); SetText( buf ); } @@ -1624,15 +1678,21 @@ void XMLElement::SetText( unsigned v ) void XMLElement::SetText(int64_t v) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr(v, buf, BUF_SIZE); SetText(buf); } +void XMLElement::SetText(uint64_t v) { + TCHAR buf[BUF_SIZE]; + XMLUtil::ToStr(v, buf, BUF_SIZE); + SetText(buf); +} + void XMLElement::SetText( bool v ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); SetText( buf ); } @@ -1640,7 +1700,7 @@ void XMLElement::SetText( bool v ) void XMLElement::SetText( float v ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); SetText( buf ); } @@ -1648,7 +1708,7 @@ void XMLElement::SetText( float v ) void XMLElement::SetText( double v ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); SetText( buf ); } @@ -1657,7 +1717,7 @@ void XMLElement::SetText( double v ) XMLError XMLElement::QueryIntText( int* ival ) const { if ( FirstChild() && FirstChild()->ToText() ) { - const wchar_t* t = FirstChild()->Value(); + const TCHAR* t = FirstChild()->Value(); if ( XMLUtil::ToInt( t, ival ) ) { return XML_SUCCESS; } @@ -1670,7 +1730,7 @@ XMLError XMLElement::QueryIntText( int* ival ) const XMLError XMLElement::QueryUnsignedText( unsigned* uval ) const { if ( FirstChild() && FirstChild()->ToText() ) { - const wchar_t* t = FirstChild()->Value(); + const TCHAR* t = FirstChild()->Value(); if ( XMLUtil::ToUnsigned( t, uval ) ) { return XML_SUCCESS; } @@ -1683,7 +1743,7 @@ XMLError XMLElement::QueryUnsignedText( unsigned* uval ) const XMLError XMLElement::QueryInt64Text(int64_t* ival) const { if (FirstChild() && FirstChild()->ToText()) { - const wchar_t* t = FirstChild()->Value(); + const TCHAR* t = FirstChild()->Value(); if (XMLUtil::ToInt64(t, ival)) { return XML_SUCCESS; } @@ -1693,10 +1753,23 @@ XMLError XMLElement::QueryInt64Text(int64_t* ival) const } +XMLError XMLElement::QueryUnsigned64Text(uint64_t* ival) const +{ + if(FirstChild() && FirstChild()->ToText()) { + const TCHAR* t = FirstChild()->Value(); + if(XMLUtil::ToUnsigned64(t, ival)) { + return XML_SUCCESS; + } + return XML_CAN_NOT_CONVERT_TEXT; + } + return XML_NO_TEXT_NODE; +} + + XMLError XMLElement::QueryBoolText( bool* bval ) const { if ( FirstChild() && FirstChild()->ToText() ) { - const wchar_t* t = FirstChild()->Value(); + const TCHAR* t = FirstChild()->Value(); if ( XMLUtil::ToBool( t, bval ) ) { return XML_SUCCESS; } @@ -1709,7 +1782,7 @@ XMLError XMLElement::QueryBoolText( bool* bval ) const XMLError XMLElement::QueryDoubleText( double* dval ) const { if ( FirstChild() && FirstChild()->ToText() ) { - const wchar_t* t = FirstChild()->Value(); + const TCHAR* t = FirstChild()->Value(); if ( XMLUtil::ToDouble( t, dval ) ) { return XML_SUCCESS; } @@ -1722,7 +1795,7 @@ XMLError XMLElement::QueryDoubleText( double* dval ) const XMLError XMLElement::QueryFloatText( float* fval ) const { if ( FirstChild() && FirstChild()->ToText() ) { - const wchar_t* t = FirstChild()->Value(); + const TCHAR* t = FirstChild()->Value(); if ( XMLUtil::ToFloat( t, fval ) ) { return XML_SUCCESS; } @@ -1752,6 +1825,13 @@ int64_t XMLElement::Int64Text(int64_t defaultValue) const return i; } +uint64_t XMLElement::Unsigned64Text(uint64_t defaultValue) const +{ + uint64_t i = defaultValue; + QueryUnsigned64Text(&i); + return i; +} + bool XMLElement::BoolText(bool defaultValue) const { bool b = defaultValue; @@ -1774,7 +1854,7 @@ float XMLElement::FloatText(float defaultValue) const } -XMLAttribute* XMLElement::FindOrCreateAttribute( const wchar_t* name ) +XMLAttribute* XMLElement::FindOrCreateAttribute( const TCHAR* name ) { XMLAttribute* last = 0; XMLAttribute* attrib = 0; @@ -1802,7 +1882,7 @@ XMLAttribute* XMLElement::FindOrCreateAttribute( const wchar_t* name ) } -void XMLElement::DeleteAttribute( const wchar_t* name ) +void XMLElement::DeleteAttribute( const TCHAR* name ) { XMLAttribute* prev = 0; for( XMLAttribute* a=_rootAttribute; a; a=a->_next ) { @@ -1821,7 +1901,7 @@ void XMLElement::DeleteAttribute( const wchar_t* name ) } -wchar_t* XMLElement::ParseAttributes( wchar_t* p, int* curLineNumPtr ) +TCHAR* XMLElement::ParseAttributes( TCHAR* p, int* curLineNumPtr ) { XMLAttribute* prevAttribute = 0; @@ -1863,12 +1943,12 @@ wchar_t* XMLElement::ParseAttributes( wchar_t* p, int* curLineNumPtr ) prevAttribute = attrib; } // end of the tag - else if ( *p == TINYXML2_CHAR('>') ) { + else if ( *p == '>' ) { ++p; break; } // end of the tag - else if ( *p == TINYXML2_CHAR('/') && *(p+1) == TINYXML2_CHAR('>') ) { + else if ( *p == '/' && *(p+1) == '>' ) { _closingType = CLOSED; return p+2; // done; sealed element. } @@ -1904,7 +1984,7 @@ XMLAttribute* XMLElement::CreateAttribute() // // foobar // -wchar_t* XMLElement::ParseDeep( wchar_t* p, StrPair* parentEndTag, int* curLineNumPtr ) +TCHAR* XMLElement::ParseDeep( TCHAR* p, StrPair* parentEndTag, int* curLineNumPtr ) { // Read the element name. p = XMLUtil::SkipWhiteSpace( p, curLineNumPtr ); @@ -1912,7 +1992,7 @@ wchar_t* XMLElement::ParseDeep( wchar_t* p, StrPair* parentEndTag, int* curLineN // The closing element is the form. It is // parsed just like a regular element then deleted from // the DOM. - if ( *p == TINYXML2_CHAR('/') ) { + if ( *p == '/' ) { _closingType = CLOSING; ++p; } @@ -1989,7 +2069,7 @@ bool XMLElement::Accept( XMLVisitor* visitor ) const // --------- XMLDocument ----------- // // Warning: List must match 'enum XMLError' -const wchar_t* XMLDocument::_errorNames[XML_ERROR_COUNT] = { +const TCHAR* XMLDocument::_errorNames[XML_ERROR_COUNT] = { TINYXML2_STR("XML_SUCCESS"), TINYXML2_STR("XML_NO_ATTRIBUTE"), TINYXML2_STR("XML_WRONG_ATTRIBUTE_TYPE"), @@ -2020,7 +2100,7 @@ XMLDocument::XMLDocument( bool processEntities, Whitespace whitespaceMode ) : _whitespaceMode( whitespaceMode ), _errorStr(), _errorLineNum( 0 ), - _wcharBuffer( 0 ), + _charBuffer( 0 ), _parseCurLineNum( 0 ), _parsingDepth(0), _unlinked(), @@ -2065,8 +2145,8 @@ void XMLDocument::Clear() #endif ClearError(); - delete [] _wcharBuffer; - _wcharBuffer = 0; + delete [] _charBuffer; + _charBuffer = 0; _parsingDepth = 0; #if 0 @@ -2100,7 +2180,7 @@ void XMLDocument::DeepCopy(XMLDocument* target) const } } -XMLElement* XMLDocument::NewElement( const wchar_t* name ) +XMLElement* XMLDocument::NewElement( const TCHAR* name ) { XMLElement* ele = CreateUnlinkedNode( _elementPool ); ele->SetName( name ); @@ -2108,7 +2188,7 @@ XMLElement* XMLDocument::NewElement( const wchar_t* name ) } -XMLComment* XMLDocument::NewComment( const wchar_t* str ) +XMLComment* XMLDocument::NewComment( const TCHAR* str ) { XMLComment* comment = CreateUnlinkedNode( _commentPool ); comment->SetValue( str ); @@ -2116,7 +2196,7 @@ XMLComment* XMLDocument::NewComment( const wchar_t* str ) } -XMLText* XMLDocument::NewText( const wchar_t* str ) +XMLText* XMLDocument::NewText( const TCHAR* str ) { XMLText* text = CreateUnlinkedNode( _textPool ); text->SetValue( str ); @@ -2124,7 +2204,7 @@ XMLText* XMLDocument::NewText( const wchar_t* str ) } -XMLDeclaration* XMLDocument::NewDeclaration( const wchar_t* str ) +XMLDeclaration* XMLDocument::NewDeclaration( const TCHAR* str ) { XMLDeclaration* dec = CreateUnlinkedNode( _commentPool ); dec->SetValue( str ? str : TINYXML2_STR("xml version=\"1.0\" encoding=\"UTF-8\"") ); @@ -2132,14 +2212,14 @@ XMLDeclaration* XMLDocument::NewDeclaration( const wchar_t* str ) } -XMLUnknown* XMLDocument::NewUnknown( const wchar_t* str ) +XMLUnknown* XMLDocument::NewUnknown( const TCHAR* str ) { XMLUnknown* unk = CreateUnlinkedNode( _commentPool ); unk->SetValue( str ); return unk; } -static FILE* callfopen( const wchar_t* filepath, const wchar_t* mode ) +static FILE* callfopen( const TCHAR* filepath, const TCHAR* mode ) { TIXMLASSERT( filepath ); TIXMLASSERT( mode ); @@ -2173,7 +2253,7 @@ void XMLDocument::DeleteNode( XMLNode* node ) { } -XMLError XMLDocument::LoadFile( const wchar_t* filename ) +XMLError XMLDocument::LoadFile( const TCHAR* filename ) { if ( !filename ) { TIXMLASSERT( false ); @@ -2203,7 +2283,7 @@ template struct LongFitsIntoSizeTMinusOne { static bool Fits( unsigned long value ) { - return value < (size_t)-1; + return value < static_cast(-1); } }; @@ -2220,7 +2300,7 @@ XMLError XMLDocument::LoadFile( FILE* fp ) Clear(); fseek( fp, 0, SEEK_SET ); - if (fgetc( fp ) == EOF && ferror( fp ) != 0 ) { + if ( fgetc( fp ) == EOF && ferror( fp ) != 0 ) { SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); return _errorID; } @@ -2246,22 +2326,22 @@ XMLError XMLDocument::LoadFile( FILE* fp ) } const size_t size = filelength; - TIXMLASSERT( _wcharBuffer == 0 ); - _wcharBuffer = new wchar_t[size + 1]; - const size_t read = fread( _wcharBuffer, 1, size*sizeof(wchar_t), fp ); + TIXMLASSERT( _charBuffer == 0 ); + _charBuffer = new TCHAR[size+1]; + const size_t read = fread( _charBuffer, 1, size * sizeof(TCHAR), fp ); if ( read != size ) { SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); return _errorID; } - _wcharBuffer[size] = 0; + _charBuffer[size] = 0; Parse(); return _errorID; } -XMLError XMLDocument::SaveFile( const wchar_t* filename, bool compact ) +XMLError XMLDocument::SaveFile( const TCHAR* filename, bool compact ) { if ( !filename ) { TIXMLASSERT( false ); @@ -2291,7 +2371,7 @@ XMLError XMLDocument::SaveFile( FILE* fp, bool compact ) } -XMLError XMLDocument::Parse( const wchar_t* p, size_t len ) +XMLError XMLDocument::Parse( const TCHAR* p, size_t len ) { Clear(); @@ -2299,13 +2379,13 @@ XMLError XMLDocument::Parse( const wchar_t* p, size_t len ) SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); return _errorID; } - if ( len == (size_t)(-1) ) { + if ( len == static_cast(-1) ) { len = strlen( p ); } - TIXMLASSERT( _wcharBuffer == 0 ); - _wcharBuffer = new wchar_t[ len+1 ]; - memcpy( _wcharBuffer, p, len * sizeof(wchar_t)); - _wcharBuffer[len] = 0; + TIXMLASSERT( _charBuffer == 0 ); + _charBuffer = new TCHAR[ len+1 ]; + memcpy( _charBuffer, p, len * sizeof(TCHAR) ); + _charBuffer[len] = 0; Parse(); if ( Error() ) { @@ -2334,7 +2414,7 @@ void XMLDocument::Print( XMLPrinter* streamer ) const } -void XMLDocument::SetError( XMLError error, int lineNum, const wchar_t* format, ... ) +void XMLDocument::SetError( XMLError error, int lineNum, const TCHAR* format, ... ) { TIXMLASSERT( error >= 0 && error < XML_ERROR_COUNT ); _errorID = error; @@ -2342,7 +2422,7 @@ void XMLDocument::SetError( XMLError error, int lineNum, const wchar_t* format, _errorStr.Reset(); const size_t BUFFER_SIZE = 1000; - wchar_t* buffer = new wchar_t[BUFFER_SIZE]; + TCHAR* buffer = new TCHAR[BUFFER_SIZE]; TIXMLASSERT(sizeof(error) <= sizeof(int)); TIXML_SNPRINTF(buffer, BUFFER_SIZE, TINYXML2_STR("Error=%s ErrorID=%d (0x%x) Line number=%d"), ErrorIDToName(error), int(error), int(error), lineNum); @@ -2362,20 +2442,26 @@ void XMLDocument::SetError( XMLError error, int lineNum, const wchar_t* format, } -/*static*/ const wchar_t* XMLDocument::ErrorIDToName(XMLError errorID) +/*static*/ const TCHAR* XMLDocument::ErrorIDToName(XMLError errorID) { TIXMLASSERT( errorID >= 0 && errorID < XML_ERROR_COUNT ); - const wchar_t* errorName = _errorNames[errorID]; + const TCHAR* errorName = _errorNames[errorID]; TIXMLASSERT( errorName && errorName[0] ); return errorName; } -const wchar_t* XMLDocument::ErrorStr() const +const TCHAR* XMLDocument::ErrorStr() const { return _errorStr.Empty() ? TINYXML2_STR("") : _errorStr.GetStr(); } -const wchar_t* XMLDocument::ErrorName() const + +void XMLDocument::PrintError() const +{ + printf(TINYXML2_STR("%s\n"), ErrorStr()); +} + +const TCHAR* XMLDocument::ErrorName() const { return ErrorIDToName(_errorID); } @@ -2383,12 +2469,12 @@ const wchar_t* XMLDocument::ErrorName() const void XMLDocument::Parse() { TIXMLASSERT( NoChildren() ); // Clear() must have been called previously - TIXMLASSERT( _wcharBuffer ); + TIXMLASSERT( _charBuffer ); _parseCurLineNum = 1; _parseLineNum = 1; - wchar_t* p = _wcharBuffer; + TCHAR* p = _charBuffer; p = XMLUtil::SkipWhiteSpace( p, &_parseCurLineNum ); - p = const_cast( XMLUtil::ReadBOM( p, &_writeBOM ) ); + p = const_cast( XMLUtil::ReadBOM( p, &_writeBOM ) ); if ( !*p ) { SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); return; @@ -2419,27 +2505,26 @@ XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) : _textDepth( -1 ), _processEntities( true ), _compactMode( compact ), - _buffer(), - _entityFlag{} + _buffer() { for( int i=0; i(entityValue); TIXMLASSERT( flagIndex < ENTITY_RANGE ); _entityFlag[flagIndex] = true; } - _restrictedEntityFlag[(TINYXML2_UNSIGNED_CHAR)TINYXML2_CHAR('&')] = true; - _restrictedEntityFlag[(TINYXML2_UNSIGNED_CHAR)TINYXML2_CHAR('<')] = true; - _restrictedEntityFlag[(TINYXML2_UNSIGNED_CHAR)TINYXML2_CHAR('>')] = true; // not required, but consistency is nice + _restrictedEntityFlag[static_cast('&')] = true; + _restrictedEntityFlag[static_cast('<')] = true; + _restrictedEntityFlag[static_cast('>')] = true; // not required, but consistency is nice _buffer.Push( 0 ); } -void XMLPrinter::Print( const wchar_t* format, ... ) +void XMLPrinter::Print( const TCHAR* format, ... ) { va_list va; va_start( va, format ); @@ -2454,33 +2539,38 @@ void XMLPrinter::Print( const wchar_t* format, ... ) TIXMLASSERT( len >= 0 ); va_start( va, format ); TIXMLASSERT( _buffer.Size() > 0 && _buffer[_buffer.Size() - 1] == 0 ); - wchar_t* p = _buffer.PushArr( len ) - 1; // back up over the null terminator. + TCHAR* p = _buffer.PushArr( len ) - 1; // back up over the null terminator. TIXML_VSNPRINTF( p, len+1, format, va ); } va_end( va ); } -void XMLPrinter::Write( const wchar_t* data, size_t size ) +void XMLPrinter::Write( const TCHAR* data, size_t size ) { if ( _fp ) { - fwrite ( data , sizeof(wchar_t), size, _fp); + fwrite ( data , sizeof(TCHAR), size, _fp); } else { - wchar_t* p = _buffer.PushArr( static_cast(size) ) - 1; // back up over the null terminator. - memcpy( p, data, size * sizeof(wchar_t)); + TCHAR* p = _buffer.PushArr( static_cast(size) ) - 1; // back up over the null terminator. + memcpy( p, data, size * sizeof(TCHAR) ); p[size] = 0; } } +void XMLPrinter::Write( const TCHAR* data) +{ + Write( data, strlen( data ) ); +} -void XMLPrinter::Putc( wchar_t ch ) + +void XMLPrinter::Putc( TCHAR ch ) { if ( _fp ) { fputc ( ch, _fp); } else { - wchar_t* p = _buffer.PushArr( sizeof(wchar_t) ) - 1; // back up over the null terminator. + TCHAR* p = _buffer.PushArr( sizeof(TCHAR) ) - 1; // back up over the null terminator. p[0] = ch; p[1] = 0; } @@ -2495,33 +2585,33 @@ void XMLPrinter::PrintSpace( int depth ) } -void XMLPrinter::PrintString( const wchar_t* p, bool restricted ) +void XMLPrinter::PrintString( const TCHAR* p, bool restricted ) { // Look for runs of bytes between entities to print. - const wchar_t* q = p; + const TCHAR* q = p; if ( _processEntities ) { const bool* flag = restricted ? _restrictedEntityFlag : _entityFlag; while ( *q ) { TIXMLASSERT( p <= q ); - // Remember, wchar_t is sometimes signed. (How many times has that bitten me?) + // Remember, char is sometimes signed. (How many times has that bitten me?) if ( *q > 0 && *q < ENTITY_RANGE ) { // Check for entities. If one is found, flush // the stream up until the entity, write the // entity, and keep looking. - if ( flag[(TINYXML2_UNSIGNED_CHAR)(*q)] ) { + if ( flag[static_cast(*q)] ) { while ( p < q ) { const size_t delta = q - p; - const int toPrint = ( INT_MAX < delta ) ? INT_MAX : (int)delta; + const int toPrint = ( INT_MAX < delta ) ? INT_MAX : static_cast(delta); Write( p, toPrint ); p += toPrint; } bool entityPatternPrinted = false; for( int i=0; i(delta); Write( p, toPrint ); } } @@ -2553,8 +2643,8 @@ void XMLPrinter::PrintString( const wchar_t* p, bool restricted ) void XMLPrinter::PushHeader( bool writeBOM, bool writeDec ) { if ( writeBOM ) { - static const TINYXML2_UNSIGNED_CHAR bom[] = { TIXML_UTF_LEAD_0, TIXML_UTF_LEAD_1, TIXML_UTF_LEAD_2, 0 }; - Write( reinterpret_cast< const wchar_t* >( bom ) ); + static const TUCHAR bom[] = { TIXML_UTF_LEAD_0, TIXML_UTF_LEAD_1, TIXML_UTF_LEAD_2, 0 }; + Write( reinterpret_cast< const TCHAR* >( bom ) ); } if ( writeDec ) { PushDeclaration( TINYXML2_STR("xml version=\"1.0\"") ); @@ -2562,13 +2652,13 @@ void XMLPrinter::PushHeader( bool writeBOM, bool writeDec ) } -void XMLPrinter::OpenElement( const wchar_t* name, bool compactMode ) +void XMLPrinter::OpenElement( const TCHAR* name, bool compactMode ) { SealElementIfJustOpened(); _stack.Push( name ); if ( _textDepth < 0 && !_firstElement && !compactMode ) { - Putc( TINYXML2_CHAR('\n') ); + Putc( '\n' ); } if ( !compactMode ) { PrintSpace( _depth ); @@ -2583,52 +2673,60 @@ void XMLPrinter::OpenElement( const wchar_t* name, bool compactMode ) } -void XMLPrinter::PushAttribute( const wchar_t* name, const wchar_t* value ) +void XMLPrinter::PushAttribute( const TCHAR* name, const TCHAR* value ) { TIXMLASSERT( _elementJustOpened ); - Putc ( TINYXML2_CHAR(' ') ); + Putc ( ' ' ); Write( name ); Write( TINYXML2_STR("=\"") ); PrintString( value, false ); - Putc ( TINYXML2_CHAR('\"') ); + Putc ( '\"' ); } -void XMLPrinter::PushAttribute( const wchar_t* name, int v ) +void XMLPrinter::PushAttribute( const TCHAR* name, int v ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); PushAttribute( name, buf ); } -void XMLPrinter::PushAttribute( const wchar_t* name, unsigned v ) +void XMLPrinter::PushAttribute( const TCHAR* name, unsigned v ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); PushAttribute( name, buf ); } -void XMLPrinter::PushAttribute(const wchar_t* name, int64_t v) +void XMLPrinter::PushAttribute(const TCHAR* name, int64_t v) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr(v, buf, BUF_SIZE); PushAttribute(name, buf); } -void XMLPrinter::PushAttribute( const wchar_t* name, bool v ) +void XMLPrinter::PushAttribute(const TCHAR* name, uint64_t v) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; + XMLUtil::ToStr(v, buf, BUF_SIZE); + PushAttribute(name, buf); +} + + +void XMLPrinter::PushAttribute( const TCHAR* name, bool v ) +{ + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); PushAttribute( name, buf ); } -void XMLPrinter::PushAttribute( const wchar_t* name, double v ) +void XMLPrinter::PushAttribute( const TCHAR* name, double v ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); PushAttribute( name, buf ); } @@ -2637,14 +2735,14 @@ void XMLPrinter::PushAttribute( const wchar_t* name, double v ) void XMLPrinter::CloseElement( bool compactMode ) { --_depth; - const wchar_t* name = _stack.Pop(); + const TCHAR* name = _stack.Pop(); if ( _elementJustOpened ) { Write( TINYXML2_STR("/>") ); } else { if ( _textDepth < 0 && !compactMode) { - Putc( TINYXML2_CHAR('\n') ); + Putc( '\n' ); PrintSpace( _depth ); } Write ( TINYXML2_STR("') ); + Putc( '>' ); } -void XMLPrinter::PushText( const wchar_t* text, bool cdata ) +void XMLPrinter::PushText( const TCHAR* text, bool cdata ) { _textDepth = _depth-1; @@ -2687,16 +2785,26 @@ void XMLPrinter::PushText( const wchar_t* text, bool cdata ) } } + void XMLPrinter::PushText( int64_t value ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( value, buf, BUF_SIZE ); PushText( buf, false ); } + +void XMLPrinter::PushText( uint64_t value ) +{ + TCHAR buf[BUF_SIZE]; + XMLUtil::ToStr(value, buf, BUF_SIZE); + PushText(buf, false); +} + + void XMLPrinter::PushText( int value ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( value, buf, BUF_SIZE ); PushText( buf, false ); } @@ -2704,7 +2812,7 @@ void XMLPrinter::PushText( int value ) void XMLPrinter::PushText( unsigned value ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( value, buf, BUF_SIZE ); PushText( buf, false ); } @@ -2712,7 +2820,7 @@ void XMLPrinter::PushText( unsigned value ) void XMLPrinter::PushText( bool value ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( value, buf, BUF_SIZE ); PushText( buf, false ); } @@ -2720,7 +2828,7 @@ void XMLPrinter::PushText( bool value ) void XMLPrinter::PushText( float value ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( value, buf, BUF_SIZE ); PushText( buf, false ); } @@ -2728,17 +2836,17 @@ void XMLPrinter::PushText( float value ) void XMLPrinter::PushText( double value ) { - wchar_t buf[BUF_SIZE]; + TCHAR buf[BUF_SIZE]; XMLUtil::ToStr( value, buf, BUF_SIZE ); PushText( buf, false ); } -void XMLPrinter::PushComment( const wchar_t* comment ) +void XMLPrinter::PushComment( const TCHAR* comment ) { SealElementIfJustOpened(); if ( _textDepth < 0 && !_firstElement && !_compactMode) { - Putc( TINYXML2_CHAR('\n') ); + Putc( '\n' ); PrintSpace( _depth ); } _firstElement = false; @@ -2749,11 +2857,11 @@ void XMLPrinter::PushComment( const wchar_t* comment ) } -void XMLPrinter::PushDeclaration( const wchar_t* value ) +void XMLPrinter::PushDeclaration( const TCHAR* value ) { SealElementIfJustOpened(); if ( _textDepth < 0 && !_firstElement && !_compactMode) { - Putc( TINYXML2_CHAR('\n') ); + Putc( '\n' ); PrintSpace( _depth ); } _firstElement = false; @@ -2764,18 +2872,18 @@ void XMLPrinter::PushDeclaration( const wchar_t* value ) } -void XMLPrinter::PushUnknown( const wchar_t* value ) +void XMLPrinter::PushUnknown( const TCHAR* value ) { SealElementIfJustOpened(); if ( _textDepth < 0 && !_firstElement && !_compactMode) { - Putc( TINYXML2_CHAR('\n') ); + Putc( '\n' ); PrintSpace( _depth ); } _firstElement = false; Write( TINYXML2_STR("') ); + Putc( '>' ); } diff --git a/src/kiwano/third-party/tinyxml2/tinyxml2.h b/src/3rd-party/tinyxml2/tinyxml2.h similarity index 80% rename from src/kiwano/third-party/tinyxml2/tinyxml2.h rename to src/3rd-party/tinyxml2/tinyxml2.h index b8636790..80675fcb 100644 --- a/src/kiwano/third-party/tinyxml2/tinyxml2.h +++ b/src/3rd-party/tinyxml2/tinyxml2.h @@ -73,7 +73,7 @@ distribution. # define TINYXML2_LIB # endif #elif __GNUC__ >= 4 -# define TINYXML2_LIB __attribute__((visibility(TINYXML2_STR("default")))) +# define TINYXML2_LIB __attribute__((visibility("default"))) #else # define TINYXML2_LIB #endif @@ -85,7 +85,7 @@ distribution. # define TIXMLASSERT( x ) if ( !((void)0,(x))) { __debugbreak(); } # elif defined (ANDROID_NDK) # include -# define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( TINYXML2_STR("assert", "grinliz", "ASSERT in TINYXML2_CHAR('%s') at %d."), __FILE__, __LINE__ ); } +# define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); } # else # include # define TIXMLASSERT assert @@ -99,16 +99,17 @@ distribution. http://semver.org/ */ static const int TIXML2_MAJOR_VERSION = 7; -static const int TIXML2_MINOR_VERSION = 0; -static const int TIXML2_PATCH_VERSION = 1; +static const int TIXML2_MINOR_VERSION = 1; +static const int TIXML2_PATCH_VERSION = 0; #define TINYXML2_MAJOR_VERSION 7 -#define TINYXML2_MINOR_VERSION 0 -#define TINYXML2_PATCH_VERSION 1 +#define TINYXML2_MINOR_VERSION 1 +#define TINYXML2_PATCH_VERSION 0 -#define TINYXML2_UNSIGNED_CHAR wchar_t -#define TINYXML2_STR(STR) (L##STR) -#define TINYXML2_CHAR(CH) (L##CH) +/* + Add by Nomango 2019.10.12 +*/ +#define TINYXML2_STR(STR) (L##STR) // A fixed element depth limit is problematic. There needs to be a // limit to avoid a stack overflow. However, that limit varies per @@ -119,6 +120,13 @@ static const int TINYXML2_MAX_ELEMENT_DEPTH = 100; namespace tinyxml2 { + +/* + Add by Nomango 2019.10.12 +*/ +typedef wchar_t TCHAR; +typedef wchar_t TUCHAR; + class XMLDocument; class XMLElement; class XMLAttribute; @@ -132,7 +140,7 @@ class XMLPrinter; A class that wraps strings. Normally stores the start and end pointers into the XML file itself, and will apply normalization and entity translation if actually read. Can also store (and memory - manage) a traditional wchar_t[] + manage) a traditional char[] Isn't clear why TINYXML2_LIB is needed; but seems to fix #719 */ @@ -155,7 +163,7 @@ public: StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {} ~StrPair(); - void Set( wchar_t* start, wchar_t* end, int flags ) { + void Set( TCHAR* start, TCHAR* end, int flags ) { TIXMLASSERT( start ); TIXMLASSERT( end ); Reset(); @@ -164,21 +172,21 @@ public: _flags = flags | NEEDS_FLUSH; } - const wchar_t* GetStr(); + const TCHAR* GetStr(); bool Empty() const { return _start == _end; } - void SetInternedStr( const wchar_t* str ) { + void SetInternedStr( const TCHAR* str ) { Reset(); - _start = const_cast(str); + _start = const_cast(str); } - void SetStr( const wchar_t* str, int flags=0 ); + void SetStr( const TCHAR* str, int flags=0 ); - wchar_t* ParseText( wchar_t* in, const wchar_t* endTag, int strFlags, int* curLineNumPtr ); - wchar_t* ParseName( wchar_t* in ); + TCHAR* ParseText( TCHAR* in, const TCHAR* endTag, int strFlags, int* curLineNumPtr ); + TCHAR* ParseName( TCHAR* in ); void TransferTo( StrPair* other ); void Reset(); @@ -191,9 +199,9 @@ private: NEEDS_DELETE = 0x200 }; - int _flags; - wchar_t* _start; - wchar_t* _end; + int _flags; + TCHAR* _start; + TCHAR* _end; StrPair( const StrPair& other ); // not supported void operator=( const StrPair& other ); // not supported, use TransferTo() @@ -210,7 +218,6 @@ class DynArray { public: DynArray() : - _pool{}, _mem( _pool ), _allocated( INITIAL_SIZE ), _size( 0 ) @@ -414,8 +421,15 @@ public: item->next = _root; _root = item; } + + void Trace( const char* name ) { + printf( "Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n", + name, _maxAllocs, _maxAllocs * ITEM_SIZE / 1024, _currentAllocs, + ITEM_SIZE, _nAllocs, _blockPtrs.Size() ); + } + void Trace( const wchar_t* name ) { - printf( TINYXML2_STR("Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n"), + wprintf( L"Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n", name, _maxAllocs, _maxAllocs * ITEM_SIZE / 1024, _currentAllocs, ITEM_SIZE, _nAllocs, _blockPtrs.Size() ); } @@ -447,7 +461,7 @@ private: union Item { Item* next; - wchar_t itemData[ITEM_SIZE]; + TCHAR itemData[ITEM_SIZE]; }; struct Block { Item items[ITEMS_PER_BLOCK]; @@ -464,7 +478,7 @@ private: /** - Implements the interface to the TINYXML2_STR("Visitor pattern") (see the Accept() method.) + Implements the interface to the "Visitor pattern" (see the Accept() method.) If you call the Accept() method, it requires being passed a XMLVisitor class to handle callbacks. For nodes that contain other nodes (Document, Element) you will get called with a VisitEnter/VisitExit pair. Nodes that are always leafs @@ -555,11 +569,11 @@ enum XMLError { class TINYXML2_LIB XMLUtil { public: - static const wchar_t* SkipWhiteSpace( const wchar_t* p, int* curLineNumPtr ) { + static const TCHAR* SkipWhiteSpace( const TCHAR* p, int* curLineNumPtr ) { TIXMLASSERT( p ); while( IsWhiteSpace(*p) ) { - if (curLineNumPtr && *p == TINYXML2_CHAR('\n')) { + if (curLineNumPtr && *p == '\n') { ++(*curLineNumPtr); } ++p; @@ -567,17 +581,17 @@ public: TIXMLASSERT( p ); return p; } - static wchar_t* SkipWhiteSpace( wchar_t* p, int* curLineNumPtr ) { - return const_cast( SkipWhiteSpace( const_cast(p), curLineNumPtr ) ); + static TCHAR* SkipWhiteSpace( TCHAR* p, int* curLineNumPtr ) { + return const_cast( SkipWhiteSpace( const_cast(p), curLineNumPtr ) ); } // Anything in the high order range of UTF-8 is assumed to not be whitespace. This isn't // correct, but simple, and usually works. - static bool IsWhiteSpace( wchar_t p ) { - return !IsUTF8Continuation(p) && isspace( static_cast(p) ); + static bool IsWhiteSpace( TCHAR p ) { + return !IsUTF8Continuation(p) && isspace( static_cast(p) ); } - inline static bool IsNameStartChar( TINYXML2_UNSIGNED_CHAR ch ) { + inline static bool IsNameStartChar( TUCHAR ch ) { if ( ch >= 128 ) { // This is a heuristic guess in attempt to not implement Unicode-aware isalpha() return true; @@ -585,14 +599,24 @@ public: if ( isalpha( ch ) ) { return true; } - return ch == TINYXML2_CHAR(':') || ch == TINYXML2_CHAR('_'); + return ch == ':' || ch == '_'; } - inline static bool IsNameChar( TINYXML2_UNSIGNED_CHAR ch ) { + inline static bool IsNameChar( TUCHAR ch ) { return IsNameStartChar( ch ) || isdigit( ch ) - || ch == TINYXML2_CHAR('.') - || ch == TINYXML2_CHAR('-'); + || ch == '.' + || ch == '-'; + } + + inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX ) { + if ( p == q ) { + return true; + } + TIXMLASSERT( p ); + TIXMLASSERT( q ); + TIXMLASSERT( nChar >= 0 ); + return strncmp( p, q, nChar ) == 0; } inline static bool StringEqual( const wchar_t* p, const wchar_t* q, int nChar=INT_MAX ) { @@ -605,42 +629,43 @@ public: return wcsncmp( p, q, nChar ) == 0; } - inline static bool IsUTF8Continuation( wchar_t p ) { + inline static bool IsUTF8Continuation( TCHAR p ) { return ( p & 0x80 ) != 0; } - static const wchar_t* ReadBOM( const wchar_t* p, bool* hasBOM ); + static const TCHAR* ReadBOM( const TCHAR* p, bool* hasBOM ); // p is the starting location, // the UTF-8 value of the entity will be placed in value, and length filled in. - static const wchar_t* GetCharacterRef( const wchar_t* p, wchar_t* value, int* length ); - static void ConvertUTF32ToUTF8( unsigned long input, wchar_t* output, int* length ); + static const TCHAR* GetCharacterRef( const TCHAR* p, TCHAR* value, int* length ); + static void ConvertUTF32ToUTF8( unsigned long input, TCHAR* output, int* length ); // converts primitive types to strings - static void ToStr( int v, wchar_t* buffer, int bufferSize ); - static void ToStr( unsigned v, wchar_t* buffer, int bufferSize ); - static void ToStr( bool v, wchar_t* buffer, int bufferSize ); - static void ToStr( float v, wchar_t* buffer, int bufferSize ); - static void ToStr( double v, wchar_t* buffer, int bufferSize ); - static void ToStr(int64_t v, wchar_t* buffer, int bufferSize); + static void ToStr( int v, TCHAR* buffer, int bufferSize ); + static void ToStr( unsigned v, TCHAR* buffer, int bufferSize ); + static void ToStr( bool v, TCHAR* buffer, int bufferSize ); + static void ToStr( float v, TCHAR* buffer, int bufferSize ); + static void ToStr( double v, TCHAR* buffer, int bufferSize ); + static void ToStr( int64_t v, TCHAR* buffer, int bufferSize ); + static void ToStr( uint64_t v, TCHAR* buffer, int bufferSize ); // converts strings to primitive types - static bool ToInt( const wchar_t* str, int* value ); - static bool ToUnsigned( const wchar_t* str, unsigned* value ); - static bool ToBool( const wchar_t* str, bool* value ); - static bool ToFloat( const wchar_t* str, float* value ); - static bool ToDouble( const wchar_t* str, double* value ); - static bool ToInt64(const wchar_t* str, int64_t* value); - + static bool ToInt( const TCHAR* str, int* value ); + static bool ToUnsigned( const TCHAR* str, unsigned* value ); + static bool ToBool( const TCHAR* str, bool* value ); + static bool ToFloat( const TCHAR* str, float* value ); + static bool ToDouble( const TCHAR* str, double* value ); + static bool ToInt64(const TCHAR* str, int64_t* value); + static bool ToUnsigned64(const TCHAR* str, uint64_t* value); // Changes what is serialized for a boolean value. - // Default to TINYXML2_STR("true" and "false"). Shouldn't be changed + // Default to "true" and "false". Shouldn't be changed // unless you have a special testing or compatibility need. // Be careful: static, global, & not thread safe. // Be sure to set static const memory as parameters. - static void SetBoolSerialization(const wchar_t* writeTrue, const wchar_t* writeFalse); + static void SetBoolSerialization(const TCHAR* writeTrue, const TCHAR* writeFalse); private: - static const wchar_t* writeBoolTrue; - static const wchar_t* writeBoolFalse; + static const TCHAR* writeBoolTrue; + static const TCHAR* writeBoolFalse; }; @@ -739,12 +764,12 @@ public: Text: the text string @endverbatim */ - const wchar_t* Value() const; + const TCHAR* Value() const; /** Set the Value of an XML node. @sa Value() */ - void SetValue( const wchar_t* val, bool staticMem=false ); + void SetValue( const TCHAR* val, bool staticMem=false ); /// Gets the line number the node is in, if the document was parsed from a file. int GetLineNum() const { return _parseLineNum; } @@ -775,9 +800,9 @@ public: /** Get the first child element, or optionally the first child element with the specified name. */ - const XMLElement* FirstChildElement( const wchar_t* name = 0 ) const; + const XMLElement* FirstChildElement( const TCHAR* name = 0 ) const; - XMLElement* FirstChildElement( const wchar_t* name = 0 ) { + XMLElement* FirstChildElement( const TCHAR* name = 0 ) { return const_cast(const_cast(this)->FirstChildElement( name )); } @@ -793,9 +818,9 @@ public: /** Get the last child element or optionally the last child element with the specified name. */ - const XMLElement* LastChildElement( const wchar_t* name = 0 ) const; + const XMLElement* LastChildElement( const TCHAR* name = 0 ) const; - XMLElement* LastChildElement( const wchar_t* name = 0 ) { + XMLElement* LastChildElement( const TCHAR* name = 0 ) { return const_cast(const_cast(this)->LastChildElement(name) ); } @@ -809,9 +834,9 @@ public: } /// Get the previous (left) sibling element of this node, with an optionally supplied name. - const XMLElement* PreviousSiblingElement( const wchar_t* name = 0 ) const ; + const XMLElement* PreviousSiblingElement( const TCHAR* name = 0 ) const ; - XMLElement* PreviousSiblingElement( const wchar_t* name = 0 ) { + XMLElement* PreviousSiblingElement( const TCHAR* name = 0 ) { return const_cast(const_cast(this)->PreviousSiblingElement( name ) ); } @@ -825,9 +850,9 @@ public: } /// Get the next (right) sibling element of this node, with an optionally supplied name. - const XMLElement* NextSiblingElement( const wchar_t* name = 0 ) const; + const XMLElement* NextSiblingElement( const TCHAR* name = 0 ) const; - XMLElement* NextSiblingElement( const wchar_t* name = 0 ) { + XMLElement* NextSiblingElement( const TCHAR* name = 0 ) { return const_cast(const_cast(this)->NextSiblingElement( name ) ); } @@ -918,13 +943,13 @@ public: - http://www.saxproject.org/ - http://c2.com/cgi/wiki?HierarchicalVisitorPattern - Which are both good references for TINYXML2_STR("visiting"). + Which are both good references for "visiting". An example of using Accept(): @verbatim XMLPrinter printer; tinyxmlDoc.Accept( &printer ); - const wchar_t* xmlcstr = printer.CStr(); + const char* xmlcstr = printer.CStr(); @endverbatim */ virtual bool Accept( XMLVisitor* visitor ) const = 0; @@ -947,7 +972,7 @@ protected: explicit XMLNode( XMLDocument* ); virtual ~XMLNode(); - virtual wchar_t* ParseDeep( wchar_t* p, StrPair* parentEndTag, int* curLineNumPtr); + virtual TCHAR* ParseDeep( TCHAR* p, StrPair* parentEndTag, int* curLineNumPtr); XMLDocument* _document; XMLNode* _parent; @@ -967,7 +992,7 @@ private: void Unlink( XMLNode* child ); static void DeleteNode( XMLNode* node ); void InsertChildPreamble( XMLNode* insertThis ) const; - const XMLElement* ToElementWithName( const wchar_t* name ) const; + const XMLElement* ToElementWithName( const TCHAR* name ) const; XMLNode( const XMLNode& ); // not supported XMLNode& operator=( const XMLNode& ); // not supported @@ -981,7 +1006,7 @@ private: This is bold @endverbatim - A text node can have 2 ways to output the next. TINYXML2_STR("normal") output + A text node can have 2 ways to output the next. "normal" output and CDATA. It will default to the mode it was parsed from the XML file and you generally want to leave it alone, but you can change the output mode with SetCData() and query it with CData(). @@ -1015,7 +1040,7 @@ protected: explicit XMLText( XMLDocument* doc ) : XMLNode( doc ), _isCData( false ) {} virtual ~XMLText() {} - wchar_t* ParseDeep( wchar_t* p, StrPair* parentEndTag, int* curLineNumPtr ); + TCHAR* ParseDeep( TCHAR* p, StrPair* parentEndTag, int* curLineNumPtr ); private: bool _isCData; @@ -1046,7 +1071,7 @@ protected: explicit XMLComment( XMLDocument* doc ); virtual ~XMLComment(); - wchar_t* ParseDeep( wchar_t* p, StrPair* parentEndTag, int* curLineNumPtr); + TCHAR* ParseDeep( TCHAR* p, StrPair* parentEndTag, int* curLineNumPtr); private: XMLComment( const XMLComment& ); // not supported @@ -1056,7 +1081,7 @@ private: /** In correct XML the declaration is the first entry in the file. @verbatim - + @endverbatim TinyXML-2 will happily read or write files without a declaration, @@ -1085,7 +1110,7 @@ protected: explicit XMLDeclaration( XMLDocument* doc ); virtual ~XMLDeclaration(); - wchar_t* ParseDeep( wchar_t* p, StrPair* parentEndTag, int* curLineNumPtr ); + TCHAR* ParseDeep( TCHAR* p, StrPair* parentEndTag, int* curLineNumPtr ); private: XMLDeclaration( const XMLDeclaration& ); // not supported @@ -1120,7 +1145,7 @@ protected: explicit XMLUnknown( XMLDocument* doc ); virtual ~XMLUnknown(); - wchar_t* ParseDeep( wchar_t* p, StrPair* parentEndTag, int* curLineNumPtr ); + TCHAR* ParseDeep( TCHAR* p, StrPair* parentEndTag, int* curLineNumPtr ); private: XMLUnknown( const XMLUnknown& ); // not supported @@ -1140,10 +1165,10 @@ class TINYXML2_LIB XMLAttribute friend class XMLElement; public: /// The name of the attribute. - const wchar_t* Name() const; + const TCHAR* Name() const; /// The value of the attribute. - const wchar_t* Value() const; + const TCHAR* Value() const; /// Gets the line number the attribute is in, if the document was parsed from a file. int GetLineNum() const { return _parseLineNum; } @@ -1169,6 +1194,12 @@ public: return i; } + uint64_t Unsigned64Value() const { + uint64_t i = 0; + QueryUnsigned64Value(&i); + return i; + } + /// Query as an unsigned integer. See IntValue() unsigned UnsignedValue() const { unsigned i=0; @@ -1202,7 +1233,9 @@ public: /// See QueryIntValue XMLError QueryUnsignedValue( unsigned int* value ) const; /// See QueryIntValue - XMLError QueryInt64Value(int64_t* value) const; + XMLError QueryInt64Value( int64_t* value ) const; + /// See QueryIntValue + XMLError QueryUnsigned64Value( uint64_t* value ) const; /// See QueryIntValue XMLError QueryBoolValue( bool* value ) const; /// See QueryIntValue @@ -1211,14 +1244,16 @@ public: XMLError QueryFloatValue( float* value ) const; /// Set the attribute to a string value. - void SetAttribute( const wchar_t* value ); + void SetAttribute( const TCHAR* value ); /// Set the attribute to value. void SetAttribute( int value ); /// Set the attribute to value. void SetAttribute( unsigned value ); /// Set the attribute to value. - void SetAttribute(int64_t value); - /// Set the attribute to value. + void SetAttribute( int64_t value ); + /// Set the attribute to value. + void SetAttribute( uint64_t value ); + /// Set the attribute to value. void SetAttribute( bool value ); /// Set the attribute to value. void SetAttribute( double value ); @@ -1233,9 +1268,9 @@ private: XMLAttribute( const XMLAttribute& ); // not supported void operator=( const XMLAttribute& ); // not supported - void SetName( const wchar_t* name ); + void SetName( const TCHAR* name ); - wchar_t* ParseDeep( wchar_t* p, bool processEntities, int* curLineNumPtr ); + TCHAR* ParseDeep( TCHAR* p, bool processEntities, int* curLineNumPtr ); mutable StrPair _name; mutable StrPair _value; @@ -1254,11 +1289,11 @@ class TINYXML2_LIB XMLElement : public XMLNode friend class XMLDocument; public: /// Get the name of an element (which is the Value() of the node.) - const wchar_t* Name() const { + const TCHAR* Name() const { return Value(); } /// Set the name of the element. - void SetName( const wchar_t* str, bool staticMem=false ) { + void SetName( const TCHAR* str, bool staticMem=false ) { SetValue( str, staticMem ); } @@ -1275,7 +1310,7 @@ public: exists. For example: @verbatim - const wchar_t* value = ele->Attribute( TINYXML2_STR("foo") ); + const char* value = ele->Attribute( "foo" ); @endverbatim The 'value' parameter is normally null. However, if specified, @@ -1283,17 +1318,17 @@ public: match. This allow you to write code: @verbatim - if ( ele->Attribute( TINYXML2_STR("foo", "bar") ) ) callFooIsBar(); + if ( ele->Attribute( "foo", "bar" ) ) callFooIsBar(); @endverbatim rather than: @verbatim - if ( ele->Attribute( TINYXML2_STR("foo") ) ) { - if ( strcmp( ele->Attribute( TINYXML2_STR("foo" ), "bar") ) == 0 ) callFooIsBar(); + if ( ele->Attribute( "foo" ) ) { + if ( strcmp( ele->Attribute( "foo" ), "bar" ) == 0 ) callFooIsBar(); } @endverbatim */ - const wchar_t* Attribute( const wchar_t* name, const wchar_t* value=0 ) const; + const TCHAR* Attribute( const TCHAR* name, const TCHAR* value=0 ) const; /** Given an attribute name, IntAttribute() returns the value of the attribute interpreted as an integer. The default @@ -1301,17 +1336,19 @@ public: or if there is an error. (For a method with error checking, see QueryIntAttribute()). */ - int IntAttribute(const wchar_t* name, int defaultValue = 0) const; + int IntAttribute(const TCHAR* name, int defaultValue = 0) const; /// See IntAttribute() - unsigned UnsignedAttribute(const wchar_t* name, unsigned defaultValue = 0) const; + unsigned UnsignedAttribute(const TCHAR* name, unsigned defaultValue = 0) const; /// See IntAttribute() - int64_t Int64Attribute(const wchar_t* name, int64_t defaultValue = 0) const; + int64_t Int64Attribute(const TCHAR* name, int64_t defaultValue = 0) const; + /// See IntAttribute() + uint64_t Unsigned64Attribute(const TCHAR* name, uint64_t defaultValue = 0) const; /// See IntAttribute() - bool BoolAttribute(const wchar_t* name, bool defaultValue = false) const; + bool BoolAttribute(const TCHAR* name, bool defaultValue = false) const; /// See IntAttribute() - double DoubleAttribute(const wchar_t* name, double defaultValue = 0) const; + double DoubleAttribute(const TCHAR* name, double defaultValue = 0) const; /// See IntAttribute() - float FloatAttribute(const wchar_t* name, float defaultValue = 0) const; + float FloatAttribute(const TCHAR* name, float defaultValue = 0) const; /** Given an attribute name, QueryIntAttribute() returns XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conversion @@ -1323,10 +1360,10 @@ public: @verbatim int value = 10; - QueryIntAttribute( TINYXML2_STR("foo", &value ); // if "foo") isn't found, value will still be 10 + QueryIntAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10 @endverbatim */ - XMLError QueryIntAttribute( const wchar_t* name, int* value ) const { + XMLError QueryIntAttribute( const TCHAR* name, int* value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) { return XML_NO_ATTRIBUTE; @@ -1335,7 +1372,7 @@ public: } /// See QueryIntAttribute() - XMLError QueryUnsignedAttribute( const wchar_t* name, unsigned int* value ) const { + XMLError QueryUnsignedAttribute( const TCHAR* name, unsigned int* value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) { return XML_NO_ATTRIBUTE; @@ -1344,7 +1381,7 @@ public: } /// See QueryIntAttribute() - XMLError QueryInt64Attribute(const wchar_t* name, int64_t* value) const { + XMLError QueryInt64Attribute(const TCHAR* name, int64_t* value) const { const XMLAttribute* a = FindAttribute(name); if (!a) { return XML_NO_ATTRIBUTE; @@ -1352,8 +1389,17 @@ public: return a->QueryInt64Value(value); } + /// See QueryIntAttribute() + XMLError QueryUnsigned64Attribute(const TCHAR* name, uint64_t* value) const { + const XMLAttribute* a = FindAttribute(name); + if(!a) { + return XML_NO_ATTRIBUTE; + } + return a->QueryUnsigned64Value(value); + } + /// See QueryIntAttribute() - XMLError QueryBoolAttribute( const wchar_t* name, bool* value ) const { + XMLError QueryBoolAttribute( const TCHAR* name, bool* value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) { return XML_NO_ATTRIBUTE; @@ -1361,7 +1407,7 @@ public: return a->QueryBoolValue( value ); } /// See QueryIntAttribute() - XMLError QueryDoubleAttribute( const wchar_t* name, double* value ) const { + XMLError QueryDoubleAttribute( const TCHAR* name, double* value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) { return XML_NO_ATTRIBUTE; @@ -1369,7 +1415,7 @@ public: return a->QueryDoubleValue( value ); } /// See QueryIntAttribute() - XMLError QueryFloatAttribute( const wchar_t* name, float* value ) const { + XMLError QueryFloatAttribute( const TCHAR* name, float* value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) { return XML_NO_ATTRIBUTE; @@ -1378,7 +1424,7 @@ public: } /// See QueryIntAttribute() - XMLError QueryStringAttribute(const wchar_t* name, const wchar_t** value) const { + XMLError QueryStringAttribute(const TCHAR* name, const TCHAR** value) const { const XMLAttribute* a = FindAttribute(name); if (!a) { return XML_NO_ATTRIBUTE; @@ -1403,67 +1449,77 @@ public: @verbatim int value = 10; - QueryAttribute( TINYXML2_STR("foo", &value ); // if "foo") isn't found, value will still be 10 + QueryAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10 @endverbatim */ - XMLError QueryAttribute( const wchar_t* name, int* value ) const { + XMLError QueryAttribute( const TCHAR* name, int* value ) const { return QueryIntAttribute( name, value ); } - XMLError QueryAttribute( const wchar_t* name, unsigned int* value ) const { + XMLError QueryAttribute( const TCHAR* name, unsigned int* value ) const { return QueryUnsignedAttribute( name, value ); } - XMLError QueryAttribute(const wchar_t* name, int64_t* value) const { + XMLError QueryAttribute(const TCHAR* name, int64_t* value) const { return QueryInt64Attribute(name, value); } - XMLError QueryAttribute( const wchar_t* name, bool* value ) const { + XMLError QueryAttribute(const TCHAR* name, uint64_t* value) const { + return QueryUnsigned64Attribute(name, value); + } + + XMLError QueryAttribute( const TCHAR* name, bool* value ) const { return QueryBoolAttribute( name, value ); } - XMLError QueryAttribute( const wchar_t* name, double* value ) const { + XMLError QueryAttribute( const TCHAR* name, double* value ) const { return QueryDoubleAttribute( name, value ); } - XMLError QueryAttribute( const wchar_t* name, float* value ) const { + XMLError QueryAttribute( const TCHAR* name, float* value ) const { return QueryFloatAttribute( name, value ); } /// Sets the named attribute to value. - void SetAttribute( const wchar_t* name, const wchar_t* value ) { + void SetAttribute( const TCHAR* name, const TCHAR* value ) { XMLAttribute* a = FindOrCreateAttribute( name ); a->SetAttribute( value ); } /// Sets the named attribute to value. - void SetAttribute( const wchar_t* name, int value ) { + void SetAttribute( const TCHAR* name, int value ) { XMLAttribute* a = FindOrCreateAttribute( name ); a->SetAttribute( value ); } /// Sets the named attribute to value. - void SetAttribute( const wchar_t* name, unsigned value ) { + void SetAttribute( const TCHAR* name, unsigned value ) { XMLAttribute* a = FindOrCreateAttribute( name ); a->SetAttribute( value ); } /// Sets the named attribute to value. - void SetAttribute(const wchar_t* name, int64_t value) { + void SetAttribute( const TCHAR* name, int64_t value) { XMLAttribute* a = FindOrCreateAttribute(name); a->SetAttribute(value); } - /// Sets the named attribute to value. - void SetAttribute( const wchar_t* name, bool value ) { + /// Sets the named attribute to value. + void SetAttribute( const TCHAR* name, uint64_t value) { + XMLAttribute* a = FindOrCreateAttribute(name); + a->SetAttribute(value); + } + + /// Sets the named attribute to value. + void SetAttribute( const TCHAR* name, bool value ) { XMLAttribute* a = FindOrCreateAttribute( name ); a->SetAttribute( value ); } /// Sets the named attribute to value. - void SetAttribute( const wchar_t* name, double value ) { + void SetAttribute( const TCHAR* name, double value ) { XMLAttribute* a = FindOrCreateAttribute( name ); a->SetAttribute( value ); } /// Sets the named attribute to value. - void SetAttribute( const wchar_t* name, float value ) { + void SetAttribute( const TCHAR* name, float value ) { XMLAttribute* a = FindOrCreateAttribute( name ); a->SetAttribute( value ); } @@ -1471,29 +1527,29 @@ public: /** Delete an attribute. */ - void DeleteAttribute( const wchar_t* name ); + void DeleteAttribute( const TCHAR* name ); /// Return the first attribute in the list. const XMLAttribute* FirstAttribute() const { return _rootAttribute; } /// Query a specific attribute in the list. - const XMLAttribute* FindAttribute( const wchar_t* name ) const; + const XMLAttribute* FindAttribute( const TCHAR* name ) const; /** Convenience function for easy access to the text inside an element. Although easy and concise, GetText() is limited compared to getting the XMLText child and accessing it directly. If the first child of 'this' is a XMLText, the GetText() - returns the wchar_tacter string of the Text node, else null is returned. + returns the character string of the Text node, else null is returned. This is a convenient method for getting the text of simple contained text: @verbatim This is text - const wchar_t* str = fooElement->GetText(); + const char* str = fooElement->GetText(); @endverbatim - 'str' will be a pointer to TINYXML2_STR("This is text"). + 'str' will be a pointer to "This is text". Note that this function can be misleading. If the element foo was created from this XML: @@ -1506,9 +1562,9 @@ public: @verbatim This is text @endverbatim - GetText() will return TINYXML2_STR("This is "). + GetText() will return "This is ". */ - const wchar_t* GetText() const; + const TCHAR* GetText() const; /** Convenience function for easy access to the text inside an element. Although easy and concise, SetText() is limited compared to creating an XMLText child @@ -1520,7 +1576,7 @@ public: This is a convenient method for setting the text of simple contained text: @verbatim This is text - fooElement->SetText( TINYXML2_STR("Hullaballoo!") ); + fooElement->SetText( "Hullaballoo!" ); Hullaballoo! @endverbatim @@ -1530,7 +1586,7 @@ public: This is text @endverbatim - then it will not change TINYXML2_STR("This is text"), but rather prefix it with a text element: + then it will not change "This is text", but rather prefix it with a text element: @verbatim Hullaballoo!This is text @endverbatim @@ -1544,13 +1600,15 @@ public: Hullaballoo! @endverbatim */ - void SetText( const wchar_t* inText ); + void SetText( const TCHAR* inText ); /// Convenience method for setting text inside an element. See SetText() for important limitations. void SetText( int value ); /// Convenience method for setting text inside an element. See SetText() for important limitations. void SetText( unsigned value ); /// Convenience method for setting text inside an element. See SetText() for important limitations. - void SetText(int64_t value); + void SetText( int64_t value ); + /// Convenience method for setting text inside an element. See SetText() for important limitations. + void SetText( uint64_t value ); /// Convenience method for setting text inside an element. See SetText() for important limitations. void SetText( bool value ); /// Convenience method for setting text inside an element. See SetText() for important limitations. @@ -1569,13 +1627,13 @@ public: @endverbatim The QueryIntText() and similar functions provide a safe and easier way to get to the - TINYXML2_STR("value") of x and y. + "value" of x and y. @verbatim int x = 0; float y = 0; // types of x and y are contrived for example - const XMLElement* xElement = pointElement->FirstChildElement( TINYXML2_STR("x") ); - const XMLElement* yElement = pointElement->FirstChildElement( TINYXML2_STR("y") ); + const XMLElement* xElement = pointElement->FirstChildElement( "x" ); + const XMLElement* yElement = pointElement->FirstChildElement( "y" ); xElement->QueryIntText( &x ); yElement->QueryFloatText( &y ); @endverbatim @@ -1588,7 +1646,9 @@ public: /// See QueryIntText() XMLError QueryUnsignedText( unsigned* uval ) const; /// See QueryIntText() - XMLError QueryInt64Text(int64_t* uval) const; + XMLError QueryInt64Text( int64_t* uval ) const; + /// See QueryIntText() + XMLError QueryUnsigned64Text( uint64_t* uval ) const; /// See QueryIntText() XMLError QueryBoolText( bool* bval ) const; /// See QueryIntText() @@ -1602,6 +1662,8 @@ public: unsigned UnsignedText(unsigned defaultValue = 0) const; /// See QueryIntText() int64_t Int64Text(int64_t defaultValue = 0) const; + /// See QueryIntText() + uint64_t Unsigned64Text(uint64_t defaultValue = 0) const; /// See QueryIntText() bool BoolText(bool defaultValue = false) const; /// See QueryIntText() @@ -1622,7 +1684,7 @@ public: virtual bool ShallowEqual( const XMLNode* compare ) const; protected: - wchar_t* ParseDeep( wchar_t* p, StrPair* parentEndTag, int* curLineNumPtr ); + TCHAR* ParseDeep( TCHAR* p, StrPair* parentEndTag, int* curLineNumPtr ); private: XMLElement( XMLDocument* doc ); @@ -1630,8 +1692,8 @@ private: XMLElement( const XMLElement& ); // not supported void operator=( const XMLElement& ); // not supported - XMLAttribute* FindOrCreateAttribute( const wchar_t* name ); - wchar_t* ParseAttributes( wchar_t* p, int* curLineNumPtr ); + XMLAttribute* FindOrCreateAttribute( const TCHAR* name ); + TCHAR* ParseAttributes( TCHAR* p, int* curLineNumPtr ); static void DeleteAttribute( XMLAttribute* attribute ); XMLAttribute* CreateAttribute(); @@ -1659,7 +1721,7 @@ class TINYXML2_LIB XMLDocument : public XMLNode { friend class XMLElement; // Gives access to SetError and Push/PopDepth, but over-access for everything else. - // Wishing C++ had TINYXML2_STR("internal") scope. + // Wishing C++ had "internal" scope. friend class XMLNode; friend class XMLText; friend class XMLComment; @@ -1680,7 +1742,7 @@ public: } /** - Parse an XML file from a wchar_tacter string. + Parse an XML file from a character string. Returns XML_SUCCESS (0) on success, or an errorID. @@ -1689,14 +1751,14 @@ public: specified, TinyXML-2 will assume 'xml' points to a null terminated string. */ - XMLError Parse( const wchar_t* xml, size_t nBytes=(size_t)(-1) ); + XMLError Parse( const TCHAR* xml, size_t nBytes=static_cast(-1) ); /** Load an XML file from disk. Returns XML_SUCCESS (0) on success, or an errorID. */ - XMLError LoadFile( const wchar_t* filename ); + XMLError LoadFile( const TCHAR* filename ); /** Load an XML file from disk. You are responsible @@ -1716,7 +1778,7 @@ public: Returns XML_SUCCESS (0) on success, or an errorID. */ - XMLError SaveFile( const wchar_t* filename, bool compact = false ); + XMLError SaveFile( const TCHAR* filename, bool compact = false ); /** Save the XML file to disk. You are responsible @@ -1767,7 +1829,7 @@ public: @verbatim XMLPrinter printer; doc.Print( &printer ); - // printer.CStr() has a const wchar_t* to the XML + // printer.CStr() has a const char* to the XML @endverbatim */ void Print( XMLPrinter* streamer=0 ) const; @@ -1778,19 +1840,19 @@ public: this Document. The memory for the Element is managed by the Document. */ - XMLElement* NewElement( const wchar_t* name ); + XMLElement* NewElement( const TCHAR* name ); /** Create a new Comment associated with this Document. The memory for the Comment is managed by the Document. */ - XMLComment* NewComment( const wchar_t* comment ); + XMLComment* NewComment( const TCHAR* comment ); /** Create a new Text associated with this Document. The memory for the Text is managed by the Document. */ - XMLText* NewText( const wchar_t* text ); + XMLText* NewText( const TCHAR* text ); /** Create a new Declaration associated with this Document. The memory for the object @@ -1799,16 +1861,16 @@ public: If the 'text' param is null, the standard declaration is used.: @verbatim - + @endverbatim */ - XMLDeclaration* NewDeclaration( const wchar_t* text=0 ); + XMLDeclaration* NewDeclaration( const TCHAR* text=0 ); /** Create a new Unknown associated with this Document. The memory for the object is managed by the Document. */ - XMLUnknown* NewUnknown( const wchar_t* text ); + XMLUnknown* NewUnknown( const TCHAR* text ); /** Delete a node associated with this document. @@ -1828,13 +1890,16 @@ public: XMLError ErrorID() const { return _errorID; } - const wchar_t* ErrorName() const; - static const wchar_t* ErrorIDToName(XMLError errorID); + const TCHAR* ErrorName() const; + static const TCHAR* ErrorIDToName(XMLError errorID); - /** Returns a TINYXML2_STR("long form") error description. A hopefully helpful + /** Returns a "long form" error description. A hopefully helpful diagnostic with location, line number, and/or additional info. */ - const wchar_t* ErrorStr() const; + const TCHAR* ErrorStr() const; + + /// A (trivial) utility function that prints the ErrorStr() to stdout. + void PrintError() const; /// Return the line where the error occurred, or zero if unknown. int ErrorLineNum() const @@ -1855,7 +1920,7 @@ public: void DeepCopy(XMLDocument* target) const; // internal - wchar_t* Identify( wchar_t* p, XMLNode** node ); + TCHAR* Identify( TCHAR* p, XMLNode** node ); // internal void MarkInUse(XMLNode*); @@ -1877,7 +1942,7 @@ private: Whitespace _whitespaceMode; mutable StrPair _errorStr; int _errorLineNum; - wchar_t* _wcharBuffer; + TCHAR* _charBuffer; int _parseCurLineNum; int _parsingDepth; // Memory tracking does add some overhead. @@ -1893,11 +1958,11 @@ private: MemPoolT< sizeof(XMLText) > _textPool; MemPoolT< sizeof(XMLComment) > _commentPool; - static const wchar_t* _errorNames[XML_ERROR_COUNT]; + static const TCHAR* _errorNames[XML_ERROR_COUNT]; void Parse(); - void SetError( XMLError error, int lineNum, const wchar_t* format, ... ); + void SetError( XMLError error, int lineNum, const TCHAR* format, ... ); // Something of an obvious security hole, once it was discovered. // Either an ill-formed XML or an excessively deep one can overflow @@ -1942,39 +2007,39 @@ inline NodeType* XMLDocument::CreateUnlinkedNode( MemPoolT& poo Take an example: @verbatim - - - + + + @endverbatim - Assuming you want the value of TINYXML2_STR("attributeB" in the 2nd "Child") element, it's very + Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very easy to write a *lot* of code that looks like: @verbatim - XMLElement* root = document.FirstChildElement( TINYXML2_STR("Document") ); + XMLElement* root = document.FirstChildElement( "Document" ); if ( root ) { - XMLElement* element = root->FirstChildElement( TINYXML2_STR("Element") ); + XMLElement* element = root->FirstChildElement( "Element" ); if ( element ) { - XMLElement* child = element->FirstChildElement( TINYXML2_STR("Child") ); + XMLElement* child = element->FirstChildElement( "Child" ); if ( child ) { - XMLElement* child2 = child->NextSiblingElement( TINYXML2_STR("Child") ); + XMLElement* child2 = child->NextSiblingElement( "Child" ); if ( child2 ) { // Finally do something useful. @endverbatim - And that doesn't even cover TINYXML2_STR("else") cases. XMLHandle addresses the verbosity + And that doesn't even cover "else" cases. XMLHandle addresses the verbosity of such code. A XMLHandle checks for null pointers so it is perfectly safe and correct to use: @verbatim XMLHandle docHandle( &document ); - XMLElement* child2 = docHandle.FirstChildElement( TINYXML2_STR("Document" ).FirstChildElement( "Element") ).FirstChildElement().NextSiblingElement(); + XMLElement* child2 = docHandle.FirstChildElement( "Document" ).FirstChildElement( "Element" ).FirstChildElement().NextSiblingElement(); if ( child2 ) { // do something useful @@ -2012,7 +2077,7 @@ public: return XMLHandle( _node ? _node->FirstChild() : 0 ); } /// Get the first child element of this handle. - XMLHandle FirstChildElement( const wchar_t* name = 0 ) { + XMLHandle FirstChildElement( const TCHAR* name = 0 ) { return XMLHandle( _node ? _node->FirstChildElement( name ) : 0 ); } /// Get the last child of this handle. @@ -2020,7 +2085,7 @@ public: return XMLHandle( _node ? _node->LastChild() : 0 ); } /// Get the last child element of this handle. - XMLHandle LastChildElement( const wchar_t* name = 0 ) { + XMLHandle LastChildElement( const TCHAR* name = 0 ) { return XMLHandle( _node ? _node->LastChildElement( name ) : 0 ); } /// Get the previous sibling of this handle. @@ -2028,7 +2093,7 @@ public: return XMLHandle( _node ? _node->PreviousSibling() : 0 ); } /// Get the previous sibling element of this handle. - XMLHandle PreviousSiblingElement( const wchar_t* name = 0 ) { + XMLHandle PreviousSiblingElement( const TCHAR* name = 0 ) { return XMLHandle( _node ? _node->PreviousSiblingElement( name ) : 0 ); } /// Get the next sibling of this handle. @@ -2036,7 +2101,7 @@ public: return XMLHandle( _node ? _node->NextSibling() : 0 ); } /// Get the next sibling element of this handle. - XMLHandle NextSiblingElement( const wchar_t* name = 0 ) { + XMLHandle NextSiblingElement( const TCHAR* name = 0 ) { return XMLHandle( _node ? _node->NextSiblingElement( name ) : 0 ); } @@ -2088,25 +2153,25 @@ public: const XMLConstHandle FirstChild() const { return XMLConstHandle( _node ? _node->FirstChild() : 0 ); } - const XMLConstHandle FirstChildElement( const wchar_t* name = 0 ) const { + const XMLConstHandle FirstChildElement( const TCHAR* name = 0 ) const { return XMLConstHandle( _node ? _node->FirstChildElement( name ) : 0 ); } const XMLConstHandle LastChild() const { return XMLConstHandle( _node ? _node->LastChild() : 0 ); } - const XMLConstHandle LastChildElement( const wchar_t* name = 0 ) const { + const XMLConstHandle LastChildElement( const TCHAR* name = 0 ) const { return XMLConstHandle( _node ? _node->LastChildElement( name ) : 0 ); } const XMLConstHandle PreviousSibling() const { return XMLConstHandle( _node ? _node->PreviousSibling() : 0 ); } - const XMLConstHandle PreviousSiblingElement( const wchar_t* name = 0 ) const { + const XMLConstHandle PreviousSiblingElement( const TCHAR* name = 0 ) const { return XMLConstHandle( _node ? _node->PreviousSiblingElement( name ) : 0 ); } const XMLConstHandle NextSibling() const { return XMLConstHandle( _node ? _node->NextSibling() : 0 ); } - const XMLConstHandle NextSiblingElement( const wchar_t* name = 0 ) const { + const XMLConstHandle NextSiblingElement( const TCHAR* name = 0 ) const { return XMLConstHandle( _node ? _node->NextSiblingElement( name ) : 0 ); } @@ -2169,8 +2234,8 @@ private: @verbatim XMLPrinter printer( fp ); - printer.OpenElement( TINYXML2_STR("foo") ); - printer.PushAttribute( TINYXML2_STR("foo", "bar") ); + printer.OpenElement( "foo" ); + printer.PushAttribute( "foo", "bar" ); printer.CloseElement(); @endverbatim */ @@ -2191,25 +2256,28 @@ public: /** If streaming, start writing an element. The element must be closed with CloseElement() */ - void OpenElement( const wchar_t* name, bool compactMode=false ); + void OpenElement( const TCHAR* name, bool compactMode=false ); /// If streaming, add an attribute to an open element. - void PushAttribute( const wchar_t* name, const wchar_t* value ); - void PushAttribute( const wchar_t* name, int value ); - void PushAttribute( const wchar_t* name, unsigned value ); - void PushAttribute(const wchar_t* name, int64_t value); - void PushAttribute( const wchar_t* name, bool value ); - void PushAttribute( const wchar_t* name, double value ); + void PushAttribute( const TCHAR* name, const TCHAR* value ); + void PushAttribute( const TCHAR* name, int value ); + void PushAttribute( const TCHAR* name, unsigned value ); + void PushAttribute( const TCHAR* name, int64_t value ); + void PushAttribute( const TCHAR* name, uint64_t value ); + void PushAttribute( const TCHAR* name, bool value ); + void PushAttribute( const TCHAR* name, double value ); /// If streaming, close the Element. virtual void CloseElement( bool compactMode=false ); /// Add a text node. - void PushText( const wchar_t* text, bool cdata=false ); + void PushText( const TCHAR* text, bool cdata=false ); /// Add a text node from an integer. void PushText( int value ); /// Add a text node from an unsigned. void PushText( unsigned value ); - /// Add a text node from an unsigned. - void PushText(int64_t value); + /// Add a text node from a signed 64bit integer. + void PushText( int64_t value ); + /// Add a text node from an unsigned 64bit integer. + void PushText( uint64_t value ); /// Add a text node from a bool. void PushText( bool value ); /// Add a text node from a float. @@ -2218,10 +2286,10 @@ public: void PushText( double value ); /// Add a comment - void PushComment( const wchar_t* comment ); + void PushComment( const TCHAR* comment ); - void PushDeclaration( const wchar_t* value ); - void PushUnknown( const wchar_t* value ); + void PushDeclaration( const TCHAR* value ); + void PushUnknown( const TCHAR* value ); virtual bool VisitEnter( const XMLDocument& /*doc*/ ); virtual bool VisitExit( const XMLDocument& /*doc*/ ) { @@ -2240,7 +2308,7 @@ public: If in print to memory mode, return a pointer to the XML file in memory. */ - const wchar_t* CStr() const { + const TCHAR* CStr() const { return _buffer.Mem(); } /** @@ -2255,10 +2323,10 @@ public: If in print to memory mode, reset the buffer to the beginning. */ - void ClearBuffer() { + void ClearBuffer( bool resetToFirstElement = true ) { _buffer.Clear(); _buffer.Push(0); - _firstElement = true; + _firstElement = resetToFirstElement; } protected: @@ -2268,17 +2336,17 @@ protected: the space and tabs used. A PrintSpace() override should call Print(). */ virtual void PrintSpace( int depth ); - void Print( const wchar_t* format, ... ); - void Write( const wchar_t* data, size_t size ); - inline void Write( const wchar_t* data ) { Write( data, wcslen( data ) ); } - void Putc( wchar_t ch ); + void Print( const TCHAR* format, ... ); + void Write( const TCHAR* data, size_t size ); + void Write( const TCHAR* data ); + void Putc( TCHAR ch ); void SealElementIfJustOpened(); bool _elementJustOpened; - DynArray< const wchar_t*, 10 > _stack; + DynArray< const TCHAR*, 10 > _stack; private: - void PrintString( const wchar_t*, bool restrictedEntitySet ); // prints out, after detecting entities. + void PrintString( const TCHAR*, bool restrictedEntitySet ); // prints out, after detecting entities. bool _firstElement; FILE* _fp; @@ -2294,7 +2362,7 @@ private: bool _entityFlag[ENTITY_RANGE]; bool _restrictedEntityFlag[ENTITY_RANGE]; - DynArray< wchar_t, 20 > _buffer; + DynArray< TCHAR, 20 > _buffer; // Prohibit cloning, intentionally not implemented XMLPrinter( const XMLPrinter& ); diff --git a/src/kiwano-audio/src/audio.cpp b/src/kiwano-audio/AudioEngine.cpp similarity index 72% rename from src/kiwano-audio/src/audio.cpp rename to src/kiwano-audio/AudioEngine.cpp index db0d0b75..53f2d05b 100644 --- a/src/kiwano-audio/src/audio.cpp +++ b/src/kiwano-audio/AudioEngine.cpp @@ -18,27 +18,27 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#include -#include "audio-modules.h" -#include "audio.h" +#include +#include +#include namespace kiwano { namespace audio { - Audio::Audio() + AudioEngine::AudioEngine() : x_audio2_(nullptr) , mastering_voice_(nullptr) { } - Audio::~Audio() + AudioEngine::~AudioEngine() { } - void Audio::SetupComponent() + void AudioEngine::SetupComponent() { - KGE_LOG(L"Creating audio resources"); + // KGE_LOG(L"Creating audio resources"); HRESULT hr = modules::MediaFoundation::Get().MFStartup(MF_VERSION, MFSTARTUP_FULL); @@ -55,9 +55,9 @@ namespace kiwano ThrowIfFailed(hr); } - void Audio::DestroyComponent() + void AudioEngine::DestroyComponent() { - KGE_LOG(L"Destroying audio resources"); + // KGE_LOG(L"Destroying audio resources"); if (mastering_voice_) { @@ -74,9 +74,9 @@ namespace kiwano modules::MediaFoundation::Get().MFShutdown(); } - HRESULT Audio::CreateVoice(IXAudio2SourceVoice** voice, const WAVEFORMATEX* wfx) + HRESULT AudioEngine::CreateVoice(IXAudio2SourceVoice** voice, const Transcoder::Buffer& buffer) { - KGE_ASSERT(x_audio2_ && "Audio engine hasn't been initialized!"); + KGE_ASSERT(x_audio2_ && "AudioEngine hasn't been initialized!"); if (voice == nullptr) { @@ -89,20 +89,19 @@ namespace kiwano (*voice) = nullptr; } - HRESULT hr = x_audio2_->CreateSourceVoice(voice, wfx, 0, XAUDIO2_DEFAULT_FREQ_RATIO); - return hr; + return x_audio2_->CreateSourceVoice(voice, buffer.format, 0, XAUDIO2_DEFAULT_FREQ_RATIO); } - void Audio::Open() + void AudioEngine::Open() { - KGE_ASSERT(x_audio2_ && "Audio engine hasn't been initialized!"); + KGE_ASSERT(x_audio2_ && "AudioEngine hasn't been initialized!"); x_audio2_->StartEngine(); } - void Audio::Close() + void AudioEngine::Close() { - KGE_ASSERT(x_audio2_ && "Audio engine hasn't been initialized!"); + KGE_ASSERT(x_audio2_ && "AudioEngine hasn't been initialized!"); x_audio2_->StopEngine(); } diff --git a/src/kiwano-audio/src/audio.h b/src/kiwano-audio/AudioEngine.h similarity index 84% rename from src/kiwano-audio/src/audio.h rename to src/kiwano-audio/AudioEngine.h index 91ddbf08..ecc4548b 100644 --- a/src/kiwano-audio/src/audio.h +++ b/src/kiwano-audio/AudioEngine.h @@ -21,22 +21,20 @@ #pragma once #include #include +#include +#include namespace kiwano { namespace audio { - class KGE_API Audio - : public Singleton