Pixar Arch 0.25.8
Loading...
Searching...
No Matches
regex.h
Go to the documentation of this file.
1// Copyright 2017 Pixar
2//
3// Licensed under the terms set forth in the LICENSE.txt file available at
4// https://openusd.org/license.
5//
6// Modified by Jeremy Retailleau.
7
8#ifndef PXR_ARCH_REGEX_H
9#define PXR_ARCH_REGEX_H
10
11#include "pxr/arch/pxr.h"
12#include "pxr/arch/api.h"
13
14#include <memory>
15#include <string>
16
17ARCH_NAMESPACE_OPEN_SCOPE
18
19class ArchRegex {
20public:
21 enum : unsigned int {
23 GLOB = 2u
24 };
25
27 ArchRegex() = default;
28
29 ArchRegex(ArchRegex &&) noexcept = default;
30 ArchRegex(ArchRegex const &) = default;
31 ArchRegex &operator=(ArchRegex &&) noexcept = default;
32 ArchRegex &operator=(ArchRegex const &) = default;
33
35 ARCH_API ArchRegex(const std::string& pattern, unsigned int flags = 0);
36
38 ARCH_API ~ArchRegex();
39
41 ARCH_API explicit operator bool() const;
42
45 ARCH_API std::string GetError() const;
46
48 ARCH_API unsigned int GetFlags() const;
49
52 ARCH_API bool Match(const std::string& query) const;
53
54private:
55 class _Impl;
56 unsigned int _flags = 0;
57 std::string _error;
58 std::shared_ptr<const _Impl> _impl;
59};
60
61ARCH_NAMESPACE_CLOSE_SCOPE
62
63#endif // PXR_ARCH_REGEX_H
unsigned int GetFlags() const
Returns the flags used to construct the regex.
bool Match(const std::string &query) const
Returns true if the regex matches query anywhere, otherwise returns false.
ArchRegex(ArchRegex &&) noexcept=default
std::string GetError() const
Returns the reason the regex is invalid or the empty string if it's valid.
ArchRegex()=default
Create an empty regex.
@ CASE_INSENSITIVE
Definition regex.h:22
@ GLOB
Definition regex.h:23