Skip to content

Commit

Permalink
feat(pbxproj): more collection object getters
Browse files Browse the repository at this point in the history
  • Loading branch information
kkharji committed Jun 12, 2022
1 parent 5e8b060 commit fdaae8a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/pbxproj/object/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,30 @@ impl PBXObjectCollection {
.collect()
}

/// Get all PBXGroup
pub fn groups<'a>(&'a self) -> Vec<(String, Rc<RefCell<PBXGroup>>)> {
self.iter()
.filter(|o| o.1.is_pbx_group())
.map(|(k, o)| (k.clone(), o.as_pbx_group().unwrap().clone()))
.collect()
}

/// Get all PBXProject
pub fn projects<'a>(&'a self) -> Vec<(String, Rc<RefCell<PBXProject>>)> {
self.iter()
.filter(|o| o.1.is_pbx_project())
.map(|(k, o)| (k.clone(), o.as_pbx_project().unwrap().clone()))
.collect()
}

/// Get all files
pub fn files<'a>(&'a self) -> Vec<(String, Rc<RefCell<PBXFileReference>>)> {
self.iter()
.filter(|o| o.1.is_pbx_file_reference())
.map(|(k, o)| (k.clone(), o.as_pbx_file_reference().unwrap().clone()))
.collect()
}

/// Get all PBXBuildFile
pub fn build_files<'a>(&'a self) -> Vec<(String, Rc<RefCell<PBXBuildFile>>)> {
self.iter()
Expand Down

0 comments on commit fdaae8a

Please sign in to comment.