14 static std::string_view ToString(T value)
17 static_assert(always_false<T>,
"Unsupported type");
21 static bool TryParse(
const std::string_view& str, T& value)
25 static_assert(always_false<T>,
"Unsupported type");
38 case PdfColorSpaceType::DeviceGray:
39 return "DeviceGray"sv;
40 case PdfColorSpaceType::DeviceRGB:
42 case PdfColorSpaceType::DeviceCMYK:
43 return "DeviceCMYK"sv;
44 case PdfColorSpaceType::CalGray:
46 case PdfColorSpaceType::CalRGB:
50 case PdfColorSpaceType::ICCBased:
52 case PdfColorSpaceType::Indexed:
54 case PdfColorSpaceType::Pattern:
56 case PdfColorSpaceType::Separation:
57 return "Separation"sv;
58 case PdfColorSpaceType::DeviceN:
60 case PdfColorSpaceType::Unknown:
68 if (str ==
"DeviceGray")
70 value = PdfColorSpaceType::DeviceGray;
73 else if (str ==
"DeviceRGB")
75 value = PdfColorSpaceType::DeviceRGB;
78 else if (str ==
"DeviceCMYK")
80 value = PdfColorSpaceType::DeviceCMYK;
83 else if (str ==
"CalGray")
85 value = PdfColorSpaceType::CalGray;
88 else if (str ==
"CalRGB")
90 value = PdfColorSpaceType::CalRGB;
93 else if (str ==
"Lab")
98 else if (str ==
"ICCBased")
100 value = PdfColorSpaceType::ICCBased;
103 else if (str ==
"Indexed")
105 value = PdfColorSpaceType::Indexed;
108 else if (str ==
"Pattern")
110 value = PdfColorSpaceType::Pattern;
113 else if (str ==
"Separation")
115 value = PdfColorSpaceType::Separation;
118 else if (str ==
"DeviceN")
120 value = PdfColorSpaceType::DeviceN;
136 case PdfAnnotationType::Text:
138 case PdfAnnotationType::Link:
140 case PdfAnnotationType::FreeText:
142 case PdfAnnotationType::Line:
144 case PdfAnnotationType::Square:
146 case PdfAnnotationType::Circle:
148 case PdfAnnotationType::Polygon:
150 case PdfAnnotationType::PolyLine:
152 case PdfAnnotationType::Highlight:
153 return "Highlight"sv;
154 case PdfAnnotationType::Underline:
155 return "Underline"sv;
156 case PdfAnnotationType::Squiggly:
158 case PdfAnnotationType::StrikeOut:
159 return "StrikeOut"sv;
160 case PdfAnnotationType::Stamp:
162 case PdfAnnotationType::Caret:
164 case PdfAnnotationType::Ink:
166 case PdfAnnotationType::Popup:
168 case PdfAnnotationType::FileAttachement:
169 return "FileAttachment"sv;
170 case PdfAnnotationType::Sound:
172 case PdfAnnotationType::Movie:
174 case PdfAnnotationType::Widget:
176 case PdfAnnotationType::Screen:
178 case PdfAnnotationType::PrinterMark:
179 return "PrinterMark"sv;
180 case PdfAnnotationType::TrapNet:
182 case PdfAnnotationType::Watermark:
183 return "Watermark"sv;
184 case PdfAnnotationType::Model3D:
186 case PdfAnnotationType::RichMedia:
187 return "RichMedia"sv;
188 case PdfAnnotationType::WebMedia:
190 case PdfAnnotationType::Redact:
192 case PdfAnnotationType::Projection:
193 return "Projection"sv;
204 value = PdfAnnotationType::Text;
207 else if (str ==
"Link"sv)
209 value = PdfAnnotationType::Link;
212 else if (str ==
"FreeText"sv)
214 value = PdfAnnotationType::FreeText;
217 else if (str ==
"Line"sv)
219 value = PdfAnnotationType::Line;
222 else if (str ==
"Square"sv)
224 value = PdfAnnotationType::Square;
227 else if (str ==
"Circle"sv)
229 value = PdfAnnotationType::Circle;
232 else if (str ==
"Polygon"sv)
234 value = PdfAnnotationType::Polygon;
237 else if (str ==
"PolyLine"sv)
239 value = PdfAnnotationType::PolyLine;
242 else if (str ==
"Highlight"sv)
244 value = PdfAnnotationType::Highlight;
247 else if (str ==
"Underline"sv)
249 value = PdfAnnotationType::Underline;
252 else if (str ==
"Squiggly"sv)
254 value = PdfAnnotationType::Squiggly;
257 else if (str ==
"StrikeOut"sv)
259 value = PdfAnnotationType::StrikeOut;
262 else if (str ==
"Stamp"sv)
264 value = PdfAnnotationType::Stamp;
267 else if (str ==
"Caret"sv)
269 value = PdfAnnotationType::Caret;
272 else if (str ==
"Ink"sv)
274 value = PdfAnnotationType::Ink;
277 else if (str ==
"Popup"sv)
279 value = PdfAnnotationType::Popup;
282 else if (str ==
"FileAttachment"sv)
284 value = PdfAnnotationType::FileAttachement;
287 else if (str ==
"Sound"sv)
289 value = PdfAnnotationType::Sound;
292 else if (str ==
"Movie"sv)
294 value = PdfAnnotationType::Movie;
297 else if (str ==
"Widget"sv)
299 value = PdfAnnotationType::Widget;
302 else if (str ==
"Screen"sv)
304 value = PdfAnnotationType::Screen;
307 else if (str ==
"PrinterMark"sv)
309 value = PdfAnnotationType::PrinterMark;
312 else if (str ==
"TrapNet"sv)
314 value = PdfAnnotationType::TrapNet;
317 else if (str ==
"Watermark"sv)
319 value = PdfAnnotationType::Watermark;
322 else if (str ==
"3D"sv)
324 value = PdfAnnotationType::Model3D;
327 else if (str ==
"RichMedia"sv)
329 value = PdfAnnotationType::RichMedia;
332 else if (str ==
"WebMedia"sv)
334 value = PdfAnnotationType::WebMedia;
337 else if (str ==
"Redact"sv)
339 value = PdfAnnotationType::Redact;
342 else if (str ==
"Projection"sv)
344 value = PdfAnnotationType::Projection;
362 case PdfRenderingIntent::AbsoluteColorimetric:
363 return "AbsoluteColorimetric"sv;
364 case PdfRenderingIntent::RelativeColorimetric:
365 return "RelativeColorimetric"sv;
366 case PdfRenderingIntent::Perceptual:
367 return "Perceptual"sv;
368 case PdfRenderingIntent::Saturation:
369 return "Saturation"sv;
370 case PdfRenderingIntent::Unknown:
378 if (str ==
"AbsoluteColorimetric")
380 value = PdfRenderingIntent::AbsoluteColorimetric;
383 else if (str ==
"RelativeColorimetric")
385 value = PdfRenderingIntent::RelativeColorimetric;
388 else if (str ==
"Perceptual")
390 value = PdfRenderingIntent::Perceptual;
393 else if (str ==
"Saturation")
395 value = PdfRenderingIntent::Saturation;
411 case PdfBlendMode::Normal:
413 case PdfBlendMode::Multiply:
415 case PdfBlendMode::Screen:
417 case PdfBlendMode::Overlay:
419 case PdfBlendMode::Darken:
421 case PdfBlendMode::Lighten:
423 case PdfBlendMode::ColorDodge:
424 return "ColorDodge"sv;
425 case PdfBlendMode::ColorBurn:
426 return "ColorBurn"sv;
427 case PdfBlendMode::HardLight:
428 return "HardLight"sv;
429 case PdfBlendMode::SoftLight:
430 return "SoftLight"sv;
431 case PdfBlendMode::Difference:
432 return "Difference"sv;
433 case PdfBlendMode::Exclusion:
434 return "Exclusion"sv;
435 case PdfBlendMode::Hue:
437 case PdfBlendMode::Saturation:
438 return "Saturation"sv;
439 case PdfBlendMode::Color:
441 case PdfBlendMode::Luminosity:
442 return "Luminosity"sv;
443 case PdfBlendMode::Unknown:
449 static bool TryParse(
const std::string_view& str,
PdfBlendMode& value)
453 value = PdfBlendMode::Normal;
456 else if (str ==
"Multiply")
458 value = PdfBlendMode::Multiply;
461 else if (str ==
"Screen")
463 value = PdfBlendMode::Screen;
466 else if (str ==
"Overlay")
468 value = PdfBlendMode::Overlay;
471 else if (str ==
"Darken")
473 value = PdfBlendMode::Darken;
476 else if (str ==
"Lighten")
478 value = PdfBlendMode::Lighten;
481 else if (str ==
"ColorDodge")
483 value = PdfBlendMode::ColorDodge;
486 else if (str ==
"ColorBurn")
488 value = PdfBlendMode::ColorBurn;
491 else if (str ==
"HardLight")
493 value = PdfBlendMode::HardLight;
496 else if (str ==
"SoftLight")
498 value = PdfBlendMode::SoftLight;
501 else if (str ==
"Difference")
503 value = PdfBlendMode::Difference;
506 else if (str ==
"Exclusion")
508 value = PdfBlendMode::Exclusion;
511 else if (str ==
"Hue")
513 value = PdfBlendMode::Hue;
516 else if (str ==
"Saturation")
518 value = PdfBlendMode::Saturation;
521 else if (str ==
"Color")
523 value = PdfBlendMode::Color;
526 else if (str ==
"Luminosity")
528 value = PdfBlendMode::Luminosity;
539 static std::string_view ToString(
PdfOperator value)
554 case PdfOperator::ri:
558 case PdfOperator::gs:
564 case PdfOperator::cm:
578 case PdfOperator::re:
588 case PdfOperator::f_Star:
592 case PdfOperator::B_Star:
596 case PdfOperator::b_Star:
602 case PdfOperator::W_Star:
604 case PdfOperator::BT:
606 case PdfOperator::ET:
608 case PdfOperator::Tc:
610 case PdfOperator::Tw:
612 case PdfOperator::Tz:
614 case PdfOperator::TL:
616 case PdfOperator::Tf:
618 case PdfOperator::Tr:
620 case PdfOperator::Ts:
622 case PdfOperator::Td:
624 case PdfOperator::TD:
626 case PdfOperator::Tm:
628 case PdfOperator::T_Star:
630 case PdfOperator::Tj:
632 case PdfOperator::TJ:
634 case PdfOperator::Quote:
636 case PdfOperator::DoubleQuote:
638 case PdfOperator::d0:
640 case PdfOperator::d1:
642 case PdfOperator::CS:
644 case PdfOperator::cs:
646 case PdfOperator::SC:
648 case PdfOperator::SCN:
650 case PdfOperator::sc:
652 case PdfOperator::scn:
658 case PdfOperator::RG:
660 case PdfOperator::rg:
666 case PdfOperator::sh:
668 case PdfOperator::BI:
670 case PdfOperator::ID:
672 case PdfOperator::EI:
674 case PdfOperator::Do:
676 case PdfOperator::MP:
678 case PdfOperator::DP:
680 case PdfOperator::BMC:
682 case PdfOperator::BDC:
684 case PdfOperator::EMC:
686 case PdfOperator::BX:
688 case PdfOperator::EX:
690 case PdfOperator::Unknown:
696 static bool TryParse(
const std::string_view& str,
PdfOperator& value)
700 value = PdfOperator::w;
705 value = PdfOperator::J;
710 value = PdfOperator::j;
715 value = PdfOperator::M;
720 value = PdfOperator::d;
723 else if (str ==
"ri")
725 value = PdfOperator::ri;
730 value = PdfOperator::i;
733 else if (str ==
"gs")
735 value = PdfOperator::gs;
740 value = PdfOperator::q;
745 value = PdfOperator::Q;
748 else if (str ==
"cm")
750 value = PdfOperator::cm;
755 value = PdfOperator::m;
760 value = PdfOperator::l;
765 value = PdfOperator::c;
770 value = PdfOperator::v;
775 value = PdfOperator::y;
780 value = PdfOperator::h;
783 else if (str ==
"re")
785 value = PdfOperator::re;
790 value = PdfOperator::S;
795 value = PdfOperator::s;
800 value = PdfOperator::f;
805 value = PdfOperator::F;
808 else if (str ==
"f*")
810 value = PdfOperator::f_Star;
815 value = PdfOperator::B;
818 else if (str ==
"B*")
820 value = PdfOperator::B_Star;
825 value = PdfOperator::b;
828 else if (str ==
"b*")
830 value = PdfOperator::b_Star;
835 value = PdfOperator::n;
840 value = PdfOperator::W;
843 else if (str ==
"W*")
845 value = PdfOperator::W_Star;
848 else if (str ==
"BT")
850 value = PdfOperator::BT;
853 else if (str ==
"ET")
855 value = PdfOperator::ET;
858 else if (str ==
"Tc")
860 value = PdfOperator::Tc;
863 else if (str ==
"Tw")
865 value = PdfOperator::Tw;
868 else if (str ==
"Tz")
870 value = PdfOperator::Tz;
873 else if (str ==
"TL")
875 value = PdfOperator::TL;
878 else if (str ==
"Tf")
880 value = PdfOperator::Tf;
883 else if (str ==
"Tr")
885 value = PdfOperator::Tr;
888 else if (str ==
"Ts")
890 value = PdfOperator::Ts;
893 else if (str ==
"Td")
895 value = PdfOperator::Td;
898 else if (str ==
"TD")
900 value = PdfOperator::TD;
903 else if (str ==
"Tm")
905 value = PdfOperator::Tm;
908 else if (str ==
"T*")
910 value = PdfOperator::T_Star;
913 else if (str ==
"Tj")
915 value = PdfOperator::Tj;
918 else if (str ==
"TJ")
920 value = PdfOperator::TJ;
925 value = PdfOperator::Quote;
928 else if (str ==
"\"")
930 value = PdfOperator::DoubleQuote;
933 else if (str ==
"d0")
935 value = PdfOperator::d0;
938 else if (str ==
"d1")
940 value = PdfOperator::d1;
943 else if (str ==
"CS")
945 value = PdfOperator::CS;
948 else if (str ==
"cs")
950 value = PdfOperator::cs;
953 else if (str ==
"SC")
955 value = PdfOperator::SC;
958 else if (str ==
"SCN")
960 value = PdfOperator::SCN;
963 else if (str ==
"sc")
965 value = PdfOperator::sc;
968 else if (str ==
"scn")
970 value = PdfOperator::scn;
975 value = PdfOperator::G;
980 value = PdfOperator::g;
983 else if (str ==
"RG")
985 value = PdfOperator::RG;
988 else if (str ==
"rg")
990 value = PdfOperator::rg;
995 value = PdfOperator::K;
1000 value = PdfOperator::k;
1003 else if (str ==
"sh")
1005 value = PdfOperator::sh;
1008 else if (str ==
"BI")
1010 value = PdfOperator::BI;
1013 else if (str ==
"ID")
1015 value = PdfOperator::ID;
1018 else if (str ==
"EI")
1020 value = PdfOperator::EI;
1023 else if (str ==
"Do")
1025 value = PdfOperator::Do;
1028 else if (str ==
"MP")
1030 value = PdfOperator::MP;
1033 else if (str ==
"DP")
1035 value = PdfOperator::DP;
1038 else if (str ==
"BMC")
1040 value = PdfOperator::BMC;
1043 else if (str ==
"BDC")
1045 value = PdfOperator::BDC;
1048 else if (str ==
"EMC")
1050 value = PdfOperator::EMC;
1053 else if (str ==
"BX")
1055 value = PdfOperator::BX;
1058 else if (str ==
"EX")
1060 value = PdfOperator::EX;
1065 value = PdfOperator::Unknown;
1072 struct Convert<PdfALevel>
1074 static std::string_view ToString(PdfALevel value)
1076 using namespace std;
1079 case PdfALevel::L1B:
1081 case PdfALevel::L1A:
1083 case PdfALevel::L2B:
1085 case PdfALevel::L2A:
1087 case PdfALevel::L2U:
1089 case PdfALevel::L3B:
1091 case PdfALevel::L3A:
1093 case PdfALevel::L3U:
1097 case PdfALevel::L4E:
1099 case PdfALevel::L4F:
1106 static bool TryParse(
const std::string_view& str, PdfALevel& value)
1110 value = PdfALevel::L1B;
1113 else if (str ==
"L1A")
1115 value = PdfALevel::L1A;
1118 else if (str ==
"L2B")
1120 value = PdfALevel::L2B;
1123 else if (str ==
"L2A")
1125 value = PdfALevel::L2A;
1128 else if (str ==
"L2U")
1130 value = PdfALevel::L2U;
1133 else if (str ==
"L3B")
1135 value = PdfALevel::L3B;
1138 else if (str ==
"L3A")
1140 value = PdfALevel::L3A;
1143 else if (str ==
"L3U")
1145 value = PdfALevel::L3U;
1148 else if (str ==
"L4")
1150 value = PdfALevel::L4;
1153 else if (str ==
"L4E")
1155 value = PdfALevel::L4E;
1158 else if (str ==
"L4F")
1160 value = PdfALevel::L4F;
1169 struct Convert<PdfUALevel>
1171 static std::string_view ToString(PdfUALevel value)
1173 using namespace std;
1176 case PdfUALevel::L1:
1178 case PdfUALevel::L2:
1185 static bool TryParse(
const std::string_view& str, PdfUALevel& value)
1189 value = PdfUALevel::L1;
1192 else if (str ==
"L2")
1194 value = PdfUALevel::L2;
1203 struct Convert<PdfSignatureType>
1205 static std::string_view ToString(PdfSignatureType value)
1207 using namespace std;
1210 case PdfSignatureType::Unknown:
1212 case PdfSignatureType::PAdES_B:
1214 case PdfSignatureType::Pkcs7:
1221 static bool TryParse(
const std::string_view& str, PdfSignatureType& value)
1223 if (str ==
"Unknown")
1225 value = PdfSignatureType::Unknown;
1228 else if (str ==
"PAdES_B")
1230 value = PdfSignatureType::PAdES_B;
1233 else if (str ==
"Pkcs7")
1235 value = PdfSignatureType::Pkcs7;
1244 struct Convert<PdfSignatureEncryption>
1246 static std::string_view ToString(PdfSignatureEncryption value)
1248 using namespace std;
1251 case PdfSignatureEncryption::RSA:
1253 case PdfSignatureEncryption::ECDSA:
1260 static bool TryParse(
const std::string_view& str, PdfSignatureEncryption& value)
1264 value = PdfSignatureEncryption::RSA;
1267 else if (str ==
"ECDSA")
1269 value = PdfSignatureEncryption::ECDSA;
1278 struct Convert<PdfHashingAlgorithm>
1280 static std::string_view ToString(PdfHashingAlgorithm value)
1282 using namespace std;
1285 case PdfHashingAlgorithm::SHA256:
1287 case PdfHashingAlgorithm::SHA384:
1289 case PdfHashingAlgorithm::SHA512:
1296 static bool TryParse(
const std::string_view& str, PdfHashingAlgorithm& value)
1298 if (str ==
"SHA256")
1300 value = PdfHashingAlgorithm::SHA256;
1303 else if (str ==
"SHA384")
1305 value = PdfHashingAlgorithm::SHA384;
1308 else if (str ==
"SHA512")
1310 value = PdfHashingAlgorithm::SHA512;
1318 template<
typename T>
1319 std::string_view ToString(T value)
1321 return Convert<T>::ToString(value);
1324 template<
typename T>
1325 bool TryConvertTo(
const std::string_view& str, T& value)
1328 return Convert<T>::TryParse(str, value);
1331 template<
typename T>
1332 T ConvertTo(
const std::string_view& str)
1335 if (!Convert<T>::TryParse(str, value))
Error information and logging is implemented in this file.
All classes, functions, types and enums of PoDoFo are members of these namespace.
Definition basetypes.h:13
PdfAnnotationType
The type of the annotation.
Definition PdfDeclarations.h:557
PdfBlendMode
List of defined transparency blending modes.
Definition PdfDeclarations.h:787
PdfRenderingIntent
List of defined Rendering intents.
Definition PdfDeclarations.h:777
@ InvalidEnumValue
An invalid enum value was specified.
PdfOperator
List of PDF stream content operators.
Definition PdfDeclarations.h:681
PdfColorSpaceType
Enum for the colorspaces supported by PDF.
Definition PdfDeclarations.h:333