Home | History | Annotate | Download | only in tests
      1 // Copyright 2016 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.
      4 
      5 #ifndef VALUES_H_
      6 #define VALUES_H_
      7 
      8 #include <vector>
      9 
     10 #include "base/strings/string16.h"
     11 #include "base/strings/string_piece.h"
     12 
     13 namespace base {
     14 
     15 class Value {};
     16 
     17 // FundamentalValue represents the simple fundamental types of values.
     18 class FundamentalValue : public Value {
     19  public:
     20   explicit FundamentalValue(bool in_value);
     21   explicit FundamentalValue(int in_value);
     22   explicit FundamentalValue(double in_value);
     23 };
     24 
     25 class StringValue : public Value {
     26  public:
     27   // Initializes a StringValue with a UTF-8 narrow character string.
     28   explicit StringValue(StringPiece in_value);
     29 
     30   // Initializes a StringValue with a string16.
     31   explicit StringValue(const string16& in_value);
     32 };
     33 
     34 // Stub base::ListValue class that supports Append(Value*).
     35 class ListValue : public Value {
     36  public:
     37   ListValue();
     38 
     39   // Appends a Value to the end of the list.
     40   void Append(std::unique_ptr<Value> in_value);
     41 
     42   // Deprecated version of the above.
     43   void Append(Value* in_value);
     44 
     45   // Convenience forms of Append.
     46   void AppendBoolean(bool in_value);
     47   void AppendInteger(int in_value);
     48   void AppendDouble(double in_value);
     49   void AppendString(StringPiece in_value);
     50   void AppendString(const string16& in_value);
     51   void AppendStrings(const std::vector<std::string>& in_values);
     52   void AppendStrings(const std::vector<string16>& in_values);
     53 };
     54 
     55 }  // namespace base
     56 
     57 #endif  // VALUES_H_