Keyple Util C++ Library 2.0.0
Reference Terminal Reader API for C++
Pattern.h
Go to the documentation of this file.
1/**************************************************************************************************
2 * Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ *
3 * *
4 * See the NOTICE file(s) distributed with this work for additional information regarding *
5 * copyright ownership. *
6 * *
7 * This program and the accompanying materials are made available under the terms of the Eclipse *
8 * Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 *
9 * *
10 * SPDX-License-Identifier: EPL-2.0 *
11 **************************************************************************************************/
12
13#pragma once
14
15#include <string>
16
17#include "KeypleUtilExport.h"
18#include "Matcher.h"
19
20namespace keyple {
21namespace core {
22namespace util {
23namespace cpp {
24
26public:
30 const std::regex mPattern;
31
35 Pattern(const std::string& pattern, const int flags);
36
42 std::unique_ptr<Pattern> compile(const std::string& regularExpression, const int flags) const;
43
47 static std::unique_ptr<Pattern> compile(const std::string& pattern);
48
49 /*
50 * Returns a Matcher for this pattern applied to the given input. The Matcher can be used to
51 * match the Pattern against the whole input, find occurences of the Pattern in the input, or
52 * replace parts of the input.
53 */
54 std::unique_ptr<Matcher> matcher(const std::string& input) const;
55
56private:
57
61 const int mFlags;
62};
63
64}
65}
66}
67}
#define KEYPLEUTIL_API
const std::regex mPattern
Definition: Pattern.h:30