Use multiline attribute to check for IA2_STATE_MULTILINE.
[chromium-blink-merge.git] / sandbox / linux / bpf_dsl / bpf_dsl_impl.h
blob2ffaf79c2fda9c4c4bb4e611f5c00a52dfcb7bb5
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef SANDBOX_LINUX_BPF_DSL_BPF_DSL_IMPL_H_
6 #define SANDBOX_LINUX_BPF_DSL_BPF_DSL_IMPL_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "sandbox/sandbox_export.h"
12 namespace sandbox {
13 class ErrorCode;
15 namespace bpf_dsl {
16 class PolicyCompiler;
18 namespace internal {
20 // Internal interface implemented by BoolExpr implementations.
21 class BoolExprImpl : public base::RefCounted<BoolExprImpl> {
22 public:
23 // Compile uses |pc| to construct an ErrorCode that conditionally continues
24 // to either |true_ec| or |false_ec|, depending on whether the represented
25 // boolean expression is true or false.
26 virtual ErrorCode Compile(PolicyCompiler* pc,
27 ErrorCode true_ec,
28 ErrorCode false_ec) const = 0;
30 protected:
31 BoolExprImpl() {}
32 virtual ~BoolExprImpl() {}
34 private:
35 friend class base::RefCounted<BoolExprImpl>;
36 DISALLOW_COPY_AND_ASSIGN(BoolExprImpl);
39 // Internal interface implemented by ResultExpr implementations.
40 class ResultExprImpl : public base::RefCounted<ResultExprImpl> {
41 public:
42 // Compile uses |pc| to construct an ErrorCode analogous to the represented
43 // result expression.
44 virtual ErrorCode Compile(PolicyCompiler* pc) const = 0;
46 // HasUnsafeTraps returns whether the result expression is or recursively
47 // contains an unsafe trap expression.
48 virtual bool HasUnsafeTraps() const;
50 // IsAllow returns whether the result expression is an "allow" result.
51 virtual bool IsAllow() const;
53 // IsAllow returns whether the result expression is a "deny" result.
54 virtual bool IsDeny() const;
56 protected:
57 ResultExprImpl() {}
58 virtual ~ResultExprImpl() {}
60 private:
61 friend class base::RefCounted<ResultExprImpl>;
62 DISALLOW_COPY_AND_ASSIGN(ResultExprImpl);
65 } // namespace internal
66 } // namespace bpf_dsl
67 } // namespace sandbox
69 #endif // SANDBOX_LINUX_BPF_DSL_BPF_DSL_IMPL_H_