use the new Rational and URational types

svn path=/trunk/exiv2-sharp/; revision=113667
This commit is contained in:
Stephane Delcroix 2008-09-21 18:28:01 +00:00
Родитель 0d7823a0ec
Коммит 6d79c27611
8 изменённых файлов: 65 добавлений и 30 удалений

Просмотреть файл

@ -35,13 +35,13 @@ public object Value {
else if (value is UInt32) else if (value is UInt32)
ValueULong = (UInt32) value; ValueULong = (UInt32) value;
else if (value is Exiv2.URational) else if (value is Exiv2.URational)
SetValueURational (((Exiv2.URational)value).Numerator, ((Exiv2.URational)value).Denominator); ValueURational = (Exiv2.URational) value;
else if (value is Int16) else if (value is Int16)
ValueSShort = (Int16) value; ValueSShort = (Int16) value;
else if (value is Int32) else if (value is Int32)
ValueSLong = (Int32) value; ValueSLong = (Int32) value;
else if (value is Exiv2.Rational) else if (value is Exiv2.Rational)
SetValueRational (((Exiv2.Rational)value).Numerator, ((Exiv2.Rational)value).Denominator); ValueRational = (Exiv2.Rational) value;
else if (value is string) else if (value is string)
ValueString = value as string; ValueString = value as string;
else else

Просмотреть файл

@ -17,8 +17,7 @@ CUSTOMS = \
$(srcdir)/ExifDatumIterator.custom \ $(srcdir)/ExifDatumIterator.custom \
$(srcdir)/XmpDatum.custom $(srcdir)/XmpDatum.custom
SOURCES = \ SOURCES =
$(srcdir)/URational.cs
CLEANFILES = \ CLEANFILES = \
exiv2-api.xml \ exiv2-api.xml \

Просмотреть файл

@ -79,8 +79,7 @@
<method name="SetValueRational" cname="exiv2_exifdatum_setValueRational"> <method name="SetValueRational" cname="exiv2_exifdatum_setValueRational">
<return-type type="void" /> <return-type type="void" />
<parameters> <parameters>
<parameter type="const-gint32" name="numerator" /> <parameter type="Exiv2Rational*" name="rational" />
<parameter type="const-gint32" name="denominator" />
</parameters> </parameters>
</method> </method>
<method name="SetValueSLong" cname="exiv2_exifdatum_setValueSLong"> <method name="SetValueSLong" cname="exiv2_exifdatum_setValueSLong">
@ -110,8 +109,7 @@
<method name="SetValueURational" cname="exiv2_exifdatum_setValueURational"> <method name="SetValueURational" cname="exiv2_exifdatum_setValueURational">
<return-type type="void" /> <return-type type="void" />
<parameters> <parameters>
<parameter type="const-guint32" name="numerator" /> <parameter type="Exiv2URational*" name="urational" />
<parameter type="const-guint32" name="denominator" />
</parameters> </parameters>
</method> </method>
<method name="SetValueUShort" cname="exiv2_exifdatum_setValueUShort"> <method name="SetValueUShort" cname="exiv2_exifdatum_setValueUShort">
@ -319,6 +317,36 @@
</parameters> </parameters>
</method> </method>
</object> </object>
<object name="URational" cname="Exiv2URational" parent="GObject">
<field name="Priv" cname="priv" type="Exiv2URationalPrivate*" />
<method name="GetDenominator" cname="exiv2_urational_getDenominator">
<return-type type="guint32" />
</method>
<method name="GetNumerator" cname="exiv2_urational_getNumerator">
<return-type type="guint32" />
</method>
<method name="GetType" cname="exiv2_urational_get_type" shared="true">
<return-type type="GType" />
</method>
<constructor cname="exiv2_urational_new">
<parameters>
<parameter type="guint32" name="numerator" />
<parameter type="guint32" name="denominator" />
</parameters>
</constructor>
<method name="SetDenominator" cname="exiv2_urational_setDenominator">
<return-type type="void" />
<parameters>
<parameter type="guint32" name="denominator" />
</parameters>
</method>
<method name="SetNumerator" cname="exiv2_urational_setNumerator">
<return-type type="void" />
<parameters>
<parameter type="guint32" name="numerator" />
</parameters>
</method>
</object>
<object name="XmpData" cname="Exiv2XmpData" parent="GObject"> <object name="XmpData" cname="Exiv2XmpData" parent="GObject">
<field name="Priv" cname="priv" type="Exiv2XmpDataPrivate*" /> <field name="Priv" cname="priv" type="Exiv2XmpDataPrivate*" />
<method name="Begin" cname="exiv2_xmpdata_begin"> <method name="Begin" cname="exiv2_xmpdata_begin">

Просмотреть файл

@ -29,6 +29,8 @@
*/ */
#include "exiv2-exifdatum.h" #include "exiv2-exifdatum.h"
#include "exiv2-exifdatum-private.h" #include "exiv2-exifdatum-private.h"
#include "exiv2-rational-private.h"
#include "exiv2-urational-private.h"
#include <exiv2/exif.hpp> #include <exiv2/exif.hpp>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -43,10 +45,10 @@ const char* exiv2_exifdatum_real_toString (Exiv2ExifDatum *self);
void exiv2_exifdatum_real_setValueUShort (Exiv2ExifDatum *self, const guint16 value); void exiv2_exifdatum_real_setValueUShort (Exiv2ExifDatum *self, const guint16 value);
void exiv2_exifdatum_real_setValueULong (Exiv2ExifDatum *self, const guint32 value); void exiv2_exifdatum_real_setValueULong (Exiv2ExifDatum *self, const guint32 value);
void exiv2_exifdatum_real_setValueURational (Exiv2ExifDatum *self, const guint32 numerator, const guint32 denominator); void exiv2_exifdatum_real_setValueURational (Exiv2ExifDatum *self, Exiv2URational *urational);
void exiv2_exifdatum_real_setValueSShort (Exiv2ExifDatum *self, const gint16 value); void exiv2_exifdatum_real_setValueSShort (Exiv2ExifDatum *self, const gint16 value);
void exiv2_exifdatum_real_setValueSLong (Exiv2ExifDatum *self, const gint32 value); void exiv2_exifdatum_real_setValueSLong (Exiv2ExifDatum *self, const gint32 value);
void exiv2_exifdatum_real_setValueRational (Exiv2ExifDatum *self, const gint32 numerator, const gint32 denominator); void exiv2_exifdatum_real_setValueRational (Exiv2ExifDatum *self, Exiv2Rational *rational);
void exiv2_exifdatum_real_setValueString (Exiv2ExifDatum *self, const char* value); void exiv2_exifdatum_real_setValueString (Exiv2ExifDatum *self, const char* value);
static void static void
@ -116,9 +118,9 @@ void exiv2_exifdatum_setValueULong (Exiv2ExifDatum *self, const guint32 value)
{ {
return EXIV2_EXIFDATUM_GET_CLASS (self)->set_value_ulong (self, value); return EXIV2_EXIFDATUM_GET_CLASS (self)->set_value_ulong (self, value);
} }
void exiv2_exifdatum_setValueURational (Exiv2ExifDatum *self, const guint32 numerator, const guint32 denominator) void exiv2_exifdatum_setValueURational (Exiv2ExifDatum *self, Exiv2URational *urational)
{ {
return EXIV2_EXIFDATUM_GET_CLASS (self)->set_value_urational (self, numerator, denominator); return EXIV2_EXIFDATUM_GET_CLASS (self)->set_value_urational (self, urational);
} }
void exiv2_exifdatum_setValueSShort (Exiv2ExifDatum *self, const gint16 value) void exiv2_exifdatum_setValueSShort (Exiv2ExifDatum *self, const gint16 value)
@ -131,9 +133,9 @@ void exiv2_exifdatum_setValueSLong (Exiv2ExifDatum *self, const gint32 value)
return EXIV2_EXIFDATUM_GET_CLASS (self)->set_value_slong (self, value); return EXIV2_EXIFDATUM_GET_CLASS (self)->set_value_slong (self, value);
} }
void exiv2_exifdatum_setValueRational (Exiv2ExifDatum *self, const gint32 numerator, const gint32 denominator) void exiv2_exifdatum_setValueRational (Exiv2ExifDatum *self, Exiv2Rational *rational)
{ {
return EXIV2_EXIFDATUM_GET_CLASS (self)->set_value_rational (self, numerator, denominator); return EXIV2_EXIFDATUM_GET_CLASS (self)->set_value_rational (self, rational);
} }
void exiv2_exifdatum_setValueString (Exiv2ExifDatum *self, const char* value) void exiv2_exifdatum_setValueString (Exiv2ExifDatum *self, const char* value)
@ -191,11 +193,12 @@ void exiv2_exifdatum_real_setValueULong (Exiv2ExifDatum *self, const uint32_t va
(*datum) = value; (*datum) = value;
} }
void exiv2_exifdatum_real_setValueURational (Exiv2ExifDatum *self, const uint32_t numerator, const uint32_t denominator) void exiv2_exifdatum_real_setValueURational (Exiv2ExifDatum *self, Exiv2URational *urational)
{ {
g_return_if_fail (EXIV2_IS_EXIFDATUM (self)); g_return_if_fail (EXIV2_IS_EXIFDATUM (self));
g_return_if_fail (EXIV2_IS_URATIONAL (urational));
Exiv2::Exifdatum* datum = self->priv->datum; Exiv2::Exifdatum* datum = self->priv->datum;
(*datum) = Exiv2::URational (numerator, denominator); (*datum) = urational->priv->urational;
} }
void exiv2_exifdatum_real_setValueSShort (Exiv2ExifDatum *self, const int16_t value) void exiv2_exifdatum_real_setValueSShort (Exiv2ExifDatum *self, const int16_t value)
@ -212,11 +215,12 @@ void exiv2_exifdatum_real_setValueSLong (Exiv2ExifDatum *self, const int32_t val
(*datum) = value; (*datum) = value;
} }
void exiv2_exifdatum_real_setValueRational (Exiv2ExifDatum *self, const int32_t numerator, const int32_t denominator) void exiv2_exifdatum_real_setValueRational (Exiv2ExifDatum *self, Exiv2Rational *rational)
{ {
g_return_if_fail (EXIV2_IS_EXIFDATUM (self)); g_return_if_fail (EXIV2_IS_EXIFDATUM (self));
g_return_if_fail (EXIV2_IS_RATIONAL (rational));
Exiv2::Exifdatum* datum = self->priv->datum; Exiv2::Exifdatum* datum = self->priv->datum;
(*datum) = Exiv2::Rational (numerator, denominator); (*datum) = rational->priv->rational;
} }
void exiv2_exifdatum_real_setValueString (Exiv2ExifDatum *self, const char* value) void exiv2_exifdatum_real_setValueString (Exiv2ExifDatum *self, const char* value)

