Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1986)

Unified Diff: base/json/json_reader.h

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/json/json_parser_unittest.cc ('k') | base/json/json_reader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_reader.h
diff --git a/base/json/json_reader.h b/base/json/json_reader.h
index c6bcb528e3b1ad0cd44a6b8559065fe56db367f3..7b5b3b0a71169158898c6ead969d670a48c7dcfa 100644
--- a/base/json/json_reader.h
+++ b/base/json/json_reader.h
@@ -28,10 +28,10 @@
#ifndef BASE_JSON_JSON_READER_H_
#define BASE_JSON_JSON_READER_H_
+#include <memory>
#include <string>
#include "base/base_export.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string_piece.h"
namespace base {
@@ -93,30 +93,31 @@ class BASE_EXPORT JSONReader {
// Reads and parses |json|, returning a Value. The caller owns the returned
// instance. If |json| is not a properly formed JSON string, returns NULL.
- static scoped_ptr<Value> Read(const StringPiece& json);
+ static std::unique_ptr<Value> Read(const StringPiece& json);
// Reads and parses |json|, returning a Value owned by the caller. The
// parser respects the given |options|. If the input is not properly formed,
// returns NULL.
- static scoped_ptr<Value> Read(const StringPiece& json, int options);
+ static std::unique_ptr<Value> Read(const StringPiece& json, int options);
// Reads and parses |json| like Read(). |error_code_out| and |error_msg_out|
// are optional. If specified and NULL is returned, they will be populated
// an error code and a formatted error message (including error location if
// appropriate). Otherwise, they will be unmodified.
- static scoped_ptr<Value> ReadAndReturnError(const StringPiece& json,
- int options, // JSONParserOptions
- int* error_code_out,
- std::string* error_msg_out,
- int* error_line_out = nullptr,
- int* error_column_out = nullptr);
+ static std::unique_ptr<Value> ReadAndReturnError(
+ const StringPiece& json,
+ int options, // JSONParserOptions
+ int* error_code_out,
+ std::string* error_msg_out,
+ int* error_line_out = nullptr,
+ int* error_column_out = nullptr);
// Converts a JSON parse error code into a human readable message.
// Returns an empty string if error_code is JSON_NO_ERROR.
static std::string ErrorCodeToString(JsonParseError error_code);
// Parses an input string into a Value that is owned by the caller.
- scoped_ptr<Value> ReadToValue(const std::string& json);
+ std::unique_ptr<Value> ReadToValue(const std::string& json);
// Returns the error code if the last call to ReadToValue() failed.
// Returns JSON_NO_ERROR otherwise.
@@ -127,7 +128,7 @@ class BASE_EXPORT JSONReader {
std::string GetErrorMessage() const;
private:
- scoped_ptr<internal::JSONParser> parser_;
+ std::unique_ptr<internal::JSONParser> parser_;
};
} // namespace base
« no previous file with comments | « base/json/json_parser_unittest.cc ('k') | base/json/json_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698