Esempio n. 1
0
	def count_array_items( self, schema_ns, array_name ):
		""" 
		count_array_items returns the number of a given array's items
		"""
		index = 0
		
		the_prop = _exempi.xmp_string_new()
		
		while( True ):
			if _exempi.xmp_get_array_item( self.xmpptr, str(schema_ns), str(array_name), index+1, the_prop, None):
				index += 1
			else:
				break
		
		return index
Esempio n. 2
0
File: core.py Progetto: vicgc/Uforia
    def count_array_items(self, schema_ns, array_name):
        """
		count_array_items returns the number of a given array's items
		"""
        index = 0

        the_prop = _exempi.xmp_string_new()

        while (True):
            if _exempi.xmp_get_array_item(self.xmpptr, str(schema_ns),
                                          str(array_name), index + 1, the_prop,
                                          None):
                index += 1
            else:
                break

        return index
Esempio n. 3
0
	def get_array_item( self, schema_ns, array_name, item_index ):
		"""
		get_array_item() provides access to items within an array.
		

		Reports whether the item exists; if it does, and if it has a value, the function retrieves the value.; if it doesn't it raises Exception.
		Items are accessed by an integer index, where the first item has index 1.
		
		.. todo:: Make get_array_item optionally return keywords describing array item's options
		"""	
		the_prop = _exempi.xmp_string_new()
		options = c_int32()
		
		if _exempi.xmp_get_array_item( self.xmpptr, schema_ns, array_name, item_index, the_prop, byref(options)): #we're never returning options
			return {_exempi.xmp_string_cstr(the_prop):options.value}
		else:
			raise Exception, "Array's over"
Esempio n. 4
0
	def does_array_item_exist(self, schema_ns, array_name, item ):
		""" 
		does_array_item_exist() reports whether an array's item currently exists.

		:return: True if item is in array, False otherwise
		:rtype: bool
		"""
		index = 0
		
		the_prop = _exempi.xmp_string_new()
		
		while( True ):
			if _exempi.xmp_get_array_item( self.xmpptr, str(schema_ns), str(array_name), index+1, the_prop, None):
				index += 1
			else:
				break
		
		return index
Esempio n. 5
0
File: core.py Progetto: vicgc/Uforia
    def get_array_item(self, schema_ns, array_name, item_index):
        """
		get_array_item() provides access to items within an array.


		Reports whether the item exists; if it does, and if it has a value, the function retrieves the value.; if it doesn't it raises Exception.
		Items are accessed by an integer index, where the first item has index 1.

		.. todo:: Make get_array_item optionally return keywords describing array item's options
		"""
        the_prop = _exempi.xmp_string_new()
        options = c_int32()

        if _exempi.xmp_get_array_item(
                self.xmpptr, schema_ns, array_name, item_index, the_prop,
                byref(options)):  # we're never returning options
            return {_exempi.xmp_string_cstr(the_prop): options.value}
        else:
            raise Exception, "Array's over"
Esempio n. 6
0
File: core.py Progetto: vicgc/Uforia
    def does_array_item_exist(self, schema_ns, array_name, item):
        """
		does_array_item_exist() reports whether an array's item currently exists.

		:return: True if item is in array, False otherwise
		:rtype: bool
		"""
        index = 0

        the_prop = _exempi.xmp_string_new()

        while (True):
            if _exempi.xmp_get_array_item(self.xmpptr, str(schema_ns),
                                          str(array_name), index + 1, the_prop,
                                          None):
                index += 1
            else:
                break

        return index