Просмотреть файл

@ -31,6 +31,8 @@
#define __EXIV2_EXIFDATUM_H__ #define __EXIV2_EXIFDATUM_H__
#include <glib-object.h> #include <glib-object.h>
#include "exiv2-rational.h"
#include "exiv2-urational.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -68,10 +70,10 @@ struct _Exiv2ExifDatumClass
void (*set_value_ushort) (Exiv2ExifDatum *self, const guint16 value); void (*set_value_ushort) (Exiv2ExifDatum *self, const guint16 value);
void (*set_value_ulong) (Exiv2ExifDatum *self, const guint32 value); void (*set_value_ulong) (Exiv2ExifDatum *self, const guint32 value);
void (*set_value_urational) (Exiv2ExifDatum *self, const guint32 denominator, const guint32 numerator); void (*set_value_urational) (Exiv2ExifDatum *self, Exiv2URational *urational);
void (*set_value_sshort) (Exiv2ExifDatum *self, const gint16 value); void (*set_value_sshort) (Exiv2ExifDatum *self, const gint16 value);
void (*set_value_slong) (Exiv2ExifDatum *self, const gint32 value); void (*set_value_slong) (Exiv2ExifDatum *self, const gint32 value);
void (*set_value_rational) (Exiv2ExifDatum *self, const gint32 numerator, const gint32 denominator); void (*set_value_rational) (Exiv2ExifDatum *self, Exiv2Rational *rational);
void (*set_value_string) (Exiv2ExifDatum *self, const char* value); void (*set_value_string) (Exiv2ExifDatum *self, const char* value);
}; };
@ -84,10 +86,10 @@ const char* exiv2_exifdatum_toString (Exiv2ExifDatum *self);
void exiv2_exifdatum_setValueUShort (Exiv2ExifDatum *self, const guint16 value); void exiv2_exifdatum_setValueUShort (Exiv2ExifDatum *self, const guint16 value);
void exiv2_exifdatum_setValueULong (Exiv2ExifDatum *self, const guint32 value); void exiv2_exifdatum_setValueULong (Exiv2ExifDatum *self, const guint32 value);
void exiv2_exifdatum_setValueURational (Exiv2ExifDatum *self, const guint32 numerator, const guint32 denominator); void exiv2_exifdatum_setValueURational (Exiv2ExifDatum *self, Exiv2URational *urational);
void exiv2_exifdatum_setValueSShort (Exiv2ExifDatum *self, const gint16 value); void exiv2_exifdatum_setValueSShort (Exiv2ExifDatum *self, const gint16 value);
void exiv2_exifdatum_setValueSLong (Exiv2ExifDatum *self, const gint32 value); void exiv2_exifdatum_setValueSLong (Exiv2ExifDatum *self, const gint32 value);
void exiv2_exifdatum_setValueRational (Exiv2ExifDatum *self, const gint32 numerator, const gint32 denominator); void exiv2_exifdatum_setValueRational (Exiv2ExifDatum *self, Exiv2Rational *rational);
void exiv2_exifdatum_setValueString (Exiv2ExifDatum *self, const char* value); void exiv2_exifdatum_setValueString (Exiv2ExifDatum *self, const char* value);
G_END_DECLS G_END_DECLS

