MySQL 8.0.39
Source Code Documentation
|
Processes a string and extracts XIDs of the form X'...',X'...',0-9. More...
#include <xid_extract.h>
Public Types | |
using | xid_list = std::vector< xid_t > |
Public Member Functions | |
XID_extractor ()=default | |
XID_extractor (std::string const &source, size_t max_extractions=std::numeric_limits< size_t >::max()) | |
Constructs a new instance and tries to extract XIDs from the given string. More... | |
virtual | ~XID_extractor ()=default |
size_t | extract (std::string const &source, size_t max_extractions=std::numeric_limits< size_t >::max()) |
Processes the given string and extracts well-formed XIDs. More... | |
xid_list::iterator | begin () |
Retrieves an iterator pointing to the beginning of the extracted XID list. More... | |
xid_list::iterator | end () |
Retrieves an iterator pointing to the end of the extracted XID list. More... | |
size_t | size () |
Retrieves the size of the extracted XID list. More... | |
xid_t & | operator[] (size_t idx) |
Retrieves the nth XID in the list of extracted XIDs. More... | |
Private Attributes | |
xid_list | m_xids |
List of extracted XIDs. More... | |
Processes a string and extracts XIDs of the form X'...',X'...',0-9.
Extracted XIDs are stored internally and are iterable through either iterator or direct access semantics:
XID_extractor tokenizer; tokenizer.extract("XA COMMIT X'1234',X'123456',1;" "XA ROLLBACK X'1234',X'123456',1;"); for (auto xid : tokenizer) std::cout << xid << std::endl << std::flush; if (tokenizer.size() != 0) std::cout << tokenizer[0] << std::endl << std::flush
At each extraction, the internal list of extracted XIDs is cleared.
using xa::XID_extractor::xid_list = std::vector<xid_t> |
|
default |
xa::XID_extractor::XID_extractor | ( | std::string const & | source, |
size_t | max_extractions = std::numeric_limits<size_t>::max() |
||
) |
Constructs a new instance and tries to extract XIDs from the given string.
The extracted XID will be stored internally and iterable either through iterator or direct access semantics.
source | The string containing XID to be extracted. |
max_extractions | The maximum number of XIDs to be extracted from the string. |
|
virtualdefault |
xa::XID_extractor::xid_list::iterator xa::XID_extractor::begin | ( | void | ) |
Retrieves an iterator pointing to the beginning of the extracted XID list.
xa::XID_extractor::xid_list::iterator xa::XID_extractor::end | ( | void | ) |
Retrieves an iterator pointing to the end of the extracted XID list.
size_t xa::XID_extractor::extract | ( | std::string const & | source, |
size_t | max_extractions = std::numeric_limits<size_t>::max() |
||
) |
Processes the given string and extracts well-formed XIDs.
The extracted XID will be stored internally and iterable either through iterator or direct access semantics. Per each invocatian of this method, the internal list of extracted XIDs is cleared.
source | The string containing XID to be extracted. |
max_extractions | The maximum number of XIDs to be extracted from the string. |
xid_t & xa::XID_extractor::operator[] | ( | size_t | idx | ) |
Retrieves the nth XID in the list of extracted XIDs.
idx | The index of the XID to be retrieved |
size_t xa::XID_extractor::size | ( | ) |
Retrieves the size of the extracted XID list.
|
private |
List of extracted XIDs.