| [148] | 1 | /*------------------------------------------------------------------------- | 
|---|
 | 2 | This source file is a part of OGRE | 
|---|
 | 3 | (Object-oriented Graphics Rendering Engine) | 
|---|
 | 4 |  | 
|---|
 | 5 | For the latest info, see http://www.ogre3d.org/ | 
|---|
 | 6 |  | 
|---|
 | 7 | Copyright (c) 2000-2013 Torus Knot Software Ltd | 
|---|
 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy | 
|---|
 | 9 | of this software and associated documentation files (the "Software"), to deal | 
|---|
 | 10 | in the Software without restriction, including without limitation the rights | 
|---|
 | 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | 
|---|
 | 12 | copies of the Software, and to permit persons to whom the Software is | 
|---|
 | 13 | furnished to do so, subject to the following conditions: | 
|---|
 | 14 |  | 
|---|
 | 15 | The above copyright notice and this permission notice shall be included in | 
|---|
 | 16 | all copies or substantial portions of the Software. | 
|---|
 | 17 |  | 
|---|
 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 
|---|
 | 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 
|---|
 | 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 
|---|
 | 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 
|---|
 | 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 
|---|
 | 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | 
|---|
 | 24 | THE SOFTWARE | 
|---|
 | 25 | -------------------------------------------------------------------------*/ | 
|---|
 | 26 | #ifndef __OgrePrerequisites_H__ | 
|---|
 | 27 | #define __OgrePrerequisites_H__ | 
|---|
 | 28 |  | 
|---|
 | 29 | // Platform-specific stuff | 
|---|
 | 30 | #include "OgrePlatform.h" | 
|---|
 | 31 |  | 
|---|
 | 32 | #include <string> | 
|---|
 | 33 |  | 
|---|
 | 34 | // configure memory tracking | 
|---|
 | 35 | #if OGRE_DEBUG_MODE  | 
|---|
 | 36 | #       if OGRE_MEMORY_TRACKER_DEBUG_MODE | 
|---|
 | 37 | #        define OGRE_MEMORY_TRACKER 1 | 
|---|
 | 38 | #       else | 
|---|
 | 39 | #        define OGRE_MEMORY_TRACKER 0 | 
|---|
 | 40 | #       endif | 
|---|
 | 41 | #else | 
|---|
 | 42 | #       if OGRE_MEMORY_TRACKER_RELEASE_MODE | 
|---|
 | 43 | #        define OGRE_MEMORY_TRACKER 1 | 
|---|
 | 44 | #       else | 
|---|
 | 45 | #        define OGRE_MEMORY_TRACKER 0 | 
|---|
 | 46 | #       endif | 
|---|
 | 47 | #endif | 
|---|
 | 48 |  | 
