You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. #include "rtc_base/location.h"
  11. #include <stdio.h>
  12. namespace rtc {
  13. Location::Location(const char* function_name, const char* file_and_line)
  14. : function_name_(function_name), file_and_line_(file_and_line) {}
  15. Location::Location() : function_name_("Unknown"), file_and_line_("Unknown") {}
  16. Location::Location(const Location& other)
  17. : function_name_(other.function_name_),
  18. file_and_line_(other.file_and_line_) {}
  19. Location& Location::operator=(const Location& other) {
  20. function_name_ = other.function_name_;
  21. file_and_line_ = other.file_and_line_;
  22. return *this;
  23. }
  24. std::string Location::ToString() const {
  25. char buf[256];
  26. snprintf(buf, sizeof(buf), "%s@%s", function_name_, file_and_line_);
  27. return buf;
  28. }
  29. } // namespace rtc