forked from NyaMisty/AltSign-Linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppGroup.cpp
More file actions
69 lines (53 loc) · 1.37 KB
/
Copy pathAppGroup.cpp
File metadata and controls
69 lines (53 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// AppGroup.cpp
// AltSign-Windows
//
// Created by Riley Testut on 5/19/20.
// Copyright (c) 2020 Riley Testut. All rights reserved.
//
#include "AppGroup.hpp"
#include "Error.hpp"
AppGroup::AppGroup()
{
}
AppGroup::~AppGroup()
{
}
AppGroup::AppGroup(plist_t plist)
{
auto nameNode = plist_dict_get_item(plist, "name");
auto identifierNode = plist_dict_get_item(plist, "applicationGroup");
auto groupIdentifierNode = plist_dict_get_item(plist, "identifier");
if (nameNode == nullptr || identifierNode == nullptr || groupIdentifierNode == nullptr)
{
throw APIError(APIErrorCode::InvalidResponse);
}
char* name = nullptr;
plist_get_string_val(nameNode, &name);
char* identifier = nullptr;
plist_get_string_val(identifierNode, &identifier);
char* groupIdentifier = nullptr;
plist_get_string_val(groupIdentifierNode, &groupIdentifier);
_name = name;
_identifier = identifier;
_groupIdentifier = groupIdentifier;
}
#pragma mark - Description -
std::ostream& operator<<(std::ostream& os, const AppGroup& appGroup)
{
os << "Name: " << appGroup.name() << " ID: " << appGroup.identifier() << " GroupID: " << appGroup.groupIdentifier();
return os;
}
#pragma mark - Getters -
std::string AppGroup::name() const
{
return _name;
}
std::string AppGroup::identifier() const
{
return _identifier;
}
std::string AppGroup::groupIdentifier() const
{
return _groupIdentifier;
}