blob: e94b518cd1232f4a1e8808febbc71198385f1584 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef TOOLS_JSON_SCHEMA_COMPILER_UTIL_H__
#define TOOLS_JSON_SCHEMA_COMPILER_UTIL_H__
#pragma once
#include <string>
#include <vector>
#include "base/memory/scoped_ptr.h"
namespace base {
class DictionaryValue;
}
namespace json_schema_compiler {
namespace util {
// Creates a new vector containing the strings |from|.|name| at |out|. Returns
// false if there is no list at the specified key or if the list has anything
// other than strings.
bool GetStrings(
const base::DictionaryValue& from,
const std::string& name,
std::vector<std::string>* out);
// Creates a new vector containing the strings |from|.|name| at |out|. Returns
// true on success or if there is nothing at the specified key. Returns false
// if anything other than a list of strings is at the specified key.
bool GetOptionalStrings(
const base::DictionaryValue& from,
const std::string& name,
scoped_ptr<std::vector<std::string> >* out);
// Puts the each string in |from| into a new ListValue at |out|.|name|.
void SetStrings(
const std::vector<std::string>& from,
const std::string& name,
base::DictionaryValue* out);
// If from is non-NULL, puts each string in |from| into a new ListValue at
// |out|.|name|.
void SetOptionalStrings(
const scoped_ptr<std::vector<std::string> >& from,
const std::string& name,
base::DictionaryValue* out);
} // namespace api_util
} // namespace extensions
#endif // TOOLS_JSON_SCHEMA_COMPILER_UTIL_H__
|