query_result.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2013 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Arkadiusz Kalinowski
27 */
28 
29 
30 #pragma once
31 
32 #include <memory>
33 
34 #include "../api_physics2d.h"
35 #include "../../Core/Math/vec2.h"
36 
37 namespace clan
38 {
41 
42  class QueryResult_Impl;
43  class Fixture;
44  class Body;
45  class Pointf;
46 
49 {
52 };
53 
56 
57 class CL_API_PHYSICS QueryResult
58 {
59 public:
60 
61 
62 
65 public:
67  QueryResult();
68 
69  ~QueryResult();
70 
71 private:
72 
74  QueryResult(Fixture &fixture);
75 
77  QueryResult(Fixture &fixture, Pointf &point, Vec2f &normal, float fraction);
78 
82 public:
83 
85  bool is_null() const { return !impl; }
86 
88  void throw_if_null() const;
89 
91  Fixture &get_fixture() const;
92 
94  Body &get_body() const;
95 
97  QueryResultType get_query_type() const;
98 
102 public:
103 
105  QueryResult &operator =(const QueryResult &copy);
106 
110 private:
111 
112  std::shared_ptr<QueryResult_Impl> impl;
114 
115  friend class PhysicsQueryAssistant_Impl;
116 };
117 
119 
120 }
Definition: query_result.h:50
Body class.
Definition: body.h:52
Definition: query_result.h:51
Used by physics query assistant.
Definition: query_result.h:57
2D (x,y) point structure - Float
Definition: point.h:73
Fixture class.
Definition: fixture.h:48
QueryResultType
Query types.
Definition: query_result.h:48
bool is_null() const
Returns true if this object is invalid.
Definition: query_result.h:85