소스 검색

Create a Base directory for non-Container code.

Avoid a situation where all code is thrown in the Container directory simply because there is no other place for it.
Separate code into speciffic headers to make headers more intuitive.
Sandu Liviu Catalin 6 년 전
부모
커밋
f312ef8bb0
4개의 변경된 파일78개의 추가작업 그리고 47개의 파일을 삭제
  1. 76 0
      Source/Urho3D/Base/Algorithm.h
  2. 0 46
      Source/Urho3D/Base/Iter.h
  3. 1 1
      Source/Urho3D/Container/VectorBase.h
  4. 1 0
      Source/Urho3D/Engine/Console.cpp

+ 76 - 0
Source/Urho3D/Base/Algorithm.h

@@ -0,0 +1,76 @@
+//
+// Copyright (c) 2008-2019 the Urho3D project.
+//
+// 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 "../Urho3DConfig.h"
+
+namespace Urho3D
+{
+
+/// Returns an iterator pointing to the first element in the range [first, last) that is not less than value.
+template <class TRandomAccessIterator, class T>
+TRandomAccessIterator LowerBound(TRandomAccessIterator first, TRandomAccessIterator last, const T& value)
+{
+    unsigned count = last - first;
+
+    while (count > 0)
+    {
+        const unsigned step = count / 2;
+        const TRandomAccessIterator it = first + step;
+        if (*it < value)
+        {
+            first = it + 1;
+            count -= step + 1;
+        }
+        else
+        {
+            count = step;
+        }
+    }
+    return first;
+}
+
+/// Returns an iterator pointing to the first element in the range [first, last) that is greater than value.
+template <class TRandomAccessIterator, class T>
+TRandomAccessIterator UpperBound(TRandomAccessIterator first, TRandomAccessIterator last, const T& value)
+{
+    unsigned count = last - first;
+
+    while (count > 0)
+    {
+        const unsigned step = count / 2;
+        const TRandomAccessIterator it = first + step;
+        if (!(value < *it))
+        {
+            first = it + 1;
+            count -= step + 1;
+        }
+        else
+        {
+            count = step;
+        };
+    }
+    return first;
+}
+
+}

+ 0 - 46
Source/Urho3D/Container/Iter.h → Source/Urho3D/Base/Iter.h

@@ -232,50 +232,4 @@ template <class T> struct RandomAccessConstIterator
     const T* ptr_;
     const T* ptr_;
 };
 };
 
 
-/// Returns an iterator pointing to the first element in the range [first, last) that is not less than value.
-template <class TRandomAccessIterator, class T>
-TRandomAccessIterator LowerBound(TRandomAccessIterator first, TRandomAccessIterator last, const T& value)
-{
-    unsigned count = last - first;
-
-    while (count > 0)
-    {
-        const unsigned step = count / 2;
-        const TRandomAccessIterator it = first + step;
-        if (*it < value)
-        {
-            first = it + 1;
-            count -= step + 1;
-        }
-        else
-        {
-            count = step;
-        }
-    }
-    return first;
-}
-
-/// Returns an iterator pointing to the first element in the range [first, last) that is greater than value.
-template <class TRandomAccessIterator, class T>
-TRandomAccessIterator UpperBound(TRandomAccessIterator first, TRandomAccessIterator last, const T& value)
-{
-    unsigned count = last - first;
-
-    while (count > 0)
-    {
-        const unsigned step = count / 2;
-        const TRandomAccessIterator it = first + step;
-        if (!(value < *it))
-        {
-            first = it + 1;
-            count -= step + 1;
-        }
-        else
-        {
-            count = step;
-        };
-    }
-    return first;
-}
-
 }
 }

+ 1 - 1
Source/Urho3D/Container/VectorBase.h

@@ -28,7 +28,7 @@
 #include <Urho3D/Urho3D.h>
 #include <Urho3D/Urho3D.h>
 #endif
 #endif
 
 
-#include "../Container/Iter.h"
+#include "../Base/Iter.h"
 #include "../Container/Swap.h"
 #include "../Container/Swap.h"
 
 
 namespace Urho3D
 namespace Urho3D

+ 1 - 0
Source/Urho3D/Engine/Console.cpp

@@ -23,6 +23,7 @@
 #include "../Precompiled.h"
 #include "../Precompiled.h"
 
 
 #include "../Core/Context.h"
 #include "../Core/Context.h"
+#include "../Base/Algorithm.h"
 #include "../Core/CoreEvents.h"
 #include "../Core/CoreEvents.h"
 #include "../Engine/Console.h"
 #include "../Engine/Console.h"
 #include "../Engine/EngineEvents.h"
 #include "../Engine/EngineEvents.h"