1#pragma once
2
3#include "FunctionsURL.h"
4#include <common/find_symbols.h>
5
6
7namespace DB
8{
9
10template <bool without_leading_char>
11struct ExtractQueryString
12{
13 static size_t getReserveLengthForElement() { return 10; }
14
15 static void execute(Pos data, size_t size, Pos & res_data, size_t & res_size)
16 {
17 res_data = data;
18 res_size = 0;
19
20 Pos pos = data;
21 Pos end = pos + size;
22
23 if (end != (pos = find_first_symbols<'?'>(pos, end)))
24 {
25 Pos fragment = find_first_symbols<'#'>(pos, end);
26
27 res_data = pos + (without_leading_char ? 1 : 0);
28 res_size = fragment - res_data;
29 }
30 }
31};
32
33}
34