Class: TagLib::MP4::ItemListMap

Inherits:
Object
  • Object
show all
Defined in:
docs/taglib/mp4.rb

Overview

The underlying C++-structure of ItemListMap inherits from std::map. Consequently, ItemListMap behaves differently from a Ruby hash in a few places: the C++ memory management strategies of ItemListMap can lead to a situation where a Ruby object refers to a location in memory that was freed by C++. To prevent Ruby from crashing on us with a segmentation fault, we raise an ObjectPreviouslyDeleted exception when we try to access data that is no longer available.

Instance Method Summary collapse

Instance Method Details

#clearnil

Note:

May free memory referred to by Ruby objects

Remove all Items from self, destroying each Item.

Examples:

Triggering an ObjectPreviouslyDeleted exception

remember_me = mp4.tag.item_list_map["\xC2\xA9nam"]
mp4.tag.item_list_map.clear
# => nil
remember_me.to_string_list
# ObjectPreviouslyDeleted: Expected argument 0 of type TagLib::MP4::Item const *, but got TagLib::MP4::Item #<TagLib::MP4::Item:0x007f9199...
# 	in SWIG method 'toStringList'
# from (pry):7:in `to_string_list'

Returns:

  • (nil)

182
183
# File 'docs/taglib/mp4.rb', line 182

def clear
end

#contains(key) ⇒ Boolean Also known as: has_key?, include?

Returns true if self has an Item under key.

Parameters:

  • key (String)

Returns:

  • (Boolean)

188
189
# File 'docs/taglib/mp4.rb', line 188

def contains(key)
end

#empty?Boolean

Returns true if self is empty

Returns:

  • (Boolean)

195
196
# File 'docs/taglib/mp4.rb', line 195

def empty?
end

#erase(key) ⇒ nil

Note:

May free memory referred to by Ruby objects

Remove and destroy the value under key, if present.

Examples:

Triggering an ObjectPreviouslyDeleted exception

remember_me = mp4.tag.item_list_map["\xC2\xA9nam"]
mp4.tag.item_list_map.erase("\xC2\xA9nam")
# => nil
remember_me.to_string_list
# ObjectPreviouslyDeleted: Expected argument 0 of type TagLib::MP4::Item const *, but got TagLib::MP4::Item #<TagLib::MP4::Item:0x007f919a...
# 	in SWIG method 'toStringList'
# from (pry):13:in `to_string_list'

Parameters:

  • key (String)

Returns:

  • (nil)

211
212
# File 'docs/taglib/mp4.rb', line 211

def erase(key)
end

#fetch(key) ⇒ TagLib::MP4::Item? Also known as: []

Return the Item under key, or nil if no Item is present.

Parameters:

  • key (String)

Returns:


166
167
# File 'docs/taglib/mp4.rb', line 166

def fetch(key)
end

#insert(key, item) ⇒ nil

Note:

May free memory referred to by Ruby objects

Insert an item at key, destoying the existing item under key.

Examples:

Triggering an ObjectPreviouslyDeleted exception

remember_me = mp4.tag.item_list_map["\xC2\xA9nam"]
mp4.tag.item_list_map.insert("\xC2\xA9nam", TagLib::MP4::Item.from_string_list(['New']))
remember_me.to_string_list
# ObjectPreviouslyDeleted: Expected argument 0 of type TagLib::MP4::Item const *, but got TagLib::MP4::Item #<TagLib::MP4::Item:0x007f919a...
# 	in SWIG method 'toStringList'
# from (pry):18:in `to_string_list'

Parameters:

Returns:

  • (nil)

226
227
# File 'docs/taglib/mp4.rb', line 226

def insert(key, item)
end

#sizeFixnum

The number of Items in self.

Returns:

  • (Fixnum)

231
232
# File 'docs/taglib/mp4.rb', line 231

def size
end

#to_aArray<Array<String, TagLib::MP4::Item>>

Convert self into an array of [key, value] pairs.

Returns:


236
237
# File 'docs/taglib/mp4.rb', line 236

def to_a
end