cpp: Add support for URL Data encodings

* lang/cpp/src/data.h (Data::Encoding): Extend enum.
* lang/cpp/src/data.cpp (Data::encoding),
Data::setEncoding): Support new values.
This commit is contained in:
Andre Heinecke 2016-10-05 16:43:16 +02:00
parent 39dd7585f5
commit 370ee1aa80
2 changed files with 10 additions and 1 deletions

View File

@ -161,6 +161,9 @@ GpgME::Data::Encoding GpgME::Data::encoding() const
case GPGME_DATA_ENCODING_BASE64: return Base64Encoding; case GPGME_DATA_ENCODING_BASE64: return Base64Encoding;
case GPGME_DATA_ENCODING_ARMOR: return ArmorEncoding; case GPGME_DATA_ENCODING_ARMOR: return ArmorEncoding;
case GPGME_DATA_ENCODING_MIME: return MimeEncoding; case GPGME_DATA_ENCODING_MIME: return MimeEncoding;
case GPGME_DATA_ENCODING_URL: return UrlEncoding;
case GPGME_DATA_ENCODING_URLESC: return UrlEscEncoding;
case GPGME_DATA_ENCODING_URL0: return Url0Encoding;
} }
return AutoEncoding; return AutoEncoding;
} }
@ -174,6 +177,9 @@ GpgME::Error GpgME::Data::setEncoding(Encoding enc)
case Base64Encoding: ge = GPGME_DATA_ENCODING_BASE64; break; case Base64Encoding: ge = GPGME_DATA_ENCODING_BASE64; break;
case ArmorEncoding: ge = GPGME_DATA_ENCODING_ARMOR; break; case ArmorEncoding: ge = GPGME_DATA_ENCODING_ARMOR; break;
case MimeEncoding: ge = GPGME_DATA_ENCODING_MIME; break; case MimeEncoding: ge = GPGME_DATA_ENCODING_MIME; break;
case UrlEncoding: ge = GPGME_DATA_ENCODING_URL; break;
case UrlEscEncoding: ge = GPGME_DATA_ENCODING_URLESC; break;
case Url0Encoding: ge = GPGME_DATA_ENCODING_URL0; break;
} }
return Error(gpgme_data_set_encoding(d->data, ge)); return Error(gpgme_data_set_encoding(d->data, ge));
} }

View File

@ -78,7 +78,10 @@ public:
BinaryEncoding, BinaryEncoding,
Base64Encoding, Base64Encoding,
ArmorEncoding, ArmorEncoding,
MimeEncoding MimeEncoding,
UrlEncoding,
UrlEscEncoding,
Url0Encoding,
}; };
Encoding encoding() const; Encoding encoding() const;
Error setEncoding(Encoding encoding); Error setEncoding(Encoding encoding);