[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libcvd-members] libcvd/cvd image_ref.h
From: |
Georg Klein |
Subject: |
[libcvd-members] libcvd/cvd image_ref.h |
Date: |
Thu, 02 Nov 2006 12:28:42 +0000 |
CVSROOT: /cvsroot/libcvd
Module name: libcvd
Changes by: Georg Klein <georgklein> 06/11/02 12:28:42
Modified files:
cvd : image_ref.h
Log message:
Changed the default output format of ImageRefs to [x y]. This
makes them compatible with gvars. The old input parser for (x,y) is
still
in there so it'll hopefully not break too much..
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/image_ref.h?cvsroot=libcvd&r1=1.12&r2=1.13
Patches:
Index: image_ref.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/image_ref.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- image_ref.h 5 May 2006 16:12:06 -0000 1.12
+++ image_ref.h 2 Nov 2006 12:28:42 -0000 1.13
@@ -192,13 +192,13 @@
// Streams stuff for ImageRef class //
-/// Write an ImageRef to a stream in the format "(x,y)"
+/// Write an ImageRef to a stream in the format "[x y]"
/// @param os The stream
/// @param ref The co-ordinate
/// @relates ImageRef
inline std::ostream& operator<<(std::ostream& os, const ImageRef& ref)
{
- return os << "(" << ref.x << "," << ref.y << ")";
+ return os << "[" << ref.x << " " << ref.y << "]";
}
/// Read an ImageRef from a stream. Any format with two successive numbers
will work
@@ -206,7 +206,7 @@
inline std::istream& operator>>(std::istream& is, ImageRef& ref)
{
//Full parsing for ImageRefs, to allow it to accept the
- //output produced above.
+ //output produced above, as well as the older (x,y) format
is >> std::ws;
unsigned char c = is.get();
@@ -226,6 +226,12 @@
if(is.get() != ')')
goto bad;
}
+ else if(c == '[' )
+ {
+ is >> std::ws >> ref.x >> std::ws >> ref.y >> std::ws;
+ if(is.get() != ']')
+ goto bad;
+ }
else if(isdigit(c))
{
is.unget();
- [libcvd-members] libcvd/cvd image_ref.h,
Georg Klein <=