Code

add ::upgrade for NRRectL
authorbuliabyak <buliabyak@users.sourceforge.net>
Mon, 19 Mar 2007 03:00:31 +0000 (03:00 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Mon, 19 Mar 2007 03:00:31 +0000 (03:00 +0000)
src/libnr/nr-rect-l.cpp
src/libnr/nr-rect-l.h

index 40db67a1edfdb2f30ae2b2581c8f56777ecf3705..3b00acd0392123ea8056622c2c8c7bbf409e5721 100644 (file)
@@ -1,5 +1,13 @@
 #include <libnr/nr-rect-l.h>
 
+NR::Maybe<NR::Rect> NRRectL::upgrade() const {
+    if (nr_rect_l_test_empty(this)) {
+        return NR::Nothing();
+    } else {
+        return NR::Rect(NR::Point(x0, y0), NR::Point(x1, y1));
+    }
+}
+
 namespace NR {
 
 IRect::IRect(Rect const &r) :
index 756a537b0bb8071a81816a0f05ccbf4146006fc1..b84a8f0cbb9c41dfbab080aa2f2694cb8cf6cde6 100644 (file)
@@ -2,13 +2,15 @@
 #define SEEN_NR_RECT_L_H
 
 #include <libnr/nr-i-coord.h>
+#include <libnr/nr-maybe.h>
+#include <libnr/nr-rect.h>
+#include <libnr/nr-point-l.h>
 
 struct NRRectL {
+    NR::Maybe<NR::Rect> upgrade() const;
     NR::ICoord x0, y0, x1, y1;
 };
 
-#include <libnr/nr-rect.h>
-#include <libnr/nr-point-l.h>
 
 namespace NR {