poly_placeable.hppGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef ADOBE_POLY_PLACEABLE_HPP
00009 #define ADOBE_POLY_PLACEABLE_HPP
00010
00011 #include <boost/ref.hpp>
00012
00013 #include <adobe/config.hpp>
00014 #include <adobe/poly.hpp>
00015 #include <adobe/placeable_concept.hpp>
00016 #include <adobe/layout_attributes.hpp>
00017
00018
00019
00020
00021
00022 namespace adobe {
00023
00024
00036 struct poly_placeable_interface : poly_copyable_interface
00037 {
00038 virtual void measure(extents_t& result) = 0;
00039 virtual void place(const place_data_t& place_data) = 0;
00040 };
00041
00042
00043
00051 template <typename T>
00052 struct poly_placeable_instance : optimized_storage_type<T, poly_placeable_interface>::type
00053 {
00054 typedef typename optimized_storage_type<T, poly_placeable_interface>::type base_t;
00055
00056 BOOST_CLASS_REQUIRE(T, adobe, PlaceableConcept);
00057
00058 poly_placeable_instance(const T& x)
00059 : base_t(x) {}
00060 poly_placeable_instance(move_from<poly_placeable_instance> x)
00061 : base_t(move_from<base_t>(x.source)) {}
00062
00063 void measure(extents_t& result)
00064 {
00065 PlaceableConcept<T>::measure(this->get(), result);
00066 }
00067
00068 void place(const place_data_t& place_data)
00069 {
00070 PlaceableConcept<T>::place(this->get(), place_data);
00071 }
00072 };
00073
00074
00075
00076
00084 struct placeable : public poly_base<poly_placeable_interface, poly_placeable_instance>
00085 {
00086 typedef poly_base<poly_placeable_interface, poly_placeable_instance> base_t;
00087
00088 template <typename T>
00089 explicit placeable(const T& x) : base_t(x) {}
00090
00091 placeable(move_from<placeable> x) : base_t(move_from<base_t>(x.source)) {}
00092
00093 void measure(extents_t& result)
00094 { interface_ref().measure(result); }
00095
00096 void place(const place_data_t& place_data)
00097 { interface_ref().place(place_data); }
00098 };
00099
00100
00101
00110 typedef poly<placeable> poly_placeable_t;
00111
00112
00113
00120 struct poly_placeable_twopass_interface : public poly_placeable_interface
00121 {
00122 virtual void measure_vertical(extents_t& in_out_attrs,
00123 const place_data_t& placed_horizontal) = 0;
00124 };
00125
00126
00127
00133 template <typename T>
00134 struct poly_placeable_twopass_instance : optimized_storage_type<T, poly_placeable_twopass_interface>::type
00135 {
00136 typedef typename optimized_storage_type<T, poly_placeable_twopass_interface>::type base_t;
00137
00138 BOOST_CLASS_REQUIRE(T, adobe, PlaceableTwoPassConcept);
00139
00140 poly_placeable_twopass_instance(const T& x)
00141 : base_t(x) {}
00142 poly_placeable_twopass_instance(move_from<poly_placeable_twopass_instance> x)
00143 : base_t(move_from<base_t>(x.source)) {}
00144
00145 void measure(extents_t& result)
00146 {
00147 PlaceableTwoPassConcept<T>::measure(this->get(), result);
00148 }
00149
00150 void measure_vertical(extents_t& calculated_horizontal, const place_data_t& placed_horizontal)
00151 {
00152 PlaceableTwoPassConcept<T>::measure_vertical(this->get(), calculated_horizontal, placed_horizontal);
00153 }
00154
00155 void place(const place_data_t& place_data)
00156 {
00157 PlaceableTwoPassConcept<T>::place(this->get(), place_data);
00158 }
00159
00160 };
00161
00162
00163
00167 struct placeable_twopass
00168 : public poly_base<poly_placeable_twopass_interface, poly_placeable_twopass_instance>
00169 {
00170 typedef poly_base<poly_placeable_twopass_interface, poly_placeable_twopass_instance> base_t;
00171
00172 template <typename T>
00173 explicit placeable_twopass(const T& x) : base_t(x) {}
00174
00175 placeable_twopass(move_from<placeable_twopass> x) : base_t(move_from<base_t>(x.source)) {}
00176
00177 void measure(extents_t& result)
00178 { interface_ref().measure(result); }
00179
00180 void measure_vertical(extents_t& calculated_horizontal, const place_data_t& placed_horizontal)
00181 { interface_ref().measure_vertical(calculated_horizontal, placed_horizontal); }
00182
00183 void place(const place_data_t& place_data)
00184 { interface_ref().place(place_data); }
00185 };
00186
00187
00188
00198 typedef poly<placeable_twopass> poly_placeable_twopass_t;
00199
00200
00201
00202 }
00203
00204
00205
00206 #endif
|