Skip to content

Commit fdaae8a

Browse files
committed
feat(pbxproj): more collection object getters
1 parent 5e8b060 commit fdaae8a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/pbxproj/object/collection.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,30 @@ impl PBXObjectCollection {
5858
.collect()
5959
}
6060

61+
/// Get all PBXGroup
62+
pub fn groups<'a>(&'a self) -> Vec<(String, Rc<RefCell<PBXGroup>>)> {
63+
self.iter()
64+
.filter(|o| o.1.is_pbx_group())
65+
.map(|(k, o)| (k.clone(), o.as_pbx_group().unwrap().clone()))
66+
.collect()
67+
}
68+
69+
/// Get all PBXProject
70+
pub fn projects<'a>(&'a self) -> Vec<(String, Rc<RefCell<PBXProject>>)> {
71+
self.iter()
72+
.filter(|o| o.1.is_pbx_project())
73+
.map(|(k, o)| (k.clone(), o.as_pbx_project().unwrap().clone()))
74+
.collect()
75+
}
76+
77+
/// Get all files
78+
pub fn files<'a>(&'a self) -> Vec<(String, Rc<RefCell<PBXFileReference>>)> {
79+
self.iter()
80+
.filter(|o| o.1.is_pbx_file_reference())
81+
.map(|(k, o)| (k.clone(), o.as_pbx_file_reference().unwrap().clone()))
82+
.collect()
83+
}
84+
6185
/// Get all PBXBuildFile
6286
pub fn build_files<'a>(&'a self) -> Vec<(String, Rc<RefCell<PBXBuildFile>>)> {
6387
self.iter()

0 commit comments

Comments
 (0)