8#ifndef INCLUDED_BDLDE_HEXENCODER
9#define INCLUDED_BDLDE_HEXENCODER
332#include <bdlscm_version.h>
365 bool d_upperCaseFlag;
368 const char *d_encodeTable_p;
410 template <
class OUTPUT_ITERATOR,
class INPUT_ITERATOR>
411 int convert(OUTPUT_ITERATOR out,
412 INPUT_ITERATOR begin,
414 template <
class OUTPUT_ITERATOR,
class INPUT_ITERATOR>
415 int convert(OUTPUT_ITERATOR out,
418 INPUT_ITERATOR begin,
437 template <
class OUTPUT_ITERATOR>
439 template <
class OUTPUT_ITERATOR>
440 int endConvert(OUTPUT_ITERATOR out,
int *numOut,
int maxNumOut = -1);
489template <
class OUTPUT_ITERATOR,
class INPUT_ITERATOR>
491 INPUT_ITERATOR begin,
497 return convert(out, &dummyNumOut, &dummyNumIn, begin, end, -1);
500template <
class OUTPUT_ITERATOR,
class INPUT_ITERATOR>
504 INPUT_ITERATOR begin,
511 if (e_ERROR_STATE == d_state || e_DONE_STATE == d_state) {
512 int rv = e_DONE_STATE == d_state ? -2 : -1;
513 d_state = e_ERROR_STATE;
519 if (0 == maxNumOut) {
539 while (begin != end && numEmitted != maxNumOut) {
548 const char digit =
static_cast<char>(*begin);
551 *out = d_encodeTable_p[(digit >> 4) & 0x0f];
554 d_deferred = d_encodeTable_p[digit & 0x0f];
558 *numOut = numEmitted;
559 d_outputLength += numEmitted;
560 *numIn = numConsumed;
561 return d_deferred ? 1 : 0;
564template <
class OUTPUT_ITERATOR>
572template <
class OUTPUT_ITERATOR>
577 if (e_ERROR_STATE == d_state) {
581 if (e_DONE_STATE == d_state && !d_deferred) {
582 d_state = e_ERROR_STATE;
586 d_state = e_DONE_STATE;
589 if (0 == maxNumOut) {
606 d_state = e_INPUT_STATE;
615 return e_INPUT_STATE == d_state && 0 == d_deferred;
621 return e_DONE_STATE == d_state && 0 == d_deferred;
627 return e_ERROR_STATE == d_state;
633 return e_INPUT_STATE == d_state && 0 == d_outputLength;
639 return d_upperCaseFlag;
645 return d_deferred ? 1 : 0;
651 return d_outputLength;
Definition bdlde_hexencoder.h:347
bool isAcceptable() const
Definition bdlde_hexencoder.h:613
int outputLength() const
Definition bdlde_hexencoder.h:649
bool isUpperCase() const
Definition bdlde_hexencoder.h:637
bool isError() const
Definition bdlde_hexencoder.h:625
int convert(OUTPUT_ITERATOR out, INPUT_ITERATOR begin, INPUT_ITERATOR end)
Definition bdlde_hexencoder.h:490
bool isDone() const
Definition bdlde_hexencoder.h:619
HexEncoder(bool upperCaseLetters=true)
~HexEncoder()=default
Destroy this object.
bool isInitialState() const
Definition bdlde_hexencoder.h:631
void reset()
Definition bdlde_hexencoder.h:604
int numOutputPending() const
Definition bdlde_hexencoder.h:643
int endConvert(OUTPUT_ITERATOR out)
Definition bdlde_hexencoder.h:565
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bdlde_base64alphabet.h:118