|---|
 | 49 | namespace Ogre { | 
|---|
 | 50 |     // Define ogre version | 
|---|
 | 51 |     #define OGRE_VERSION_MAJOR 1 | 
|---|
 | 52 |     #define OGRE_VERSION_MINOR 9 | 
|---|
 | 53 |     #define OGRE_VERSION_PATCH 0 | 
|---|
 | 54 |         #define OGRE_VERSION_SUFFIX "" | 
|---|
 | 55 |     #define OGRE_VERSION_NAME "Ghadamon" | 
|---|
 | 56 |  | 
|---|
 | 57 |     #define OGRE_VERSION    ((OGRE_VERSION_MAJOR << 16) | (OGRE_VERSION_MINOR << 8) | OGRE_VERSION_PATCH) | 
|---|
 | 58 |  | 
|---|
 | 59 |     // define the real number values to be used | 
|---|
 | 60 |     // default to use 'float' unless precompiler option set | 
|---|
 | 61 |     #if OGRE_DOUBLE_PRECISION == 1 | 
|---|
 | 62 |         /** Software floating point type. | 
|---|
 | 63 |         @note Not valid as a pointer to GPU buffers / parameters | 
|---|
 | 64 |         */ | 
|---|
 | 65 |         typedef double Real; | 
|---|
 | 66 |     #else | 
|---|
 | 67 |         /** Software floating point type. | 
|---|
 | 68 |         @note Not valid as a pointer to GPU buffers / parameters | 
|---|
 | 69 |         */ | 
|---|
 | 70 |         typedef float Real; | 
|---|
 | 71 |     #endif | 
|---|
 | 72 |  | 
|---|
 | 73 |     #if OGRE_COMPILER == OGRE_COMPILER_GNUC && OGRE_COMP_VER >= 310 && !defined(STLPORT) | 
|---|
 | 74 |         #   if OGRE_COMP_VER >= 430 | 
|---|
 | 75 |         #       define HashMap ::std::tr1::unordered_map | 
|---|
 | 76 |         #       define HashSet ::std::tr1::unordered_set | 
|---|
 | 77 |         #    else | 
|---|
 | 78 |         #       define HashMap ::__gnu_cxx::hash_map | 
|---|
 | 79 |         #       define HashSet ::__gnu_cxx::hash_set | 
|---|
 | 80 |         #    endif | 
|---|
 | 81 |     #elif OGRE_COMPILER == OGRE_COMPILER_CLANG | 
|---|
 | 82 |     #    if defined(_LIBCPP_VERSION) | 
|---|
 | 83 |     #       define HashMap ::std::unordered_map | 
|---|
 | 84 |     #       define HashSet ::std::unordered_set | 
|---|
 | 85 |     #    else | 
|---|
 | 86 |     #       define HashMap ::std::tr1::unordered_map | 
|---|
 | 87 |     #       define HashSet ::std::tr1::unordered_set | 
|---|
 | 88 |     #    endif | 
|---|
 | 89 |     #else | 
|---|
 | 90 |     #   if OGRE_COMPILER == OGRE_COMPILER_MSVC && !defined(_STLP_MSVC) | 
|---|
 | 91 |     #       if _MSC_FULL_VER >= 150030729 // VC++ 9.0 SP1+ | 
|---|
 | 92 |     #           define HashMap ::std::tr1::unordered_map | 
|---|
 | 93 |     #           define HashSet ::std::tr1::unordered_set | 
|---|
 | 94 |     #       elif OGRE_THREAD_PROVIDER == 1 | 
|---|
 | 95 |     #           define HashMap ::boost::unordered_map | 
|---|
 | 96 |     #           define HashSet ::boost::unordered_set | 
|---|
 | 97 |     #       else | 
|---|
 | 98 |     #           define HashMap ::std::unordered_map | 
|---|
 | 99 |     #           define HashSet ::std::unordered_set | 
|---|
 | 100 |     #       endif | 
|---|
 | 101 |     #   else | 
|---|
 | 102 |     #       define HashMap ::std::unordered_map | 
|---|
 | 103 |         #       define HashSet ::std::unordered_set | 
|---|
 | 104 |     #   endif | 
|---|
 | 105 |     #endif | 
|---|
 | 106 |  | 
|---|
 | 107 |     #define OGRE_DEFINE_STATIC_LOCAL(type, name, arguments) \ | 
|---|
 | 108 |         static type& name = *new type arguments | 
|---|
 | 109 |  | 
|---|
 | 110 |     /** In order to avoid finger-aches :) | 
|---|
 | 111 |     */ | 
|---|
 | 112 |     typedef unsigned char uchar; | 
|---|
 | 113 |     typedef unsigned short ushort; | 
|---|
 | 114 |     typedef unsigned int uint; | 
|---|
 | 115 |         typedef unsigned long ulong; | 
|---|
 | 116 |  | 
|---|
 | 117 | // Pre-declare classes | 
|---|
 | 118 | // Allows use of pointers in header files without including individual .h | 
|---|
 | 119 | // so decreases dependencies between files | 
|---|
 | 120 |     class Angle; | 
|---|
 | 121 |     class Animation; | 
|---|
 | 122 |     class AnimationState; | 
|---|
 | 123 |     class AnimationStateSet; | 
|---|
 | 124 |     class AnimationTrack; | 
|---|
 | 125 |     class Archive; | 
|---|
 | 126 |     class ArchiveFactory; | 
|---|
 | 127 |     class ArchiveManager; | 
|---|
 | 128 |     class AutoParamDataSource; | 
|---|
 | 129 |     class AxisAlignedBox; | 
|---|
 | 130 |     class AxisAlignedBoxSceneQuery; | 
|---|
 | 131 |     class Billboard; | 
|---|
 | 132 |     class BillboardChain; | 
|---|
 | 133 |     class BillboardSet; | 
|---|
 | 134 |     class Bone; | 
|---|
 | 135 |     class Camera; | 
|---|
 | 136 |     class Codec; | 
|---|
 | 137 |     class ColourValue; | 
|---|
 | 138 |     class ConfigDialog; | 
|---|
 | 139 |     template <typename T> class Controller; | 
|---|
 | 140 |     template <typename T> class ControllerFunction; | 
|---|
 | 141 |     class ControllerManager; | 
|---|
 | 142 |     template <typename T> class ControllerValue; | 
|---|
 | 143 |         class DefaultWorkQueue; | 
|---|
 | 144 |     class Degree; | 
|---|
 | 145 |         class DepthBuffer; | 
|---|
 | 146 |     class DynLib; | 
|---|
 | 147 |     class DynLibManager; | 
|---|
 | 148 |     class EdgeData; | 
|---|
 | 149 |     class EdgeListBuilder; | 
|---|
 | 150 |     class Entity; | 
|---|
 | 151 |     class ErrorDialog; | 
|---|
 | 152 |     class ExternalTextureSourceManager; | 
|---|
 | 153 |     class Factory; | 
|---|
 | 154 |     struct FrameEvent; | 
|---|
 | 155 |     class FrameListener; | 
|---|
 | 156 |     class Frustum; | 
|---|
 | 157 |     class GpuProgram; | 
|---|
 | 158 |     class GpuProgramManager; | 
|---|
 | 159 |         class GpuProgramUsage; | 
|---|
 | 160 |     class HardwareIndexBuffer; | 
|---|
 | 161 |     class HardwareOcclusionQuery; | 
|---|
 | 162 |     class HardwareVertexBuffer; | 
|---|
 | 163 |         class HardwarePixelBuffer; | 
|---|
 | 164 |     class HardwarePixelBufferSharedPtr; | 
|---|
 | 165 |         class HighLevelGpuProgram; | 
|---|
 | 166 |         class HighLevelGpuProgramManager; | 
|---|
 | 167 |         class HighLevelGpuProgramFactory; | 
|---|
 | 168 |     class IndexData; | 
|---|
 | 169 |         class InstanceBatch; | 
|---|
 | 170 |         class InstanceBatchHW; | 
|---|
 | 171 |         class InstanceBatchHW_VTF; | 
|---|
 | 172 |         class InstanceBatchShader; | 
|---|
 | 173 |         class InstanceBatchVTF; | 
|---|
 | 174 |         class InstanceManager; | 
|---|
 | 175 |         class InstancedEntity; | 
|---|
 | 176 |     class IntersectionSceneQuery; | 
|---|
 | 177 |     class IntersectionSceneQueryListener; | 
|---|
 | 178 |     class Image; | 
|---|
 | 179 |     class KeyFrame; | 
|---|
 | 180 |     class Light; | 
|---|
 | 181 |     class Log; | 
|---|
 | 182 |     class LogManager; | 
|---|
 | 183 |         class LodStrategy; | 
|---|
 | 184 |         class ManualResourceLoader; | 
|---|
 | 185 |         class ManualObject; | 
|---|
 | 186 |     class Material; | 
|---|
 | 187 |     class MaterialManager; | 
|---|
 | 188 |     class Math; | 
|---|
 | 189 |     class Matrix3; | 
|---|
 | 190 |     class Matrix4; | 
|---|
 | 191 |     class MemoryManager; | 
|---|
 | 192 |     class Mesh; | 
|---|
 | 193 |     class MeshSerializer; | 
|---|
 | 194 |     class MeshSerializerImpl; | 
|---|
 | 195 |     class MeshManager; | 
|---|
 | 196 |     class MovableObject; | 
|---|
 | 197 |     class MovablePlane; | 
|---|
 | 198 |     class Node; | 
|---|
 | 199 |         class NodeAnimationTrack; | 
|---|
 | 200 |         class NodeKeyFrame; | 
|---|
 | 201 |         class NumericAnimationTrack; | 
|---|
 | 202 |         class NumericKeyFrame; | 
|---|
 | 203 |     class Particle; | 
|---|
 | 204 |     class ParticleAffector; | 
|---|
 | 205 |     class ParticleAffectorFactory; | 
|---|
 | 206 |     class ParticleEmitter; | 
|---|
 | 207 |     class ParticleEmitterFactory; | 
|---|
 | 208 |     class ParticleSystem; | 
|---|
 | 209 |     class ParticleSystemManager; | 
|---|
 | 210 |     class ParticleSystemRenderer; | 
|---|
 | 211 |     class ParticleSystemRendererFactory; | 
|---|
 | 212 |     class ParticleVisualData; | 
|---|
 | 213 |     class Pass; | 
|---|
 | 214 |     class PatchMesh; | 
|---|
 | 215 |     class PixelBox; | 
|---|
 | 216 |     class Plane; | 
|---|
 | 217 |     class PlaneBoundedVolume; | 
|---|
 | 218 |     class Plugin; | 
|---|
 | 219 |     class PMWorker; | 
|---|
 | 220 |     class PMInjector; | 
|---|
 | 221 |     class Pose; | 
|---|
 | 222 |     class ProgressiveMeshGenerator; | 
|---|
 | 223 |     class Profile; | 
|---|
 | 224 |         class Profiler; | 
|---|
 | 225 |     class Quaternion; | 
|---|
 | 226 |         class Radian; | 
|---|
 | 227 |     class Ray; | 
|---|
 | 228 |     class RaySceneQuery; | 
|---|
 | 229 |     class RaySceneQueryListener; | 
|---|
 | 230 |     class Renderable; | 
|---|
 | 231 |     class RenderPriorityGroup; | 
|---|
 | 232 |     class RenderQueue; | 
|---|
 | 233 |     class RenderQueueGroup; | 
|---|
 | 234 |         class RenderQueueInvocation; | 
|---|
 | 235 |         class RenderQueueInvocationSequence; | 
|---|
 | 236 |     class RenderQueueListener; | 
|---|
 | 237 |         class RenderObjectListener; | 
|---|
 | 238 |     class RenderSystem; | 
|---|
 | 239 |     class RenderSystemCapabilities; | 
|---|
 | 240 |     class RenderSystemCapabilitiesManager; | 
|---|
 | 241 |     class RenderSystemCapabilitiesSerializer; | 
|---|
 | 242 |     class RenderTarget; | 
|---|
 | 243 |     class RenderTargetListener; | 
|---|
 | 244 |     class RenderTexture; | 
|---|
 | 245 |         class MultiRenderTarget; | 
|---|
 | 246 |     class RenderWindow; | 
|---|
 | 247 |     class RenderOperation; | 
|---|
 | 248 |     class Resource; | 
|---|
 | 249 |         class ResourceBackgroundQueue; | 
|---|
 | 250 |         class ResourceGroupManager; | 
|---|
 | 251 |     class ResourceManager; | 
|---|
 | 252 |     class RibbonTrail; | 
|---|
 | 253 |         class Root; | 
|---|
 | 254 |     class SceneManager; | 
|---|
 | 255 |     class SceneManagerEnumerator; | 
|---|
 | 256 |     class SceneNode; | 
|---|
 | 257 |     class SceneQuery; | 
|---|
 | 258 |     class SceneQueryListener; | 
|---|
 | 259 |         class ScriptCompiler; | 
|---|
 | 260 |         class ScriptCompilerManager; | 
|---|
 | 261 |         class ScriptLoader; | 
|---|
 | 262 |     class Serializer; | 
|---|
 | 263 |     class ShadowCaster; | 
|---|
 | 264 |     class ShadowRenderable; | 
|---|
 | 265 |         class ShadowTextureManager; | 
|---|
 | 266 |     class SimpleRenderable; | 
|---|
 | 267 |     class SimpleSpline; | 
|---|
 | 268 |     class Skeleton; | 
|---|
 | 269 |     class SkeletonInstance; | 
|---|
 | 270 |     class SkeletonManager; | 
|---|
 | 271 |     class Sphere; | 
|---|
 | 272 |     class SphereSceneQuery; | 
|---|
 | 273 |         class StaticGeometry; | 
|---|
 | 274 |         class StreamSerialiser; | 
|---|
 | 275 |     class StringConverter; | 
|---|
 | 276 |     class StringInterface; | 
|---|
 | 277 |     class SubEntity; | 
|---|
 | 278 |     class SubMesh; | 
|---|
 | 279 |         class TagPoint; | 
|---|
 | 280 |     class Technique; | 
|---|
 | 281 |         class TempBlendedBufferInfo; | 
|---|
 | 282 |         class ExternalTextureSource; | 
|---|
 | 283 |     class TextureUnitState; | 
|---|
 | 284 |     class Texture; | 
|---|
 | 285 |     class TextureManager; | 
|---|
 | 286 |     class TransformKeyFrame; | 
|---|
 | 287 |         class Timer; | 
|---|
 | 288 |         class UserObjectBindings; | 
|---|
 | 289 |     class Vector2; | 
|---|
 | 290 |     class Vector3; | 
|---|
 | 291 |     class Vector4; | 
|---|
 | 292 |     class Viewport; | 
|---|
 | 293 |         class VertexAnimationTrack; | 
|---|
 | 294 |     class VertexBufferBinding; | 
|---|
 | 295 |     class VertexData; | 
|---|
 | 296 |     class VertexDeclaration; | 
|---|
 | 297 |         class VertexMorphKeyFrame; | 
|---|
 | 298 |     class WireBoundingBox; | 
|---|
 | 299 |         class WorkQueue; | 
|---|
 | 300 |     class Compositor; | 
|---|
 | 301 |     class CompositorManager; | 
|---|
 | 302 |     class CompositorChain; | 
|---|
 | 303 |     class CompositorInstance; | 
|---|
 | 304 |         class CompositorLogic; | 
|---|
 | 305 |     class CompositionTechnique; | 
|---|
 | 306 |     class CompositionPass; | 
|---|
 | 307 |     class CompositionTargetPass; | 
|---|
 | 308 |         class CustomCompositionPass; | 
|---|
 | 309 |  | 
|---|
 | 310 |     template<typename T> class SharedPtr; | 
|---|
 | 311 |     typedef SharedPtr<Compositor> CompositorPtr; | 
|---|
 | 312 |     typedef SharedPtr<GpuProgram> GpuProgramPtr; | 
|---|
 | 313 |     typedef SharedPtr<HighLevelGpuProgram> HighLevelGpuProgramPtr; | 
|---|
 | 314 |     typedef SharedPtr<Material> MaterialPtr; | 
|---|
 | 315 |     typedef SharedPtr<Mesh> MeshPtr; | 
|---|
 | 316 |     typedef SharedPtr<PatchMesh> PatchMeshPtr; | 
|---|
 | 317 |     typedef SharedPtr<Resource> ResourcePtr; | 
|---|
 | 318 |     typedef SharedPtr<Skeleton> SkeletonPtr; | 
|---|
 | 319 |     typedef SharedPtr<Texture> TexturePtr; | 
|---|
 | 320 | } | 
