stlab.adobe.com Adobe Systems Incorporated
poly_placeable.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2006-2007 Adobe Systems Incorporated
3  Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
4  or a copy at http://stlab.adobe.com/licenses.html)
5 
6  Author(s): Mat Marcus
7 */
8 
9 /*************************************************************************************************/
10 #ifndef ADOBE_POLY_PLACEABLE_HPP
11 #define ADOBE_POLY_PLACEABLE_HPP
12 
13 #include <boost/ref.hpp>
14 
15 #include <adobe/config.hpp>
16 #include <adobe/poly.hpp>
19 
20 
21 
22 /*************************************************************************************************/
23 
24 namespace adobe {
25 
26 /*************************************************************************************************/
39 {
40  virtual void measure(extents_t& result) = 0;
41  virtual void place(const place_data_t& place_data) = 0;
42 };
43 
44 /*************************************************************************************************/
45 
53 template <typename T>
54 struct poly_placeable_instance : optimized_storage_type<T, poly_placeable_interface>::type
55 {
57 
59 
61  : base_t(x) {}
63  : base_t(move_from<base_t>(x.source)) {}
64 
65  void measure(extents_t& result)
66  {
67  PlaceableConcept<T>::measure(this->get(), result);
68  }
69 
70  void place(const place_data_t& place_data)
71  {
72  PlaceableConcept<T>::place(this->get(), place_data);
73  }
74 };
75 
76 
77 /*************************************************************************************************/
78 
86 struct placeable : public poly_base<poly_placeable_interface, poly_placeable_instance>
87 {
89 
90  template <typename T>
91  explicit placeable(const T& x) : base_t(x) {}
92 
93  placeable(move_from<placeable> x) : base_t(move_from<base_t>(x.source)) {}
94 
95  void measure(extents_t& result)
96  { interface_ref().measure(result); }
97 
98  void place(const place_data_t& place_data)
99  { interface_ref().place(place_data); }
100 };
101 
102 /*************************************************************************************************/
103 
113 
114 /*************************************************************************************************/
115 
123 {
124  virtual void measure_vertical(extents_t& in_out_attrs,
125  const place_data_t& placed_horizontal) = 0;
126 };
127 
128 /*************************************************************************************************/
129 
135 template <typename T>
136 struct poly_placeable_twopass_instance : optimized_storage_type<T, poly_placeable_twopass_interface>::type
137 {
139 
141 
143  : base_t(x) {}
145  : base_t(move_from<base_t>(x.source)) {}
146 
147  void measure(extents_t& result)
148  {
149  PlaceableTwoPassConcept<T>::measure(this->get(), result);
150  }
151 
152  void measure_vertical(extents_t& calculated_horizontal, const place_data_t& placed_horizontal)
153  {
154  PlaceableTwoPassConcept<T>::measure_vertical(this->get(), calculated_horizontal, placed_horizontal);
155  }
156 
157  void place(const place_data_t& place_data)
158  {
159  PlaceableTwoPassConcept<T>::place(this->get(), place_data);
160  }
161 
162 };
163 
164 /*************************************************************************************************/
165 
170  : public poly_base<poly_placeable_twopass_interface, poly_placeable_twopass_instance>
171 {
173 
174  template <typename T>
175  explicit placeable_twopass(const T& x) : base_t(x) {}
176 
177  placeable_twopass(move_from<placeable_twopass> x) : base_t(move_from<base_t>(x.source)) {}
178 
179  void measure(extents_t& result)
180  { interface_ref().measure(result); }
181 
182  void measure_vertical(extents_t& calculated_horizontal, const place_data_t& placed_horizontal)
183  { interface_ref().measure_vertical(calculated_horizontal, placed_horizontal); }
184 
185  void place(const place_data_t& place_data)
186  { interface_ref().place(place_data); }
187 };
188 
189 /*************************************************************************************************/
190 
201 
202 /*************************************************************************************************/
203 
204 } // namespace adobe
205 
206 /*************************************************************************************************/
207 
208 #endif
virtual void place(const place_data_t &place_data)=0
poly_base< poly_placeable_interface, poly_placeable_instance > base_t
placeable(move_from< placeable > x)
placeable_twopass(move_from< placeable_twopass > x)
void measure_vertical(extents_t &calculated_horizontal, const place_data_t &placed_horizontal)
void place(const place_data_t &place_data)
void place(const place_data_t &place_data)
Pure virtual interface for poly modeling adobe::PlaceableTwoPassConcept.
move_from is used for move_ctors.
Definition: move.hpp:306
void place(const place_data_t &place_data)
Implementation of virtual interface for the poly modeling adobe::PlaceableConcept.
poly< placeable > poly_placeable_t
convenience typedef.
Layout data interface from the engine to the client.
void measure_vertical(T &t, extents_t &calculated_horizontal, const place_data_t &placed_horizontal)
void measure_vertical(extents_t &calculated_horizontal, const place_data_t &placed_horizontal)
virtual void measure(extents_t &result)=0
optimized_storage_type< T, poly_placeable_interface >::type base_t
An intrinsic geometry class for objects with a graphical representation.
Definition: extents.hpp:75
Authors of a Concept representative F, intended as a template parameter to adobe::poly, will inherit from adobe::poly_base. The first template parameter for adobe::poly_base provides the virtual interface for the concept representative. The second template parameter for adobe::poly_base must inherit from the Concept interface representative. The author's third duty is to provide forwarding functions in a their Concept representative. See the placeable_concept.hpp header file for details.
Definition: poly.hpp:259
poly_base< poly_placeable_twopass_interface, poly_placeable_twopass_instance > base_t
void measure(T &t, extents_t &result)
Concept map and constraints checking for the Placeable concept.
adobe::poly will be a runtime polymorphic value type wrapper modelling a concept represented by ...
Definition: poly.hpp:414
Abstract interface providing signatures needed to implement "handle" objects modeling a Value (Copyab...
Definition: poly.hpp:66
placeable(const T &x)
poly_placeable_twopass_instance(move_from< poly_placeable_twopass_instance > x)
void measure(extents_t &result)
BOOST_CLASS_REQUIRE(T, adobe, PlaceableConcept)
void place(T &t, const place_data_t &place_data)
Concept map and constraints checking for the PlaceableTwoPass concept.
Pure virtual interface for the poly modeling adobe::PlaceableConcept.
void place(const place_data_t &place_data)
Authors of adobe::poly concept representatives must derive their instance class from this...
Definition: poly.hpp:238
BOOST_CLASS_REQUIRE(T, adobe, PlaceableTwoPassConcept)
poly< placeable_twopass > poly_placeable_twopass_t
convenience typedef.
Implementation of virtual interface for the poly modeling adobe::PlaceableTwoPassC...
Representative of adobe::PlaceableConcept so that placeable models adobe::PlaceableConcept when T doe...
optimized_storage_type< T, poly_placeable_twopass_interface >::type base_t
virtual void measure_vertical(extents_t &in_out_attrs, const place_data_t &placed_horizontal)=0
void measure(extents_t &result)
poly_placeable_instance(move_from< poly_placeable_instance > x)
void measure(extents_t &result)

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google