forked from pocoproject/poco
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResource.h
More file actions
129 lines (102 loc) · 2.28 KB
/
Resource.h
File metadata and controls
129 lines (102 loc) · 2.28 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//
// Resource.h
//
// $Id: //poco/Main/PDF/include/Poco/PDF/Resource.h#4 $
//
// Library: PDF
// Package: PDFCore
// Module: Resource
//
// Definition of the Resource class.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef PDF_Resource_INCLUDED
#define PDF_Resource_INCLUDED
#include "Poco/PDF/PDF.h"
#include <vector>
namespace Poco {
namespace PDF {
template <typename R>
class Resource
/// A Resource represents a PDF resource resource.
{
public:
typedef R Type;
Resource(HPDF_Doc* pPDF, const R& resource, const std::string& name = ""):
_pPDF(pPDF),
_resource(resource),
_name(name)
/// Creates the resource
{
}
Resource(const Resource& other):
_pPDF(other._pPDF),
_resource(other._resource),
_name(other._name)
/// Copy creates the resource.
{
}
virtual ~Resource()
/// Destroys the resource.
{
}
Resource& operator = (const Resource& resource)
/// Assignment operator.
{
Resource tmp(resource);
swap(tmp);
return *this;
}
operator const Type& () const
/// Const conversion operator into reference to native type.
{
return _resource;
}
bool operator == (const Resource& other) const
/// Equality operator.
{
return _pPDF == other._pPDF && _resource == other._resource;
}
void swap(Resource& other)
{
using std::swap;
swap(_pPDF, other._pPDF);
swap(_resource, other._resource);
swap(_name, other._name);
}
virtual const std::string& name() const
{
return _name;
}
protected:
const R& handle() const
{
return _resource;
}
private:
Resource();
HPDF_Doc* _pPDF;
R _resource;
std::string _name;
};
//
// typedefs
//
//typedef Resource<HPDF_Annotation> Annotation;
typedef Resource<HPDF_ExtGState> ExtGraphicsState;
typedef HPDF_TransMatrix TransMatrix;
typedef HPDF_Rect Rectangle;
typedef HPDF_Point Point;
typedef HPDF_LineCap LineCap;
typedef HPDF_LineJoin LineJoin;
typedef HPDF_DashMode DashMode;
typedef HPDF_RGBColor RGBColor;
typedef HPDF_CMYKColor CMYKColor;
typedef std::vector<HPDF_UINT16> PatternVec;
typedef HPDF_TextWidth TextWidth;
} } // namespace Poco::PDF
#endif // PDF_Resource_INCLUDED