|---|
 | 321 |  | 
|---|
 | 322 | /* Include all the standard header *after* all the configuration | 
|---|
 | 323 | settings have been made. | 
|---|
 | 324 | */ | 
|---|
 | 325 | #include "OgreStdHeaders.h" | 
|---|
 | 326 | #include "OgreMemoryAllocatorConfig.h" | 
|---|
 | 327 |  | 
|---|
 | 328 |  | 
|---|
 | 329 | namespace Ogre | 
|---|
 | 330 | { | 
|---|
 | 331 | #if OGRE_STRING_USE_CUSTOM_MEMORY_ALLOCATOR | 
|---|
 | 332 |     typedef std::basic_string<char, std::char_traits<char>, STLAllocator<char,GeneralAllocPolicy > >        _StringBase; | 
|---|
 | 333 |     typedef std::basic_stringstream<char,std::char_traits<char>,STLAllocator<char,GeneralAllocPolicy > >    _StringStreamBase; | 
|---|
 | 334 |  | 
|---|
 | 335 |         #define StdStringT(T) std::basic_string<T, std::char_traits<T>, std::allocator<T> >      | 
|---|
 | 336 |         #define CustomMemoryStringT(T) std::basic_string<T, std::char_traits<T>, STLAllocator<T,GeneralAllocPolicy> >    | 
|---|
 | 337 |  | 
|---|
 | 338 |         template<typename T> | 
|---|
 | 339 |         bool operator <(const CustomMemoryStringT(T)& l,const StdStringT(T)& o) | 
|---|
 | 340 |         { | 
|---|
 | 341 |         return l.compare(0,l.length(),o.c_str(),o.length())<0; | 
|---|
 | 342 |         } | 
|---|
 | 343 |         template<typename T> | 
|---|
 | 344 |         bool operator <(const StdStringT(T)& l,const CustomMemoryStringT(T)& o) | 
|---|
 | 345 |         { | 
|---|
 | 346 |         return l.compare(0,l.length(),o.c_str(),o.length())<0; | 
|---|
 | 347 |         } | 
|---|
 | 348 |         template<typename T> | 
|---|
 | 349 |         bool operator <=(const CustomMemoryStringT(T)& l,const StdStringT(T)& o) | 
|---|
 | 350 |         { | 
|---|
 | 351 |         return l.compare(0,l.length(),o.c_str(),o.length())<=0; | 
|---|
 | 352 |         } | 
|---|
 | 353 |         template<typename T> | 
|---|
 | 354 |         bool operator <=(const StdStringT(T)& l,const CustomMemoryStringT(T)& o) | 
|---|
 | 355 |         { | 
|---|
 | 356 |         return l.compare(0,l.length(),o.c_str(),o.length())<=0; | 
|---|
 | 357 |         } | 
|---|
 | 358 |         template<typename T> | 
|---|
 | 359 |         bool operator >(const CustomMemoryStringT(T)& l,const StdStringT(T)& o) | 
|---|
 | 360 |         { | 
|---|
 | 361 |         return l.compare(0,l.length(),o.c_str(),o.length())>0; | 
|---|
 | 362 |         } | 
|---|
 | 363 |         template<typename T> | 
|---|
 | 364 |         bool operator >(const StdStringT(T)& l,const CustomMemoryStringT(T)& o) | 
|---|
 | 365 |         { | 
|---|
 | 366 |         return l.compare(0,l.length(),o.c_str(),o.length())>0; | 
|---|
 | 367 |         } | 
|---|
 | 368 |         template<typename T> | 
|---|
 | 369 |         bool operator >=(const CustomMemoryStringT(T)& l,const StdStringT(T)& o) | 
|---|
 | 370 |         { | 
|---|
 | 371 |         return l.compare(0,l.length(),o.c_str(),o.length())>=0; | 
|---|
 | 372 |         } | 
|---|
 | 373 |         template<typename T> | 
|---|
 | 374 |         bool operator >=(const StdStringT(T)& l,const CustomMemoryStringT(T)& o) | 
|---|
 | 375 |         { | 
|---|
 | 376 |         return l.compare(0,l.length(),o.c_str(),o.length())>=0; | 
|---|
 | 377 |         } | 
|---|
 | 378 |  | 
|---|
 | 379 |         template<typename T> | 
|---|
 | 380 |         bool operator ==(const CustomMemoryStringT(T)& l,const StdStringT(T)& o) | 
|---|
 | 381 |         { | 
|---|
 | 382 |         return l.compare(0,l.length(),o.c_str(),o.length())==0; | 
|---|
 | 383 |         } | 
|---|
 | 384 |         template<typename T> | 
|---|
 | 385 |         bool operator ==(const StdStringT(T)& l,const CustomMemoryStringT(T)& o) | 
|---|
 | 386 |         { | 
|---|
 | 387 |         return l.compare(0,l.length(),o.c_str(),o.length())==0; | 
|---|
 | 388 |         } | 
|---|
 | 389 |  | 
|---|
 | 390 |         template<typename T> | 
|---|
 | 391 |         bool operator !=(const CustomMemoryStringT(T)& l,const StdStringT(T)& o) | 
|---|
 | 392 |         { | 
|---|
 | 393 |         return l.compare(0,l.length(),o.c_str(),o.length())!=0; | 
|---|
 | 394 |         } | 
|---|
 | 395 |         template<typename T> | 
|---|
 | 396 |         bool operator !=(const StdStringT(T)& l,const CustomMemoryStringT(T)& o) | 
|---|
 | 397 |         { | 
|---|
 | 398 |         return l.compare(0,l.length(),o.c_str(),o.length())!=0; | 
|---|
 | 399 |         } | 
|---|
 | 400 |  | 
|---|
 | 401 |         template<typename T> | 
|---|
 | 402 |         CustomMemoryStringT(T) operator +=(const CustomMemoryStringT(T)& l,const StdStringT(T)& o) | 
|---|
 | 403 |         { | 
|---|
 | 404 |         return CustomMemoryStringT(T)(l)+=o.c_str(); | 
|---|
 | 405 |         } | 
|---|
 | 406 |         template<typename T> | 
|---|
 | 407 |         CustomMemoryStringT(T) operator +=(const StdStringT(T)& l,const CustomMemoryStringT(T)& o) | 
|---|
 | 408 |         { | 
|---|
 | 409 |         return CustomMemoryStringT(T)(l.c_str())+=o.c_str(); | 
|---|
 | 410 |         } | 
|---|
 | 411 |  | 
|---|
 | 412 |         template<typename T> | 
|---|
 | 413 |         CustomMemoryStringT(T) operator +(const CustomMemoryStringT(T)& l,const StdStringT(T)& o) | 
|---|
 | 414 |         { | 
|---|
 | 415 |         return CustomMemoryStringT(T)(l)+=o.c_str(); | 
|---|
 | 416 |         } | 
|---|
 | 417 |  | 
|---|
 | 418 |         template<typename T> | 
|---|
 | 419 |         CustomMemoryStringT(T) operator +(const StdStringT(T)& l,const CustomMemoryStringT(T)& o) | 
|---|
 | 420 |         { | 
|---|
 | 421 |         return CustomMemoryStringT(T)(l.c_str())+=o.c_str(); | 
|---|
 | 422 |         } | 
|---|
 | 423 |  | 
|---|
 | 424 |         template<typename T> | 
|---|
 | 425 |         CustomMemoryStringT(T) operator +(const T* l,const CustomMemoryStringT(T)& o) | 
|---|
 | 426 |         { | 
|---|
 | 427 |         return CustomMemoryStringT(T)(l)+=o; | 
|---|
 | 428 |         } | 
|---|
 | 429 |  | 
|---|
 | 430 |         #undef StdStringT | 
|---|
 | 431 |         #undef CustomMemoryStringT | 
|---|
 | 432 |  | 
|---|
 | 433 | #else | 
|---|
 | 434 |     typedef std::string _StringBase; | 
|---|
 | 435 |     typedef std::basic_stringstream<char,std::char_traits<char>,std::allocator<char> > _StringStreamBase; | 
|---|
 | 436 |  | 
|---|
 | 437 | #endif | 
|---|
 | 438 |  | 
|---|
 | 439 |         typedef _StringBase String; | 
|---|
 | 440 |         typedef _StringStreamBase StringStream; | 
|---|
 | 441 |         typedef StringStream stringstream; | 
|---|
 | 442 |  | 
|---|
 | 443 | } | 
