class Xcodeproj::Project::ObjectList


@todo Cover all the mutations methods of the {Array} class.
usually are implemented in C
Moreover it is a moving target because the methods of array
the array methods should be covered, but this is not done yet.
which are overridden to inform objects reference count. Ideally all
@note Concerning the mutations methods it is safe to call only those
with reference count on modifications.
the project is not serialized with unreachable objects by updating the
It works in conjunction with the {AbstractObject} class to ensure that
This class represents an ordered relationship to many objects.

def +(other)

Returns:
  • (void) -

Parameters:
  • objects (Array) --
def +(other)
  perform_additions_operations(other)
  super
end

def <<(object)

Returns:
  • (void) -

Parameters:
  • object (AbstractObject, ObjectDictionary) --
def <<(object)
  perform_additions_operations(object)
  super
end

def clear

Returns:
  • (void) -
def clear
  objects.each do |object|
    perform_deletion_operations(object)
  end
  super
end

def delete(object)

Returns:
  • (AbstractObject, ObjectDictionary, Nil) - the object if found.

Parameters:
  • object (AbstractObject, ObjectDictionary) --
def delete(object)
  perform_deletion_operations(object)
  super
end

def delete_at(index)

Returns:
  • (AbstractObject, ObjectDictionary, Nil) - the object if found.

Parameters:
  • from (Fixnum) --
def delete_at(index)
  object = at(index)
  perform_deletion_operations(object)
  super
end

def initialize(attribute, owner)


synthesized methods generated by {AbstractObject.has_many}.
{ObjectList}, it is always initialized empty and automatically by the
{Xcodeproj} clients are not expected to create instances of
def initialize(attribute, owner)
  @attribute = attribute
  @owner = owner
end

def insert(index, object)

Returns:
  • (void) -

Parameters:
  • object (AbstractObject, ObjectDictionary) --
def insert(index, object)
  perform_additions_operations(object)
  super
end

def move(object, new_index)

Returns:
  • (void) -

Parameters:
  • to (Fixnum) --
  • object (AbstractObject, ObjectDictionary) --
def move(object, new_index)
  return if index(object) == new_index
  if obj = delete(object)
    insert(new_index, obj)
  else
    raise "Attempt to move object `#{object}` not present in the list `#{inspect}`"
  end
end

def move_from(current_index, new_index)

Returns:
  • (void) -

Parameters:
  • to (Fixnum) --
  • from (Fixnum) --
def move_from(current_index, new_index)
  return if current_index == new_index
  if obj = delete_at(current_index)
    insert(new_index, obj)
  else
    raise "Attempt to move object from index `#{current_index}` which is beyond bounds of the list `#{inspect}`"
  end
end

def objects

Returns:
  • (Array) -
def objects
  to_a
end

def perform_additions_operations(objects)

Returns:
  • (void) -
def perform_additions_operations(objects)
  objects = [objects] unless objects.is_a?(Array)
  objects.each do |obj|
    owner.mark_project_as_dirty!
    obj.add_referrer(owner)
    attribute.validate_value(obj) unless obj.is_a?(ObjectDictionary)
  end
end

def perform_deletion_operations(objects)

Returns:
  • (void) -
def perform_deletion_operations(objects)
  objects = [objects] unless objects.is_a?(Array)
  objects.each do |obj|
    owner.mark_project_as_dirty!
    obj.remove_referrer(owner) unless obj.is_a?(ObjectDictionary)
  end
end

def sort!

def sort!
  return super if owner.project.dirty?
  previous = to_a
  super
  owner.mark_project_as_dirty! unless previous == to_a
  self
end

def unshift(object)

Returns:
  • (void) -

Parameters:
  • object (AbstractObject, ObjectDictionary) --
def unshift(object)
  perform_additions_operations(object)
  super
end

def uuids

Returns:
  • (Array) -
def uuids
  map(&:uuid)
end