Commit 0727df38 authored by Roland Levillain's avatar Roland Levillain
Browse files

Improve Swilena.

	* int_u.ixx (__int__, __str__): New methods (extensions).
	* python/dynamic-image2d-misc.py: Revive dead code.

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@3822 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 37cec09d
2009-05-14 Roland Levillain <roland@lrde.epita.fr>
Improve Swilena.
* int_u.ixx (__int__, __str__): New methods (extensions).
* python/dynamic-image2d-misc.py: Revive dead code.
2009-05-14 Roland Levillain <roland@lrde.epita.fr>
Revive Swilena (again).
......
......@@ -111,3 +111,28 @@ namespace mln
} // end of namespace mln::value
} // end of namespace mln
// Helper for the conversion to int.
%extend mln::value::int_u
{
int __int__() const { return *$self; }
}
// Helper for the conversion to string.
%{
#include <cstring>
#include <string>
#include <sstream>
%}
%extend mln::value::int_u
{
char* __str__() const
{
std::ostringstream s;
s << *$self;
// FIXME: This is admittedly ugly; can't we use std::string as
// return type? See Swig's manual.
return strdup(s.str().c_str());
}
}
......@@ -79,6 +79,6 @@ image.println(ima)
# FIXME: Doesn't really work yet, since int_u8 is not convertible
# to int.
# for r in range(0, 10):
# for c in range(0, 10):
# print ima(point2d(r, c))
for r in range(0, 10):
for c in range(0, 10):
print ima(point2d(r, c))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment