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