📄 generic_values.sgml
字号:
<refsect2><title><anchor id="g-value-copy">g_value_copy ()</title><programlisting>void g_value_copy (const <link linkend="GValue">GValue</link> *src_value, <link linkend="GValue">GValue</link> *dest_value);</programlisting><para>Copies the value of <parameter>src_value</parameter> into <parameter>dest_value</parameter>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>src_value</parameter> :</entry><entry> An initialized <link linkend="GValue">GValue</link> structure.</entry></row><row><entry align="right"><parameter>dest_value</parameter> :</entry><entry> An initialized <link linkend="GValue">GValue</link> structure of the same type as <parameter>src_value</parameter>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-value-reset">g_value_reset ()</title><programlisting><link linkend="GValue">GValue</link>* g_value_reset (<link linkend="GValue">GValue</link> *value);</programlisting><para>Clears the current value in <parameter>value</parameter> and resets it to the default value(as if the value had just been initialized).</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>value</parameter> :</entry><entry> An initialized <link linkend="GValue">GValue</link> structure.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry></entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-value-unset">g_value_unset ()</title><programlisting>void g_value_unset (<link linkend="GValue">GValue</link> *value);</programlisting><para>Clears the current value in <parameter>value</parameter> and "unsets" the type,this releases all resources associated with this GValue.An unset value is the same as an uninitialized (zero-filled)<link linkend="GValue">GValue</link> structure.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>value</parameter> :</entry><entry> An initialized <link linkend="GValue">GValue</link> structure.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-value-fits-pointer">g_value_fits_pointer ()</title><programlisting><link linkend="gboolean">gboolean</link> g_value_fits_pointer (const <link linkend="GValue">GValue</link> *value);</programlisting><para>Determines if <parameter>value</parameter> will fit inside the size of a pointer value.This is an internal function introduced mainly for C marshallers.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>value</parameter> :</entry><entry> An initialized <link linkend="GValue">GValue</link> structure.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> <link linkend="TRUE-CAPS">TRUE</link> if <parameter>value</parameter> will fit inside a pointer value.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-value-peek-pointer">g_value_peek_pointer ()</title><programlisting><link linkend="gpointer">gpointer</link> g_value_peek_pointer (const <link linkend="GValue">GValue</link> *value);</programlisting><para>Return the value contents as pointer. This function asserts that<link linkend="g-value-fits-pointer">g_value_fits_pointer</link>() returned <link linkend="TRUE-CAPS">TRUE</link> for the passed in value.This is an internal function introduced mainly for C marshallers.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>value</parameter> :</entry><entry> An initialized <link linkend="GValue">GValue</link> structure.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> <link linkend="TRUE-CAPS">TRUE</link> if <parameter>value</parameter> will fit inside a pointer value.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-value-type-compatible">g_value_type_compatible ()</title><programlisting><link linkend="gboolean">gboolean</link> g_value_type_compatible (<link linkend="GType">GType</link> src_type, <link linkend="GType">GType</link> dest_type);</programlisting><para>Returns whether a <link linkend="GValue">GValue</link> of type <parameter>src_type</parameter> can be copied intoa <link linkend="GValue">GValue</link> of type <parameter>dest_type</parameter>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>src_type</parameter> :</entry><entry> source type to be copied.</entry></row><row><entry align="right"><parameter>dest_type</parameter> :</entry><entry>destination type for copying.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> <literal>TRUE</literal> if <link linkend="g-value-copy">g_value_copy</link>() is possible with <parameter>src_type</parameter> and <parameter>dest_type</parameter>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-value-type-transformable">g_value_type_transformable ()</title><programlisting><link linkend="gboolean">gboolean</link> g_value_type_transformable (<link linkend="GType">GType</link> src_type, <link linkend="GType">GType</link> dest_type);</programlisting><para>Check whether <link linkend="g-value-transform">g_value_transform</link>() is able to transform valuesof type <parameter>src_type</parameter> into values of type <parameter>dest_type</parameter>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>src_type</parameter> :</entry><entry> Source type.</entry></row><row><entry align="right"><parameter>dest_type</parameter> :</entry><entry>Target type.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> <literal>TRUE</literal> if the transformation is possible, <literal>FALSE</literal> otherwise.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-value-transform">g_value_transform ()</title><programlisting><link linkend="gboolean">gboolean</link> g_value_transform (const <link linkend="GValue">GValue</link> *src_value, <link linkend="GValue">GValue</link> *dest_value);</programlisting><para>Tries to cast the contents of <parameter>src_value</parameter> into a type apropriateto store in <parameter>dest_value</parameter>, e.g. to transform a <literal>G_TYPE_INT</literal> valueinto a <literal>G_TYPE_FLOAT</literal> value. Performing transformations betweenvalue types might incour precision lossage. Especiallytransformations into strings might reveal seemingly arbitraryresults and shouldn't be relied upon for production code (suchas rcfile value or object property serialization).</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>src_value</parameter> :</entry><entry> Source value.</entry></row><row><entry align="right"><parameter>dest_value</parameter> :</entry><entry>Target value.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> Whether a transformation rule was found and could be applied. Upon failing transformations, <parameter>dest_value</parameter> is left untouched.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="GValueTransform">GValueTransform ()</title><programlisting>void (*GValueTransform) (const <link linkend="GValue">GValue</link> *src_value, <link linkend="GValue">GValue</link> *dest_value);</programlisting><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>src_value</parameter> :</entry><entry></entry></row><row><entry align="right"><parameter>dest_value</parameter> :</entry><entry></entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-value-register-transform-func">g_value_register_transform_func ()</title><programlisting>void g_value_register_transform_func (<link linkend="GType">GType</link> src_type, <link linkend="GType">GType</link> dest_type, <link linkend="GValueTransform">GValueTransform</link> transform_func);</programlisting><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>src_type</parameter> :</entry><entry></entry></row><row><entry align="right"><parameter>dest_type</parameter> :</entry><entry></entry></row><row><entry align="right"><parameter>transform_func</parameter> :</entry><entry></entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-strdup-value-contents">g_strdup_value_contents ()</title><programlisting><link linkend="gchar">gchar</link>* g_strdup_value_contents (const <link linkend="GValue">GValue</link> *value);</programlisting><para>Return a newly allocated string, which describes the contents of a <link linkend="GValue">GValue</link>.The main purpose of this function is to describe <link linkend="GValue">GValue</link> contents for debuggingoutput, the way in which the contents are described may change between differentGLib versions.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>value</parameter> :</entry><entry> <link linkend="GValue">GValue</link> which contents are to be described.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>Newly allocated string.</entry></row></tbody></tgroup></informaltable></refsect2></refsect1><refsect1><title>See Also</title><para>The fundamental types which all support <link linkend="GValue">GValue</link> operations and thuscan be used as a type initializer for <link linkend="g-value-init">g_value_init</link>() are defined bya separate interface. See the Standard Values API for details.</para></refsect1></refentry>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -