@@ -54,7 +54,7 @@ use crate::segment::{Segment, SegmentBuilder};
5454use crate :: settings:: Settings ;
5555use crate :: string:: * ;
5656use crate :: symbol:: { Symbol , SymbolType } ;
57- use crate :: tags:: { Tag , TagType } ;
57+ use crate :: tags:: { Tag , TagReference , TagType } ;
5858use crate :: types:: {
5959 NamedTypeReference , QualifiedName , QualifiedNameAndType , QualifiedNameTypeAndId , Type ,
6060 TypeArchive , TypeArchiveId , TypeContainer , TypeLibrary ,
@@ -1646,6 +1646,34 @@ pub trait BinaryViewExt: BinaryViewBase {
16461646 }
16471647 }
16481648
1649+ /// Get all tags in all scopes
1650+ fn tags_all_scopes ( & self ) -> Array < TagReference > {
1651+ let mut count = 0 ;
1652+ unsafe {
1653+ let tag_references = BNGetAllTagReferences ( self . as_ref ( ) . handle , & mut count) ;
1654+ Array :: new ( tag_references, count, ( ) )
1655+ }
1656+ }
1657+
1658+ /// Get all tag types present for the view
1659+ fn tag_types ( & self ) -> Array < TagType > {
1660+ let mut count = 0 ;
1661+ unsafe {
1662+ let tag_types_raw = BNGetTagTypes ( self . as_ref ( ) . handle , & mut count) ;
1663+ Array :: new ( tag_types_raw, count, ( ) )
1664+ }
1665+ }
1666+
1667+ // Get all tags of a specific type
1668+ fn tags_by_type ( & self , tag_type : & TagType ) -> Array < TagReference > {
1669+ let mut count = 0 ;
1670+ unsafe {
1671+ let tag_references =
1672+ BNGetAllTagReferencesOfType ( self . as_ref ( ) . handle , tag_type. handle , & mut count) ;
1673+ Array :: new ( tag_references, count, ( ) )
1674+ }
1675+ }
1676+
16491677 /// Get a tag by its id.
16501678 ///
16511679 /// Note this does not tell you anything about where it is used.
0 commit comments