Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license | |
| 5 * that can be found in the LICENSE file in the root of the source | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #include "webrtc/base/location.h" | |
| 12 | |
| 13 #include <sstream> | |
| 14 | |
| 15 namespace rtc { | |
| 16 | |
| 17 Location::Location(const char* function_name, | |
| 18 const char* file_name, | |
| 19 int line_number) | |
| 20 : function_name_(function_name), | |
| 21 file_name_(file_name), | |
| 22 line_number_(line_number) {} | |
| 23 | |
| 24 Location::Location() | |
| 25 : function_name_("Unknown"), file_name_("Unknown"), line_number_(-1) {} | |
| 26 | |
| 27 Location::Location(const Location& other) | |
| 28 : function_name_(other.function_name_), | |
| 29 file_name_(other.file_name_), | |
| 30 line_number_(other.line_number_) {} | |
| 31 | |
| 32 Location& Location::operator=(const Location& other) { | |
| 33 function_name_ = other.function_name_; | |
| 34 file_name_ = other.file_name_; | |
| 35 line_number_ = other.line_number_; | |
| 36 return *this; | |
| 37 } | |
| 38 | |
| 39 std::string Location::ToString() const { | |
| 40 std::ostringstream os; | |
| 41 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
| |
| 42 return os.str(); | |
| 43 } | |
| 44 | |
| 45 } // namespace rtc | |
| OLD | NEW |