path.h
Go to the documentation of this file.00001
00002
00003 #ifndef _CLUTTERMM_PATH_H
00004 #define _CLUTTERMM_PATH_H
00005
00006
00007 #include <glibmm.h>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <cluttermm/types.h>
00029 #include <glibmm/object.h>
00030 #include <clutter/clutter.h>
00031
00032
00033 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00034 typedef struct _ClutterPath ClutterPath;
00035 typedef struct _ClutterPathClass ClutterPathClass;
00036 #endif
00037
00038
00039 namespace Clutter
00040 { class Path_Class; }
00041 namespace Clutter
00042 {
00043
00044
00045
00046 class PathNode
00047 {
00048 public:
00049 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00050 typedef PathNode CppObjectType;
00051 typedef ClutterPathNode BaseObjectType;
00052
00053 static GType get_type() G_GNUC_CONST;
00054 #endif
00055
00056 PathNode();
00057
00058 explicit PathNode(const ClutterPathNode* gobject);
00059
00061 ClutterPathNode* gobj() { return &gobject_; }
00062
00064 const ClutterPathNode* gobj() const { return &gobject_; }
00065
00066 protected:
00067 ClutterPathNode gobject_;
00068
00069 private:
00070
00071 public:
00072 typedef unsigned int size_type;
00073 typedef int difference_type;
00074
00075 typedef Knot value_type;
00076 typedef Knot& reference;
00077 typedef const Knot& const_reference;
00078
00079
00080 typedef Knot* iterator;
00081 typedef const Knot* const_iterator;
00082
00083 #ifndef GLIBMM_HAVE_SUN_REVERSE_ITERATOR
00084 typedef std::reverse_iterator<iterator> reverse_iterator;
00085 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
00086 #else
00087 typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
00088 Knot, Knot&, Knot*, ptrdiff_t> reverse_iterator;
00089
00090 typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
00091 Knot, const Knot&, const Knot*, ptrdiff_t> const_reverse_iterator;
00092 #endif
00093 explicit PathNode(PathNodeType type);
00094
00095 size_type size() const;
00096 bool empty() const;
00097
00098 iterator begin();
00099 iterator end();
00100 const_iterator begin() const;
00101 const_iterator end() const;
00102
00103 inline reverse_iterator rbegin() { return reverse_iterator(end()); }
00104 inline reverse_iterator rend() { return reverse_iterator(begin()); }
00105 inline const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
00106 inline const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
00107
00108 inline reference front() { return *begin(); }
00109 inline const_reference front() const { return *begin(); }
00110 inline reference back() { return *rbegin(); }
00111 inline const_reference back() const { return *rbegin(); }
00112
00113 inline reference operator[](size_type i) { return begin()[i]; }
00114 inline const_reference operator[](size_type i) const { return begin()[i]; }
00115
00116
00117 };
00118
00119
00120 class Path : public Glib::Object
00121 {
00122
00123 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00124
00125 public:
00126 typedef Path CppObjectType;
00127 typedef Path_Class CppClassType;
00128 typedef ClutterPath BaseObjectType;
00129 typedef ClutterPathClass BaseClassType;
00130
00131 private: friend class Path_Class;
00132 static CppClassType path_class_;
00133
00134 private:
00135
00136 Path(const Path&);
00137 Path& operator=(const Path&);
00138
00139 protected:
00140 explicit Path(const Glib::ConstructParams& construct_params);
00141 explicit Path(ClutterPath* castitem);
00142
00143 #endif
00144
00145 public:
00146 virtual ~Path();
00147
00148 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00149 static GType get_type() G_GNUC_CONST;
00150 static GType get_base_type() G_GNUC_CONST;
00151 #endif
00152
00154 ClutterPath* gobj() { return reinterpret_cast<ClutterPath*>(gobject_); }
00155
00157 const ClutterPath* gobj() const { return reinterpret_cast<ClutterPath*>(gobject_); }
00158
00160 ClutterPath* gobj_copy();
00161
00162 private:
00163
00164
00165 protected:
00166 Path();
00167
00168
00169 public:
00170 class Nodes;
00171
00172
00173 static Glib::RefPtr<Path> create();
00174
00175
00176 static Glib::RefPtr<Path> create(const Glib::ustring& description);
00177
00178
00179 inline Nodes nodes();
00180 inline const Nodes nodes() const;
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201 public:
00202
00203 public:
00204
00205 #ifdef GLIBMM_VFUNCS_ENABLED
00206 #endif //GLIBMM_VFUNCS_ENABLED
00207
00208 protected:
00209
00210 #ifdef GLIBMM_VFUNCS_ENABLED
00211 #endif //GLIBMM_VFUNCS_ENABLED
00212
00213
00214 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00215 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00216
00217
00218 };
00219
00220 class Path::Nodes
00221 {
00222 private:
00223 friend class Clutter::Path;
00224
00225 ClutterPath* path_;
00226
00227 inline Nodes(const Path::Nodes& other) : path_ (other.path_) {}
00228 explicit inline Nodes(ClutterPath* path) : path_ (path) {}
00229 Nodes& operator=(const Path::Nodes&);
00230
00231 public:
00232 typedef unsigned int size_type;
00233 typedef int difference_type;
00234 typedef PathNode value_type;
00235 typedef const value_type const_reference;
00236
00237 class const_iterator;
00238 class iterator;
00239
00240 class reference
00241 {
00242 private:
00243 friend class Path::Nodes;
00244 friend class Path::Nodes::iterator;
00245 friend class Path::Nodes::const_iterator;
00246
00247 ClutterPath* path_;
00248 unsigned int index_;
00249
00250 inline reference(ClutterPath* path, unsigned int index)
00251 : path_ (path), index_ (index) {}
00252
00253
00254 reference* operator&();
00255 const reference* operator&() const;
00256
00257 public:
00258 reference& operator=(const PathNode& node);
00259 operator PathNode() const;
00260 };
00261
00262 class const_iterator
00263 {
00264 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00265 protected:
00266 Path::Nodes::reference ref_;
00267 #endif
00268 public:
00269 typedef std::random_access_iterator_tag iterator_category;
00270 typedef PathNode value_type;
00271 typedef int difference_type;
00272 typedef const value_type reference;
00273 typedef void pointer;
00274
00275 inline const_iterator() : ref_ (0, 0) {}
00276 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00277 inline const_iterator(ClutterPath* path, unsigned int index)
00278 : ref_ (path, index) {}
00279
00280 inline bool equal(const const_iterator& b) const
00281 { return (ref_.index_ == b.ref_.index_); }
00282 #endif
00283 reference operator*() const;
00284 reference operator[](difference_type i) const;
00285
00286 inline const_iterator& operator++() { ++ref_.index_; return *this; }
00287 inline const_iterator operator++(int) { return const_iterator(ref_.path_, ref_.index_++); }
00288 inline const_iterator& operator--() { --ref_.index_; return *this; }
00289 inline const_iterator operator--(int) { return const_iterator(ref_.path_, ref_.index_--); }
00290 };
00291
00292 class iterator : public const_iterator
00293 {
00294 public:
00295 typedef Path::Nodes::reference reference;
00296
00297 inline iterator() {}
00298 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00299 inline iterator(ClutterPath* path, unsigned int index)
00300 : const_iterator(path, index) {}
00301 #endif
00302 inline reference operator*() const { return ref_; }
00303 inline reference operator[](difference_type i) const
00304 { return reference(ref_.path_, ref_.index_ + i); }
00305
00306 inline iterator& operator++() { ++ref_.index_; return *this; }
00307 inline iterator operator++(int) { return iterator(ref_.path_, ref_.index_++); }
00308 inline iterator& operator--() { --ref_.index_; return *this; }
00309 inline iterator operator--(int) { return iterator(ref_.path_, ref_.index_--); }
00310 };
00311
00312 #ifndef GLIBMM_HAVE_SUN_REVERSE_ITERATOR
00313 typedef std::reverse_iterator<iterator> reverse_iterator;
00314 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
00315 #else
00316 typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
00317 value_type, reference, void, ptrdiff_t> reverse_iterator;
00318 typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
00319 value_type, const_reference, void, ptrdiff_t> const_reverse_iterator;
00320 #endif
00321 size_type size() const;
00322 inline bool empty() const { return (size() == 0); }
00323
00324 inline iterator begin() { return iterator(path_, 0); }
00325 inline const_iterator begin() const { return const_iterator(path_, 0); }
00326 inline iterator end() { return iterator(path_, size()); }
00327 inline const_iterator end() const { return const_iterator(path_, size()); }
00328
00329 inline reverse_iterator rbegin() { return reverse_iterator(end()); }
00330 inline reverse_iterator rend() { return reverse_iterator(begin()); }
00331 inline const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
00332 inline const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
00333
00334 const_reference operator[](size_type i) const;
00335 inline reference operator[](size_type i) { return reference(path_, i); }
00336
00337 inline reference front() { return reference(path_, 0); }
00338 inline const_reference front() const { return (*this)[0]; }
00339 inline reference back() { return reference(path_, size() - 1); }
00340 inline const_reference back() const { return (*this)[size() - 1]; }
00341 };
00342
00344 inline bool operator==(const Path::Nodes::const_iterator& a, const Path::Nodes::const_iterator& b)
00345 { return a.equal(b); }
00346
00348 inline bool operator!=(const Path::Nodes::const_iterator& a, const Path::Nodes::const_iterator& b)
00349 { return !a.equal(b); }
00350
00351 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00352 inline Path::Nodes Path::nodes()
00353 { return Path::Nodes(gobj()); }
00354
00355 inline const Path::Nodes Path::nodes() const
00356 { return Path::Nodes(const_cast<ClutterPath*>(gobj())); }
00357 #endif
00358
00359 }
00360
00361
00362 namespace Clutter
00363 {
00364
00370 bool operator==(const PathNode& lhs, const PathNode& rhs);
00371
00377 bool operator!=(const PathNode& lhs, const PathNode& rhs);
00378
00379
00380 }
00381
00382
00383 namespace Glib
00384 {
00385
00390 Clutter::PathNode& wrap(ClutterPathNode* object);
00391
00396 const Clutter::PathNode& wrap(const ClutterPathNode* object);
00397
00398 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00399 template <>
00400 class Value<Clutter::PathNode> : public Glib::Value_Boxed<Clutter::PathNode>
00401 {};
00402 #endif
00403
00404 }
00405
00406
00407 namespace Glib
00408 {
00417 Glib::RefPtr<Clutter::Path> wrap(ClutterPath* object, bool take_copy = false);
00418 }
00419
00420
00421 #endif
00422