Chromium Code Reviews| Index: webrtc/base/location.cc |
| diff --git a/webrtc/base/location.cc b/webrtc/base/location.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..34551555e9659d882cb6a34a4fb6cc518a3ea924 |
| --- /dev/null |
| +++ b/webrtc/base/location.cc |
| @@ -0,0 +1,45 @@ |
| +/* |
| + * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| + |
| +#include "webrtc/base/location.h" |
| + |
| +#include <sstream> |
| + |
| +namespace rtc { |
| + |
| +Location::Location(const char* function_name, |
| + const char* file_name, |
| + int line_number) |
| + : function_name_(function_name), |
| + file_name_(file_name), |
| + line_number_(line_number) {} |
| + |
| +Location::Location() |
| + : function_name_("Unknown"), file_name_("Unknown"), line_number_(-1) {} |
| + |
| +Location::Location(const Location& other) |
| + : function_name_(other.function_name_), |
| + file_name_(other.file_name_), |
| + line_number_(other.line_number_) {} |
| + |
| +Location& Location::operator=(const Location& other) { |
| + function_name_ = other.function_name_; |
| + file_name_ = other.file_name_; |
| + line_number_ = other.line_number_; |
| + return *this; |
| +} |
| + |
| +std::string Location::ToString() const { |
| + std::ostringstream os; |
| + os << function_name_ << '@' << file_name_ << ':' << line_number_; |
|
tommi
2016/05/31 19:56:27
It would be great to not need sstream. I'm lookin
Taylor Brandstetter
2016/06/02 22:38:41
What's the approved method of building a string wi
tommi
2016/06/03 05:45:10
sprintfn. There's also a stringbuilder class somew
|
| + return os.str(); |
| +} |
| + |
| +} // namespace rtc |