Public Types | Public Member Functions | Private Attributes | List of all members
GenericPointer< ValueType, Allocator >::PercentDecodeStream Class Reference

A helper stream for decoding a percent-encoded sequence into code unit. More...

Public Types

typedef ValueType::Ch Ch
 

Public Member Functions

 PercentDecodeStream (const Ch *source, const Ch *end)
 Constructor. More...
 
Ch Take ()
 
size_t Tell () const
 
bool IsValid () const
 

Private Attributes

const Chsrc_
 Current read position. More...
 
const Chhead_
 Original head of the string. More...
 
const Chend_
 Past-the-end position. More...
 
bool valid_
 Whether the parsing is valid. More...
 

Detailed Description

template<typename ValueType, typename Allocator = CrtAllocator>
class GenericPointer< ValueType, Allocator >::PercentDecodeStream

A helper stream for decoding a percent-encoded sequence into code unit.

This stream decodes XY triplet into code unit (0-255). If it encounters invalid characters, it sets output code unit as 0 and mark invalid, and to be checked by IsValid().

Definition at line 983 of file pointer.h.

Member Typedef Documentation

template<typename ValueType, typename Allocator = CrtAllocator>
typedef ValueType::Ch GenericPointer< ValueType, Allocator >::PercentDecodeStream::Ch

Definition at line 985 of file pointer.h.

Constructor & Destructor Documentation

template<typename ValueType, typename Allocator = CrtAllocator>
GenericPointer< ValueType, Allocator >::PercentDecodeStream::PercentDecodeStream ( const Ch source,
const Ch end 
)
inline

Constructor.

Parameters
sourceStart of the stream
endPast-the-end of the stream.

Definition at line 992 of file pointer.h.

992 : src_(source), head_(source), end_(end), valid_(true) {}
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
const CharType(& source)[N]
Definition: pointer.h:1147
const Ch * head_
Original head of the string.
Definition: pointer.h:1021
bool valid_
Whether the parsing is valid.
Definition: pointer.h:1023
const Ch * end_
Past-the-end position.
Definition: pointer.h:1022
const Ch * src_
Current read position.
Definition: pointer.h:1020

Member Function Documentation

template<typename ValueType, typename Allocator = CrtAllocator>
bool GenericPointer< ValueType, Allocator >::PercentDecodeStream::IsValid ( ) const
inline

Definition at line 1017 of file pointer.h.

1017 { return valid_; }
bool valid_
Whether the parsing is valid.
Definition: pointer.h:1023
template<typename ValueType, typename Allocator = CrtAllocator>
Ch GenericPointer< ValueType, Allocator >::PercentDecodeStream::Take ( )
inline

Definition at line 994 of file pointer.h.

994  {
995  if (*src_ != '%' || src_ + 3 > end_) { // %XY triplet
996  valid_ = false;
997  return 0;
998  }
999  src_++;
1000  Ch c = 0;
1001  for (int j = 0; j < 2; j++) {
1002  c = static_cast<Ch>(c << 4);
1003  Ch h = *src_;
1004  if (h >= '0' && h <= '9') c = static_cast<Ch>(c + h - '0');
1005  else if (h >= 'A' && h <= 'F') c = static_cast<Ch>(c + h - 'A' + 10);
1006  else if (h >= 'a' && h <= 'f') c = static_cast<Ch>(c + h - 'a' + 10);
1007  else {
1008  valid_ = false;
1009  return 0;
1010  }
1011  src_++;
1012  }
1013  return c;
1014  }
bool valid_
Whether the parsing is valid.
Definition: pointer.h:1023
const Ch * end_
Past-the-end position.
Definition: pointer.h:1022
const Ch * src_
Current read position.
Definition: pointer.h:1020
h
training ###############################
Definition: train_cnn.py:186
template<typename ValueType, typename Allocator = CrtAllocator>
size_t GenericPointer< ValueType, Allocator >::PercentDecodeStream::Tell ( ) const
inline

Definition at line 1016 of file pointer.h.

1016 { return static_cast<size_t>(src_ - head_); }
const Ch * head_
Original head of the string.
Definition: pointer.h:1021
const Ch * src_
Current read position.
Definition: pointer.h:1020

Member Data Documentation

template<typename ValueType, typename Allocator = CrtAllocator>
const Ch* GenericPointer< ValueType, Allocator >::PercentDecodeStream::end_
private

Past-the-end position.

Definition at line 1022 of file pointer.h.

template<typename ValueType, typename Allocator = CrtAllocator>
const Ch* GenericPointer< ValueType, Allocator >::PercentDecodeStream::head_
private

Original head of the string.

Definition at line 1021 of file pointer.h.

template<typename ValueType, typename Allocator = CrtAllocator>
const Ch* GenericPointer< ValueType, Allocator >::PercentDecodeStream::src_
private

Current read position.

Definition at line 1020 of file pointer.h.

template<typename ValueType, typename Allocator = CrtAllocator>
bool GenericPointer< ValueType, Allocator >::PercentDecodeStream::valid_
private

Whether the parsing is valid.

Definition at line 1023 of file pointer.h.


The documentation for this class was generated from the following file: