OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_PROFILE_RESETTER_JTL_INTERPRETER_H_ | 5 #ifndef CHROME_BROWSER_PROFILE_RESETTER_JTL_INTERPRETER_H_ |
6 #define CHROME_BROWSER_PROFILE_RESETTER_JTL_INTERPRETER_H_ | 6 #define CHROME_BROWSER_PROFILE_RESETTER_JTL_INTERPRETER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 | 12 |
13 // Executes a JTL program on a given dictionary. | 13 // Executes a JTL program on a given dictionary. |
14 // | 14 // |
15 // JTL (Json Traversal Language) programs are defined in jtl_foundation.h | 15 // JTL (Json Traversal Language) programs are defined in jtl_foundation.h |
16 class JtlInterpreter { | 16 class JtlInterpreter { |
17 public: | 17 public: |
18 enum Result { | 18 enum Result { |
19 OK, | 19 OK, |
20 PARSE_ERROR, | 20 PARSE_ERROR, |
21 RUNTIME_ERROR, | 21 RUNTIME_ERROR, |
| 22 RESULT_MAX, |
22 }; | 23 }; |
23 | 24 |
24 // |hasher_seed| is a value used in jtl_foundation::Hasher. All node names, | 25 // |hasher_seed| is a value used in jtl_foundation::Hasher. All node names, |
25 // strings, integers and doubles are hashed before being compared to hash | 26 // strings, integers and doubles are hashed before being compared to hash |
26 // values listed in |program|. | 27 // values listed in |program|. |
27 // |program| is a byte array containing a JTL program. | 28 // |program| is a byte array containing a JTL program. |
28 // |input| is a dictionary on which the program is evaluated. | 29 // |input| is a dictionary on which the program is evaluated. |
29 JtlInterpreter(const std::string& hasher_seed, | 30 JtlInterpreter(const std::string& hasher_seed, |
30 const std::string& program, | 31 const std::string& program, |
31 const DictionaryValue* input); | 32 const DictionaryValue* input); |
(...skipping 15 matching lines...) Expand all Loading... |
47 std::string program_; | 48 std::string program_; |
48 const DictionaryValue* input_; | 49 const DictionaryValue* input_; |
49 // Output. | 50 // Output. |
50 scoped_ptr<DictionaryValue> working_memory_; | 51 scoped_ptr<DictionaryValue> working_memory_; |
51 Result result_; | 52 Result result_; |
52 | 53 |
53 DISALLOW_COPY_AND_ASSIGN(JtlInterpreter); | 54 DISALLOW_COPY_AND_ASSIGN(JtlInterpreter); |
54 }; | 55 }; |
55 | 56 |
56 #endif // CHROME_BROWSER_PROFILE_RESETTER_JTL_INTERPRETER_H_ | 57 #endif // CHROME_BROWSER_PROFILE_RESETTER_JTL_INTERPRETER_H_ |
OLD | NEW |