|---|
 | 444 |  | 
|---|
 | 445 | #if OGRE_STRING_USE_CUSTOM_MEMORY_ALLOCATOR  | 
|---|
 | 446 | namespace std  | 
|---|
 | 447 | { | 
|---|
 | 448 | #if (OGRE_COMPILER == OGRE_COMPILER_GNUC && OGRE_COMP_VER >= 430) || OGRE_COMPILER == OGRE_COMPILER_CLANG && !defined(STLPORT) && __cplusplus < 201103L | 
|---|
 | 449 |         namespace tr1 | 
|---|
 | 450 |         { | 
|---|
 | 451 | #endif | 
|---|
 | 452 |     template <> struct hash<Ogre::String> | 
|---|
 | 453 |         { | 
|---|
 | 454 |     public : | 
|---|
 | 455 |         size_t operator()(const Ogre::String &str ) const | 
|---|
 | 456 |         { | 
|---|
 | 457 |                 size_t _Val = 2166136261U; | 
|---|
 | 458 |                 size_t _First = 0; | 
|---|
 | 459 |                 size_t _Last = str.size(); | 
|---|
 | 460 |                 size_t _Stride = 1 + _Last / 10; | 
|---|
 | 461 |  | 
|---|
 | 462 |                 for(; _First < _Last; _First += _Stride) | 
|---|
 | 463 |                 _Val = 16777619U * _Val ^ (size_t)str[_First]; | 
|---|
 | 464 |                 return (_Val); | 
|---|
 | 465 |         } | 
|---|
 | 466 |     }; | 
|---|
 | 467 | #if (OGRE_COMPILER == OGRE_COMPILER_GNUC && OGRE_COMP_VER >= 430) || OGRE_COMPILER == OGRE_COMPILER_CLANG && !defined(STLPORT) && __cplusplus < 201103L | 
|---|
 | 468 |         } | 
|---|
 | 469 | #endif | 
|---|
 | 470 | } | 
