~cosme/ubuntu/precise/freeimage/freeimage-3.15.1

« back to all changes in this revision

Viewing changes to Wrapper/FreeImage.NET/cs/Library/Structs/FIMETADATA.cs

  • Committer: Stefano Rivera
  • Date: 2010-07-24 15:35:51 UTC
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: stefanor@ubuntu.com-20100724153551-6s3fth1653huk31a
Tags: upstream-3.13.1
ImportĀ upstreamĀ versionĀ 3.31.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ==========================================================
 
2
// FreeImage 3 .NET wrapper
 
3
// Original FreeImage 3 functions and .NET compatible derived functions
 
4
//
 
5
// Design and implementation by
 
6
// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net)
 
7
// - Carsten Klein (cklein05@users.sourceforge.net)
 
8
//
 
9
// Contributors:
 
10
// - David Boland (davidboland@vodafone.ie)
 
11
//
 
12
// Main reference : MSDN Knowlede Base
 
13
//
 
14
// This file is part of FreeImage 3
 
15
//
 
16
// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
 
17
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
 
18
// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
 
19
// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
 
20
// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
 
21
// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
 
22
// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
 
23
// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
 
24
// THIS DISCLAIMER.
 
25
//
 
26
// Use at your own risk!
 
27
// ==========================================================
 
28
 
 
29
// ==========================================================
 
30
// CVS
 
31
// $Revision: 1.5 $
 
32
// $Date: 2009/02/20 07:41:08 $
 
33
// $Id: FIMETADATA.cs,v 1.5 2009/02/20 07:41:08 cklein05 Exp $
 
34
// ==========================================================
 
35
 
 
36
using System;
 
37
using System.Runtime.InteropServices;
 
38
 
 
39
namespace FreeImageAPI
 
