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 
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 
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

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