Просмотреть файл

@ -27,8 +27,8 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* *
*/ */
#ifndef __EXIV2_EXIFTHUMB_PRIVATE_H__ #ifndef __EXIV2_RATIONAL_PRIVATE_H__
#define __EXIV2_EXIFTHUMB_PRIVATE_H__ #define __EXIV2_RATIONAL_PRIVATE_H__
#include "exiv2-rational.h" #include "exiv2-rational.h"
#include <exiv2/exif.hpp> #include <exiv2/exif.hpp>
@ -42,4 +42,4 @@ struct _Exiv2RationalPrivate
G_END_DECLS G_END_DECLS
#endif /* __EXIV2_EXIFTHUMB_PRIVATE_H__ */ #endif /* __EXIV2_RATIONAL_PRIVATE_H__ */

Просмотреть файл

@ -27,8 +27,8 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* *
*/ */
#ifndef __EXIV2_EXIFTHUMB_PRIVATE_H__ #ifndef __EXIV2_URATIONAL_PRIVATE_H__
#define __EXIV2_EXIFTHUMB_PRIVATE_H__ #define __EXIV2_URATIONAL_PRIVATE_H__
#include "exiv2-urational.h" #include "exiv2-urational.h"
#include <exiv2/exif.hpp> #include <exiv2/exif.hpp>
@ -42,4 +42,4 @@ struct _Exiv2URationalPrivate
G_END_DECLS G_END_DECLS
#endif /* __EXIV2_EXIFTHUMB_PRIVATE_H__ */ #endif /* __EXIV2_URATIONAL_PRIVATE_H__ */

