Unity Scopes API
|
A department with optional sub-departments. More...
#include <unity/scopes/Department.h>
Public Member Functions | |
void | set_subdepartments (DepartmentList const &departments) |
Set sub-departments of this department. More... | |
void | add_subdepartment (Department::SCPtr const &department) |
Add sub-department to this department. More... | |
void | set_alternate_label (std::string const &label) |
Set the alternate label (plural of the normal label) of this department. More... | |
void | set_has_subdepartments (bool subdepartments=true) |
Sets has_subdepartments flag of this department. More... | |
std::string | id () const |
Get the identifier of this department. More... | |
std::string | label () const |
Get the label of this department. More... | |
std::string | alternate_label () const |
Get the alternate label of this department. More... | |
CannedQuery | query () const |
Get the canned query associated with this department. More... | |
DepartmentList | subdepartments () const |
Get list of sub-departments of this department. More... | |
bool | has_subdepartments () const |
Check if this department has subdepartments or has_subdepartments flag is set. More... | |
Copy and assignment | |
Copy and assignment operators (move and non-move versions) have the usual value semantics. | |
Department (Department const &other) | |
Department (Department &&) | |
Department & | operator= (Department const &other) |
Department & | operator= (Department &&) |
Static Public Member Functions | |
static Department::UPtr | create (CannedQuery const &query, std::string const &label) |
Create a department with the given canned query and name. More... | |
static Department::UPtr | create (std::string const &department_id, CannedQuery const &query, std::string const &label) |
Create a department with the given department identifier, canned query, and name. More... | |
A department with optional sub-departments.
void unity::scopes::Department::add_subdepartment | ( | Department::SCPtr const & | department | ) |
Add sub-department to this department.
department | The subdepartment instance. |
std::string unity::scopes::Department::alternate_label | ( | ) | const |
Get the alternate label of this department.
Return the alternate label of this department. The alternate label expresses the plural "all" form of the normal label. For example, if the normal label is "Books", then the alternate label is "All Books". Note that alternate label and can be empty - in that case the normal label should be displayed instead.
|
static |
Create a department with the given canned query and name.
The identifier of this department instance is that of the query
instance (CannedQuery::department_id()).
query | The query (and associated parameters, such as filter state) to be executed when the user selects this department. |
label | The display name of this department. |
|
static |
Create a department with the given department identifier, canned query, and name.
The canned query's target department identifier is updated with department_id. This constructor is convenient for creating multiple departments that use the same query and only need a different department identifier.
department_id | The department identifier. |
query | The canned query (and associated parameters, such as filter state) to be executed when the user selects this department. |
label | The display name of this department. |
bool unity::scopes::Department::has_subdepartments | ( | ) | const |
Check if this department has subdepartments or has_subdepartments flag is set.
std::string unity::scopes::Department::id | ( | ) | const |
Get the identifier of this department.
std::string unity::scopes::Department::label | ( | ) | const |
Get the label of this department.
CannedQuery unity::scopes::Department::query | ( | ) | const |
Get the canned query associated with this department.
void unity::scopes::Department::set_alternate_label | ( | std::string const & | label | ) |
Set the alternate label (plural of the normal label) of this department.
The alternate label should express the plural "all" form of the normal label. For example, if the normal label is "Books", then the alternate label should be "All Books". The alternate label needs to be provided for the current department only.
label | The alternate label to display when showing plural form of this department's name. |
void unity::scopes::Department::set_has_subdepartments | ( | bool | subdepartments = true | ) |
Sets has_subdepartments flag of this department.
This flag is a display hint for the Shell that indicates if this department has sub-departments and as such should be displayed in a way that suggests further navigation to the user. Setting this flag is not needed when sub-departments have been added with set_subdepartments() method. Setting this flag to false after adding sub-departments with set_subdepartments() throws unity::LogicException.
unity::LogicException | if called with false after adding sub-departments with unity::scopes::Department::set_subdepartments() |
void unity::scopes::Department::set_subdepartments | ( | DepartmentList const & | departments | ) |
Set sub-departments of this department.
departments | The list of sub-departments. |
DepartmentList unity::scopes::Department::subdepartments | ( | ) | const |
Get list of sub-departments of this department.