refactoring
This commit is contained in:
parent
09bc22de65
commit
12eaaa6bdf
|
|
@ -11,21 +11,21 @@
|
||||||
<ClInclude Include="..\..\src\kiwano\2d\action\Animation.h" />
|
<ClInclude Include="..\..\src\kiwano\2d\action\Animation.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\2d\Frame.h" />
|
<ClInclude Include="..\..\src\kiwano\2d\Frame.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\2d\GifSprite.h" />
|
<ClInclude Include="..\..\src\kiwano\2d\GifSprite.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\Director.h" />
|
<ClInclude Include="..\..\src\kiwano\core\Director.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\Event.h" />
|
<ClInclude Include="..\..\src\kiwano\core\Event.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\Library.h" />
|
<ClInclude Include="..\..\src\kiwano\core\Library.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\win32\ComPtr.hpp" />
|
<ClInclude Include="..\..\src\kiwano\core\win32\ComPtr.hpp" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\win32\helper.h" />
|
<ClInclude Include="..\..\src\kiwano\core\win32\helper.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\core\any.hpp" />
|
<ClInclude Include="..\..\src\kiwano\common\any.hpp" />
|
||||||
<ClInclude Include="..\..\src\kiwano\core\basic_json.hpp" />
|
<ClInclude Include="..\..\src\kiwano\common\basic_json.hpp" />
|
||||||
<ClInclude Include="..\..\src\kiwano\core\function.hpp" />
|
<ClInclude Include="..\..\src\kiwano\common\function.hpp" />
|
||||||
<ClInclude Include="..\..\src\kiwano\core\core.h" />
|
<ClInclude Include="..\..\src\kiwano\common\common.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\core\intrusive_list.hpp" />
|
<ClInclude Include="..\..\src\kiwano\common\intrusive_list.hpp" />
|
||||||
<ClInclude Include="..\..\src\kiwano\core\intrusive_ptr.hpp" />
|
<ClInclude Include="..\..\src\kiwano\common\intrusive_ptr.hpp" />
|
||||||
<ClInclude Include="..\..\src\kiwano\core\noncopyable.hpp" />
|
<ClInclude Include="..\..\src\kiwano\common\noncopyable.hpp" />
|
||||||
<ClInclude Include="..\..\src\kiwano\core\singleton.hpp" />
|
<ClInclude Include="..\..\src\kiwano\common\singleton.hpp" />
|
||||||
<ClInclude Include="..\..\src\kiwano\core\string.hpp" />
|
<ClInclude Include="..\..\src\kiwano\common\string.hpp" />
|
||||||
<ClInclude Include="..\..\src\kiwano\core\vector.hpp" />
|
<ClInclude Include="..\..\src\kiwano\common\vector.hpp" />
|
||||||
<ClInclude Include="..\..\src\kiwano\kiwano.h" />
|
<ClInclude Include="..\..\src\kiwano\kiwano.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\config.h" />
|
<ClInclude Include="..\..\src\kiwano\config.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\macros.h" />
|
<ClInclude Include="..\..\src\kiwano\macros.h" />
|
||||||
|
|
@ -42,21 +42,19 @@
|
||||||
<ClInclude Include="..\..\src\kiwano\2d\TextStyle.hpp" />
|
<ClInclude Include="..\..\src\kiwano\2d\TextStyle.hpp" />
|
||||||
<ClInclude Include="..\..\src\kiwano\2d\Transform.h" />
|
<ClInclude Include="..\..\src\kiwano\2d\Transform.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\2d\Transition.h" />
|
<ClInclude Include="..\..\src\kiwano\2d\Transition.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\AsyncTask.h" />
|
<ClInclude Include="..\..\src\kiwano\core\AsyncTask.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\Component.h" />
|
<ClInclude Include="..\..\src\kiwano\core\Component.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\EventDispatcher.h" />
|
<ClInclude Include="..\..\src\kiwano\core\EventDispatcher.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\EventListener.h" />
|
<ClInclude Include="..\..\src\kiwano\core\EventListener.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\Input.h" />
|
<ClInclude Include="..\..\src\kiwano\core\keys.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\keys.hpp" />
|
<ClInclude Include="..\..\src\kiwano\core\Logger.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\Logger.h" />
|
<ClInclude Include="..\..\src\kiwano\core\ObjectBase.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\ObjectBase.h" />
|
<ClInclude Include="..\..\src\kiwano\core\RefCounter.hpp" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\RefCounter.hpp" />
|
<ClInclude Include="..\..\src\kiwano\core\Resource.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\Resource.h" />
|
<ClInclude Include="..\..\src\kiwano\core\SmartPtr.hpp" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\SmartPtr.hpp" />
|
<ClInclude Include="..\..\src\kiwano\core\Timer.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\Timer.h" />
|
<ClInclude Include="..\..\src\kiwano\core\TimerManager.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\TimerManager.h" />
|
<ClInclude Include="..\..\src\kiwano\core\time.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\time.h" />
|
|
||||||
<ClInclude Include="..\..\src\kiwano\base\Window.h" />
|
|
||||||
<ClInclude Include="..\..\src\kiwano\math\constants.h" />
|
<ClInclude Include="..\..\src\kiwano\math\constants.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\math\ease.h" />
|
<ClInclude Include="..\..\src\kiwano\math\ease.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\math\math.h" />
|
<ClInclude Include="..\..\src\kiwano\math\math.h" />
|
||||||
|
|
@ -66,7 +64,10 @@
|
||||||
<ClInclude Include="..\..\src\kiwano\math\scalar.h" />
|
<ClInclude Include="..\..\src\kiwano\math\scalar.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\math\Vec2.hpp" />
|
<ClInclude Include="..\..\src\kiwano\math\Vec2.hpp" />
|
||||||
<ClInclude Include="..\..\src\kiwano\platform\Application.h" />
|
<ClInclude Include="..\..\src\kiwano\platform\Application.h" />
|
||||||
|
<ClInclude Include="..\..\src\kiwano\platform\FileSystem.h" />
|
||||||
|
<ClInclude Include="..\..\src\kiwano\platform\Input.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\platform\modules.h" />
|
<ClInclude Include="..\..\src\kiwano\platform\modules.h" />
|
||||||
|
<ClInclude Include="..\..\src\kiwano\platform\Window.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\renderer\Brush.h" />
|
<ClInclude Include="..\..\src\kiwano\renderer\Brush.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\renderer\Color.h" />
|
<ClInclude Include="..\..\src\kiwano\renderer\Color.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\renderer\Font.h" />
|
<ClInclude Include="..\..\src\kiwano\renderer\Font.h" />
|
||||||
|
|
@ -89,7 +90,6 @@
|
||||||
<ClInclude Include="..\..\src\kiwano\ui\Button.h" />
|
<ClInclude Include="..\..\src\kiwano\ui\Button.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\ui\Menu.h" />
|
<ClInclude Include="..\..\src\kiwano\ui\Menu.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\utils\LocalStorage.h" />
|
<ClInclude Include="..\..\src\kiwano\utils\LocalStorage.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\utils\FileSystem.h" />
|
|
||||||
<ClInclude Include="..\..\src\kiwano\utils\ResourceCache.h" />
|
<ClInclude Include="..\..\src\kiwano\utils\ResourceCache.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\utils\UserData.h" />
|
<ClInclude Include="..\..\src\kiwano\utils\UserData.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
@ -114,23 +114,24 @@
|
||||||
<ClCompile Include="..\..\src\kiwano\2d\Text.cpp" />
|
<ClCompile Include="..\..\src\kiwano\2d\Text.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\2d\Transform.cpp" />
|
<ClCompile Include="..\..\src\kiwano\2d\Transform.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\2d\Transition.cpp" />
|
<ClCompile Include="..\..\src\kiwano\2d\Transition.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\base\AsyncTask.cpp" />
|
<ClCompile Include="..\..\src\kiwano\core\AsyncTask.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\base\Component.cpp" />
|
<ClCompile Include="..\..\src\kiwano\core\Component.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\base\Event.cpp" />
|
<ClCompile Include="..\..\src\kiwano\core\Event.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\base\EventDispatcher.cpp" />
|
<ClCompile Include="..\..\src\kiwano\core\EventDispatcher.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\base\EventListener.cpp" />
|
<ClCompile Include="..\..\src\kiwano\core\EventListener.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\base\Input.cpp" />
|
<ClCompile Include="..\..\src\kiwano\core\Library.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\base\Library.cpp" />
|
<ClCompile Include="..\..\src\kiwano\core\Logger.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\base\Logger.cpp" />
|
<ClCompile Include="..\..\src\kiwano\core\ObjectBase.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\base\ObjectBase.cpp" />
|
<ClCompile Include="..\..\src\kiwano\core\Resource.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\base\Resource.cpp" />
|
<ClCompile Include="..\..\src\kiwano\core\Director.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\base\Director.cpp" />
|
<ClCompile Include="..\..\src\kiwano\core\Timer.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\base\Timer.cpp" />
|
<ClCompile Include="..\..\src\kiwano\core\TimerManager.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\base\TimerManager.cpp" />
|
<ClCompile Include="..\..\src\kiwano\core\time.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\base\time.cpp" />
|
|
||||||
<ClCompile Include="..\..\src\kiwano\base\Window.cpp" />
|
|
||||||
<ClCompile Include="..\..\src\kiwano\platform\Application.cpp" />
|
<ClCompile Include="..\..\src\kiwano\platform\Application.cpp" />
|
||||||
|
<ClCompile Include="..\..\src\kiwano\platform\FileSystem.cpp" />
|
||||||
|
<ClCompile Include="..\..\src\kiwano\platform\Input.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\platform\modules.cpp" />
|
<ClCompile Include="..\..\src\kiwano\platform\modules.cpp" />
|
||||||
|
<ClCompile Include="..\..\src\kiwano\platform\Window.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\renderer\Brush.cpp" />
|
<ClCompile Include="..\..\src\kiwano\renderer\Brush.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\renderer\Color.cpp" />
|
<ClCompile Include="..\..\src\kiwano\renderer\Color.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\renderer\Font.cpp" />
|
<ClCompile Include="..\..\src\kiwano\renderer\Font.cpp" />
|
||||||
|
|
@ -151,7 +152,6 @@
|
||||||
<ClCompile Include="..\..\src\kiwano\ui\Button.cpp" />
|
<ClCompile Include="..\..\src\kiwano\ui\Button.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\ui\Menu.cpp" />
|
<ClCompile Include="..\..\src\kiwano\ui\Menu.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\utils\LocalStorage.cpp" />
|
<ClCompile Include="..\..\src\kiwano\utils\LocalStorage.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\utils\FileSystem.cpp" />
|
|
||||||
<ClCompile Include="..\..\src\kiwano\utils\ResourceCache.cpp" />
|
<ClCompile Include="..\..\src\kiwano\utils\ResourceCache.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\utils\UserData.cpp" />
|
<ClCompile Include="..\..\src\kiwano\utils\UserData.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
<Filter Include="2d">
|
<Filter Include="2d">
|
||||||
<UniqueIdentifier>{896bdedf-6e82-449b-9b6e-0bc69f3699b1}</UniqueIdentifier>
|
<UniqueIdentifier>{896bdedf-6e82-449b-9b6e-0bc69f3699b1}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="base">
|
<Filter Include="core">
|
||||||
<UniqueIdentifier>{2e18d99a-e906-499a-9e29-4e0783202644}</UniqueIdentifier>
|
<UniqueIdentifier>{2e18d99a-e906-499a-9e29-4e0783202644}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="renderer">
|
<Filter Include="renderer">
|
||||||
|
|
@ -25,13 +25,13 @@
|
||||||
<Filter Include="2d\action">
|
<Filter Include="2d\action">
|
||||||
<UniqueIdentifier>{9314f30d-5742-48b6-94e5-e3b4284106f6}</UniqueIdentifier>
|
<UniqueIdentifier>{9314f30d-5742-48b6-94e5-e3b4284106f6}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="core">
|
<Filter Include="common">
|
||||||
<UniqueIdentifier>{86e2d0f2-a9d0-4456-b6a5-d480228bbf82}</UniqueIdentifier>
|
<UniqueIdentifier>{86e2d0f2-a9d0-4456-b6a5-d480228bbf82}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="renderer\win32">
|
<Filter Include="renderer\win32">
|
||||||
<UniqueIdentifier>{30333461-e9bc-4709-84bd-ce6e0e1a3079}</UniqueIdentifier>
|
<UniqueIdentifier>{30333461-e9bc-4709-84bd-ce6e0e1a3079}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="base\win32">
|
<Filter Include="core\win32">
|
||||||
<UniqueIdentifier>{192a47a9-9df6-4f40-a7d3-888eb00c53ac}</UniqueIdentifier>
|
<UniqueIdentifier>{192a47a9-9df6-4f40-a7d3-888eb00c53ac}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
@ -63,26 +63,23 @@
|
||||||
<ClInclude Include="..\..\src\kiwano\2d\Transition.h">
|
<ClInclude Include="..\..\src\kiwano\2d\Transition.h">
|
||||||
<Filter>2d</Filter>
|
<Filter>2d</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\base\Component.h">
|
<ClInclude Include="..\..\src\kiwano\core\Component.h">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\base\EventDispatcher.h">
|
<ClInclude Include="..\..\src\kiwano\core\EventDispatcher.h">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\base\EventListener.h">
|
<ClInclude Include="..\..\src\kiwano\core\EventListener.h">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\base\keys.hpp">
|
<ClInclude Include="..\..\src\kiwano\core\RefCounter.hpp">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\base\RefCounter.hpp">
|
<ClInclude Include="..\..\src\kiwano\core\Resource.h">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\base\Resource.h">
|
<ClInclude Include="..\..\src\kiwano\core\time.h">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\kiwano\base\time.h">
|
|
||||||
<Filter>base</Filter>
|
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\math\Matrix.hpp">
|
<ClInclude Include="..\..\src\kiwano\math\Matrix.hpp">
|
||||||
<Filter>math</Filter>
|
<Filter>math</Filter>
|
||||||
|
|
@ -104,27 +101,24 @@
|
||||||
<ClInclude Include="..\..\src\kiwano\math\Vec2.hpp">
|
<ClInclude Include="..\..\src\kiwano\math\Vec2.hpp">
|
||||||
<Filter>math</Filter>
|
<Filter>math</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\base\Input.h">
|
<ClInclude Include="..\..\src\kiwano\core\SmartPtr.hpp">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\kiwano\base\SmartPtr.hpp">
|
|
||||||
<Filter>base</Filter>
|
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\kiwano.h" />
|
<ClInclude Include="..\..\src\kiwano\kiwano.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\base\Timer.h">
|
<ClInclude Include="..\..\src\kiwano\core\Timer.h">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\base\TimerManager.h">
|
<ClInclude Include="..\..\src\kiwano\core\TimerManager.h">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\base\AsyncTask.h">
|
<ClInclude Include="..\..\src\kiwano\core\AsyncTask.h">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\2d\GifSprite.h">
|
<ClInclude Include="..\..\src\kiwano\2d\GifSprite.h">
|
||||||
<Filter>2d</Filter>
|
<Filter>2d</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\base\Director.h">
|
<ClInclude Include="..\..\src\kiwano\core\Director.h">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\2d\Actor.h">
|
<ClInclude Include="..\..\src\kiwano\2d\Actor.h">
|
||||||
<Filter>2d</Filter>
|
<Filter>2d</Filter>
|
||||||
|
|
@ -159,32 +153,32 @@
|
||||||
<ClInclude Include="..\..\src\kiwano\2d\FrameSequence.h">
|
<ClInclude Include="..\..\src\kiwano\2d\FrameSequence.h">
|
||||||
<Filter>2d</Filter>
|
<Filter>2d</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\core\basic_json.hpp">
|
<ClInclude Include="..\..\src\kiwano\common\basic_json.hpp">
|
||||||
<Filter>core</Filter>
|
<Filter>common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\core\function.hpp">
|
<ClInclude Include="..\..\src\kiwano\common\function.hpp">
|
||||||
<Filter>core</Filter>
|
<Filter>common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\core\intrusive_list.hpp">
|
<ClInclude Include="..\..\src\kiwano\common\intrusive_list.hpp">
|
||||||
<Filter>core</Filter>
|
<Filter>common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\core\intrusive_ptr.hpp">
|
<ClInclude Include="..\..\src\kiwano\common\intrusive_ptr.hpp">
|
||||||
<Filter>core</Filter>
|
<Filter>common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\core\noncopyable.hpp">
|
<ClInclude Include="..\..\src\kiwano\common\noncopyable.hpp">
|
||||||
<Filter>core</Filter>
|
<Filter>common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\core\singleton.hpp">
|
<ClInclude Include="..\..\src\kiwano\common\singleton.hpp">
|
||||||
<Filter>core</Filter>
|
<Filter>common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\core\string.hpp">
|
<ClInclude Include="..\..\src\kiwano\common\string.hpp">
|
||||||
<Filter>core</Filter>
|
<Filter>common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\core\vector.hpp">
|
<ClInclude Include="..\..\src\kiwano\common\vector.hpp">
|
||||||
<Filter>core</Filter>
|
<Filter>common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\core\core.h">
|
<ClInclude Include="..\..\src\kiwano\common\common.h">
|
||||||
<Filter>core</Filter>
|
<Filter>common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\2d\DebugActor.h">
|
<ClInclude Include="..\..\src\kiwano\2d\DebugActor.h">
|
||||||
<Filter>2d</Filter>
|
<Filter>2d</Filter>
|
||||||
|
|
@ -198,17 +192,14 @@
|
||||||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionWalk.h">
|
<ClInclude Include="..\..\src\kiwano\2d\action\ActionWalk.h">
|
||||||
<Filter>2d\action</Filter>
|
<Filter>2d\action</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\base\Logger.h">
|
<ClInclude Include="..\..\src\kiwano\core\Logger.h">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\kiwano\base\Window.h">
|
|
||||||
<Filter>base</Filter>
|
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\math\math.h">
|
<ClInclude Include="..\..\src\kiwano\math\math.h">
|
||||||
<Filter>math</Filter>
|
<Filter>math</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\base\ObjectBase.h">
|
<ClInclude Include="..\..\src\kiwano\core\ObjectBase.h">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\renderer\Color.h">
|
<ClInclude Include="..\..\src\kiwano\renderer\Color.h">
|
||||||
<Filter>renderer</Filter>
|
<Filter>renderer</Filter>
|
||||||
|
|
@ -279,29 +270,38 @@
|
||||||
<ClInclude Include="..\..\src\kiwano\math\scalar.h">
|
<ClInclude Include="..\..\src\kiwano\math\scalar.h">
|
||||||
<Filter>math</Filter>
|
<Filter>math</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\base\win32\ComPtr.hpp">
|
<ClInclude Include="..\..\src\kiwano\core\win32\ComPtr.hpp">
|
||||||
<Filter>base\win32</Filter>
|
<Filter>core\win32</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\base\win32\helper.h">
|
<ClInclude Include="..\..\src\kiwano\core\win32\helper.h">
|
||||||
<Filter>base\win32</Filter>
|
<Filter>core\win32</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\utils\LocalStorage.h">
|
<ClInclude Include="..\..\src\kiwano\utils\LocalStorage.h">
|
||||||
<Filter>utils</Filter>
|
<Filter>utils</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\utils\FileSystem.h">
|
<ClInclude Include="..\..\src\kiwano\common\any.hpp">
|
||||||
<Filter>utils</Filter>
|
<Filter>common</Filter>
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\kiwano\core\any.hpp">
|
|
||||||
<Filter>core</Filter>
|
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\utils\UserData.h">
|
<ClInclude Include="..\..\src\kiwano\utils\UserData.h">
|
||||||
<Filter>utils</Filter>
|
<Filter>utils</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\base\Library.h">
|
<ClInclude Include="..\..\src\kiwano\core\Library.h">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\base\Event.h">
|
<ClInclude Include="..\..\src\kiwano\core\Event.h">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\kiwano\platform\FileSystem.h">
|
||||||
|
<Filter>platform</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\kiwano\core\keys.h">
|
||||||
|
<Filter>core</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\kiwano\platform\Input.h">
|
||||||
|
<Filter>platform</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\kiwano\platform\Window.h">
|
||||||
|
<Filter>platform</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
@ -326,17 +326,17 @@
|
||||||
<ClCompile Include="..\..\src\kiwano\2d\Transition.cpp">
|
<ClCompile Include="..\..\src\kiwano\2d\Transition.cpp">
|
||||||
<Filter>2d</Filter>
|
<Filter>2d</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\base\EventDispatcher.cpp">
|
<ClCompile Include="..\..\src\kiwano\core\EventDispatcher.cpp">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\base\EventListener.cpp">
|
<ClCompile Include="..\..\src\kiwano\core\EventListener.cpp">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\base\Resource.cpp">
|
<ClCompile Include="..\..\src\kiwano\core\Resource.cpp">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\base\time.cpp">
|
<ClCompile Include="..\..\src\kiwano\core\time.cpp">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\platform\Application.cpp">
|
<ClCompile Include="..\..\src\kiwano\platform\Application.cpp">
|
||||||
<Filter>platform</Filter>
|
<Filter>platform</Filter>
|
||||||
|
|
@ -344,23 +344,20 @@
|
||||||
<ClCompile Include="..\..\src\kiwano\platform\modules.cpp">
|
<ClCompile Include="..\..\src\kiwano\platform\modules.cpp">
|
||||||
<Filter>platform</Filter>
|
<Filter>platform</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\base\Input.cpp">
|
<ClCompile Include="..\..\src\kiwano\core\Timer.cpp">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\base\Timer.cpp">
|
<ClCompile Include="..\..\src\kiwano\core\TimerManager.cpp">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\base\TimerManager.cpp">
|
<ClCompile Include="..\..\src\kiwano\core\AsyncTask.cpp">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\kiwano\base\AsyncTask.cpp">
|
|
||||||
<Filter>base</Filter>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\2d\GifSprite.cpp">
|
<ClCompile Include="..\..\src\kiwano\2d\GifSprite.cpp">
|
||||||
<Filter>2d</Filter>
|
<Filter>2d</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\base\Director.cpp">
|
<ClCompile Include="..\..\src\kiwano\core\Director.cpp">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\2d\Actor.cpp">
|
<ClCompile Include="..\..\src\kiwano\2d\Actor.cpp">
|
||||||
<Filter>2d</Filter>
|
<Filter>2d</Filter>
|
||||||
|
|
@ -404,14 +401,11 @@
|
||||||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionWalk.cpp">
|
<ClCompile Include="..\..\src\kiwano\2d\action\ActionWalk.cpp">
|
||||||
<Filter>2d\action</Filter>
|
<Filter>2d\action</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\base\Logger.cpp">
|
<ClCompile Include="..\..\src\kiwano\core\Logger.cpp">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\base\Window.cpp">
|
<ClCompile Include="..\..\src\kiwano\core\ObjectBase.cpp">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\kiwano\base\ObjectBase.cpp">
|
|
||||||
<Filter>base</Filter>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\renderer\Color.cpp">
|
<ClCompile Include="..\..\src\kiwano\renderer\Color.cpp">
|
||||||
<Filter>renderer</Filter>
|
<Filter>renderer</Filter>
|
||||||
|
|
@ -467,23 +461,29 @@
|
||||||
<ClCompile Include="..\..\src\kiwano\renderer\Brush.cpp">
|
<ClCompile Include="..\..\src\kiwano\renderer\Brush.cpp">
|
||||||
<Filter>renderer</Filter>
|
<Filter>renderer</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\base\Component.cpp">
|
<ClCompile Include="..\..\src\kiwano\core\Component.cpp">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\utils\LocalStorage.cpp">
|
<ClCompile Include="..\..\src\kiwano\utils\LocalStorage.cpp">
|
||||||
<Filter>utils</Filter>
|
<Filter>utils</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\utils\FileSystem.cpp">
|
|
||||||
<Filter>utils</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\kiwano\utils\UserData.cpp">
|
<ClCompile Include="..\..\src\kiwano\utils\UserData.cpp">
|
||||||
<Filter>utils</Filter>
|
<Filter>utils</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\base\Library.cpp">
|
<ClCompile Include="..\..\src\kiwano\core\Library.cpp">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\base\Event.cpp">
|
<ClCompile Include="..\..\src\kiwano\core\Event.cpp">
|
||||||
<Filter>base</Filter>
|
<Filter>core</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\kiwano\platform\FileSystem.cpp">
|
||||||
|
<Filter>platform</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\kiwano\platform\Input.cpp">
|
||||||
|
<Filter>platform</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\kiwano\platform\Window.cpp">
|
||||||
|
<Filter>platform</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/base/win32/helper.h>
|
#include <kiwano/core/win32/helper.h>
|
||||||
#include <kiwano-audio/audio-modules.h>
|
#include <kiwano-audio/audio-modules.h>
|
||||||
#include <kiwano-audio/AudioEngine.h>
|
#include <kiwano-audio/AudioEngine.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/core/singleton.hpp>
|
#include <kiwano/common/singleton.hpp>
|
||||||
#include <kiwano/base/Component.h>
|
#include <kiwano/core/Component.h>
|
||||||
#include <kiwano/base/win32/ComPtr.hpp>
|
#include <kiwano/core/win32/ComPtr.hpp>
|
||||||
#include <kiwano-audio/Transcoder.h>
|
#include <kiwano-audio/Transcoder.h>
|
||||||
#include <xaudio2.h>
|
#include <xaudio2.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
#include <kiwano/utils/FileSystem.h>
|
#include <kiwano/platform/FileSystem.h>
|
||||||
#include <kiwano-audio/Sound.h>
|
#include <kiwano-audio/Sound.h>
|
||||||
#include <kiwano-audio/AudioEngine.h>
|
#include <kiwano-audio/AudioEngine.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/core/intrusive_ptr.hpp>
|
#include <kiwano/common/intrusive_ptr.hpp>
|
||||||
#include <kiwano/base/ObjectBase.h>
|
#include <kiwano/core/ObjectBase.h>
|
||||||
#include <kiwano/base/Resource.h>
|
#include <kiwano/core/Resource.h>
|
||||||
#include <kiwano-audio/Transcoder.h>
|
#include <kiwano-audio/Transcoder.h>
|
||||||
#include <xaudio2.h>
|
#include <xaudio2.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/core/intrusive_ptr.hpp>
|
#include <kiwano/common/intrusive_ptr.hpp>
|
||||||
#include <kiwano/base/ObjectBase.h>
|
#include <kiwano/core/ObjectBase.h>
|
||||||
#include <kiwano-audio/Sound.h>
|
#include <kiwano-audio/Sound.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,10 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <kiwano/macros.h>
|
#include <kiwano/macros.h>
|
||||||
#include <kiwano/core/string.hpp>
|
#include <kiwano/common/string.hpp>
|
||||||
#include <kiwano/base/Resource.h>
|
#include <kiwano/core/Resource.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
#include <kiwano/base/win32/ComPtr.hpp>
|
#include <kiwano/core/win32/ComPtr.hpp>
|
||||||
#include <kiwano/platform/modules.h>
|
#include <kiwano/platform/modules.h>
|
||||||
#include <kiwano-audio/audio-modules.h>
|
#include <kiwano-audio/audio-modules.h>
|
||||||
#include <kiwano-audio/Transcoder.h>
|
#include <kiwano-audio/Transcoder.h>
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/base/Resource.h>
|
#include <kiwano/core/Resource.h>
|
||||||
#include <mfapi.h>
|
#include <mfapi.h>
|
||||||
#include <mfidl.h>
|
#include <mfidl.h>
|
||||||
#include <mfreadwrite.h>
|
#include <mfreadwrite.h>
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
#include <kiwano-audio/audio-modules.h>
|
#include <kiwano-audio/audio-modules.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/base/Library.h>
|
#include <kiwano/core/Library.h>
|
||||||
#include <xaudio2.h>
|
#include <xaudio2.h>
|
||||||
#include <mfapi.h>
|
#include <mfapi.h>
|
||||||
#include <mfidl.h>
|
#include <mfidl.h>
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
// Copyright (C) 2019 Nomango
|
// Copyright (C) 2019 Nomango
|
||||||
|
|
||||||
#include <kiwano/core/core.h>
|
#include <kiwano/common/common.h>
|
||||||
#include <kiwano/core/Function.hpp>
|
#include <kiwano/common/Function.hpp>
|
||||||
#include <kiwano/core/intrusive_ptr.hpp>
|
#include <kiwano/common/intrusive_ptr.hpp>
|
||||||
#include <kiwano/base/Window.h>
|
#include <kiwano/platform/Window.h>
|
||||||
#include <kiwano/base/Input.h>
|
#include <kiwano/platform/Input.h>
|
||||||
#include <kiwano/renderer/Renderer.h>
|
#include <kiwano/renderer/Renderer.h>
|
||||||
#include <kiwano-imgui/ImGuiModule.h>
|
#include <kiwano-imgui/ImGuiModule.h>
|
||||||
#include <kiwano-imgui/imgui_impl.h>
|
#include <kiwano-imgui/imgui_impl.h>
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/base/Component.h>
|
#include <kiwano/core/Component.h>
|
||||||
#include <kiwano/core/singleton.hpp>
|
#include <kiwano/common/singleton.hpp>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// dear imgui: Renderer for Kiwano (DirectX11)
|
// dear imgui: Renderer for Kiwano (DirectX11)
|
||||||
|
|
||||||
#include <kiwano/base/win32/helper.h>
|
#include <kiwano/core/win32/helper.h>
|
||||||
#include <kiwano-imgui/imgui_impl_dx11.h>
|
#include <kiwano-imgui/imgui_impl_dx11.h>
|
||||||
|
|
||||||
// DirectX
|
// DirectX
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
#include <kiwano-network/HttpResponse.hpp>
|
#include <kiwano-network/HttpResponse.hpp>
|
||||||
#include <kiwano-network/HttpClient.h>
|
#include <kiwano-network/HttpClient.h>
|
||||||
|
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
#include <kiwano/platform/Application.h>
|
#include <kiwano/platform/Application.h>
|
||||||
#include <3rd-party/curl/curl.h> // CURL
|
#include <3rd-party/curl/curl.h> // CURL
|
||||||
|
|
||||||
|
|
@ -36,7 +36,7 @@ namespace
|
||||||
|
|
||||||
uint32_t write_data(void* buffer, uint32_t size, uint32_t nmemb, void* userp)
|
uint32_t write_data(void* buffer, uint32_t size, uint32_t nmemb, void* userp)
|
||||||
{
|
{
|
||||||
core::string* recv_buffer = (core::string*)userp;
|
common::string* recv_buffer = (common::string*)userp;
|
||||||
uint32_t total = size * nmemb;
|
uint32_t total = size * nmemb;
|
||||||
|
|
||||||
// add data to the end of recv_buffer
|
// add data to the end of recv_buffer
|
||||||
|
|
@ -46,10 +46,10 @@ namespace
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
core::string convert_to_utf8(core::wstring const& str)
|
common::string convert_to_utf8(common::wstring const& str)
|
||||||
{
|
{
|
||||||
std::wstring_convert<std::codecvt_utf8<wchar_t>> utf8_conv;
|
std::wstring_convert<std::codecvt_utf8<wchar_t>> utf8_conv;
|
||||||
core::string result;
|
common::string result;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -63,10 +63,10 @@ namespace
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
core::wstring convert_from_utf8(core::string const& str)
|
common::wstring convert_from_utf8(common::string const& str)
|
||||||
{
|
{
|
||||||
kiwano::string_convert<std::codecvt_utf8<wchar_t>> utf8_conv;
|
kiwano::string_convert<std::codecvt_utf8<wchar_t>> utf8_conv;
|
||||||
core::wstring result;
|
common::wstring result;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -104,7 +104,7 @@ namespace
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Init(HttpClient* client, Vector<core::string> const& headers, core::string const& url, core::string* response_data, core::string* response_header, char* error_buffer)
|
bool Init(HttpClient* client, Vector<common::string> const& headers, common::string const& url, common::string* response_data, common::string* response_header, char* error_buffer)
|
||||||
{
|
{
|
||||||
if (!SetOption(CURLOPT_ERRORBUFFER, error_buffer))
|
if (!SetOption(CURLOPT_ERRORBUFFER, error_buffer))
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -170,11 +170,11 @@ namespace
|
||||||
public:
|
public:
|
||||||
static inline bool GetRequest(
|
static inline bool GetRequest(
|
||||||
HttpClient* client,
|
HttpClient* client,
|
||||||
Vector<core::string> const& headers,
|
Vector<common::string> const& headers,
|
||||||
core::string const& url,
|
common::string const& url,
|
||||||
long* response_code,
|
long* response_code,
|
||||||
core::string* response_data,
|
common::string* response_data,
|
||||||
core::string* response_header,
|
common::string* response_header,
|
||||||
char* error_buffer)
|
char* error_buffer)
|
||||||
{
|
{
|
||||||
Curl curl;
|
Curl curl;
|
||||||
|
|
@ -185,12 +185,12 @@ namespace
|
||||||
|
|
||||||
static inline bool PostRequest(
|
static inline bool PostRequest(
|
||||||
HttpClient* client,
|
HttpClient* client,
|
||||||
Vector<core::string> const& headers,
|
Vector<common::string> const& headers,
|
||||||
core::string const& url,
|
common::string const& url,
|
||||||
core::string const& request_data,
|
common::string const& request_data,
|
||||||
long* response_code,
|
long* response_code,
|
||||||
core::string* response_data,
|
common::string* response_data,
|
||||||
core::string* response_header,
|
common::string* response_header,
|
||||||
char* error_buffer)
|
char* error_buffer)
|
||||||
{
|
{
|
||||||
Curl curl;
|
Curl curl;
|
||||||
|
|
@ -203,12 +203,12 @@ namespace
|
||||||
|
|
||||||
static inline bool PutRequest(
|
static inline bool PutRequest(
|
||||||
HttpClient* client,
|
HttpClient* client,
|
||||||
Vector<core::string> const& headers,
|
Vector<common::string> const& headers,
|
||||||
core::string const& url,
|
common::string const& url,
|
||||||
core::string const& request_data,
|
common::string const& request_data,
|
||||||
long* response_code,
|
long* response_code,
|
||||||
core::string* response_data,
|
common::string* response_data,
|
||||||
core::string* response_header,
|
common::string* response_header,
|
||||||
char* error_buffer)
|
char* error_buffer)
|
||||||
{
|
{
|
||||||
Curl curl;
|
Curl curl;
|
||||||
|
|
@ -221,11 +221,11 @@ namespace
|
||||||
|
|
||||||
static inline bool DeleteRequest(
|
static inline bool DeleteRequest(
|
||||||
HttpClient* client,
|
HttpClient* client,
|
||||||
Vector<core::string> const& headers,
|
Vector<common::string> const& headers,
|
||||||
core::string const& url,
|
common::string const& url,
|
||||||
long* response_code,
|
long* response_code,
|
||||||
core::string* response_data,
|
common::string* response_data,
|
||||||
core::string* response_header,
|
common::string* response_header,
|
||||||
char* error_buffer)
|
char* error_buffer)
|
||||||
{
|
{
|
||||||
Curl curl;
|
Curl curl;
|
||||||
|
|
@ -307,13 +307,13 @@ namespace kiwano
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
long response_code = 0;
|
long response_code = 0;
|
||||||
char error_message[256] = { 0 };
|
char error_message[256] = { 0 };
|
||||||
core::string response_header;
|
common::string response_header;
|
||||||
core::string response_data;
|
common::string response_data;
|
||||||
|
|
||||||
core::string url = convert_to_utf8(request->GetUrl());
|
common::string url = convert_to_utf8(request->GetUrl());
|
||||||
core::string data = convert_to_utf8(request->GetData());
|
common::string data = convert_to_utf8(request->GetData());
|
||||||
|
|
||||||
Vector<core::string> headers;
|
Vector<common::string> headers;
|
||||||
headers.reserve(request->GetHeaders().size());
|
headers.reserve(request->GetHeaders().size());
|
||||||
for (const auto& pair : request->GetHeaders())
|
for (const auto& pair : request->GetHeaders())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/core/core.h>
|
#include <kiwano/common/common.h>
|
||||||
#include <kiwano/core/singleton.hpp>
|
#include <kiwano/common/singleton.hpp>
|
||||||
#include <kiwano/base/Component.h>
|
#include <kiwano/core/Component.h>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
|
|
||||||
|
|
@ -36,39 +36,19 @@ namespace kiwano
|
||||||
KGE_DECLARE_SINGLETON(HttpClient);
|
KGE_DECLARE_SINGLETON(HttpClient);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Send(
|
void Send(HttpRequestPtr request);
|
||||||
HttpRequestPtr request
|
|
||||||
);
|
|
||||||
|
|
||||||
inline void SetTimeoutForConnect(Duration timeout)
|
void SetTimeoutForConnect(Duration timeout);
|
||||||
{
|
|
||||||
timeout_for_connect_ = timeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline Duration GetTimeoutForConnect() const
|
Duration GetTimeoutForConnect() const;
|
||||||
{
|
|
||||||
return timeout_for_connect_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void SetTimeoutForRead(Duration timeout)
|
void SetTimeoutForRead(Duration timeout);
|
||||||
{
|
|
||||||
timeout_for_read_ = timeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline Duration GetTimeoutForRead() const
|
Duration GetTimeoutForRead() const;
|
||||||
{
|
|
||||||
return timeout_for_read_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void SetSSLVerification(String const& root_certificate_path)
|
void SetSSLVerification(String const& root_certificate_path);
|
||||||
{
|
|
||||||
ssl_verification_ = root_certificate_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline String const& GetSSLVerification() const
|
String const& GetSSLVerification() const;
|
||||||
{
|
|
||||||
return ssl_verification_;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void SetupComponent() override;
|
virtual void SetupComponent() override;
|
||||||
|
|
@ -101,5 +81,37 @@ namespace kiwano
|
||||||
|
|
||||||
std::condition_variable_any sleep_condition_;
|
std::condition_variable_any sleep_condition_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline void HttpClient::SetTimeoutForConnect(Duration timeout)
|
||||||
|
{
|
||||||
|
timeout_for_connect_ = timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Duration HttpClient::GetTimeoutForConnect() const
|
||||||
|
{
|
||||||
|
return timeout_for_connect_;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void HttpClient::SetTimeoutForRead(Duration timeout)
|
||||||
|
{
|
||||||
|
timeout_for_read_ = timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Duration HttpClient::GetTimeoutForRead() const
|
||||||
|
{
|
||||||
|
return timeout_for_read_;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void HttpClient::SetSSLVerification(String const& root_certificate_path)
|
||||||
|
{
|
||||||
|
ssl_verification_ = root_certificate_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline String const& HttpClient::GetSSLVerification() const
|
||||||
|
{
|
||||||
|
return ssl_verification_;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,19 +30,5 @@ namespace kiwano
|
||||||
SetHeader(L"Content-Type", L"application/json;charset=UTF-8");
|
SetHeader(L"Content-Type", L"application/json;charset=UTF-8");
|
||||||
data_ = json.dump();
|
data_ = json.dump();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpRequest::SetHeader(String const& field, String const& content)
|
|
||||||
{
|
|
||||||
auto iter = headers_.find(field);
|
|
||||||
if (iter != headers_.end())
|
|
||||||
{
|
|
||||||
headers_[field] = content;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
headers_.insert(std::make_pair(field, content));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,10 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/core/function.hpp>
|
#include <kiwano/common/function.hpp>
|
||||||
#include <kiwano/core/basic_json.hpp>
|
#include <kiwano/common/basic_json.hpp>
|
||||||
#include <kiwano/base/ObjectBase.h>
|
#include <kiwano/core/ObjectBase.h>
|
||||||
#include <kiwano/base/SmartPtr.hpp>
|
#include <kiwano/core/SmartPtr.hpp>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -47,35 +47,32 @@ namespace kiwano
|
||||||
Delete
|
Delete
|
||||||
};
|
};
|
||||||
|
|
||||||
inline HttpRequest() : type_(Type::Unknown) {}
|
HttpRequest();
|
||||||
|
|
||||||
inline HttpRequest(Type type) : type_(type) {}
|
HttpRequest(Type type);
|
||||||
|
|
||||||
inline void SetUrl(String const& url) { url_ = url; }
|
// 请求地址
|
||||||
|
void SetUrl(String const& url);
|
||||||
|
String const& GetUrl() const;
|
||||||
|
|
||||||
inline String const& GetUrl() const { return url_; }
|
// 请求类型
|
||||||
|
void SetType(Type type);
|
||||||
|
Type GetType() const;
|
||||||
|
|
||||||
inline void SetType(Type type) { type_ = type; }
|
// 请求数据
|
||||||
|
void SetData(String const& data);
|
||||||
|
void SetJsonData(Json const& json);
|
||||||
|
String const& GetData() const;
|
||||||
|
|
||||||
inline Type GetType() const { return type_; }
|
// 请求头
|
||||||
|
void SetHeaders(Map<String, String> const& headers);
|
||||||
|
void SetHeader(String const& field, String const& content);
|
||||||
|
Map<String, String>& GetHeaders();
|
||||||
|
String const& GetHeader(String const& header) const;
|
||||||
|
|
||||||
inline void SetData(String const& data) { data_ = data; }
|
// 响应回调
|
||||||
|
void SetResponseCallback(ResponseCallback const& callback);
|
||||||
void SetJsonData(Json const& json);
|
ResponseCallback const& GetResponseCallback() const;
|
||||||
|
|
||||||
inline String const& GetData() const { return data_; }
|
|
||||||
|
|
||||||
inline void SetHeaders(Map<String, String> const& headers) { headers_ = headers; }
|
|
||||||
|
|
||||||
void SetHeader(String const& field, String const& content);
|
|
||||||
|
|
||||||
inline Map<String, String>& GetHeaders() { return headers_; }
|
|
||||||
|
|
||||||
inline String const& GetHeader(String const& header) const { return headers_.at(header); }
|
|
||||||
|
|
||||||
inline void SetResponseCallback(ResponseCallback const& callback) { response_cb_ = callback; }
|
|
||||||
|
|
||||||
inline ResponseCallback const& GetResponseCallback() const { return response_cb_; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Type type_;
|
Type type_;
|
||||||
|
|
@ -84,5 +81,33 @@ namespace kiwano
|
||||||
Map<String, String> headers_;
|
Map<String, String> headers_;
|
||||||
ResponseCallback response_cb_;
|
ResponseCallback response_cb_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline HttpRequest::HttpRequest() : type_(Type::Unknown) {}
|
||||||
|
|
||||||
|
inline HttpRequest::HttpRequest(Type type) : type_(type) {}
|
||||||
|
|
||||||
|
inline void HttpRequest::SetUrl(String const& url) { url_ = url; }
|
||||||
|
|
||||||
|
inline String const& HttpRequest::GetUrl() const { return url_; }
|
||||||
|
|
||||||
|
inline void HttpRequest::SetType(Type type) { type_ = type; }
|
||||||
|
|
||||||
|
inline HttpRequest::Type HttpRequest::GetType() const { return type_; }
|
||||||
|
|
||||||
|
inline void HttpRequest::SetData(String const& data) { data_ = data; }
|
||||||
|
|
||||||
|
inline String const& HttpRequest::GetData() const { return data_; }
|
||||||
|
|
||||||
|
inline void HttpRequest::SetHeaders(Map<String, String> const& headers) { headers_ = headers; }
|
||||||
|
|
||||||
|
inline void HttpRequest::SetHeader(String const& field, String const& content) { headers_[field] = content; }
|
||||||
|
|
||||||
|
inline Map<String, String>& HttpRequest::GetHeaders() { return headers_; }
|
||||||
|
|
||||||
|
inline String const& HttpRequest::GetHeader(String const& header) const { return headers_.at(header); }
|
||||||
|
|
||||||
|
inline void HttpRequest::SetResponseCallback(ResponseCallback const& callback) { response_cb_ = callback; }
|
||||||
|
|
||||||
|
inline HttpRequest::ResponseCallback const& HttpRequest::GetResponseCallback() const { return response_cb_; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,29 +31,30 @@ namespace kiwano
|
||||||
: public ObjectBase
|
: public ObjectBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline HttpResponse(HttpRequestPtr request) : request_(request), succeed_(false), response_code_(0) {}
|
HttpResponse(HttpRequestPtr request);
|
||||||
|
|
||||||
inline HttpRequestPtr GetRequest() const { return request_; }
|
// 获取请求
|
||||||
|
HttpRequestPtr GetRequest() const;
|
||||||
|
|
||||||
inline void SetSucceed(bool succeed) { succeed_ = succeed; }
|
// 响应状态
|
||||||
|
bool IsSucceed() const;
|
||||||
|
void SetSucceed(bool succeed);
|
||||||
|
|
||||||
inline bool IsSucceed() const { return succeed_; }
|
// 响应状态码
|
||||||
|
long GetResponseCode() const;
|
||||||
|
void SetResponseCode(long response_code);
|
||||||
|
|
||||||
inline void SetResponseCode(long response_code) { response_code_ = response_code; }
|
// 响应头
|
||||||
|
String GetHeader() const;
|
||||||
|
void SetHeader(String const& response_header);
|
||||||
|
|
||||||
inline long GetResponseCode() const { return response_code_; }
|
// 响应数据
|
||||||
|
String const& GetData() const;
|
||||||
|
void SetData(String const& response_data);
|
||||||
|
|
||||||
inline void SetHeader(String const& response_header) { response_header_ = response_header; }
|
// 错误信息
|
||||||
|
String const& GetError() const;
|
||||||
inline String GetHeader() const { return response_header_; }
|
void SetError(String const& error_buffer);
|
||||||
|
|
||||||
inline void SetData(String const& response_data) { response_data_ = response_data; }
|
|
||||||
|
|
||||||
inline String const& GetData() const { return response_data_; }
|
|
||||||
|
|
||||||
inline void SetError(String const& error_buffer) { error_buffer_ = error_buffer; }
|
|
||||||
|
|
||||||
inline String const& GetError() const { return error_buffer_; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool succeed_;
|
bool succeed_;
|
||||||
|
|
@ -64,5 +65,29 @@ namespace kiwano
|
||||||
String response_data_;
|
String response_data_;
|
||||||
String error_buffer_;
|
String error_buffer_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline HttpResponse::HttpResponse(HttpRequestPtr request) : request_(request), succeed_(false), response_code_(0) {}
|
||||||
|
|
||||||
|
inline HttpRequestPtr HttpResponse::GetRequest() const { return request_; }
|
||||||
|
|
||||||
|
inline void HttpResponse::SetSucceed(bool succeed) { succeed_ = succeed; }
|
||||||
|
|
||||||
|
inline bool HttpResponse::IsSucceed() const { return succeed_; }
|
||||||
|
|
||||||
|
inline void HttpResponse::SetResponseCode(long response_code) { response_code_ = response_code; }
|
||||||
|
|
||||||
|
inline long HttpResponse::GetResponseCode() const { return response_code_; }
|
||||||
|
|
||||||
|
inline void HttpResponse::SetHeader(String const& response_header) { response_header_ = response_header; }
|
||||||
|
|
||||||
|
inline String HttpResponse::GetHeader() const { return response_header_; }
|
||||||
|
|
||||||
|
inline void HttpResponse::SetData(String const& response_data) { response_data_ = response_data; }
|
||||||
|
|
||||||
|
inline String const& HttpResponse::GetData() const { return response_data_; }
|
||||||
|
|
||||||
|
inline void HttpResponse::SetError(String const& error_buffer) { error_buffer_ = error_buffer; }
|
||||||
|
|
||||||
|
inline String const& HttpResponse::GetError() const { return error_buffer_; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include <kiwano/2d/Actor.h>
|
#include <kiwano/2d/Actor.h>
|
||||||
#include <kiwano/2d/Stage.h>
|
#include <kiwano/2d/Stage.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
#include <kiwano/renderer/Renderer.h>
|
#include <kiwano/renderer/Renderer.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
#include <kiwano/2d/include-forwards.h>
|
#include <kiwano/2d/include-forwards.h>
|
||||||
#include <kiwano/2d/Transform.h>
|
#include <kiwano/2d/Transform.h>
|
||||||
#include <kiwano/2d/action/ActionManager.h>
|
#include <kiwano/2d/action/ActionManager.h>
|
||||||
#include <kiwano/base/TimerManager.h>
|
#include <kiwano/core/TimerManager.h>
|
||||||
#include <kiwano/base/EventDispatcher.h>
|
#include <kiwano/core/EventDispatcher.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/2d/Canvas.h>
|
#include <kiwano/2d/Canvas.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
#include <kiwano/renderer/Renderer.h>
|
#include <kiwano/renderer/Renderer.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ namespace kiwano
|
||||||
KGE_NOT_USED(dt);
|
KGE_NOT_USED(dt);
|
||||||
|
|
||||||
frame_time_.push_back(Time::Now());
|
frame_time_.push_back(Time::Now());
|
||||||
while (frame_time_.back() - frame_time_.front() >= time::Sec)
|
while (frame_time_.back() - frame_time_.front() >= Duration::Second)
|
||||||
{
|
{
|
||||||
frame_time_.erase(frame_time_.begin());
|
frame_time_.erase(frame_time_.begin());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/base/ObjectBase.h>
|
#include <kiwano/core/ObjectBase.h>
|
||||||
#include <kiwano/renderer/Texture.h>
|
#include <kiwano/renderer/Texture.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include <kiwano/2d/FrameSequence.h>
|
#include <kiwano/2d/FrameSequence.h>
|
||||||
#include <kiwano/2d/Frame.h>
|
#include <kiwano/2d/Frame.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/2d/GifSprite.h>
|
#include <kiwano/2d/GifSprite.h>
|
||||||
#include <kiwano/base/win32/helper.h>
|
#include <kiwano/core/win32/helper.h>
|
||||||
#include <kiwano/renderer/TextureCache.h>
|
#include <kiwano/renderer/TextureCache.h>
|
||||||
#include <kiwano/renderer/Renderer.h>
|
#include <kiwano/renderer/Renderer.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/2d/Actor.h>
|
#include <kiwano/2d/Actor.h>
|
||||||
#include <kiwano/base/Resource.h>
|
#include <kiwano/core/Resource.h>
|
||||||
#include <kiwano/renderer/RenderTarget.h>
|
#include <kiwano/renderer/RenderTarget.h>
|
||||||
#include <kiwano/renderer/GifImage.h>
|
#include <kiwano/renderer/GifImage.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/2d/ShapeActor.h>
|
#include <kiwano/2d/ShapeActor.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
#include <kiwano/renderer/Renderer.h>
|
#include <kiwano/renderer/Renderer.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/2d/Stage.h>
|
#include <kiwano/2d/Stage.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
#include <kiwano/renderer/Renderer.h>
|
#include <kiwano/renderer/Renderer.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/2d/Text.h>
|
#include <kiwano/2d/Text.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
#include <kiwano/renderer/Renderer.h>
|
#include <kiwano/renderer/Renderer.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
#include <kiwano/2d/Transition.h>
|
#include <kiwano/2d/Transition.h>
|
||||||
#include <kiwano/2d/Actor.h>
|
#include <kiwano/2d/Actor.h>
|
||||||
#include <kiwano/2d/Stage.h>
|
#include <kiwano/2d/Stage.h>
|
||||||
#include <kiwano/base/Window.h>
|
#include <kiwano/platform/Window.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
#include <kiwano/renderer/Renderer.h>
|
#include <kiwano/renderer/Renderer.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include <kiwano/2d/action/ActionGroup.h>
|
#include <kiwano/2d/action/ActionGroup.h>
|
||||||
#include <kiwano/2d/Actor.h>
|
#include <kiwano/2d/Actor.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -30,71 +30,71 @@ namespace kiwano
|
||||||
struct ActionHelper
|
struct ActionHelper
|
||||||
{
|
{
|
||||||
// 设置循环次数
|
// 设置循环次数
|
||||||
inline ActionHelper& SetLoops(int loops) { base->SetLoops(loops); return (*this); }
|
inline ActionHelper& SetLoops(int loops) { core->SetLoops(loops); return (*this); }
|
||||||
|
|
||||||
// 设置动作延迟
|
// 设置动作延迟
|
||||||
inline ActionHelper& SetDelay(Duration delay) { base->SetDelay(delay); return (*this); }
|
inline ActionHelper& SetDelay(Duration delay) { core->SetDelay(delay); return (*this); }
|
||||||
|
|
||||||
// 设置动作结束回调函数
|
// 设置动作结束回调函数
|
||||||
inline ActionHelper& SetDoneCallback(ActionCallback const& cb) { base->SetDoneCallback(cb); return (*this); }
|
inline ActionHelper& SetDoneCallback(ActionCallback const& cb) { core->SetDoneCallback(cb); return (*this); }
|
||||||
|
|
||||||
// 设置动作循环结束时的回调函数
|
// 设置动作循环结束时的回调函数
|
||||||
inline ActionHelper& SetLoopDoneCallback(ActionCallback const& cb) { base->SetLoopDoneCallback(cb); return (*this); }
|
inline ActionHelper& SetLoopDoneCallback(ActionCallback const& cb) { core->SetLoopDoneCallback(cb); return (*this); }
|
||||||
|
|
||||||
// 动作结束时移除目标角色
|
// 动作结束时移除目标角色
|
||||||
inline ActionHelper& RemoveTargetWhenDone() { base->RemoveTargetWhenDone(); return (*this); }
|
inline ActionHelper& RemoveTargetWhenDone() { core->RemoveTargetWhenDone(); return (*this); }
|
||||||
|
|
||||||
// 设置名称
|
// 设置名称
|
||||||
inline ActionHelper& SetName(String const& name) { base->SetName(name); return (*this); }
|
inline ActionHelper& SetName(String const& name) { core->SetName(name); return (*this); }
|
||||||
|
|
||||||
// 获取指针
|
// 获取指针
|
||||||
inline ActionPtr Get() const { return base; }
|
inline ActionPtr Get() const { return core; }
|
||||||
|
|
||||||
inline ActionHelper(ActionPtr base) : base(base) {}
|
inline ActionHelper(ActionPtr core) : core(core) {}
|
||||||
|
|
||||||
inline operator ActionPtr() const { return base; }
|
inline operator ActionPtr() const { return core; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ActionPtr base;
|
ActionPtr core;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TweenHelper
|
struct TweenHelper
|
||||||
{
|
{
|
||||||
// 设置动画持续时长
|
// 设置动画持续时长
|
||||||
inline TweenHelper& SetDuration(Duration dur) { base->SetDuration(dur); return (*this); }
|
inline TweenHelper& SetDuration(Duration dur) { core->SetDuration(dur); return (*this); }
|
||||||
|
|
||||||
// 设置循环次数
|
// 设置循环次数
|
||||||
inline TweenHelper& SetLoops(int loops) { base->SetLoops(loops); return (*this); }
|
inline TweenHelper& SetLoops(int loops) { core->SetLoops(loops); return (*this); }
|
||||||
|
|
||||||
// 设置缓动函数
|
// 设置缓动函数
|
||||||
inline TweenHelper& SetEaseFunc(EaseFunc ease) { base->SetEaseFunc(ease); return (*this); }
|
inline TweenHelper& SetEaseFunc(EaseFunc ease) { core->SetEaseFunc(ease); return (*this); }
|
||||||
|
|
||||||
// 设置动作延迟
|
// 设置动作延迟
|
||||||
inline TweenHelper& SetDelay(Duration delay) { base->SetDelay(delay); return (*this); }
|
inline TweenHelper& SetDelay(Duration delay) { core->SetDelay(delay); return (*this); }
|
||||||
|
|
||||||
// 设置动作结束回调函数
|
// 设置动作结束回调函数
|
||||||
inline TweenHelper& SetDoneCallback(ActionCallback const& cb) { base->SetDoneCallback(cb); return (*this); }
|
inline TweenHelper& SetDoneCallback(ActionCallback const& cb) { core->SetDoneCallback(cb); return (*this); }
|
||||||
|
|
||||||
// 设置动作循环结束时的回调函数
|
// 设置动作循环结束时的回调函数
|
||||||
inline TweenHelper& SetLoopDoneCallback(ActionCallback const& cb) { base->SetLoopDoneCallback(cb); return (*this); }
|
inline TweenHelper& SetLoopDoneCallback(ActionCallback const& cb) { core->SetLoopDoneCallback(cb); return (*this); }
|
||||||
|
|
||||||
// 动作结束时移除目标角色
|
// 动作结束时移除目标角色
|
||||||
inline TweenHelper& RemoveTargetWhenDone() { base->RemoveTargetWhenDone(); return (*this); }
|
inline TweenHelper& RemoveTargetWhenDone() { core->RemoveTargetWhenDone(); return (*this); }
|
||||||
|
|
||||||
// 设置名称
|
// 设置名称
|
||||||
inline TweenHelper& SetName(String const& name) { base->SetName(name); return (*this); }
|
inline TweenHelper& SetName(String const& name) { core->SetName(name); return (*this); }
|
||||||
|
|
||||||
// 获取指针
|
// 获取指针
|
||||||
inline ActionTweenPtr Get() const { return base; }
|
inline ActionTweenPtr Get() const { return core; }
|
||||||
|
|
||||||
inline TweenHelper(ActionTweenPtr base) : base(base) {}
|
inline TweenHelper(ActionTweenPtr core) : core(core) {}
|
||||||
|
|
||||||
inline operator ActionPtr() const { return base; }
|
inline operator ActionPtr() const { return core; }
|
||||||
|
|
||||||
inline operator ActionTweenPtr() const { return base; }
|
inline operator ActionTweenPtr() const { return core; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ActionTweenPtr base;
|
ActionTweenPtr core;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Tween actions helper
|
// Tween actions helper
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include <kiwano/2d/action/ActionManager.h>
|
#include <kiwano/2d/action/ActionManager.h>
|
||||||
#include <kiwano/2d/Actor.h>
|
#include <kiwano/2d/Actor.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/2d/action/Action.h>
|
#include <kiwano/2d/action/Action.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,11 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/core/core.h>
|
#include <kiwano/common/common.h>
|
||||||
#include <kiwano/base/time.h>
|
#include <kiwano/core/time.h>
|
||||||
#include <kiwano/base/RefCounter.hpp>
|
#include <kiwano/core/RefCounter.hpp>
|
||||||
#include <kiwano/base/SmartPtr.hpp>
|
#include <kiwano/core/SmartPtr.hpp>
|
||||||
#include <kiwano/base/ObjectBase.h>
|
#include <kiwano/core/ObjectBase.h>
|
||||||
#include <kiwano/math/math.h>
|
#include <kiwano/math/math.h>
|
||||||
#include <kiwano/renderer/Color.h>
|
#include <kiwano/renderer/Color.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,426 +0,0 @@
|
||||||
// Copyright (c) 2016-2018 Kiwano - Nomango
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
|
|
||||||
#include <regex>
|
|
||||||
#include <unordered_map>
|
|
||||||
|
|
||||||
#include <kiwano/base/time.h>
|
|
||||||
#include <kiwano/base/Logger.h>
|
|
||||||
|
|
||||||
namespace kiwano
|
|
||||||
{
|
|
||||||
namespace time
|
|
||||||
{
|
|
||||||
//-------------------------------------------------------
|
|
||||||
// Time
|
|
||||||
//-------------------------------------------------------
|
|
||||||
|
|
||||||
Time::Time()
|
|
||||||
: dur_(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Time::Time(long dur)
|
|
||||||
: dur_(dur)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
const Time Time::operator+(const Duration & dur) const
|
|
||||||
{
|
|
||||||
return Time{ dur_ + dur.Milliseconds() };
|
|
||||||
}
|
|
||||||
|
|
||||||
const Time Time::operator-(const Duration & dur) const
|
|
||||||
{
|
|
||||||
return Time{ dur_ - dur.Milliseconds() };
|
|
||||||
}
|
|
||||||
|
|
||||||
Time & Time::operator+=(const Duration & other)
|
|
||||||
{
|
|
||||||
dur_ += other.Milliseconds();
|
|
||||||
return (*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
Time & Time::operator-=(const Duration &other)
|
|
||||||
{
|
|
||||||
dur_ -= other.Milliseconds();
|
|
||||||
return (*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration Time::operator-(const Time & other) const
|
|
||||||
{
|
|
||||||
return Duration(dur_ - other.dur_);
|
|
||||||
}
|
|
||||||
|
|
||||||
Time Time::Now() noexcept
|
|
||||||
{
|
|
||||||
static LARGE_INTEGER freq = {};
|
|
||||||
if (freq.QuadPart == 0LL)
|
|
||||||
{
|
|
||||||
// the Function will always succceed on systems that run Windows XP or later
|
|
||||||
QueryPerformanceFrequency(&freq);
|
|
||||||
}
|
|
||||||
|
|
||||||
LARGE_INTEGER count;
|
|
||||||
QueryPerformanceCounter(&count);
|
|
||||||
|
|
||||||
const long long whole = (count.QuadPart / freq.QuadPart) * 1000LL;
|
|
||||||
const long long part = (count.QuadPart % freq.QuadPart) * 1000LL / freq.QuadPart;
|
|
||||||
return Time{ static_cast<long>(whole + part) };
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------
|
|
||||||
// Duration
|
|
||||||
//-------------------------------------------------------
|
|
||||||
|
|
||||||
const Duration Ms = 1L;
|
|
||||||
const Duration Sec = 1000 * Ms;
|
|
||||||
const Duration Min = 60 * Sec;
|
|
||||||
const Duration Hour = 60 * Min;
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
const auto duration_regex = std::wregex(LR"(^[-+]?([0-9]*(\.[0-9]*)?(h|m|s|ms)+)+$)");
|
|
||||||
|
|
||||||
typedef std::unordered_map<String, Duration> UnitMap;
|
|
||||||
const auto unit_map = UnitMap
|
|
||||||
{
|
|
||||||
{L"ms", Ms},
|
|
||||||
{L"s", Sec},
|
|
||||||
{L"m", Min},
|
|
||||||
{L"h", Hour}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
Duration::Duration()
|
|
||||||
: milliseconds_(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Duration::Duration(long milliseconds)
|
|
||||||
: milliseconds_(milliseconds)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
float Duration::Seconds() const
|
|
||||||
{
|
|
||||||
long sec = milliseconds_ / Sec.milliseconds_;
|
|
||||||
long ms = milliseconds_ % Sec.milliseconds_;
|
|
||||||
return static_cast<float>(sec) + static_cast<float>(ms) / 1000.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
float Duration::Minutes() const
|
|
||||||
{
|
|
||||||
long min = milliseconds_ / Min.milliseconds_;
|
|
||||||
long ms = milliseconds_ % Min.milliseconds_;
|
|
||||||
return static_cast<float>(min) + static_cast<float>(ms) / (60 * 1000.f);
|
|
||||||
}
|
|
||||||
|
|
||||||
float Duration::Hours() const
|
|
||||||
{
|
|
||||||
long hour = milliseconds_ / Hour.milliseconds_;
|
|
||||||
long ms = milliseconds_ % Hour.milliseconds_;
|
|
||||||
return static_cast<float>(hour) + static_cast<float>(ms) / (60 * 60 * 1000.f);
|
|
||||||
}
|
|
||||||
|
|
||||||
String kiwano::time::Duration::ToString() const
|
|
||||||
{
|
|
||||||
if (IsZero())
|
|
||||||
{
|
|
||||||
return String(L"0s");
|
|
||||||
}
|
|
||||||
|
|
||||||
String result;
|
|
||||||
long total_ms = milliseconds_;
|
|
||||||
if (total_ms < 0)
|
|
||||||
{
|
|
||||||
result.append(L"-");
|
|
||||||
total_ms = -total_ms;
|
|
||||||
}
|
|
||||||
|
|
||||||
long hour = total_ms / Hour.milliseconds_;
|
|
||||||
long min = total_ms / Min.milliseconds_ - hour * 60;
|
|
||||||
long sec = total_ms / Sec.milliseconds_ - (hour * 60 * 60 + min * 60);
|
|
||||||
long ms = total_ms % Sec.milliseconds_;
|
|
||||||
|
|
||||||
if (hour)
|
|
||||||
{
|
|
||||||
result.append(String::parse(hour)).append(L"h");
|
|
||||||
result.append(String::parse(min)).append(L"m");
|
|
||||||
}
|
|
||||||
else if(min)
|
|
||||||
{
|
|
||||||
result.append(String::parse(min)).append(L"m");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ms != 0)
|
|
||||||
{
|
|
||||||
result.append(String::parse(static_cast<float>(sec) + static_cast<float>(ms) / 1000.f))
|
|
||||||
.append(L"s");
|
|
||||||
}
|
|
||||||
else if (sec != 0)
|
|
||||||
{
|
|
||||||
result.append(String::parse(sec)).append(L"s");
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Duration::operator==(const Duration & other) const
|
|
||||||
{
|
|
||||||
return milliseconds_ == other.milliseconds_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Duration::operator!=(const Duration & other) const
|
|
||||||
{
|
|
||||||
return milliseconds_ != other.milliseconds_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Duration::operator>(const Duration & other) const
|
|
||||||
{
|
|
||||||
return milliseconds_ > other.milliseconds_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Duration::operator>=(const Duration & other) const
|
|
||||||
{
|
|
||||||
return milliseconds_ >= other.milliseconds_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Duration::operator<(const Duration & other) const
|
|
||||||
{
|
|
||||||
return milliseconds_ < other.milliseconds_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Duration::operator<=(const Duration & other) const
|
|
||||||
{
|
|
||||||
return milliseconds_ <= other.milliseconds_;
|
|
||||||
}
|
|
||||||
|
|
||||||
float kiwano::time::Duration::operator/(const Duration & other) const
|
|
||||||
{
|
|
||||||
return static_cast<float>(milliseconds_) / other.milliseconds_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration Duration::operator+(const Duration & other) const
|
|
||||||
{
|
|
||||||
return Duration(milliseconds_ + other.milliseconds_);
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration Duration::operator-(const Duration & other) const
|
|
||||||
{
|
|
||||||
return Duration(milliseconds_ - other.milliseconds_);
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration Duration::operator-() const
|
|
||||||
{
|
|
||||||
return Duration(-milliseconds_);
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration Duration::operator*(int val) const
|
|
||||||
{
|
|
||||||
return Duration(milliseconds_ * val);
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration kiwano::time::Duration::operator*(unsigned long long val) const
|
|
||||||
{
|
|
||||||
return Duration(static_cast<long>(milliseconds_ * val));
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration Duration::operator*(float val) const
|
|
||||||
{
|
|
||||||
return Duration(static_cast<long>(milliseconds_ * val));
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration Duration::operator*(double val) const
|
|
||||||
{
|
|
||||||
return Duration(static_cast<long>(milliseconds_ * val));
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration Duration::operator*(long double val) const
|
|
||||||
{
|
|
||||||
return Duration(static_cast<long>(milliseconds_ * val));
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration Duration::operator/(int val) const
|
|
||||||
{
|
|
||||||
return Duration(milliseconds_ / val);
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration Duration::operator/(float val) const
|
|
||||||
{
|
|
||||||
return Duration(static_cast<long>(milliseconds_ / val));
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration Duration::operator/(double val) const
|
|
||||||
{
|
|
||||||
return Duration(static_cast<long>(milliseconds_ / val));
|
|
||||||
}
|
|
||||||
|
|
||||||
Duration & Duration::operator+=(const Duration &other)
|
|
||||||
{
|
|
||||||
milliseconds_ += other.milliseconds_;
|
|
||||||
return (*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
Duration & Duration::operator-=(const Duration &other)
|
|
||||||
{
|
|
||||||
milliseconds_ -= other.milliseconds_;
|
|
||||||
return (*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
Duration & Duration::operator*=(int val)
|
|
||||||
{
|
|
||||||
milliseconds_ *= val;
|
|
||||||
return (*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
Duration & Duration::operator/=(int val)
|
|
||||||
{
|
|
||||||
milliseconds_ = static_cast<long>(milliseconds_ / val);
|
|
||||||
return (*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
Duration & Duration::operator*=(float val)
|
|
||||||
{
|
|
||||||
milliseconds_ = static_cast<long>(milliseconds_ * val);
|
|
||||||
return (*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
Duration & Duration::operator/=(float val)
|
|
||||||
{
|
|
||||||
milliseconds_ = static_cast<long>(milliseconds_ / val);
|
|
||||||
return (*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
Duration & Duration::operator*=(double val)
|
|
||||||
{
|
|
||||||
milliseconds_ = static_cast<long>(milliseconds_ * val);
|
|
||||||
return (*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
Duration & Duration::operator/=(double val)
|
|
||||||
{
|
|
||||||
milliseconds_ = static_cast<long>(milliseconds_ / val);
|
|
||||||
return (*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration kiwano::time::operator*(int val, const Duration & dur)
|
|
||||||
{
|
|
||||||
return dur * val;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration kiwano::time::operator/(int val, const Duration & dur)
|
|
||||||
{
|
|
||||||
return dur / val;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration kiwano::time::operator*(float val, const Duration & dur)
|
|
||||||
{
|
|
||||||
return dur * val;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration kiwano::time::operator/(float val, const Duration & dur)
|
|
||||||
{
|
|
||||||
return dur / val;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration kiwano::time::operator*(double val, const Duration & dur)
|
|
||||||
{
|
|
||||||
return dur * val;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration kiwano::time::operator/(double val, const Duration & dur)
|
|
||||||
{
|
|
||||||
return dur / val;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Duration kiwano::time::operator*(long double val, const Duration & dur)
|
|
||||||
{
|
|
||||||
return dur * val;
|
|
||||||
}
|
|
||||||
|
|
||||||
Duration Duration::Parse(const String& str)
|
|
||||||
{
|
|
||||||
bool negative = false;
|
|
||||||
size_t len = str.length();
|
|
||||||
size_t pos = 0;
|
|
||||||
Duration ret;
|
|
||||||
|
|
||||||
if (!std::regex_match(str.c_str(), duration_regex))
|
|
||||||
{
|
|
||||||
KGE_ERROR_LOG(L"Duration::Parse failed, invalid duration");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str.empty() || str == L"0") { return ret; }
|
|
||||||
|
|
||||||
// ·ûºÅλ
|
|
||||||
if (str[0] == L'-' || str[0] == L'+')
|
|
||||||
{
|
|
||||||
negative = (str[0] == L'-');
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (pos < len)
|
|
||||||
{
|
|
||||||
// ÊýÖµ
|
|
||||||
size_t i = pos;
|
|
||||||
for (; i < len; ++i)
|
|
||||||
{
|
|
||||||
wchar_t ch = str[i];
|
|
||||||
if (!(ch == L'.' || L'0' <= ch && ch <= L'9'))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String num_str = str.substr(pos, i - pos);
|
|
||||||
pos = i;
|
|
||||||
|
|
||||||
KGE_ASSERT(!(num_str.empty() || num_str == L".") && "Duration::Parse failed, invalid duration");
|
|
||||||
|
|
||||||
// µ¥Î»
|
|
||||||
for (; i < len; ++i)
|
|
||||||
{
|
|
||||||
wchar_t ch = str[i];
|
|
||||||
if (ch == L'.' || L'0' <= ch && ch <= L'9')
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String unit_str = str.substr(pos, i - pos);
|
|
||||||
pos = i;
|
|
||||||
|
|
||||||
KGE_ASSERT(unit_map.find(unit_str) != unit_map.end() && "Duration::Parse failed, invalid duration");
|
|
||||||
|
|
||||||
double num = std::wcstod(num_str.c_str(), nullptr);
|
|
||||||
Duration unit = unit_map.at(unit_str);
|
|
||||||
ret += unit * num;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (negative)
|
|
||||||
{
|
|
||||||
ret = -ret;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,247 +0,0 @@
|
||||||
// Copyright (c) 2016-2018 Kiwano - Nomango
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include <ostream>
|
|
||||||
#include <istream>
|
|
||||||
|
|
||||||
#include <kiwano/macros.h>
|
|
||||||
#include <kiwano/core/core.h>
|
|
||||||
|
|
||||||
namespace kiwano
|
|
||||||
{
|
|
||||||
namespace time
|
|
||||||
{
|
|
||||||
// 时间段
|
|
||||||
//
|
|
||||||
// 时间段表示法:
|
|
||||||
// 5 秒: time::Sec * 5
|
|
||||||
// 1.5 小时: time::Hour * 1.5
|
|
||||||
// 3 小时 45 分 15 秒: time::Hour * 3 + time::Min * 45 + time::Sec * 15
|
|
||||||
// 在 VS2015 及更高版本可以使用 time literals:
|
|
||||||
// 5 秒: 5_s
|
|
||||||
// 1.5 小时: 1.5_h
|
|
||||||
// 3 小时 45 分 15 秒: 3_h + 45_m + 15_s
|
|
||||||
//
|
|
||||||
struct KGE_API Duration
|
|
||||||
{
|
|
||||||
Duration();
|
|
||||||
|
|
||||||
Duration(
|
|
||||||
long milliseconds
|
|
||||||
);
|
|
||||||
|
|
||||||
// 转化为毫秒
|
|
||||||
inline long Milliseconds() const { return milliseconds_; }
|
|
||||||
|
|
||||||
// 转化为秒
|
|
||||||
float Seconds() const;
|
|
||||||
|
|
||||||
// 转化为分钟
|
|
||||||
float Minutes() const;
|
|
||||||
|
|
||||||
// 转化为小时
|
|
||||||
float Hours() const;
|
|
||||||
|
|
||||||
// 时长是否是零
|
|
||||||
inline bool IsZero() const { return milliseconds_ == 0LL; }
|
|
||||||
|
|
||||||
inline void SetMilliseconds(long ms) { milliseconds_ = ms; }
|
|
||||||
|
|
||||||
inline void SetSeconds(float seconds) { milliseconds_ = static_cast<long>(seconds * 1000.f); }
|
|
||||||
|
|
||||||
inline void SetMinutes(float minutes) { milliseconds_ = static_cast<long>(minutes * 60 * 1000.f); }
|
|
||||||
|
|
||||||
inline void SetHours(float hours) { milliseconds_ = static_cast<long>(hours * 60 * 60 * 1000.f); }
|
|
||||||
|
|
||||||
// 转为字符串
|
|
||||||
String ToString() const;
|
|
||||||
|
|
||||||
inline operator bool() const { return !IsZero(); }
|
|
||||||
|
|
||||||
bool operator== (const Duration &) const;
|
|
||||||
bool operator!= (const Duration &) const;
|
|
||||||
bool operator> (const Duration &) const;
|
|
||||||
bool operator>= (const Duration &) const;
|
|
||||||
bool operator< (const Duration &) const;
|
|
||||||
bool operator<= (const Duration &) const;
|
|
||||||
|
|
||||||
float operator / (const Duration &) const;
|
|
||||||
|
|
||||||
const Duration operator + (const Duration &) const;
|
|
||||||
const Duration operator - (const Duration &) const;
|
|
||||||
const Duration operator - () const;
|
|
||||||
const Duration operator * (int) const;
|
|
||||||
const Duration operator * (unsigned long long) const;
|
|
||||||
const Duration operator * (float) const;
|
|
||||||
const Duration operator * (double) const;
|
|
||||||
const Duration operator * (long double) const;
|
|
||||||
const Duration operator / (int) const;
|
|
||||||
const Duration operator / (float) const;
|
|
||||||
const Duration operator / (double) const;
|
|
||||||
|
|
||||||
Duration& operator += (const Duration &);
|
|
||||||
Duration& operator -= (const Duration &);
|
|
||||||
Duration& operator *= (int);
|
|
||||||
Duration& operator *= (float);
|
|
||||||
Duration& operator *= (double);
|
|
||||||
Duration& operator /= (int);
|
|
||||||
Duration& operator /= (float);
|
|
||||||
Duration& operator /= (double);
|
|
||||||
|
|
||||||
friend const Duration operator* (int, const Duration &);
|
|
||||||
friend const Duration operator* (float, const Duration &);
|
|
||||||
friend const Duration operator* (double, const Duration &);
|
|
||||||
friend const Duration operator* (long double, const Duration &);
|
|
||||||
friend const Duration operator/ (int, const Duration &);
|
|
||||||
friend const Duration operator/ (float, const Duration &);
|
|
||||||
friend const Duration operator/ (double, const Duration &);
|
|
||||||
|
|
||||||
public:
|
|
||||||
// 时间段格式化
|
|
||||||
//
|
|
||||||
// 时间段字符串允许是有符号的浮点数, 并且带有时间单位后缀
|
|
||||||
// 例如: "300ms", "-1.5h", "2h45m"
|
|
||||||
// 允许的时间单位有 "ms", "s", "m", "h"
|
|
||||||
static Duration Parse(const String& parse_str);
|
|
||||||
|
|
||||||
template <typename _Char>
|
|
||||||
friend inline std::basic_ostream<_Char>& operator<<(std::basic_ostream<_Char>& out, const Duration& dur)
|
|
||||||
{
|
|
||||||
return out << dur.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename _Char>
|
|
||||||
friend inline std::basic_istream<_Char>& operator>>(std::basic_istream<_Char>& in, Duration& dur)
|
|
||||||
{
|
|
||||||
String str;
|
|
||||||
if (in >> str)
|
|
||||||
{
|
|
||||||
dur = Duration::Parse(str);
|
|
||||||
}
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
long milliseconds_;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 预定义的时间段 */
|
|
||||||
KGE_API extern const Duration Ms; // 毫秒
|
|
||||||
KGE_API extern const Duration Sec; // 秒
|
|
||||||
KGE_API extern const Duration Min; // 分钟
|
|
||||||
KGE_API extern const Duration Hour; // 小时
|
|
||||||
|
|
||||||
|
|
||||||
// 时间
|
|
||||||
//
|
|
||||||
// 获取当前时间: Time now = Time::Now();
|
|
||||||
// 两时间相减, 得到一个 Duration 对象, 例如:
|
|
||||||
// Time t1, t2;
|
|
||||||
// int ms = (t2 - t1).Milliseconds(); // 获取两时间相差的毫秒数
|
|
||||||
//
|
|
||||||
struct KGE_API Time
|
|
||||||
{
|
|
||||||
Time();
|
|
||||||
|
|
||||||
Time(long);
|
|
||||||
|
|
||||||
// 是否是零时
|
|
||||||
inline bool IsZero() const { return dur_ == 0; }
|
|
||||||
|
|
||||||
const Time operator + (const Duration &) const;
|
|
||||||
const Time operator - (const Duration &) const;
|
|
||||||
|
|
||||||
Time& operator += (const Duration &);
|
|
||||||
Time& operator -= (const Duration &);
|
|
||||||
|
|
||||||
const Duration operator - (const Time &) const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
// 获取当前时间
|
|
||||||
// 由于该时间点基于系统启动时间开始计算, 所以无法格式化该时间,
|
|
||||||
// 也无法获得该时间的 Unix 时间戳
|
|
||||||
static Time Now() noexcept;
|
|
||||||
|
|
||||||
private:
|
|
||||||
long dur_;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace kiwano
|
|
||||||
{
|
|
||||||
using namespace time;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if KGE_VS_VER > KGE_VS_2013
|
|
||||||
|
|
||||||
namespace kiwano
|
|
||||||
{
|
|
||||||
inline namespace literals
|
|
||||||
{
|
|
||||||
inline const kiwano::time::Duration operator "" _ms(long double val)
|
|
||||||
{
|
|
||||||
return kiwano::time::Ms * val;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const kiwano::time::Duration operator "" _s(long double val)
|
|
||||||
{
|
|
||||||
return kiwano::time::Sec * val;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const kiwano::time::Duration operator "" _m(long double val)
|
|
||||||
{
|
|
||||||
return kiwano::time::Min * val;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const kiwano::time::Duration operator "" _h(long double val)
|
|
||||||
{
|
|
||||||
return kiwano::time::Hour * val;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const kiwano::time::Duration operator "" _ms(unsigned long long val)
|
|
||||||
{
|
|
||||||
return kiwano::time::Ms * val;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const kiwano::time::Duration operator "" _s(unsigned long long val)
|
|
||||||
{
|
|
||||||
return kiwano::time::Sec * val;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const kiwano::time::Duration operator "" _m(unsigned long long val)
|
|
||||||
{
|
|
||||||
return kiwano::time::Min * val;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const kiwano::time::Duration operator "" _h(unsigned long long val)
|
|
||||||
{
|
|
||||||
return kiwano::time::Hour * val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace time
|
|
||||||
{
|
|
||||||
using namespace kiwano::literals;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace core
|
namespace common
|
||||||
{
|
{
|
||||||
|
|
||||||
class bad_any_cast : public std::exception
|
class bad_any_cast : public std::exception
|
||||||
|
|
@ -519,13 +519,13 @@ _Ty any_cast(any&& a)
|
||||||
return static_cast<_Ty>(std::move(*ptr));
|
return static_cast<_Ty>(std::move(*ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace core
|
} // namespace common
|
||||||
|
|
||||||
} // namespace kiwano
|
} // namespace kiwano
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
inline void swap(kiwano::core::any& lhs, kiwano::core::any& rhs) noexcept
|
inline void swap(kiwano::common::any& lhs, kiwano::common::any& rhs) noexcept
|
||||||
{
|
{
|
||||||
lhs.swap(rhs);
|
lhs.swap(rhs);
|
||||||
}
|
}
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace core
|
namespace common
|
||||||
{
|
{
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -1602,14 +1602,14 @@ namespace __json_detail
|
||||||
|
|
||||||
if ((std::isdigit(current) && current != '0') || (current == '-') || (current == '+'))
|
if ((std::isdigit(current) && current != '0') || (current == '-') || (current == '+'))
|
||||||
{
|
{
|
||||||
float_type base = 10;
|
float_type core = 10;
|
||||||
if (current == '+')
|
if (current == '+')
|
||||||
{
|
{
|
||||||
read_next();
|
read_next();
|
||||||
}
|
}
|
||||||
else if (current == '-')
|
else if (current == '-')
|
||||||
{
|
{
|
||||||
base = static_cast<float_type>(0.1);
|
core = static_cast<float_type>(0.1);
|
||||||
read_next();
|
read_next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1620,9 +1620,9 @@ namespace __json_detail
|
||||||
}
|
}
|
||||||
|
|
||||||
float_type power = 1;
|
float_type power = 1;
|
||||||
for (; exponent; exponent >>= 1, base *= base)
|
for (; exponent; exponent >>= 1, core *= core)
|
||||||
if (exponent & 1)
|
if (exponent & 1)
|
||||||
power *= base;
|
power *= core;
|
||||||
|
|
||||||
number_value *= power;
|
number_value *= power;
|
||||||
return token_type::value_float;
|
return token_type::value_float;
|
||||||
|
|
@ -2728,7 +2728,7 @@ private:
|
||||||
__json_detail::json_value<basic_json> value_;
|
__json_detail::json_value<basic_json> value_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace core
|
} // namespace common
|
||||||
|
|
||||||
} // namespace kiwano
|
} // namespace kiwano
|
||||||
|
|
||||||
|
|
@ -28,24 +28,24 @@
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <kiwano/core/vector.hpp>
|
#include <kiwano/common/vector.hpp>
|
||||||
#include <kiwano/core/string.hpp>
|
#include <kiwano/common/string.hpp>
|
||||||
#include <kiwano/core/any.hpp>
|
#include <kiwano/common/any.hpp>
|
||||||
#include <kiwano/core/intrusive_list.hpp>
|
#include <kiwano/common/intrusive_list.hpp>
|
||||||
#include <kiwano/core/intrusive_ptr.hpp>
|
#include <kiwano/common/intrusive_ptr.hpp>
|
||||||
#include <kiwano/core/noncopyable.hpp>
|
#include <kiwano/common/noncopyable.hpp>
|
||||||
#include <kiwano/core/singleton.hpp>
|
#include <kiwano/common/singleton.hpp>
|
||||||
#include <kiwano/core/function.hpp>
|
#include <kiwano/common/function.hpp>
|
||||||
#include <kiwano/core/basic_json.hpp>
|
#include <kiwano/common/basic_json.hpp>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
using String = kiwano::core::wstring;
|
using String = kiwano::common::wstring;
|
||||||
|
|
||||||
using StringStream = std::wstringstream;
|
using StringStream = std::wstringstream;
|
||||||
|
|
||||||
template <typename _Ty, typename... _Args>
|
template <typename _Ty, typename... _Args>
|
||||||
using Vector = kiwano::core::vector<_Ty, _Args...>;
|
using Vector = kiwano::common::vector<_Ty, _Args...>;
|
||||||
|
|
||||||
template <typename _Ty, typename... _Args>
|
template <typename _Ty, typename... _Args>
|
||||||
using List = std::list<_Ty, _Args...>;
|
using List = std::list<_Ty, _Args...>;
|
||||||
|
|
@ -72,21 +72,21 @@ namespace kiwano
|
||||||
using UnorderedMap = std::unordered_map<_Kty, _Ty, _Args...>;
|
using UnorderedMap = std::unordered_map<_Kty, _Ty, _Args...>;
|
||||||
|
|
||||||
template <typename _FuncTy>
|
template <typename _FuncTy>
|
||||||
using Function = kiwano::core::function<_FuncTy>;
|
using Function = kiwano::common::function<_FuncTy>;
|
||||||
|
|
||||||
using Any = kiwano::core::any;
|
using Any = kiwano::common::any;
|
||||||
|
|
||||||
using Json = kiwano::core::basic_json<kiwano::Map, kiwano::Vector, kiwano::String,
|
using Json = kiwano::common::basic_json<kiwano::Map, kiwano::Vector, kiwano::String,
|
||||||
int, double, bool, std::allocator>;
|
int, double, bool, std::allocator>;
|
||||||
|
|
||||||
template <typename _Ty>
|
template <typename _Ty>
|
||||||
using Singleton = core::singleton<_Ty>;
|
using Singleton = common::singleton<_Ty>;
|
||||||
|
|
||||||
template <typename _Ty>
|
template <typename _Ty>
|
||||||
using IntrusiveList = core::intrusive_list<_Ty>;
|
using IntrusiveList = common::intrusive_list<_Ty>;
|
||||||
|
|
||||||
template <typename _Ty>
|
template <typename _Ty>
|
||||||
using IntrusiveListItem = core::intrusive_list_item<_Ty>;
|
using IntrusiveListItem = common::intrusive_list_item<_Ty>;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace core
|
namespace common
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// function is a light weight ::std::function<>-like class
|
// function is a light weight ::std::function<>-like class
|
||||||
|
|
@ -321,7 +321,7 @@ private:
|
||||||
__function_detail::callable<_Ret, _Args...>* callable_;
|
__function_detail::callable<_Ret, _Args...>* callable_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace core
|
} // namespace common
|
||||||
|
|
||||||
} // namespace kiwano
|
} // namespace kiwano
|
||||||
|
|
||||||
|
|
@ -335,9 +335,9 @@ namespace kiwano
|
||||||
typename _Ret,
|
typename _Ret,
|
||||||
typename... _Args
|
typename... _Args
|
||||||
>
|
>
|
||||||
inline core::function<_Ret(_Args...)> Closure(_Uty* ptr, _Ret(_Ty::* func)(_Args...))
|
inline common::function<_Ret(_Args...)> Closure(_Uty* ptr, _Ret(_Ty::* func)(_Args...))
|
||||||
{
|
{
|
||||||
return core::function<_Ret(_Args...)>(ptr, func);
|
return common::function<_Ret(_Args...)>(ptr, func);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Ty,
|
template<typename _Ty,
|
||||||
|
|
@ -348,8 +348,8 @@ namespace kiwano
|
||||||
typename _Ret,
|
typename _Ret,
|
||||||
typename... _Args
|
typename... _Args
|
||||||
>
|
>
|
||||||
inline core::function<_Ret(_Args...)> Closure(_Uty* ptr, _Ret(_Ty::* func)(_Args...) const)
|
inline common::function<_Ret(_Args...)> Closure(_Uty* ptr, _Ret(_Ty::* func)(_Args...) const)
|
||||||
{
|
{
|
||||||
return core::function<_Ret(_Args...)>(ptr, func);
|
return common::function<_Ret(_Args...)>(ptr, func);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace core
|
namespace common
|
||||||
{
|
{
|
||||||
|
|
||||||
template <typename _Ty>
|
template <typename _Ty>
|
||||||
|
|
@ -261,7 +261,7 @@ private:
|
||||||
// disable warning 4996
|
// disable warning 4996
|
||||||
using _Unchecked_type = _Ty;
|
using _Unchecked_type = _Ty;
|
||||||
|
|
||||||
inline iterator_impl(value_type base = nullptr, bool is_end = false) : base_(base), is_end_(is_end) {}
|
inline iterator_impl(value_type core = nullptr, bool is_end = false) : base_(core), is_end_(is_end) {}
|
||||||
|
|
||||||
inline _Ty operator*() const { KGE_ASSERT(base_); return static_cast<_Ty>(const_cast<reference>(base_)); }
|
inline _Ty operator*() const { KGE_ASSERT(base_); return static_cast<_Ty>(const_cast<reference>(base_)); }
|
||||||
inline iterator_impl& operator++() { KGE_ASSERT(base_ && !is_end_); value_type next = base_->next_item(); if (next) base_ = next; else is_end_ = true; return (*this);}
|
inline iterator_impl& operator++() { KGE_ASSERT(base_ && !is_end_); value_type next = base_->next_item(); if (next) base_ = next; else is_end_ = true; return (*this);}
|
||||||
|
|
@ -307,7 +307,7 @@ private:
|
||||||
value_type last_;
|
value_type last_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace core
|
} // namespace common
|
||||||
|
|
||||||
} // namespace kiwano
|
} // namespace kiwano
|
||||||
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace core
|
namespace common
|
||||||
{
|
{
|
||||||
|
|
||||||
template <typename _Ty, typename _ManagerTy>
|
template <typename _Ty, typename _ManagerTy>
|
||||||
|
|
@ -141,6 +141,6 @@ inline void swap(intrusive_ptr<_Ty, manager_type>& lhs, intrusive_ptr<_Ty, manag
|
||||||
lhs.swap(rhs);
|
lhs.swap(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace core
|
} // namespace common
|
||||||
|
|
||||||
} // namespace kiwano
|
} // namespace kiwano
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
namespace core
|
namespace common
|
||||||
{
|
{
|
||||||
|
|
||||||
class noncopyable
|
class noncopyable
|
||||||
|
|
@ -36,5 +36,5 @@ private:
|
||||||
noncopyable& operator=(const noncopyable&) = delete;
|
noncopyable& operator=(const noncopyable&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace core
|
} // namespace common
|
||||||
} // namespace kiwano
|
} // namespace kiwano
|
||||||
|
|
@ -27,13 +27,13 @@
|
||||||
|
|
||||||
#ifndef KGE_DECLARE_SINGLETON
|
#ifndef KGE_DECLARE_SINGLETON
|
||||||
#define KGE_DECLARE_SINGLETON( CLASS ) \
|
#define KGE_DECLARE_SINGLETON( CLASS ) \
|
||||||
friend ::kiwano::core::singleton< CLASS >; \
|
friend ::kiwano::common::singleton< CLASS >; \
|
||||||
friend typename std::unique_ptr< CLASS >::deleter_type
|
friend typename std::unique_ptr< CLASS >::deleter_type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
namespace core
|
namespace common
|
||||||
{
|
{
|
||||||
|
|
||||||
template <typename _Ty>
|
template <typename _Ty>
|
||||||
|
|
@ -81,5 +81,5 @@ std::once_flag singleton<_Ty>::once_;
|
||||||
template <typename _Ty>
|
template <typename _Ty>
|
||||||
std::unique_ptr<_Ty> singleton<_Ty>::instance_;
|
std::unique_ptr<_Ty> singleton<_Ty>::instance_;
|
||||||
|
|
||||||
} // namespace core
|
} // namespace common
|
||||||
} // namespace kiwano
|
} // namespace kiwano
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
namespace core
|
namespace common
|
||||||
{
|
{
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -56,10 +56,10 @@ private:
|
||||||
// disable warning 4996
|
// disable warning 4996
|
||||||
using _Unchecked_type = _Ty;
|
using _Unchecked_type = _Ty;
|
||||||
|
|
||||||
inline iterator_impl(pointer base = nullptr) : base_(base) {}
|
inline iterator_impl(pointer core = nullptr) : base_(core) {}
|
||||||
|
|
||||||
inline reference operator*() const { return *base_; }
|
inline reference operator*() const { return *base_; }
|
||||||
inline pointer base() const { return base_; }
|
inline pointer core() const { return base_; }
|
||||||
|
|
||||||
inline iterator_impl& operator++() { ++base_; return (*this); }
|
inline iterator_impl& operator++() { ++base_; return (*this); }
|
||||||
inline iterator_impl operator++(int) { iterator_impl old = (*this); ++(*this); return old; }
|
inline iterator_impl operator++(int) { iterator_impl old = (*this); ++(*this); return old; }
|
||||||
|
|
@ -176,8 +176,8 @@ public:
|
||||||
inline basic_string& assign(_Iter first, _Iter last) { assign_iter(first, last); return(*this); }
|
inline basic_string& assign(_Iter first, _Iter last) { assign_iter(first, last); return(*this); }
|
||||||
|
|
||||||
basic_string& erase(size_type offset = 0, size_type count = npos);
|
basic_string& erase(size_type offset = 0, size_type count = npos);
|
||||||
iterator erase(const const_iterator where) { size_type off = where - cbegin(); erase(off, 1); return begin().base() + off; }
|
iterator erase(const const_iterator where) { size_type off = where - cbegin(); erase(off, 1); return begin().core() + off; }
|
||||||
iterator erase(const const_iterator first, const const_iterator last) { size_type off = first - cbegin(); erase(first - cbegin(), last - first); return begin().base() + off; }
|
iterator erase(const const_iterator first, const const_iterator last) { size_type off = first - cbegin(); erase(first - cbegin(), last - first); return begin().core() + off; }
|
||||||
|
|
||||||
basic_string substr(size_type pos = 0, size_type count = npos) const { return basic_string(*this, pos, count); }
|
basic_string substr(size_type pos = 0, size_type count = npos) const { return basic_string(*this, pos, count); }
|
||||||
|
|
||||||
|
|
@ -186,7 +186,7 @@ public:
|
||||||
basic_string& insert(size_type index, const basic_string& str, size_type off, size_type count = npos);
|
basic_string& insert(size_type index, const basic_string& str, size_type off, size_type count = npos);
|
||||||
inline basic_string& insert(size_type index, const char_type* s) { return insert(index, s, traits_type::length(s)); }
|
inline basic_string& insert(size_type index, const char_type* s) { return insert(index, s, traits_type::length(s)); }
|
||||||
inline basic_string& insert(size_type index, const basic_string& str) { return insert(index, str, 0, str.size()); }
|
inline basic_string& insert(size_type index, const basic_string& str) { return insert(index, str, 0, str.size()); }
|
||||||
inline iterator insert(const_iterator pos, size_type count, char_type ch) { size_type off = pos - cbegin(); insert(off, count, ch); return begin().base() + off; }
|
inline iterator insert(const_iterator pos, size_type count, char_type ch) { size_type off = pos - cbegin(); insert(off, count, ch); return begin().core() + off; }
|
||||||
inline iterator insert(const_iterator pos, char_type ch) { return insert(pos, 1, ch); }
|
inline iterator insert(const_iterator pos, char_type ch) { return insert(pos, 1, ch); }
|
||||||
|
|
||||||
inline void push_back(const char_type ch) { append(1, ch); }
|
inline void push_back(const char_type ch) { append(1, ch); }
|
||||||
|
|
@ -425,8 +425,8 @@ basic_string<wchar_t> format_string(const wchar_t* const fmt, _Args&& ... args);
|
||||||
//
|
//
|
||||||
// string && wstring
|
// string && wstring
|
||||||
//
|
//
|
||||||
using string = ::kiwano::core::basic_string<char>;
|
using string = ::kiwano::common::basic_string<char>;
|
||||||
using wstring = ::kiwano::core::basic_string<wchar_t>;
|
using wstring = ::kiwano::common::basic_string<wchar_t>;
|
||||||
|
|
||||||
|
|
||||||
inline string to_string(int val) { return to_basic_string<char>(val); }
|
inline string to_string(int val) { return to_basic_string<char>(val); }
|
||||||
|
|
@ -450,7 +450,7 @@ inline wstring to_wstring(double val) { return to_basic_string<wchar_t>(val);
|
||||||
inline wstring to_wstring(long double val) { return to_basic_string<wchar_t>(val); }
|
inline wstring to_wstring(long double val) { return to_basic_string<wchar_t>(val); }
|
||||||
|
|
||||||
|
|
||||||
} // namespace core
|
} // namespace common
|
||||||
} // namespace kiwano
|
} // namespace kiwano
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
@ -515,7 +515,7 @@ namespace __string_details
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace core
|
namespace common
|
||||||
{
|
{
|
||||||
|
|
||||||
template <typename _CharTy>
|
template <typename _CharTy>
|
||||||
|
|
@ -670,7 +670,7 @@ namespace core
|
||||||
}
|
}
|
||||||
size_ = count;
|
size_ = count;
|
||||||
|
|
||||||
traits_type::move(str_, rhs.begin().base() + pos, size_);
|
traits_type::move(str_, rhs.begin().core() + pos, size_);
|
||||||
traits_type::assign(str_[size_], value_type());
|
traits_type::assign(str_[size_], value_type());
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
@ -693,8 +693,8 @@ namespace core
|
||||||
}
|
}
|
||||||
|
|
||||||
size_type new_size = size_ - count;
|
size_type new_size = size_ - count;
|
||||||
iterator erase_at = begin().base() + offset;
|
iterator erase_at = begin().core() + offset;
|
||||||
traits_type::move(erase_at.base(), erase_at.base() + count, new_size - offset + 1);
|
traits_type::move(erase_at.core(), erase_at.core() + count, new_size - offset + 1);
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -807,7 +807,7 @@ namespace core
|
||||||
|
|
||||||
char_type* const insert_at = new_ptr + index;
|
char_type* const insert_at = new_ptr + index;
|
||||||
traits_type::move(new_ptr, old_ptr, index); // (0) - (index)
|
traits_type::move(new_ptr, old_ptr, index); // (0) - (index)
|
||||||
traits_type::move(insert_at, str.begin().base() + off, count); // (index) - (index + count)
|
traits_type::move(insert_at, str.begin().core() + off, count); // (index) - (index + count)
|
||||||
traits_type::move(insert_at + count, old_ptr + index, suffix_size); // (index + count) - (old_size - index)
|
traits_type::move(insert_at + count, old_ptr + index, suffix_size); // (index + count) - (old_size - index)
|
||||||
|
|
||||||
deallocate(str_, old_capacity + 1);
|
deallocate(str_, old_capacity + 1);
|
||||||
|
|
@ -817,7 +817,7 @@ namespace core
|
||||||
{
|
{
|
||||||
char_type* const insert_at = old_ptr + index;
|
char_type* const insert_at = old_ptr + index;
|
||||||
traits_type::move(insert_at + count, old_ptr + index, suffix_size);
|
traits_type::move(insert_at + count, old_ptr + index, suffix_size);
|
||||||
traits_type::move(insert_at, str.begin().base() + off, count);
|
traits_type::move(insert_at, str.begin().core() + off, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (*this);
|
return (*this);
|
||||||
|
|
@ -880,7 +880,7 @@ namespace core
|
||||||
char_type* new_str = allocate(new_cap);
|
char_type* new_str = allocate(new_cap);
|
||||||
|
|
||||||
traits_type::move(new_str, str_, size_);
|
traits_type::move(new_str, str_, size_);
|
||||||
traits_type::move(new_str + size_, other.begin().base() + pos, count);
|
traits_type::move(new_str + size_, other.begin().core() + pos, count);
|
||||||
traits_type::assign(new_str[new_size], value_type());
|
traits_type::assign(new_str[new_size], value_type());
|
||||||
|
|
||||||
destroy();
|
destroy();
|
||||||
|
|
@ -948,7 +948,7 @@ namespace core
|
||||||
if (offset >= size_)
|
if (offset >= size_)
|
||||||
return basic_string<_CharTy>::npos;
|
return basic_string<_CharTy>::npos;
|
||||||
|
|
||||||
const_iterator citer = traits_type::find(cbegin().base() + offset, size_, ch);
|
const_iterator citer = traits_type::find(cbegin().core() + offset, size_, ch);
|
||||||
return citer ? (citer - cbegin()) : basic_string<_CharTy>::npos;
|
return citer ? (citer - cbegin()) : basic_string<_CharTy>::npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -966,7 +966,7 @@ namespace core
|
||||||
if (offset >= size_)
|
if (offset >= size_)
|
||||||
return basic_string<_CharTy>::npos;
|
return basic_string<_CharTy>::npos;
|
||||||
|
|
||||||
const_iterator citer = std::find_first_of(cbegin().base() + offset, cend().base(), str, str + count);
|
const_iterator citer = std::find_first_of(cbegin().core() + offset, cend().core(), str, str + count);
|
||||||
return (citer != cend()) ? (citer - cbegin()) : basic_string<_CharTy>::npos;
|
return (citer != cend()) ? (citer - cbegin()) : basic_string<_CharTy>::npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -977,7 +977,7 @@ namespace core
|
||||||
return npos;
|
return npos;
|
||||||
|
|
||||||
const_reverse_iterator criter = std::find(crbegin(), crend(), ch);
|
const_reverse_iterator criter = std::find(crbegin(), crend(), ch);
|
||||||
return (criter != crend()) ? (criter.base() - cbegin()) : basic_string<_CharTy>::npos;
|
return (criter != crend()) ? (criter.core() - cbegin()) : basic_string<_CharTy>::npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename _CharTy>
|
template <typename _CharTy>
|
||||||
|
|
@ -1090,7 +1090,7 @@ namespace core
|
||||||
check_offset(pos);
|
check_offset(pos);
|
||||||
|
|
||||||
count = clamp_suffix_size(pos, count);
|
count = clamp_suffix_size(pos, count);
|
||||||
traits_type::move(cstr, cbegin().base() + pos, count);
|
traits_type::move(cstr, cbegin().core() + pos, count);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1159,31 +1159,31 @@ namespace core
|
||||||
//
|
//
|
||||||
|
|
||||||
template <typename _CharTy>
|
template <typename _CharTy>
|
||||||
inline basic_string<_CharTy> basic_string<_CharTy>::parse(int val) { return ::kiwano::core::to_basic_string<char_type>(val); }
|
inline basic_string<_CharTy> basic_string<_CharTy>::parse(int val) { return ::kiwano::common::to_basic_string<char_type>(val); }
|
||||||
|
|
||||||
template <typename _CharTy>
|
template <typename _CharTy>
|
||||||
inline basic_string<_CharTy> basic_string<_CharTy>::parse(unsigned int val) { return ::kiwano::core::to_basic_string<char_type>(val); }
|
inline basic_string<_CharTy> basic_string<_CharTy>::parse(unsigned int val) { return ::kiwano::common::to_basic_string<char_type>(val); }
|
||||||
|
|
||||||
template <typename _CharTy>
|
template <typename _CharTy>
|
||||||
inline basic_string<_CharTy> basic_string<_CharTy>::parse(long val) { return ::kiwano::core::to_basic_string<char_type>(val); }
|
inline basic_string<_CharTy> basic_string<_CharTy>::parse(long val) { return ::kiwano::common::to_basic_string<char_type>(val); }
|
||||||
|
|
||||||
template <typename _CharTy>
|
template <typename _CharTy>
|
||||||
inline basic_string<_CharTy> basic_string<_CharTy>::parse(unsigned long val) { return ::kiwano::core::to_basic_string<char_type>(val); }
|
inline basic_string<_CharTy> basic_string<_CharTy>::parse(unsigned long val) { return ::kiwano::common::to_basic_string<char_type>(val); }
|
||||||
|
|
||||||
template <typename _CharTy>
|
template <typename _CharTy>
|
||||||
inline basic_string<_CharTy> basic_string<_CharTy>::parse(long long val) { return ::kiwano::core::to_basic_string<char_type>(val); }
|
inline basic_string<_CharTy> basic_string<_CharTy>::parse(long long val) { return ::kiwano::common::to_basic_string<char_type>(val); }
|
||||||
|
|
||||||
template <typename _CharTy>
|
template <typename _CharTy>
|
||||||
inline basic_string<_CharTy> basic_string<_CharTy>::parse(unsigned long long val) { return ::kiwano::core::to_basic_string<char_type>(val); }
|
inline basic_string<_CharTy> basic_string<_CharTy>::parse(unsigned long long val) { return ::kiwano::common::to_basic_string<char_type>(val); }
|
||||||
|
|
||||||
template <typename _CharTy>
|
template <typename _CharTy>
|
||||||
inline basic_string<_CharTy> basic_string<_CharTy>::parse(float val) { return ::kiwano::core::to_basic_string<char_type>(val); }
|
inline basic_string<_CharTy> basic_string<_CharTy>::parse(float val) { return ::kiwano::common::to_basic_string<char_type>(val); }
|
||||||
|
|
||||||
template <typename _CharTy>
|
template <typename _CharTy>
|
||||||
inline basic_string<_CharTy> basic_string<_CharTy>::parse(double val) { return ::kiwano::core::to_basic_string<char_type>(val); }
|
inline basic_string<_CharTy> basic_string<_CharTy>::parse(double val) { return ::kiwano::common::to_basic_string<char_type>(val); }
|
||||||
|
|
||||||
template <typename _CharTy>
|
template <typename _CharTy>
|
||||||
inline basic_string<_CharTy> basic_string<_CharTy>::parse(long double val) { return ::kiwano::core::to_basic_string<char_type>(val); }
|
inline basic_string<_CharTy> basic_string<_CharTy>::parse(long double val) { return ::kiwano::common::to_basic_string<char_type>(val); }
|
||||||
|
|
||||||
//
|
//
|
||||||
// details of basic_string::format
|
// details of basic_string::format
|
||||||
|
|
@ -1193,7 +1193,7 @@ namespace core
|
||||||
template <typename ..._Args>
|
template <typename ..._Args>
|
||||||
inline basic_string<_CharTy> basic_string<_CharTy>::format(const char_type* fmt, _Args&& ... args)
|
inline basic_string<_CharTy> basic_string<_CharTy>::format(const char_type* fmt, _Args&& ... args)
|
||||||
{
|
{
|
||||||
return ::kiwano::core::format_string(fmt, std::forward<_Args>(args)...);
|
return ::kiwano::common::format_string(fmt, std::forward<_Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -1527,8 +1527,8 @@ class string_convert
|
||||||
enum : size_t { BUFFER_INCREASE = 8, BUFFER_MAX = 16 };
|
enum : size_t { BUFFER_INCREASE = 8, BUFFER_MAX = 16 };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using byte_string = ::kiwano::core::basic_string<char>;
|
using byte_string = ::kiwano::common::basic_string<char>;
|
||||||
using wide_string = ::kiwano::core::basic_string<_Elem>;
|
using wide_string = ::kiwano::common::basic_string<_Elem>;
|
||||||
using codecvt_type = _Codecvt;
|
using codecvt_type = _Codecvt;
|
||||||
using state_type = typename codecvt_type::state_type;
|
using state_type = typename codecvt_type::state_type;
|
||||||
using int_type = typename wide_string::traits_type::int_type;
|
using int_type = typename wide_string::traits_type::int_type;
|
||||||
|
|
@ -1702,25 +1702,25 @@ class chs_codecvt
|
||||||
public:
|
public:
|
||||||
chs_codecvt() : codecvt_byname("chs") {}
|
chs_codecvt() : codecvt_byname("chs") {}
|
||||||
|
|
||||||
static inline ::kiwano::core::wstring string_to_wide(::kiwano::core::string const& str)
|
static inline ::kiwano::common::wstring string_to_wide(::kiwano::common::string const& str)
|
||||||
{
|
{
|
||||||
string_convert<chs_codecvt> conv;
|
string_convert<chs_codecvt> conv;
|
||||||
return conv.from_bytes(str);
|
return conv.from_bytes(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline ::kiwano::core::string wide_to_string(::kiwano::core::wstring const& str)
|
static inline ::kiwano::common::string wide_to_string(::kiwano::common::wstring const& str)
|
||||||
{
|
{
|
||||||
string_convert<chs_codecvt> conv;
|
string_convert<chs_codecvt> conv;
|
||||||
return conv.to_bytes(str);
|
return conv.to_bytes(str);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline ::kiwano::core::wstring string_to_wide(::kiwano::core::string const& str)
|
inline ::kiwano::common::wstring string_to_wide(::kiwano::common::string const& str)
|
||||||
{
|
{
|
||||||
return kiwano::chs_codecvt::string_to_wide(str);
|
return kiwano::chs_codecvt::string_to_wide(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ::kiwano::core::string wide_to_string(::kiwano::core::wstring const& str)
|
inline ::kiwano::common::string wide_to_string(::kiwano::common::wstring const& str)
|
||||||
{
|
{
|
||||||
return kiwano::chs_codecvt::wide_to_string(str);
|
return kiwano::chs_codecvt::wide_to_string(str);
|
||||||
}
|
}
|
||||||
|
|
@ -1730,18 +1730,18 @@ inline ::kiwano::core::string wide_to_string(::kiwano::core::wstring const& str)
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
template<>
|
template<>
|
||||||
struct hash<::kiwano::core::string>
|
struct hash<::kiwano::common::string>
|
||||||
{
|
{
|
||||||
inline size_t operator()(const ::kiwano::core::string& key) const
|
inline size_t operator()(const ::kiwano::common::string& key) const
|
||||||
{
|
{
|
||||||
return key.hash();
|
return key.hash();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct hash<::kiwano::core::wstring>
|
struct hash<::kiwano::common::wstring>
|
||||||
{
|
{
|
||||||
inline size_t operator()(const ::kiwano::core::wstring& key) const
|
inline size_t operator()(const ::kiwano::common::wstring& key) const
|
||||||
{
|
{
|
||||||
return key.hash();
|
return key.hash();
|
||||||
}
|
}
|
||||||
|
|
@ -1751,13 +1751,13 @@ namespace std
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
template<>
|
template<>
|
||||||
inline void swap<::kiwano::core::string>(::kiwano::core::string& lhs, ::kiwano::core::string& rhs) noexcept
|
inline void swap<::kiwano::common::string>(::kiwano::common::string& lhs, ::kiwano::common::string& rhs) noexcept
|
||||||
{
|
{
|
||||||
lhs.swap(rhs);
|
lhs.swap(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline void swap<::kiwano::core::wstring>(::kiwano::core::wstring& lhs, ::kiwano::core::wstring& rhs) noexcept
|
inline void swap<::kiwano::common::wstring>(::kiwano::common::wstring& lhs, ::kiwano::common::wstring& rhs) noexcept
|
||||||
{
|
{
|
||||||
lhs.swap(rhs);
|
lhs.swap(rhs);
|
||||||
}
|
}
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
namespace core
|
namespace common
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -284,5 +284,5 @@ namespace __vector_details
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace core
|
} // namespace common
|
||||||
} // namespace kiwano
|
} // namespace kiwano
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/base/AsyncTask.h>
|
#include <kiwano/core/AsyncTask.h>
|
||||||
#include <kiwano/platform/Application.h>
|
#include <kiwano/platform/Application.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include <kiwano/base/ObjectBase.h>
|
#include <kiwano/core/ObjectBase.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/base/Component.h>
|
#include <kiwano/core/Component.h>
|
||||||
|
|
||||||
#define KGE_DEFINE_COMPONENT_FLAG(OFFSET) ( 0x01 << (OFFSET % 32) )
|
#define KGE_DEFINE_COMPONENT_FLAG(OFFSET) ( 0x01 << (OFFSET % 32) )
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/macros.h>
|
#include <kiwano/macros.h>
|
||||||
#include <kiwano/base/time.h>
|
#include <kiwano/core/time.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/base/Director.h>
|
#include <kiwano/core/Director.h>
|
||||||
#include <kiwano/2d/Actor.h>
|
#include <kiwano/2d/Actor.h>
|
||||||
#include <kiwano/2d/Stage.h>
|
#include <kiwano/2d/Stage.h>
|
||||||
#include <kiwano/2d/Transition.h>
|
#include <kiwano/2d/Transition.h>
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/2d/include-forwards.h>
|
#include <kiwano/2d/include-forwards.h>
|
||||||
#include <kiwano/base/Component.h>
|
#include <kiwano/core/Component.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#include <kiwano/base/Event.h>
|
#include <kiwano/core/Event.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -19,9 +19,9 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/core/core.h>
|
#include <kiwano/common/common.h>
|
||||||
#include <kiwano/math/math.h>
|
#include <kiwano/math/math.h>
|
||||||
#include <kiwano/base/keys.hpp>
|
#include <kiwano/core/keys.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -49,6 +49,31 @@ namespace kiwano
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
namespace event
|
||||||
|
{
|
||||||
|
// 鼠标事件
|
||||||
|
extern EventType MouseMove; // 移动
|
||||||
|
extern EventType MouseDown; // 鼠标按下
|
||||||
|
extern EventType MouseUp; // 鼠标抬起
|
||||||
|
extern EventType MouseWheel; // 滚轮滚动
|
||||||
|
extern EventType MouseHover; // 鼠标移入
|
||||||
|
extern EventType MouseOut; // 鼠标移出
|
||||||
|
extern EventType MouseClick; // 鼠标点击
|
||||||
|
|
||||||
|
// 按键事件
|
||||||
|
extern EventType KeyDown; // 按键按下
|
||||||
|
extern EventType KeyUp; // 按键抬起
|
||||||
|
extern EventType KeyChar; // 输出字符
|
||||||
|
|
||||||
|
// 窗口消息
|
||||||
|
extern EventType WindowMoved; // 窗口移动
|
||||||
|
extern EventType WindowResized; // 窗口大小变化
|
||||||
|
extern EventType WindowFocusChanged; // 获得或失去焦点
|
||||||
|
extern EventType WindowTitleChanged; // 标题变化
|
||||||
|
extern EventType WindowClosed; // 窗口被关闭
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 事件
|
// 事件
|
||||||
class KGE_API Event
|
class KGE_API Event
|
||||||
{
|
{
|
||||||
|
|
@ -244,29 +269,4 @@ namespace kiwano
|
||||||
WindowClosedEvent();
|
WindowClosedEvent();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
namespace event
|
|
||||||
{
|
|
||||||
// 鼠标事件
|
|
||||||
extern EventType MouseMove; // 移动
|
|
||||||
extern EventType MouseDown; // 鼠标按下
|
|
||||||
extern EventType MouseUp; // 鼠标抬起
|
|
||||||
extern EventType MouseWheel; // 滚轮滚动
|
|
||||||
extern EventType MouseHover; // 鼠标移入
|
|
||||||
extern EventType MouseOut; // 鼠标移出
|
|
||||||
extern EventType MouseClick; // 鼠标点击
|
|
||||||
|
|
||||||
// 按键事件
|
|
||||||
extern EventType KeyDown; // 按键按下
|
|
||||||
extern EventType KeyUp; // 按键抬起
|
|
||||||
extern EventType KeyChar; // 输出字符
|
|
||||||
|
|
||||||
// 窗口消息
|
|
||||||
extern EventType WindowMoved; // 窗口移动
|
|
||||||
extern EventType WindowResized; // 窗口大小变化
|
|
||||||
extern EventType WindowFocusChanged; // 获得或失去焦点
|
|
||||||
extern EventType WindowTitleChanged; // 标题变化
|
|
||||||
extern EventType WindowClosed; // 窗口被关闭
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/base/EventDispatcher.h>
|
#include <kiwano/core/EventDispatcher.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/base/EventListener.h>
|
#include <kiwano/core/EventListener.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/base/EventListener.h>
|
#include <kiwano/core/EventListener.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -19,10 +19,10 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/core/core.h>
|
#include <kiwano/common/common.h>
|
||||||
#include <kiwano/base/SmartPtr.hpp>
|
#include <kiwano/core/SmartPtr.hpp>
|
||||||
#include <kiwano/base/ObjectBase.h>
|
#include <kiwano/core/ObjectBase.h>
|
||||||
#include <kiwano/base/Event.h>
|
#include <kiwano/core/Event.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/base/Library.h>
|
#include <kiwano/core/Library.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/macros.h>
|
#include <kiwano/macros.h>
|
||||||
#include <kiwano/core/core.h>
|
#include <kiwano/common/common.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <kiwano/macros.h>
|
#include <kiwano/macros.h>
|
||||||
#include <kiwano/core/core.h>
|
#include <kiwano/common/common.h>
|
||||||
|
|
||||||
#ifndef KGE_LOG
|
#ifndef KGE_LOG
|
||||||
# ifdef KGE_DEBUG
|
# ifdef KGE_DEBUG
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include <kiwano/base/ObjectBase.h>
|
#include <kiwano/core/ObjectBase.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -20,9 +20,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/macros.h>
|
#include <kiwano/macros.h>
|
||||||
#include <kiwano/core/core.h>
|
#include <kiwano/common/common.h>
|
||||||
#include <kiwano/base/RefCounter.hpp>
|
#include <kiwano/core/RefCounter.hpp>
|
||||||
#include <kiwano/base/SmartPtr.hpp>
|
#include <kiwano/core/SmartPtr.hpp>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -20,12 +20,12 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/macros.h>
|
#include <kiwano/macros.h>
|
||||||
#include <kiwano/core/noncopyable.hpp>
|
#include <kiwano/common/noncopyable.hpp>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
class KGE_API RefCounter
|
class KGE_API RefCounter
|
||||||
: protected core::noncopyable
|
: protected common::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// 增加引用计数
|
// 增加引用计数
|
||||||
|
|
@ -20,8 +20,8 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <kiwano/base/Resource.h>
|
#include <kiwano/core/Resource.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/macros.h>
|
#include <kiwano/macros.h>
|
||||||
#include <kiwano/core/core.h>
|
#include <kiwano/common/common.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/base/RefCounter.hpp>
|
#include <kiwano/core/RefCounter.hpp>
|
||||||
#include <kiwano/core/intrusive_ptr.hpp>
|
#include <kiwano/common/intrusive_ptr.hpp>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -38,7 +38,7 @@ namespace kiwano
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename _Ty>
|
template <typename _Ty>
|
||||||
using SmartPtr = core::intrusive_ptr<_Ty, DefaultIntrusivePtrManager>;
|
using SmartPtr = common::intrusive_ptr<_Ty, DefaultIntrusivePtrManager>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/base/Timer.h>
|
#include <kiwano/core/Timer.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include <kiwano/base/ObjectBase.h>
|
#include <kiwano/core/ObjectBase.h>
|
||||||
#include <kiwano/base/time.h>
|
#include <kiwano/core/time.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/base/TimerManager.h>
|
#include <kiwano/core/TimerManager.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/base/Timer.h>
|
#include <kiwano/core/Timer.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -0,0 +1,424 @@
|
||||||
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#include <regex>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
|
#include <kiwano/core/time.h>
|
||||||
|
#include <kiwano/core/Logger.h>
|
||||||
|
|
||||||
|
namespace kiwano
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------
|
||||||
|
// Time
|
||||||
|
//-------------------------------------------------------
|
||||||
|
|
||||||
|
Time::Time()
|
||||||
|
: dur_(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Time::Time(long dur)
|
||||||
|
: dur_(dur)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const Time Time::operator+(const Duration & dur) const
|
||||||
|
{
|
||||||
|
return Time{ dur_ + dur.Milliseconds() };
|
||||||
|
}
|
||||||
|
|
||||||
|
const Time Time::operator-(const Duration & dur) const
|
||||||
|
{
|
||||||
|
return Time{ dur_ - dur.Milliseconds() };
|
||||||
|
}
|
||||||
|
|
||||||
|
Time & Time::operator+=(const Duration & other)
|
||||||
|
{
|
||||||
|
dur_ += other.Milliseconds();
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
Time & Time::operator-=(const Duration &other)
|
||||||
|
{
|
||||||
|
dur_ -= other.Milliseconds();
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration Time::operator-(const Time & other) const
|
||||||
|
{
|
||||||
|
return Duration(dur_ - other.dur_);
|
||||||
|
}
|
||||||
|
|
||||||
|
Time Time::Now() noexcept
|
||||||
|
{
|
||||||
|
static LARGE_INTEGER freq = {};
|
||||||
|
if (freq.QuadPart == 0LL)
|
||||||
|
{
|
||||||
|
// the Function will always succceed on systems that run Windows XP or later
|
||||||
|
QueryPerformanceFrequency(&freq);
|
||||||
|
}
|
||||||
|
|
||||||
|
LARGE_INTEGER count;
|
||||||
|
QueryPerformanceCounter(&count);
|
||||||
|
|
||||||
|
const long long whole = (count.QuadPart / freq.QuadPart) * 1000LL;
|
||||||
|
const long long part = (count.QuadPart % freq.QuadPart) * 1000LL / freq.QuadPart;
|
||||||
|
return Time{ static_cast<long>(whole + part) };
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------
|
||||||
|
// Duration
|
||||||
|
//-------------------------------------------------------
|
||||||
|
|
||||||
|
const Duration Duration::Ms = 1L;
|
||||||
|
const Duration Duration::Second = 1000 * Duration::Ms;
|
||||||
|
const Duration Duration::Minute = 60 * Duration::Second;
|
||||||
|
const Duration Duration::Hour = 60 * Duration::Minute;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
const auto duration_regex = std::wregex(LR"(^[-+]?([0-9]*(\.[0-9]*)?(h|m|s|ms)+)+$)");
|
||||||
|
|
||||||
|
typedef std::unordered_map<String, Duration> UnitMap;
|
||||||
|
const auto unit_map = UnitMap
|
||||||
|
{
|
||||||
|
{L"ms", Duration::Ms},
|
||||||
|
{L"s", Duration::Second},
|
||||||
|
{L"m", Duration::Minute},
|
||||||
|
{L"h", Duration::Hour}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Duration::Duration()
|
||||||
|
: milliseconds_(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Duration::Duration(long milliseconds)
|
||||||
|
: milliseconds_(milliseconds)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
float Duration::Seconds() const
|
||||||
|
{
|
||||||
|
long sec = milliseconds_ / Second.milliseconds_;
|
||||||
|
long ms = milliseconds_ % Second.milliseconds_;
|
||||||
|
return static_cast<float>(sec) + static_cast<float>(ms) / 1000.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
float Duration::Minutes() const
|
||||||
|
{
|
||||||
|
long min = milliseconds_ / Minute.milliseconds_;
|
||||||
|
long ms = milliseconds_ % Minute.milliseconds_;
|
||||||
|
return static_cast<float>(min) + static_cast<float>(ms) / (60 * 1000.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
float Duration::Hours() const
|
||||||
|
{
|
||||||
|
long hour = milliseconds_ / Hour.milliseconds_;
|
||||||
|
long ms = milliseconds_ % Hour.milliseconds_;
|
||||||
|
return static_cast<float>(hour) + static_cast<float>(ms) / (60 * 60 * 1000.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
String Duration::ToString() const
|
||||||
|
{
|
||||||
|
if (IsZero())
|
||||||
|
{
|
||||||
|
return String(L"0s");
|
||||||
|
}
|
||||||
|
|
||||||
|
String result;
|
||||||
|
long total_ms = milliseconds_;
|
||||||
|
if (total_ms < 0)
|
||||||
|
{
|
||||||
|
result.append(L"-");
|
||||||
|
total_ms = -total_ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
long hour = total_ms / Hour.milliseconds_;
|
||||||
|
long min = total_ms / Minute.milliseconds_ - hour * 60;
|
||||||
|
long sec = total_ms / Second.milliseconds_ - (hour * 60 * 60 + min * 60);
|
||||||
|
long ms = total_ms % Second.milliseconds_;
|
||||||
|
|
||||||
|
if (hour)
|
||||||
|
{
|
||||||
|
result.append(String::parse(hour)).append(L"h");
|
||||||
|
result.append(String::parse(min)).append(L"m");
|
||||||
|
}
|
||||||
|
else if(min)
|
||||||
|
{
|
||||||
|
result.append(String::parse(min)).append(L"m");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ms != 0)
|
||||||
|
{
|
||||||
|
result.append(String::parse(static_cast<float>(sec) + static_cast<float>(ms) / 1000.f))
|
||||||
|
.append(L"s");
|
||||||
|
}
|
||||||
|
else if (sec != 0)
|
||||||
|
{
|
||||||
|
result.append(String::parse(sec)).append(L"s");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Duration::operator==(const Duration & other) const
|
||||||
|
{
|
||||||
|
return milliseconds_ == other.milliseconds_;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Duration::operator!=(const Duration & other) const
|
||||||
|
{
|
||||||
|
return milliseconds_ != other.milliseconds_;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Duration::operator>(const Duration & other) const
|
||||||
|
{
|
||||||
|
return milliseconds_ > other.milliseconds_;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Duration::operator>=(const Duration & other) const
|
||||||
|
{
|
||||||
|
return milliseconds_ >= other.milliseconds_;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Duration::operator<(const Duration & other) const
|
||||||
|
{
|
||||||
|
return milliseconds_ < other.milliseconds_;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Duration::operator<=(const Duration & other) const
|
||||||
|
{
|
||||||
|
return milliseconds_ <= other.milliseconds_;
|
||||||
|
}
|
||||||
|
|
||||||
|
float Duration::operator/(const Duration & other) const
|
||||||
|
{
|
||||||
|
return static_cast<float>(milliseconds_) / other.milliseconds_;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration Duration::operator+(const Duration & other) const
|
||||||
|
{
|
||||||
|
return Duration(milliseconds_ + other.milliseconds_);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration Duration::operator-(const Duration & other) const
|
||||||
|
{
|
||||||
|
return Duration(milliseconds_ - other.milliseconds_);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration Duration::operator-() const
|
||||||
|
{
|
||||||
|
return Duration(-milliseconds_);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration Duration::operator*(int val) const
|
||||||
|
{
|
||||||
|
return Duration(milliseconds_ * val);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration Duration::operator*(unsigned long long val) const
|
||||||
|
{
|
||||||
|
return Duration(static_cast<long>(milliseconds_ * val));
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration Duration::operator*(float val) const
|
||||||
|
{
|
||||||
|
return Duration(static_cast<long>(milliseconds_ * val));
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration Duration::operator*(double val) const
|
||||||
|
{
|
||||||
|
return Duration(static_cast<long>(milliseconds_ * val));
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration Duration::operator*(long double val) const
|
||||||
|
{
|
||||||
|
return Duration(static_cast<long>(milliseconds_ * val));
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration Duration::operator/(int val) const
|
||||||
|
{
|
||||||
|
return Duration(milliseconds_ / val);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration Duration::operator/(float val) const
|
||||||
|
{
|
||||||
|
return Duration(static_cast<long>(milliseconds_ / val));
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration Duration::operator/(double val) const
|
||||||
|
{
|
||||||
|
return Duration(static_cast<long>(milliseconds_ / val));
|
||||||
|
}
|
||||||
|
|
||||||
|
Duration & Duration::operator+=(const Duration &other)
|
||||||
|
{
|
||||||
|
milliseconds_ += other.milliseconds_;
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
Duration & Duration::operator-=(const Duration &other)
|
||||||
|
{
|
||||||
|
milliseconds_ -= other.milliseconds_;
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
Duration & Duration::operator*=(int val)
|
||||||
|
{
|
||||||
|
milliseconds_ *= val;
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
Duration & Duration::operator/=(int val)
|
||||||
|
{
|
||||||
|
milliseconds_ = static_cast<long>(milliseconds_ / val);
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
Duration & Duration::operator*=(float val)
|
||||||
|
{
|
||||||
|
milliseconds_ = static_cast<long>(milliseconds_ * val);
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
Duration & Duration::operator/=(float val)
|
||||||
|
{
|
||||||
|
milliseconds_ = static_cast<long>(milliseconds_ / val);
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
Duration & Duration::operator*=(double val)
|
||||||
|
{
|
||||||
|
milliseconds_ = static_cast<long>(milliseconds_ * val);
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
Duration & Duration::operator/=(double val)
|
||||||
|
{
|
||||||
|
milliseconds_ = static_cast<long>(milliseconds_ / val);
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration operator*(int val, const Duration & dur)
|
||||||
|
{
|
||||||
|
return dur * val;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration operator/(int val, const Duration & dur)
|
||||||
|
{
|
||||||
|
return dur / val;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration operator*(float val, const Duration & dur)
|
||||||
|
{
|
||||||
|
return dur * val;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration operator/(float val, const Duration & dur)
|
||||||
|
{
|
||||||
|
return dur / val;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration operator*(double val, const Duration & dur)
|
||||||
|
{
|
||||||
|
return dur * val;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration operator/(double val, const Duration & dur)
|
||||||
|
{
|
||||||
|
return dur / val;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Duration operator*(long double val, const Duration & dur)
|
||||||
|
{
|
||||||
|
return dur * val;
|
||||||
|
}
|
||||||
|
|
||||||
|
Duration Duration::Parse(const String& str)
|
||||||
|
{
|
||||||
|
bool negative = false;
|
||||||
|
size_t len = str.length();
|
||||||
|
size_t pos = 0;
|
||||||
|
Duration ret;
|
||||||
|
|
||||||
|
if (!std::regex_match(str.c_str(), duration_regex))
|
||||||
|
{
|
||||||
|
KGE_ERROR_LOG(L"Duration::Parse failed, invalid duration");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (str.empty() || str == L"0") { return ret; }
|
||||||
|
|
||||||
|
// ·ûºÅλ
|
||||||
|
if (str[0] == L'-' || str[0] == L'+')
|
||||||
|
{
|
||||||
|
negative = (str[0] == L'-');
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (pos < len)
|
||||||
|
{
|
||||||
|
// ÊýÖµ
|
||||||
|
size_t i = pos;
|
||||||
|
for (; i < len; ++i)
|
||||||
|
{
|
||||||
|
wchar_t ch = str[i];
|
||||||
|
if (!(ch == L'.' || L'0' <= ch && ch <= L'9'))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String num_str = str.substr(pos, i - pos);
|
||||||
|
pos = i;
|
||||||
|
|
||||||
|
KGE_ASSERT(!(num_str.empty() || num_str == L".") && "Duration::Parse failed, invalid duration");
|
||||||
|
|
||||||
|
// µ¥Î»
|
||||||
|
for (; i < len; ++i)
|
||||||
|
{
|
||||||
|
wchar_t ch = str[i];
|
||||||
|
if (ch == L'.' || L'0' <= ch && ch <= L'9')
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String unit_str = str.substr(pos, i - pos);
|
||||||
|
pos = i;
|
||||||
|
|
||||||
|
KGE_ASSERT(unit_map.find(unit_str) != unit_map.end() && "Duration::Parse failed, invalid duration");
|
||||||
|
|
||||||
|
double num = std::wcstod(num_str.c_str(), nullptr);
|
||||||
|
Duration unit = unit_map.at(unit_str);
|
||||||
|
ret += unit * num;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (negative)
|
||||||
|
{
|
||||||
|
ret = -ret;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,225 @@
|
||||||
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <kiwano/macros.h>
|
||||||
|
#include <kiwano/common/common.h>
|
||||||
|
|
||||||
|
namespace kiwano
|
||||||
|
{
|
||||||
|
// 时间段
|
||||||
|
//
|
||||||
|
// 时间段表示法:
|
||||||
|
// 5 秒: time::Second * 5
|
||||||
|
// 1.5 小时: time::Hour * 1.5
|
||||||
|
// 3 小时 45 分 15 秒: time::Hour * 3 + time::Minute * 45 + time::Second * 15
|
||||||
|
// 在 VS2015 及更高版本可以使用 time literals:
|
||||||
|
// 5 秒: 5_s
|
||||||
|
// 1.5 小时: 1.5_h
|
||||||
|
// 3 小时 45 分 15 秒: 3_h + 45_m + 15_s
|
||||||
|
//
|
||||||
|
struct KGE_API Duration
|
||||||
|
{
|
||||||
|
Duration();
|
||||||
|
|
||||||
|
Duration(
|
||||||
|
long milliseconds
|
||||||
|
);
|
||||||
|
|
||||||
|
// 转化为毫秒
|
||||||
|
long Milliseconds() const;
|
||||||
|
|
||||||
|
// 转化为秒
|
||||||
|
float Seconds() const;
|
||||||
|
|
||||||
|
// 转化为分钟
|
||||||
|
float Minutes() const;
|
||||||
|
|
||||||
|
// 转化为小时
|
||||||
|
float Hours() const;
|
||||||
|
|
||||||
|
// 时长是否是零
|
||||||
|
bool IsZero() const;
|
||||||
|
|
||||||
|
void SetMilliseconds(long ms);
|
||||||
|
|
||||||
|
void SetSeconds(float seconds);
|
||||||
|
|
||||||
|
void SetMinutes(float minutes);
|
||||||
|
|
||||||
|
void SetHours(float hours);
|
||||||
|
|
||||||
|
// 转为字符串
|
||||||
|
String ToString() const;
|
||||||
|
|
||||||
|
bool operator== (const Duration &) const;
|
||||||
|
bool operator!= (const Duration &) const;
|
||||||
|
bool operator> (const Duration &) const;
|
||||||
|
bool operator>= (const Duration &) const;
|
||||||
|
bool operator< (const Duration &) const;
|
||||||
|
bool operator<= (const Duration &) const;
|
||||||
|
|
||||||
|
float operator / (const Duration &) const;
|
||||||
|
|
||||||
|
const Duration operator + (const Duration &) const;
|
||||||
|
const Duration operator - (const Duration &) const;
|
||||||
|
const Duration operator - () const;
|
||||||
|
const Duration operator * (int) const;
|
||||||
|
const Duration operator * (unsigned long long) const;
|
||||||
|
const Duration operator * (float) const;
|
||||||
|
const Duration operator * (double) const;
|
||||||
|
const Duration operator * (long double) const;
|
||||||
|
const Duration operator / (int) const;
|
||||||
|
const Duration operator / (float) const;
|
||||||
|
const Duration operator / (double) const;
|
||||||
|
|
||||||
|
Duration& operator += (const Duration &);
|
||||||
|
Duration& operator -= (const Duration &);
|
||||||
|
Duration& operator *= (int);
|
||||||
|
Duration& operator *= (float);
|
||||||
|
Duration& operator *= (double);
|
||||||
|
Duration& operator /= (int);
|
||||||
|
Duration& operator /= (float);
|
||||||
|
Duration& operator /= (double);
|
||||||
|
|
||||||
|
friend const Duration operator* (int, const Duration &);
|
||||||
|
friend const Duration operator* (float, const Duration &);
|
||||||
|
friend const Duration operator* (double, const Duration &);
|
||||||
|
friend const Duration operator* (long double, const Duration &);
|
||||||
|
friend const Duration operator/ (int, const Duration &);
|
||||||
|
friend const Duration operator/ (float, const Duration &);
|
||||||
|
friend const Duration operator/ (double, const Duration &);
|
||||||
|
|
||||||
|
// 时间段格式化
|
||||||
|
//
|
||||||
|
// 时间段字符串允许是有符号的浮点数, 并且带有时间单位后缀
|
||||||
|
// 例如: "300ms", "-1.5h", "2h45m"
|
||||||
|
// 允许的时间单位有 "ms", "s", "m", "h"
|
||||||
|
static Duration Parse(const String& parse_str);
|
||||||
|
|
||||||
|
static const Duration Ms; // 毫秒
|
||||||
|
static const Duration Second; // 秒
|
||||||
|
static const Duration Minute; // 分钟
|
||||||
|
static const Duration Hour; // 小时
|
||||||
|
|
||||||
|
private:
|
||||||
|
long milliseconds_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 时间
|
||||||
|
//
|
||||||
|
// 获取当前时间: Time now = Time::Now();
|
||||||
|
// 两时间相减, 得到一个 Duration 对象, 例如:
|
||||||
|
// Time t1, t2;
|
||||||
|
// int ms = (t2 - t1).Milliseconds(); // 获取两时间相差的毫秒数
|
||||||
|
//
|
||||||
|
struct KGE_API Time
|
||||||
|
{
|
||||||
|
Time();
|
||||||
|
|
||||||
|
// 是否是零时
|
||||||
|
bool IsZero() const;
|
||||||
|
|
||||||
|
const Duration operator -(const Time&) const;
|
||||||
|
|
||||||
|
const Time operator +(const Duration &) const;
|
||||||
|
const Time operator -(const Duration &) const;
|
||||||
|
|
||||||
|
Time& operator +=(const Duration &);
|
||||||
|
Time& operator -=(const Duration &);
|
||||||
|
|
||||||
|
// 获取当前时间
|
||||||
|
// 由于该时间点基于系统启动时间开始计算, 所以无法格式化该时间,
|
||||||
|
// 也无法获得该时间的 Unix 时间戳
|
||||||
|
static Time Now() noexcept;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Time(long ms);
|
||||||
|
|
||||||
|
private:
|
||||||
|
long dur_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline long Duration::Milliseconds() const { return milliseconds_; }
|
||||||
|
|
||||||
|
inline bool Duration::IsZero() const { return milliseconds_ == 0LL; }
|
||||||
|
|
||||||
|
inline void Duration::SetMilliseconds(long ms) { milliseconds_ = ms; }
|
||||||
|
|
||||||
|
inline void Duration::SetSeconds(float seconds) { milliseconds_ = static_cast<long>(seconds * 1000.f); }
|
||||||
|
|
||||||
|
inline void Duration::SetMinutes(float minutes) { milliseconds_ = static_cast<long>(minutes * 60 * 1000.f); }
|
||||||
|
|
||||||
|
inline void Duration::SetHours(float hours) { milliseconds_ = static_cast<long>(hours * 60 * 60 * 1000.f); }
|
||||||
|
|
||||||
|
inline bool Time::IsZero() const { return dur_ == 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#if KGE_VS_VER > KGE_VS_2013
|
||||||
|
|
||||||
|
namespace kiwano
|
||||||
|
{
|
||||||
|
inline namespace literals
|
||||||
|
{
|
||||||
|
inline const kiwano::Duration operator "" _ms(long double val)
|
||||||
|
{
|
||||||
|
return kiwano::Duration::Ms * val;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const kiwano::Duration operator "" _s(long double val)
|
||||||
|
{
|
||||||
|
return kiwano::Duration::Second * val;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const kiwano::Duration operator "" _m(long double val)
|
||||||
|
{
|
||||||
|
return kiwano::Duration::Minute * val;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const kiwano::Duration operator "" _h(long double val)
|
||||||
|
{
|
||||||
|
return kiwano::Duration::Hour * val;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const kiwano::Duration operator "" _ms(unsigned long long val)
|
||||||
|
{
|
||||||
|
return kiwano::Duration::Ms * val;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const kiwano::Duration operator "" _s(unsigned long long val)
|
||||||
|
{
|
||||||
|
return kiwano::Duration::Second * val;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const kiwano::Duration operator "" _m(unsigned long long val)
|
||||||
|
{
|
||||||
|
return kiwano::Duration::Minute * val;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const kiwano::Duration operator "" _h(unsigned long long val)
|
||||||
|
{
|
||||||
|
return kiwano::Duration::Hour * val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <kiwano/core/intrusive_ptr.hpp>
|
#include <kiwano/common/intrusive_ptr.hpp>
|
||||||
#include <Unknwnbase.h>
|
#include <Unknwnbase.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
@ -42,6 +42,6 @@ namespace kiwano
|
||||||
template<
|
template<
|
||||||
typename _Ty,
|
typename _Ty,
|
||||||
typename = typename std::enable_if<std::is_base_of<IUnknown, _Ty>::value, int>::type>
|
typename = typename std::enable_if<std::is_base_of<IUnknown, _Ty>::value, int>::type>
|
||||||
using ComPtr = core::intrusive_ptr<_Ty, ComPtrManager>;
|
using ComPtr = common::intrusive_ptr<_Ty, ComPtrManager>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
#include <3rd-party/StackWalker/StackWalker.h>
|
#include <3rd-party/StackWalker/StackWalker.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
@ -29,19 +29,19 @@
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// core
|
// common
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <kiwano/core/vector.hpp>
|
#include <kiwano/common/vector.hpp>
|
||||||
#include <kiwano/core/string.hpp>
|
#include <kiwano/common/string.hpp>
|
||||||
#include <kiwano/core/any.hpp>
|
#include <kiwano/common/any.hpp>
|
||||||
#include <kiwano/core/function.hpp>
|
#include <kiwano/common/function.hpp>
|
||||||
#include <kiwano/core/intrusive_list.hpp>
|
#include <kiwano/common/intrusive_list.hpp>
|
||||||
#include <kiwano/core/intrusive_ptr.hpp>
|
#include <kiwano/common/intrusive_ptr.hpp>
|
||||||
#include <kiwano/core/noncopyable.hpp>
|
#include <kiwano/common/noncopyable.hpp>
|
||||||
#include <kiwano/core/singleton.hpp>
|
#include <kiwano/common/singleton.hpp>
|
||||||
#include <kiwano/core/basic_json.hpp>
|
#include <kiwano/common/basic_json.hpp>
|
||||||
#include <kiwano/core/core.h>
|
#include <kiwano/common/common.h>
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -72,23 +72,21 @@
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// base
|
// core
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <kiwano/base/time.h>
|
#include <kiwano/core/time.h>
|
||||||
#include <kiwano/base/Window.h>
|
#include <kiwano/core/Director.h>
|
||||||
#include <kiwano/base/input.h>
|
#include <kiwano/core/Logger.h>
|
||||||
#include <kiwano/base/Director.h>
|
#include <kiwano/core/SmartPtr.hpp>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/ObjectBase.h>
|
||||||
#include <kiwano/base/SmartPtr.hpp>
|
#include <kiwano/core/Event.h>
|
||||||
#include <kiwano/base/ObjectBase.h>
|
#include <kiwano/core/EventListener.h>
|
||||||
#include <kiwano/base/Event.h>
|
#include <kiwano/core/EventDispatcher.h>
|
||||||
#include <kiwano/base/EventListener.h>
|
#include <kiwano/core/Timer.h>
|
||||||
#include <kiwano/base/EventDispatcher.h>
|
#include <kiwano/core/TimerManager.h>
|
||||||
#include <kiwano/base/Timer.h>
|
#include <kiwano/core/AsyncTask.h>
|
||||||
#include <kiwano/base/TimerManager.h>
|
#include <kiwano/core/Resource.h>
|
||||||
#include <kiwano/base/AsyncTask.h>
|
|
||||||
#include <kiwano/base/Resource.h>
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -129,6 +127,9 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <kiwano/platform/modules.h>
|
#include <kiwano/platform/modules.h>
|
||||||
|
#include <kiwano/platform/FileSystem.h>
|
||||||
|
#include <kiwano/platform/Input.h>
|
||||||
|
#include <kiwano/platform/Window.h>
|
||||||
#include <kiwano/platform/Application.h>
|
#include <kiwano/platform/Application.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -136,7 +137,7 @@
|
||||||
// utils
|
// utils
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <kiwano/utils/FileSystem.h>
|
#include <kiwano/utils/UserData.h>
|
||||||
#include <kiwano/utils/LocalStorage.h>
|
#include <kiwano/utils/LocalStorage.h>
|
||||||
#include <kiwano/utils/ResourceCache.h>
|
#include <kiwano/utils/ResourceCache.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/core/core.h>
|
#include <kiwano/common/common.h>
|
||||||
#include <kiwano/math/constants.h>
|
#include <kiwano/math/constants.h>
|
||||||
#include <kiwano/math/ease.h>
|
#include <kiwano/math/ease.h>
|
||||||
#include <kiwano/math/scalar.h>
|
#include <kiwano/math/scalar.h>
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ namespace kiwano
|
||||||
inline float Sqrt(float val) { return ::sqrtf(val); }
|
inline float Sqrt(float val) { return ::sqrtf(val); }
|
||||||
inline double Sqrt(double val) { return ::sqrt(val); }
|
inline double Sqrt(double val) { return ::sqrt(val); }
|
||||||
|
|
||||||
inline float Pow(float base, float exponent) { return ::powf(base, exponent); }
|
inline float Pow(float core, float exponent) { return ::powf(core, exponent); }
|
||||||
inline double Pow(double base, double exponent) { return ::pow(base, exponent); }
|
inline double Pow(double core, double exponent) { return ::pow(core, exponent); }
|
||||||
|
|
||||||
inline int Sign(int val) { return val < 0 ? -1 : 1; }
|
inline int Sign(int val) { return val < 0 ? -1 : 1; }
|
||||||
inline float Sign(float val) { return val < 0 ? -1.f : 1.f; }
|
inline float Sign(float val) { return val < 0 ? -1.f : 1.f; }
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,9 @@
|
||||||
|
|
||||||
#include <kiwano/platform/Application.h>
|
#include <kiwano/platform/Application.h>
|
||||||
#include <kiwano/platform/modules.h>
|
#include <kiwano/platform/modules.h>
|
||||||
#include <kiwano/base/win32/helper.h>
|
#include <kiwano/core/win32/helper.h>
|
||||||
#include <kiwano/base/input.h>
|
#include <kiwano/platform/Input.h>
|
||||||
#include <kiwano/base/Director.h>
|
#include <kiwano/core/Director.h>
|
||||||
#include <kiwano/renderer/TextureCache.h>
|
#include <kiwano/renderer/TextureCache.h>
|
||||||
#include <kiwano/utils/ResourceCache.h>
|
#include <kiwano/utils/ResourceCache.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,11 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/core/core.h>
|
#include <kiwano/common/common.h>
|
||||||
#include <kiwano/base/time.h>
|
#include <kiwano/core/time.h>
|
||||||
#include <kiwano/base/Component.h>
|
#include <kiwano/core/Component.h>
|
||||||
#include <kiwano/base/Event.h>
|
#include <kiwano/core/Event.h>
|
||||||
#include <kiwano/base/Window.h>
|
#include <kiwano/platform/Window.h>
|
||||||
#include <kiwano/renderer/Renderer.h>
|
#include <kiwano/renderer/Renderer.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
@ -50,7 +50,7 @@ namespace kiwano
|
||||||
|
|
||||||
// 应用
|
// 应用
|
||||||
class KGE_API Application
|
class KGE_API Application
|
||||||
: protected core::noncopyable
|
: protected common::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Application();
|
Application();
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/utils/FileSystem.h>
|
#include <kiwano/platform/FileSystem.h>
|
||||||
#include <kiwano/platform/modules.h>
|
#include <kiwano/platform/modules.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/base/Resource.h>
|
#include <kiwano/core/Resource.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/base/input.h>
|
#include <kiwano/platform/Input.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
#include <windowsx.h> // GET_X_LPARAM, GET_Y_LPARAM
|
#include <windowsx.h> // GET_X_LPARAM, GET_Y_LPARAM
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
@ -20,10 +20,10 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/macros.h>
|
#include <kiwano/macros.h>
|
||||||
#include <kiwano/core/core.h>
|
#include <kiwano/common/common.h>
|
||||||
#include <kiwano/math/math.h>
|
#include <kiwano/math/math.h>
|
||||||
#include <kiwano/base/keys.hpp>
|
#include <kiwano/core/keys.h>
|
||||||
#include <kiwano/base/Component.h>
|
#include <kiwano/core/Component.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/base/Window.h>
|
#include <kiwano/platform/Window.h>
|
||||||
#include <kiwano/base/win32/helper.h>
|
#include <kiwano/core/win32/helper.h>
|
||||||
#include <kiwano/platform/Application.h>
|
#include <kiwano/platform/Application.h>
|
||||||
|
|
||||||
#define WINDOW_FIXED_STYLE WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX
|
#define WINDOW_FIXED_STYLE WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/macros.h>
|
#include <kiwano/macros.h>
|
||||||
#include <kiwano/core/core.h>
|
#include <kiwano/common/common.h>
|
||||||
#include <kiwano/math/math.h>
|
#include <kiwano/math/math.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/platform/modules.h>
|
#include <kiwano/platform/modules.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/macros.h>
|
#include <kiwano/macros.h>
|
||||||
#include <kiwano/base/Library.h>
|
#include <kiwano/core/Library.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include <kiwano/renderer/Brush.h>
|
#include <kiwano/renderer/Brush.h>
|
||||||
#include <kiwano/renderer/Renderer.h>
|
#include <kiwano/renderer/Renderer.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/macros.h>
|
#include <kiwano/macros.h>
|
||||||
#include <kiwano/core/core.h>
|
#include <kiwano/common/common.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/base/Resource.h>
|
#include <kiwano/core/Resource.h>
|
||||||
#include <kiwano/base/win32/ComPtr.hpp>
|
#include <kiwano/core/win32/ComPtr.hpp>
|
||||||
#include <dwrite.h>
|
#include <dwrite.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include <kiwano/renderer/Geometry.h>
|
#include <kiwano/renderer/Geometry.h>
|
||||||
#include <kiwano/renderer/Renderer.h>
|
#include <kiwano/renderer/Renderer.h>
|
||||||
#include <kiwano/base/win32/helper.h>
|
#include <kiwano/core/win32/helper.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ namespace kiwano
|
||||||
|
|
||||||
// 几何体生成器
|
// 几何体生成器
|
||||||
class KGE_API GeometrySink
|
class KGE_API GeometrySink
|
||||||
: protected core::noncopyable
|
: protected common::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GeometrySink();
|
GeometrySink();
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include <kiwano/renderer/GifImage.h>
|
#include <kiwano/renderer/GifImage.h>
|
||||||
#include <kiwano/renderer/Renderer.h>
|
#include <kiwano/renderer/Renderer.h>
|
||||||
#include <kiwano/base/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/renderer/Texture.h>
|
#include <kiwano/renderer/Texture.h>
|
||||||
#include <kiwano/base/time.h>
|
#include <kiwano/core/time.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/renderer/RenderTarget.h>
|
#include <kiwano/renderer/RenderTarget.h>
|
||||||
#include <kiwano/base/win32/helper.h>
|
#include <kiwano/core/win32/helper.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue