Ring Daemon 16.0.0
Loading...
Searching...
No Matches
vcard.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2004-2025 Savoir-faire Linux Inc.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17#pragma once
18
19#include <string>
20#include <string_view>
21#include <map>
22
23namespace vCard {
24
26{
27 constexpr static std::string_view SEPARATOR_TOKEN = ";";
28 constexpr static std::string_view END_LINE_TOKEN = "\n";
29 constexpr static std::string_view BEGIN_TOKEN = "BEGIN:VCARD";
30 constexpr static std::string_view END_TOKEN = "END:VCARD";
31 constexpr static std::string_view BEGIN_TOKEN_KEY = "BEGIN";
32 constexpr static std::string_view END_TOKEN_KEY = "END";
33};;
34
36{
37 constexpr static std::string_view UID = "UID";
38 constexpr static std::string_view VCARD_VERSION = "VERSION";
39 constexpr static std::string_view ADDRESS = "ADR";
40 constexpr static std::string_view AGENT = "AGENT";
41 constexpr static std::string_view BIRTHDAY = "BDAY";
42 constexpr static std::string_view CATEGORIES = "CATEGORIES";
43 constexpr static std::string_view CLASS = "CLASS";
44 constexpr static std::string_view DELIVERY_LABEL = "LABEL";
45 constexpr static std::string_view EMAIL = "EMAIL";
46 constexpr static std::string_view FORMATTED_NAME = "FN";
47 constexpr static std::string_view GEOGRAPHIC_POSITION = "GEO";
48 constexpr static std::string_view KEY = "KEY";
49 constexpr static std::string_view LOGO = "LOGO";
50 constexpr static std::string_view MAILER = "MAILER";
51 constexpr static std::string_view NAME = "N";
52 constexpr static std::string_view NICKNAME = "NICKNAME";
53 constexpr static std::string_view DESCRIPTION = "DESCRIPTION";
54 constexpr static std::string_view NOTE = "NOTE";
55 constexpr static std::string_view ORGANIZATION = "ORG";
56 constexpr static std::string_view PHOTO = "PHOTO";
57 constexpr static std::string_view PRODUCT_IDENTIFIER = "PRODID";
58 constexpr static std::string_view REVISION = "REV";
59 constexpr static std::string_view ROLE = "ROLE";
60 constexpr static std::string_view SORT_STRING = "SORT-STRING";
61 constexpr static std::string_view SOUND = "SOUND";
62 constexpr static std::string_view TELEPHONE = "TEL";
63 constexpr static std::string_view TIME_ZONE = "TZ";
64 constexpr static std::string_view TITLE = "TITLE";
65 constexpr static std::string_view RDV_ACCOUNT = "RDV_ACCOUNT";
66 constexpr static std::string_view RDV_DEVICE = "RDV_DEVICE";
67 constexpr static std::string_view URL = "URL";
68 constexpr static std::string_view BASE64 = "ENCODING=BASE64";
69 constexpr static std::string_view TYPE_PNG = "TYPE=PNG";
70 constexpr static std::string_view TYPE_JPEG = "TYPE=JPEG";
71 constexpr static std::string_view PHOTO_PNG = "PHOTO;ENCODING=BASE64;TYPE=PNG";
72 constexpr static std::string_view PHOTO_JPEG = "PHOTO;ENCODING=BASE64;TYPE=JPEG";
73};
74
75struct Value
76{
77 constexpr static std::string_view TITLE = "title";
78 constexpr static std::string_view DESCRIPTION = "description";
79 constexpr static std::string_view AVATAR = "avatar";
80 constexpr static std::string_view RDV_ACCOUNT = "rdvAccount";
81 constexpr static std::string_view RDV_DEVICE = "rdvDevice";
82};
83
84namespace utils {
90std::map<std::string, std::string> toMap(std::string_view content);
91std::map<std::string, std::string> initVcard();
92std::string toString(const std::map<std::string, std::string>& vCard);
93void removeByKey(std::map<std::string, std::string>& vCard, std::string_view key);
94
95} // namespace utils
96
97} // namespace vCard
std::map< std::string, std::string > toMap(std::string_view content)
Payload to vCard.
Definition vcard.cpp:25
std::map< std::string, std::string > initVcard()
Definition vcard.cpp:42
std::string toString(const std::map< std::string, std::string > &vCard)
Definition vcard.cpp:53
void removeByKey(std::map< std::string, std::string > &vCard, std::string_view key)
Definition vcard.cpp:80
static constexpr std::string_view END_LINE_TOKEN
Definition vcard.h:28
static constexpr std::string_view BEGIN_TOKEN
Definition vcard.h:29
static constexpr std::string_view END_TOKEN_KEY
Definition vcard.h:32
static constexpr std::string_view END_TOKEN
Definition vcard.h:30
static constexpr std::string_view SEPARATOR_TOKEN
Definition vcard.h:27
static constexpr std::string_view BEGIN_TOKEN_KEY
Definition vcard.h:31
static constexpr std::string_view PHOTO_PNG
Definition vcard.h:71
static constexpr std::string_view RDV_DEVICE
Definition vcard.h:66
static constexpr std::string_view BASE64
Definition vcard.h:68
static constexpr std::string_view PHOTO_JPEG
Definition vcard.h:72
static constexpr std::string_view UID
Definition vcard.h:37
static constexpr std::string_view FORMATTED_NAME
Definition vcard.h:46
static constexpr std::string_view ADDRESS
Definition vcard.h:39
static constexpr std::string_view GEOGRAPHIC_POSITION
Definition vcard.h:47
static constexpr std::string_view MAILER
Definition vcard.h:50
static constexpr std::string_view TYPE_JPEG
Definition vcard.h:70
static constexpr std::string_view URL
Definition vcard.h:67
static constexpr std::string_view TIME_ZONE
Definition vcard.h:63
static constexpr std::string_view DESCRIPTION
Definition vcard.h:53
static constexpr std::string_view AGENT
Definition vcard.h:40
static constexpr std::string_view SORT_STRING
Definition vcard.h:60
static constexpr std::string_view PHOTO
Definition vcard.h:56
static constexpr std::string_view CATEGORIES
Definition vcard.h:42
static constexpr std::string_view CLASS
Definition vcard.h:43
static constexpr std::string_view TELEPHONE
Definition vcard.h:62
static constexpr std::string_view NAME
Definition vcard.h:51
static constexpr std::string_view ROLE
Definition vcard.h:59
static constexpr std::string_view TYPE_PNG
Definition vcard.h:69
static constexpr std::string_view BIRTHDAY
Definition vcard.h:41
static constexpr std::string_view REVISION
Definition vcard.h:58
static constexpr std::string_view TITLE
Definition vcard.h:64
static constexpr std::string_view KEY
Definition vcard.h:48
static constexpr std::string_view NICKNAME
Definition vcard.h:52
static constexpr std::string_view SOUND
Definition vcard.h:61
static constexpr std::string_view DELIVERY_LABEL
Definition vcard.h:44
static constexpr std::string_view EMAIL
Definition vcard.h:45
static constexpr std::string_view LOGO
Definition vcard.h:49
static constexpr std::string_view PRODUCT_IDENTIFIER
Definition vcard.h:57
static constexpr std::string_view VCARD_VERSION
Definition vcard.h:38
static constexpr std::string_view ORGANIZATION
Definition vcard.h:55
static constexpr std::string_view NOTE
Definition vcard.h:54
static constexpr std::string_view RDV_ACCOUNT
Definition vcard.h:65
static constexpr std::string_view RDV_DEVICE
Definition vcard.h:81
static constexpr std::string_view RDV_ACCOUNT
Definition vcard.h:80
static constexpr std::string_view DESCRIPTION
Definition vcard.h:78
static constexpr std::string_view TITLE
Definition vcard.h:77
static constexpr std::string_view AVATAR
Definition vcard.h:79