class_docstr: Wrap GValue in a Python class.
  
  This class wraps :class:`.GValue` in a convenient interface. You can use
  instances of this class to get and set :class:`.GObject` properties.
  
  On construction, :class:`.GValue` is all zero (empty). You can pass it to
  a get function to have it filled by :class:`.GObject`, or use init to
  set a type, set to set a value, then use it to set an object property.
  
  GValue lifetime is managed automatically.
class_docstr_tok: ["Wrap","GValue","in","a","Python","class",".","This","class","wraps",":","class",":","`",".GValue","`","in","a","convenient","interface",".","You","can","use","instances","of","this","class","to","get","and","set",":","class",":","`",".GObject","`","properties",".","On","construction",",",":","class",":","`",".GValue","`","is","all","zero","(","empty",")",".","You","can","pass","it","to","a","get","function","to","have","it","filled","by",":","class",":","`",".GObject","`",",","or","use","init","to","set","a","type",",","set","to","set","a","value",",","then","use","it","to","set","an","object","property",".","GValue","lifetime","is","managed","automatically","."]
docstr: Get the contents of a GValue.
  
  The contents of the GValue are read out as a Python type.
docstr_tok: ["Get","the","contents","of","a","GValue",".","The","contents","of","the","GValue","are","read","out","as","a","Python","type","."]
code: def get(self):
      """Get the contents of a GValue.
  
      The contents of the GValue are read out as a Python type.
      """
  
      # logger.debug('GValue.get: self = %s', self)
  
      gtype = self.gvalue.g_type
      fundamental = gobject_lib.g_type_fundamental(gtype)
  
      result = None
  
      if gtype == GValue.gbool_type:
          result = bool(gobject_lib.g_value_get_boolean(self.gvalue))
      elif gtype == GValue.gint_type:
          result = gobject_lib.g_value_get_int(self.gvalue)
      elif gtype == GValue.guint64_type:
          result = gobject_lib.g_value_get_uint64(self.gvalue)
      elif gtype == GValue.gdouble_type:
          result = gobject_lib.g_value_get_double(self.gvalue)
      elif fundamental == GValue.genum_type:
          return GValue.from_enum(
              gtype, gobject_lib.g_value_get_enum(self.gvalue)
          )
      elif fundamental == GValue.gflags_type:
          result = gobject_lib.g_value_get_flags(self.gvalue)
      elif gtype == GValue.gstr_type:
          pointer = gobject_lib.g_value_get_string(self.gvalue)
  
          if pointer != ffi.NULL:
              result = _to_string(pointer)
      elif gtype == GValue.refstr_type:
          psize = ffi.new("size_t *")
          pointer = vips_lib.vips_value_get_ref_string(
              self.gvalue, psize
          )
  
          # psize[0] will be number of bytes in string, but just assume it's
          # NULL-terminated
          result = _to_string(pointer)
      elif gtype == GValue.image_type:
          # g_value_get_object() will not add a ref ... that is
          # held by the gvalue
          go = gobject_lib.g_value_get_object(self.gvalue)
          vi = ffi.cast("VipsImage *", go)
  
          # we want a ref that will last with the life of the vimage:
          # this ref is matched by the unref that's attached to finalize
          # by Image()
          gobject_lib.g_object_ref(vi)
  
          result = pyvips.Image(vi)
      elif gtype == GValue.array_int_type:
          pint = ffi.new("int *")
          array = vips_lib.vips_value_get_array_int(self.gvalue, pint)
  
          result = []
          for i in range(0, pint[0]):
              result.append(array[i])
      elif gtype == GValue.array_double_type:
          pint = ffi.new("int *")
          array = vips_lib.vips_value_get_array_double(
              self.gvalue, pint
          )
  
          result = []
          for i in range(0, pint[0]):
              result.append(array[i])
      elif gtype == GValue.array_image_type:
          pint = ffi.new("int *")
          array = vips_lib.vips_value_get_array_image(self.gvalue, pint)
  
          result = []
          for i in range(0, pint[0]):
              vi = array[i]
              gobject_lib.g_object_ref(vi)
              image = pyvips.Image(vi)
              result.append(image)
      elif gtype == GValue.blob_type:
          psize = ffi.new("size_t *")
          array = vips_lib.vips_value_get_blob(self.gvalue, psize)
          buf = ffi.cast("char*", array)
  
          result = ffi.unpack(buf, psize[0])
      else:
          raise Error(
              "unsupported gtype for get {0}".format(type_name(gtype))
          )
  
      return result
  
file_path: pyvips/pyvips/gvalue.py
imports: from __future__ import division
  from __future__ import unicode_literals
  import logging
  import numbers
  import sys
  import pyvips
  from pyvips import ffi, vips_lib, gobject_lib, glib_lib, Error, _to_bytes, _to_string, type_name, type_from_name, at_least_libvips
label_desc: Use image node_id 8 for calling the GValue obj's underlying member method code with example usage: obj.get() and returns: result, GValue