source: icGREP/icgrep-devel/icgrep/re/re_assertion.h @ 4532

Last change on this file since 4532 was 4516, checked in by nmedfort, 5 years ago

More memory leak fixes. All known leaks accounted for.

File size: 1.2 KB
Line 
1/*
2 *  Copyright (c) 2015 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6
7#ifndef RE_ASSERTION_H
8#define RE_ASSERTION_H
9
10#include <re/re_re.h>
11
12namespace re {
13
14class Assertion : public RE {
15public:
16    static inline bool classof(const RE * re) {
17        return re->getClassTypeId() == ClassTypeId::Assertion;
18    }
19    static inline bool classof(const void *) {
20        return false;
21    }
22    enum class Kind {Lookbehind, Lookahead};
23    enum class Sense {Positive, Negative};
24
25    RE * getAsserted() const {return mAsserted;}
26    Assertion::Kind getKind() const {return mKind;}
27    Assertion::Sense getSense() const {return mSense;}
28    void setAsserted(RE * r) {mAsserted = r;}
29
30
31protected:
32    friend Assertion * makeAssertion(RE * asserted, Kind k, Sense s);
33    Assertion(RE * r, Kind k, Sense s) : RE(ClassTypeId::Assertion), mAsserted(r), mKind(k), mSense(s) {}
34    virtual ~Assertion() {}
35
36private:
37    RE * mAsserted;
38    Kind mKind;
39    Sense mSense;
40};
41
42inline Assertion * makeAssertion(RE * asserted, Assertion::Kind k, Assertion::Sense s) {
43    return new Assertion(asserted, k, s);
44}
45
46}
47
48#endif // RE_ASSERTION_H
49
Note: See TracBrowser for help on using the repository browser.