|---|
 | 471 | #endif | 
|---|
 | 472 |  | 
|---|
 | 473 | //for stl container | 
|---|
 | 474 | namespace Ogre | 
|---|
 | 475 | {  | 
|---|
 | 476 |         template <typename T, typename A = STLAllocator<T, GeneralAllocPolicy> >  | 
|---|
 | 477 |         struct deque  | 
|---|
 | 478 |         {  | 
|---|
 | 479 | #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR | 
|---|
 | 480 |         typedef typename std::deque<T, A> type;     | 
|---|
 | 481 |         typedef typename std::deque<T, A>::iterator iterator; | 
|---|
 | 482 |         typedef typename std::deque<T, A>::const_iterator const_iterator; | 
|---|
 | 483 | #else | 
|---|
 | 484 |         typedef typename std::deque<T> type; | 
|---|
 | 485 |         typedef typename std::deque<T>::iterator iterator; | 
|---|
 | 486 |         typedef typename std::deque<T>::const_iterator const_iterator; | 
|---|
 | 487 | #endif | 
|---|
 | 488 |         };  | 
|---|
 | 489 |  | 
|---|
 | 490 |         template <typename T, typename A = STLAllocator<T, GeneralAllocPolicy> >  | 
|---|
 | 491 |         struct vector  | 
|---|
 | 492 |         {  | 
|---|
 | 493 | #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR | 
|---|
 | 494 |         typedef typename std::vector<T, A> type; | 
|---|
 | 495 |         typedef typename std::vector<T, A>::iterator iterator; | 
|---|
 | 496 |         typedef typename std::vector<T, A>::const_iterator const_iterator; | 
|---|
 | 497 | #else | 
|---|
 | 498 |         typedef typename std::vector<T> type; | 
|---|
 | 499 |         typedef typename std::vector<T>::iterator iterator; | 
|---|
 | 500 |         typedef typename std::vector<T>::const_iterator const_iterator; | 
|---|
 | 501 | #endif | 
|---|
 | 502 |         };  | 
|---|
 | 503 |  | 
|---|
 | 504 |         template <typename T, typename A = STLAllocator<T, GeneralAllocPolicy> >  | 
|---|
 | 505 |         struct list  | 
|---|
 | 506 |         {  | 
|---|
 | 507 | #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR | 
|---|
 | 508 |         typedef typename std::list<T, A> type; | 
|---|
 | 509 |         typedef typename std::list<T, A>::iterator iterator; | 
|---|
 | 510 |         typedef typename std::list<T, A>::const_iterator const_iterator; | 
|---|
 | 511 | #else | 
|---|
 | 512 |         typedef typename std::list<T> type; | 
|---|
 | 513 |         typedef typename std::list<T>::iterator iterator; | 
|---|
 | 514 |         typedef typename std::list<T>::const_iterator const_iterator; | 
|---|
 | 515 | #endif | 
|---|
 | 516 |         };  | 
|---|
 | 517 |  | 
|---|
 | 518 |         template <typename T, typename P = std::less<T>, typename A = STLAllocator<T, GeneralAllocPolicy> >  | 
|---|
 | 519 |         struct set  | 
|---|
 | 520 |         {  | 
|---|
 | 521 | #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR | 
|---|
 | 522 |         typedef typename std::set<T, P, A> type; | 
|---|
 | 523 |         typedef typename std::set<T, P, A>::iterator iterator; | 
|---|
 | 524 |         typedef typename std::set<T, P, A>::const_iterator const_iterator; | 
|---|
 | 525 | #else | 
|---|
 | 526 |         typedef typename std::set<T, P> type; | 
|---|
 | 527 |         typedef typename std::set<T, P>::iterator iterator; | 
|---|
 | 528 |         typedef typename std::set<T, P>::const_iterator const_iterator; | 
|---|
 | 529 | #endif | 
|---|
 | 530 |         };  | 
|---|
 | 531 |  | 
|---|
 | 532 |         template <typename K, typename V, typename P = std::less<K>, typename A = STLAllocator<std::pair<const K, V>, GeneralAllocPolicy> >  | 
|---|
 | 533 |         struct map  | 
|---|
 | 534 |         {  | 
|---|
 | 535 | #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR | 
|---|
 | 536 |         typedef typename std::map<K, V, P, A> type; | 
|---|
 | 537 |         typedef typename std::map<K, V, P, A>::iterator iterator; | 
|---|
 | 538 |         typedef typename std::map<K, V, P, A>::const_iterator const_iterator; | 
|---|
 | 539 | #else | 
|---|
 | 540 |         typedef typename std::map<K, V, P> type; | 
|---|
 | 541 |         typedef typename std::map<K, V, P>::iterator iterator; | 
|---|
 | 542 |         typedef typename std::map<K, V, P>::const_iterator const_iterator; | 
|---|
 | 543 | #endif | 
|---|
 | 544 |         };  | 
|---|
 | 545 |  | 
|---|
 | 546 |         template <typename K, typename V, typename P = std::less<K>, typename A = STLAllocator<std::pair<const K, V>, GeneralAllocPolicy> >  | 
|---|
 | 547 |         struct multimap  | 
|---|
 | 548 |         {  | 
|---|
 | 549 | #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR | 
|---|
 | 550 |         typedef typename std::multimap<K, V, P, A> type; | 
|---|
 | 551 |         typedef typename std::multimap<K, V, P, A>::iterator iterator; | 
|---|
 | 552 |         typedef typename std::multimap<K, V, P, A>::const_iterator const_iterator; | 
|---|
 | 553 | #else | 
|---|
 | 554 |         typedef typename std::multimap<K, V, P> type; | 
|---|
 | 555 |         typedef typename std::multimap<K, V, P>::iterator iterator; | 
|---|
 | 556 |         typedef typename std::multimap<K, V, P>::const_iterator const_iterator; | 
|---|
 | 557 | #endif | 
|---|
 | 558 |         };  | 
|---|
 | 559 |  | 
|---|
 | 560 | } // Ogre | 
|---|
 | 561 |  | 
|---|
 | 562 | #endif // __OgrePrerequisites_H__ | 
|---|
 | 563 |  | 
|---|
 | 564 |  | 
|---|