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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_PROFILE_RESETTER_JTL_INTERPRETER_H_
6 #define CHROME_BROWSER_PROFILE_RESETTER_JTL_INTERPRETER_H_
10 #include "base/basictypes.h"
11 #include "base/values.h"
13 // Executes a JTL program on a given dictionary.
15 // JTL (Json Traversal Language) programs are defined in jtl_foundation.h
16 class JtlInterpreter {
25 // |hasher_seed| is a value used in jtl_foundation::Hasher. All node names,
26 // strings, integers and doubles are hashed before being compared to hash
27 // values listed in |program|.
28 // |program| is a byte array containing a JTL program.
29 // |input| is a dictionary on which the program is evaluated.
30 JtlInterpreter(const std::string& hasher_seed,
31 const std::string& program,
32 const DictionaryValue* input);
37 Result result() const { return result_; }
38 const DictionaryValue* working_memory() const {
39 return working_memory_.get();
41 bool GetOutputBoolean(const std::string& unhashed_key, bool* output) const;
42 bool GetOutputString(const std::string& unhashed_key,
43 std::string* output) const;
47 std::string hasher_seed_;
49 const DictionaryValue* input_;
51 scoped_ptr<DictionaryValue> working_memory_;
54 DISALLOW_COPY_AND_ASSIGN(JtlInterpreter);
57 #endif // CHROME_BROWSER_PROFILE_RESETTER_JTL_INTERPRETER_H_