DocWire SDK
DocWire SDK: Award-winning modern data processing in C++20. SourceForge Community Choice & Microsoft support. AI-driven processing. Supports nearly 100 data formats, including email boxes and OCR. Boost efficiency in text extraction, web data extraction, data mining, document analysis. Offline processing possible for security and confidentiality
attributes.h
1 /*********************************************************************************************************************************************/
2 /* DocWire SDK: Award-winning modern data processing in C++20. SourceForge Community Choice & Microsoft support. AI-driven processing. */
3 /* Supports nearly 100 data formats, including email boxes and OCR. Boost efficiency in text extraction, web data extraction, data mining, */
4 /* document analysis. Offline processing possible for security and confidentiality */
5 /* */
6 /* Copyright (c) SILVERCODERS Ltd, http://silvercoders.com */
7 /* Project homepage: https://github.com/docwire/docwire */
8 /* */
9 /* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-DocWire-Commercial */
10 /*********************************************************************************************************************************************/
11 
12 #ifndef DOCWIRE_ATTRIBUTES_H
13 #define DOCWIRE_ATTRIBUTES_H
14 
15 #include <chrono>
16 #include <concepts>
17 #include <cstddef>
18 #include <optional>
19 #include <string>
20 #include <vector>
21 
22 namespace docwire
23 {
27 namespace attributes
28 {
29 
33 struct styling
34 {
36  std::vector<std::string> classes;
38  std::string id;
40  std::string style;
41 };
42 
43 struct email
44 {
46  std::string from;
48  std::chrono::sys_seconds date;
50  std::optional<std::string> to;
52  std::optional<std::string> subject;
54  std::optional<std::string> reply_to;
56  std::optional<std::string> sender;
57 };
58 
59 struct metadata
60 {
62  std::optional<std::string> author;
64  std::optional<std::chrono::sys_seconds> creation_date;
66  std::optional<std::string> last_modified_by;
68  std::optional<std::chrono::sys_seconds> last_modification_date;
70  std::optional<size_t> page_count;
72  std::optional<size_t> word_count;
74  std::optional<email> email_attrs;
75 };
76 
80 template<class T>
81 concept WithStyling = requires(T tag) {
82  {tag.styling} -> std::convertible_to<styling>;
83 };
84 
88 struct position
89 {
90  std::optional<double> x;
91  std::optional<double> y;
92  std::optional<double> width;
93  std::optional<double> height;
94 };
95 
96 } // namespace attributes
97 } // namespace docwire
98 
99 #endif // DOCWIRE_ATTRIBUTES_H
concept WithStyling
Concept for types that have styling information.
Definition: attributes.h:81
The main namespace for the DocWire SDK.
Definition: ai_elements.h:19
requires(!string_method_equipped< T >) struct stringifier< T >
Specialization for types that are streamable to std::ostream.
std::optional< std::string > sender
The sender's name or address.
Definition: attributes.h:56
std::optional< std::string > reply_to
The email address to reply to.
Definition: attributes.h:54
std::chrono::sys_seconds date
The date and time the email was sent.
Definition: attributes.h:48
std::optional< std::string > subject
The subject of the email.
Definition: attributes.h:52
std::string from
The sender's email address.
Definition: attributes.h:46
std::optional< std::string > to
The recipient's email address.
Definition: attributes.h:50
std::optional< size_t > word_count
The number of words in the document.
Definition: attributes.h:72
std::optional< email > email_attrs
Email-specific attributes if applicable.
Definition: attributes.h:74
std::optional< std::string > last_modified_by
The user who last modified the document.
Definition: attributes.h:66
std::optional< std::chrono::sys_seconds > creation_date
The creation date and time of the document.
Definition: attributes.h:64
std::optional< size_t > page_count
The number of pages in the document.
Definition: attributes.h:70
std::optional< std::chrono::sys_seconds > last_modification_date
The last modification date and time of the document.
Definition: attributes.h:68
std::optional< std::string > author
The author of the document.
Definition: attributes.h:62
Represents the geometric position and dimensions of an element.
Definition: attributes.h:89
std::optional< double > x
Optional x-coordinate of the bottom-left corner.
Definition: attributes.h:90
std::optional< double > height
Optional height of the element.
Definition: attributes.h:93
std::optional< double > y
Optional y-coordinate of the bottom-left corner.
Definition: attributes.h:91
std::optional< double > width
Optional width of the element.
Definition: attributes.h:92
Represents CSS-like styling information for document elements.
Definition: attributes.h:34
std::vector< std::string > classes
List of CSS classes.
Definition: attributes.h:36
std::string id
Unique identifier for the element.
Definition: attributes.h:38
std::string style
Inline style string.
Definition: attributes.h:40