HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
regex.h
Go to the documentation of this file.
1 //
2 // Copyright 2017 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_BASE_ARCH_REGEX_H
8 #define PXR_BASE_ARCH_REGEX_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/base/arch/api.h"
12 
13 #include <memory>
14 #include <string>
15 
17 
18 class ArchRegex {
19 public:
20  enum : unsigned int {
22  GLOB = 2u
23  };
24 
25  /// Create an empty regex.
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 
33  /// Create with pattern and optional flags.
34  ARCH_API ArchRegex(const std::string& pattern, unsigned int flags = 0);
35 
36  /// Destructor.
38 
39  /// Returns \c true if the regex is valid.
40  ARCH_API explicit operator bool() const;
41 
42  /// Returns the reason the regex is invalid or the empty string if
43  /// it's valid.
44  ARCH_API std::string GetError() const;
45 
46  /// Returns the flags used to construct the regex.
47  ARCH_API unsigned int GetFlags() const;
48 
49  /// Returns \c true if the regex matches \p query anywhere, otherwise
50  /// returns \c false.
51  ARCH_API bool Match(const std::string& query) const;
52 
53 private:
54  class _Impl;
55  unsigned int _flags = 0;
56  std::string _error;
57  std::shared_ptr<const _Impl> _impl;
58 };
59 
61 
62 #endif // PXR_BASE_ARCH_REGEX_H
GLenum query
Definition: glad.h:2772
GLbitfield flags
Definition: glcorearb.h:1596
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
Definition: thread.h:632
ARCH_API unsigned int GetFlags() const
Returns the flags used to construct the regex.
ARCH_API bool Match(const std::string &query) const
ARCH_API std::string GetError() const
GLushort pattern
Definition: glad.h:2583
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
#define ARCH_API
Definition: api.h:23
ArchRegex()=default
Create an empty regex.