MySQL 8.0.40
Source Code Documentation
|
WKB scanner event handler that checks if the WKB string is well formed. More...
Public Member Functions | |
Geometry_well_formed_checker (Geometry::wkbType type, Geometry::wkbByteOrder required_byte_order) | |
Create a new even handler. More... | |
void | on_wkb_start (Geometry::wkbByteOrder bo, Geometry::wkbType geotype, const void *, uint32, bool has_hdr) override |
Notified when scanner sees the start of a geometry WKB. More... | |
void | on_wkb_end (const void *wkb) override |
Notified when scanner sees the end of a geometry WKB. More... | |
bool | continue_scan () const override |
bool | is_well_formed () |
Check if the parsed WKB was well-formed, as far as this handler knows. More... | |
const char * | get_last_position () |
Get the position after the last parsed byte. More... | |
Public Member Functions inherited from WKB_scanner_event_handler | |
virtual | ~WKB_scanner_event_handler ()=default |
Private Attributes | |
Prealloced_array< Geometry::wkbType, 8 > | type |
Geometry::wkbType | previous_type |
Current stack of types. More... | |
int | points_in_linestring |
Type of previous start/end. More... | |
const void * | last_position |
Points in current ls. More... | |
bool | is_ok |
Last wkb pointer seen. More... | |
Geometry::wkbByteOrder | required_byte_order |
Whether the WKB is OK so far. More... | |
WKB scanner event handler that checks if the WKB string is well formed.
This doesn't check if the geometry is valid (e.g., it's not checking if a polygon is self-intersecting), it only checks some simple rules for WKB well-formedness:
R1. The byte order is as specified (constructor parameter) R2. The wkbType is within the supported range R3. The geometry is of the specified type (constructor parameter), or a subtype R4. Nested geometries contain only geometries that can be contained by that type R5. Linestrings have at least two points R6. Polygon rings have at least four points R7. Polygons have at least one ring R8. Collections, except geometrycollection, contain at least one element.
An additional requirement, that the WKB ends exactly at the end of the string, is checked by Geometry::is_well_formed(). The last parse position is maintained as last_position here to make that test possible.
|
inline |
Create a new even handler.
type | Expected geometry type. If set to Geometry::wkb_invalid_type, any geometry is allowed. |
required_byte_order | The expected byted order |
|
inlineoverridevirtual |
Reimplemented from WKB_scanner_event_handler.
|
inline |
Get the position after the last parsed byte.
|
inline |
Check if the parsed WKB was well-formed, as far as this handler knows.
There may be other conditions that cause the object to not be well-formed.
|
inlineoverridevirtual |
Notified when scanner sees the end of a geometry WKB.
wkb | the position of the first byte after the WKB byte string which the scanner just scanned. |
Implements WKB_scanner_event_handler.
|
inlineoverridevirtual |
Notified when scanner sees the start of a geometry WKB.
bo | byte order of the WKB. |
geotype | geometry type of the WKB; |
wkb | WKB byte string, the first byte after the WKB header if any. |
len | NO. of bytes of the WKB byte string starting from wkb. There can be many geometries in the [wkb, wkb+len) buffer. |
has_hdr | whether there is a WKB header right before 'wkb' in the byte string. |
Implements WKB_scanner_event_handler.
|
private |
Last wkb pointer seen.
|
private |
Points in current ls.
|
private |
Type of previous start/end.
|
private |
Current stack of types.
|
private |
Whether the WKB is OK so far.
|
private |