Просмотреть файл

@ -31,6 +31,8 @@
#define __EXIV2_XMPDATUM_H__ #define __EXIV2_XMPDATUM_H__
#include <glib-object.h> #include <glib-object.h>
#include "exiv2-rational.h"
#include "exiv2-urational.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -68,10 +70,10 @@ struct _Exiv2XmpDatumClass
void (*set_value_ushort) (Exiv2XmpDatum *self, const guint16 value); void (*set_value_ushort) (Exiv2XmpDatum *self, const guint16 value);
void (*set_value_ulong) (Exiv2XmpDatum *self, const guint32 value); void (*set_value_ulong) (Exiv2XmpDatum *self, const guint32 value);
void (*set_value_urational) (Exiv2XmpDatum *self, const guint32 denominator, const guint32 numerator); void (*set_value_urational) (Exiv2XmpDatum *self, Exiv2URational *urational);
void (*set_value_sshort) (Exiv2XmpDatum *self, const gint16 value); void (*set_value_sshort) (Exiv2XmpDatum *self, const gint16 value);
void (*set_value_slong) (Exiv2XmpDatum *self, const gint32 value); void (*set_value_slong) (Exiv2XmpDatum *self, const gint32 value);
void (*set_value_rational) (Exiv2XmpDatum *self, const gint32 numerator, const gint32 denominator); void (*set_value_rational) (Exiv2XmpDatum *self, Exiv2Rational *rational);
void (*set_value_string) (Exiv2XmpDatum *self, const char* value); void (*set_value_string) (Exiv2XmpDatum *self, const char* value);
}; };