Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
MenuRegistry::detail::VisitorBase Struct Reference

#include <MenuRegistry.h>

Inheritance diagram for MenuRegistry::detail::VisitorBase:
[legend]
Collaboration diagram for MenuRegistry::detail::VisitorBase:
[legend]

Public Member Functions

std::pair< bool, bool > ShouldBeginGroup (const ItemProperties *pProperties)
 
void AfterBeginGroup (const ItemProperties *pProperties)
 
bool ShouldEndGroup (const ItemProperties *pProperties)
 
bool ShouldDoSeparator ()
 

Public Attributes

std::vector< bool > firstItem
 
std::vector< bool > needSeparator
 

Detailed Description

Definition at line 119 of file MenuRegistry.h.

Member Function Documentation

◆ AfterBeginGroup()

void MenuRegistry::detail::VisitorBase::AfterBeginGroup ( const ItemProperties pProperties)

Definition at line 61 of file MenuRegistry.cpp.

63{
64 const auto properties =
65 pProperties ? pProperties->GetProperties() : ItemProperties::None;
66
67 bool isMenu = false;
68 bool isExtension = false;
69
70 switch (properties) {
73 isMenu = true;
74 isExtension = (properties == ItemProperties::Extension);
75 break;
76 }
77 default:
78 break;
79 }
80
81 if (isMenu) {
82 needSeparator.push_back(false);
83 firstItem.push_back(!isExtension);
84 }
85}
std::vector< bool > needSeparator
Definition: MenuRegistry.h:127

References MenuRegistry::ItemProperties::Extension, MenuRegistry::ItemProperties::GetProperties(), MenuRegistry::ItemProperties::None, and MenuRegistry::ItemProperties::Whole.

Referenced by MenuRegistry::Visitor< MenuTraits >::Visitor().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShouldBeginGroup()

std::pair< bool, bool > MenuRegistry::detail::VisitorBase::ShouldBeginGroup ( const ItemProperties pProperties)

Definition at line 30 of file MenuRegistry.cpp.

32{
33 const auto properties =
34 pProperties ? pProperties->GetProperties() : ItemProperties::None;
35
36 bool inlined = false;
37 bool shouldDoSeparator = false;
38
39 switch (properties) {
41 inlined = true;
42 break;
43 }
45 if (!needSeparator.empty())
46 needSeparator.back() = true;
47 break;
48 }
51 shouldDoSeparator = ShouldDoSeparator();
52 break;
53 }
54 default:
55 break;
56 }
57
58 return { !inlined, shouldDoSeparator };
59}

References MenuRegistry::ItemProperties::Extension, MenuRegistry::ItemProperties::GetProperties(), MenuRegistry::ItemProperties::Inline, needSeparator, MenuRegistry::ItemProperties::None, MenuRegistry::ItemProperties::Section, ShouldDoSeparator(), and MenuRegistry::ItemProperties::Whole.

Referenced by MenuRegistry::Visitor< MenuTraits >::Visitor().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShouldDoSeparator()

bool MenuRegistry::detail::VisitorBase::ShouldDoSeparator ( )

Definition at line 118 of file MenuRegistry.cpp.

119{
120 bool separate = false;
121 if (!needSeparator.empty()) {
122 separate = needSeparator.back() && !firstItem.back();
123 needSeparator.back() = false;
124 firstItem.back() = false;
125 }
126 return separate;
127}

Referenced by ShouldBeginGroup(), and MenuRegistry::Visitor< MenuTraits >::Visitor().

Here is the caller graph for this function:

◆ ShouldEndGroup()

bool MenuRegistry::detail::VisitorBase::ShouldEndGroup ( const ItemProperties pProperties)

Definition at line 87 of file MenuRegistry.cpp.

89{
90 const auto properties =
91 pProperties ? pProperties->GetProperties() : ItemProperties::None;
92
93 bool inlined = false;
94
95 switch (properties) {
97 inlined = true;
98 break;
99 }
101 if ( !needSeparator.empty() )
102 needSeparator.back() = true;
103 break;
104 }
107 firstItem.pop_back();
108 needSeparator.pop_back();
109 break;
110 }
111 default:
112 break;
113 }
114
115 return !inlined;
116}

References MenuRegistry::ItemProperties::Extension, MenuRegistry::ItemProperties::GetProperties(), MenuRegistry::ItemProperties::Inline, MenuRegistry::ItemProperties::None, MenuRegistry::ItemProperties::Section, and MenuRegistry::ItemProperties::Whole.

Referenced by MenuRegistry::Visitor< MenuTraits >::Visitor().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ firstItem

std::vector<bool> MenuRegistry::detail::VisitorBase::firstItem

Definition at line 126 of file MenuRegistry.h.

◆ needSeparator

std::vector<bool> MenuRegistry::detail::VisitorBase::needSeparator

Definition at line 127 of file MenuRegistry.h.

Referenced by ShouldBeginGroup().


The documentation for this struct was generated from the following files: