1 /* 2 * Created by Phil on 27/11/2013. 3 * Copyright 2013 Two Blue Cubes Ltd. All rights reserved. 4 * 5 * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 */ 8 9 #include "catch_common.h" 10 #include "catch_context.h" 11 #include "catch_interfaces_config.h" 12 13 #include <cstring> 14 #include <ostream> 15 16 namespace Catch { 17 empty() const18 bool SourceLineInfo::empty() const noexcept { 19 return file[0] == '\0'; 20 } operator ==(SourceLineInfo const & other) const21 bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept { 22 return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0); 23 } operator <(SourceLineInfo const & other) const24 bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept { 25 // We can assume that the same file will usually have the same pointer. 26 // Thus, if the pointers are the same, there is no point in calling the strcmp 27 return line < other.line || ( line == other.line && file != other.file && (std::strcmp(file, other.file) < 0)); 28 } 29 operator <<(std::ostream & os,SourceLineInfo const & info)30 std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) { 31 #ifndef __GNUG__ 32 os << info.file << '(' << info.line << ')'; 33 #else 34 os << info.file << ':' << info.line; 35 #endif 36 return os; 37 } 38 operator +() const39 std::string StreamEndStop::operator+() const { 40 return std::string(); 41 } 42 43 NonCopyable::NonCopyable() = default; 44 NonCopyable::~NonCopyable() = default; 45 46 } 47