Pixar Arch
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 "./api.h"
12
13#include <memory>
14#include <string>
15
16namespace pxr {
17
18class ArchRegex {
19public:
20 enum : unsigned int {
22 GLOB = 2u
23 };
24
26 ArchRegex() = default;
27
28 ArchRegex(ArchRegex &&) noexcept = default;
29 ArchRegex(ArchRegex const &) = default;
30 ArchRegex &operator=(ArchRegex &&) noexcept = default;
31 ArchRegex &operator=(ArchRegex const &) = default;
32
34 ARCH_API ArchRegex(const std::string& pattern, unsigned int flags = 0);
35
37 ARCH_API ~ArchRegex();
38
40 ARCH_API explicit operator bool() const;
41
44 ARCH_API std::string GetError() const;
45
47 ARCH_API unsigned int GetFlags() const;
48
51 ARCH_API bool Match(const std::string& query) const;
52
53private:
54 class _Impl;
55 unsigned int _flags = 0;
56 std::string _error;
57 std::shared_ptr<const _Impl> _impl;
58};
59
60} // namespace pxr
61
62#endif // PXR_ARCH_REGEX_H
Definition regex.h:18
ArchRegex(ArchRegex &&) noexcept=default
ARCH_API bool Match(const std::string &query) const
Returns true if the regex matches query anywhere, otherwise returns false.
ArchRegex()=default
Create an empty regex.
ARCH_API unsigned int GetFlags() const
Returns the flags used to construct the regex.
ARCH_API std::string GetError() const
Returns the reason the regex is invalid or the empty string if it's valid.
@ CASE_INSENSITIVE
Definition regex.h:21
@ GLOB
Definition regex.h:22