40
{
 
41
        /// <summary>
 
42
        /// The <b>FIMETADATA</b> structure is an unique search handle for metadata search operations.
 
43
        /// </summary>
 
44
        /// <remarks>
 
45
        /// The <b>FIMETADATA</b> structure is usually returned by the
 
46
        /// <see cref="FreeImageAPI.FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL, FIBITMAP, out FITAG)"/>
 
47
        /// function and then used on subsequent calls to
 
48
        /// <see cref="FreeImageAPI.FreeImage.FindNextMetadata(FIMETADATA, out FITAG)"/>.
 
49
        /// When the <b>FIMETADATA</b> handle is no longer used, it needs to be freed by the
 
50
        /// <see cref="FreeImageAPI.FreeImage.FindCloseMetadata(FIMETADATA)"/> function.
 
51
        /// </remarks>
 
52
        [Serializable, StructLayout(LayoutKind.Sequential)]
 
53
        public struct FIMETADATA : IComparable, IComparable<FIMETADATA>, IEquatable<FIMETADATA>
 
54
        {
 
55
                private IntPtr data;
 
56
 
 
57
                /// <summary>
 
58
                /// A read-only field that represents a handle that has been initialized to zero.
 
59
                /// </summary>
 
60
                public static readonly FIMETADATA Zero;
 
61
 
 
62
                /// <summary>
 
63
                /// Tests whether two specified <see cref="FIMETADATA"/> structures are equivalent.
 
64
                /// </summary>
 
65
                /// <param name="left">The <see cref="FIMETADATA"/> that is to the left of the equality operator.</param>
 
66
                /// <param name="right">The <see cref="FIMETADATA"/> that is to the right of the equality operator.</param>
 
67
                /// <returns>
 
68
                /// <b>true</b> if the two <see cref="FIMETADATA"/> structures are equal; otherwise, <b>false</b>.
 
69
                /// </returns>
 
70
                public static bool operator ==(FIMETADATA left, FIMETADATA right)
 
71
                {
 
72
                        return (left.data == right.data);
 
73
                }
 
74
 
 
75
                /// <summary>
 
76
                /// Tests whether two specified <see cref="FIMETADATA"/> structures are different.
 
77
                /// </summary>
 
78
                /// <param name="left">The <see cref="FIMETADATA"/> that is to the left of the inequality operator.</param>
 
79
                /// <param name="right">The <see cref="FIMETADATA"/> that is to the right of the inequality operator.</param>
 
80
                /// <returns>
 
81
                /// <b>true</b> if the two <see cref="FIMETADATA"/> structures are different; otherwise, <b>false</b>.
 
82
                /// </returns>
 
83
                public static bool operator !=(FIMETADATA left, FIMETADATA right)
 
84
                {
 
85
                        return (left.data != right.data);
 
86
                }
 
87
 
 
88
                /// <summary>
 
89
                /// Gets whether the pointer is a null pointer or not.
 
90
                /// </summary>
 
91
                /// <value><b>true</b> if this <see cref="FIMETADATA"/> is a null pointer;
 
92
                /// otherwise, <b>false</b>.</value>            
 
93
                public bool IsNull
 
94
                {
 
95
                        get
 
96
                        {
 
97
                                return (data == IntPtr.Zero);
 
98
                        }
 
99
                }
 
100
 
 
101
                /// <summary>
 
102
                /// Sets the handle to <i>null</i>.
 
103
                /// </summary>
 
104
                public void SetNull()
 
105
                {
 
106
                        data = IntPtr.Zero;
 
107
                }
 
108
 
 
109
                /// <summary>
 
110
                /// Converts the numeric value of the <see cref="FIMETADATA"/> object
 
111
                /// to its equivalent string representation.
 
112
                /// </summary>
 
113
                /// <returns>The string representation of the value of this instance.</returns>
 
114
                public override string ToString()
 
115
                {
 
116
                        return data.ToString();
 
117
                }
 
118
 
 
119
                /// <summary>
 
120
                /// Returns a hash code for this <see cref="FIMETADATA"/> structure.
 
121
                /// </summary>
 
122
                /// <returns>An integer value that specifies the hash code for this <see cref="FIMETADATA"/>.</returns>
 
123
                public override int GetHashCode()
 
124
                {
 
125
                        return data.GetHashCode();
 
126
                }
 
127
 
 
128
                /// <summary>
 
129
                /// Determines whether the specified <see cref="Object"/> is equal to the current <see cref="Object"/>.
 
130
                /// </summary>
 
131
                /// <param name="obj">The <see cref="Object"/> to compare with the current <see cref="Object"/>.</param>
 
132
                /// <returns><b>true</b> if the specified <see cref="Object"/> is equal to the current <see cref="Object"/>; otherwise, <b>false</b>.</returns>
 
133
                public override bool Equals(object obj)
 
134
                {
 
135
                        return ((obj is FIMETADATA) && (this == ((FIMETADATA)obj)));
 
136
                }
 
137
 
 
138
                /// <summary>
 
139
                /// Indicates whether the current object is equal to another object of the same type.
 
140
                /// </summary>
 
141
                /// <param name="other">An object to compare with this object.</param>
 
142
                /// <returns><b>true</b> if the current object is equal to the other parameter; otherwise, <b>false</b>.</returns>
 
143
                public bool Equals(FIMETADATA other)
 
144
                {
 
145
                        return (this == other);
 
146
                }
 
147
 
 
148
                /// <summary>
 
149
                /// Compares this instance with a specified <see cref="Object"/>.
 
150
                /// </summary>
 
151
                /// <param name="obj">An object to compare with this instance.</param>
 
152
                /// <returns>A 32-bit signed integer indicating the lexical relationship between the two comparands.</returns>
 
153
                /// <exception cref="ArgumentException"><paramref name="obj"/> is not a <see cref="FIMETADATA"/>.</exception>
 
154
                public int CompareTo(object obj)
 
155
                {
 
156
                        if (obj == null)
 
157
                        {
 
158
                                return 1;
 
159
                        }
 
160
                        if (!(obj is FIMETADATA))
 
161
                        {
 
162
                                throw new ArgumentException("obj");
 
163
                        }
 
164
                        return CompareTo((FIMETADATA)obj);
 
165
                }
 
166
 
 
167
                /// <summary>
 
168
                /// Compares this instance with a specified <see cref="FIMETADATA"/> object.
 
169
                /// </summary>
 
170
                /// <param name="other">A <see cref="FIMETADATA"/> to compare.</param>
 
171
                /// <returns>A signed number indicating the relative values of this instance
 
172
                /// and <paramref name="other"/>.</returns>
 
173
                public int CompareTo(FIMETADATA other)
 
174
                {
 
175
                        return this.data.ToInt64().CompareTo(other.data.ToInt64());
 
176
                }
 
177
        }
 
178
}
 
 
b'\\ No newline at end of file'