| 
									
										
										
										
											2020-10-10 14:16:11 +02:00
										 |  |  | # typed: true | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-02 21:57:52 -05:00
										 |  |  | require "compilers" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-14 03:39:31 +02:00
										 |  |  | # Combination of C++ standard library and compiler. | 
					
						
							| 
									
										
										
										
											2013-07-27 00:11:45 -07:00
										 |  |  | class CxxStdlib | 
					
						
							| 
									
										
										
										
											2014-08-02 19:29:59 -05:00
										 |  |  |   def self.create(type, compiler) | 
					
						
							| 
									
										
										
										
											2020-12-01 17:04:59 +00:00
										 |  |  |     raise ArgumentError, "Invalid C++ stdlib type: #{type}" if type && [:libstdcxx, :libcxx].exclude?(type) | 
					
						
							| 
									
										
										
										
											2018-09-17 02:45:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-02 12:38:39 +01:00
										 |  |  |     CxxStdlib.new(type, compiler) | 
					
						
							| 
									
										
										
										
											2014-08-22 22:18:03 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-02 19:29:59 -05:00
										 |  |  |   attr_reader :type, :compiler | 
					
						
							| 
									
										
										
										
											2013-07-27 00:11:45 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-02 12:38:39 +01:00
										 |  |  |   def initialize(type, compiler) | 
					
						
							| 
									
										
										
										
											2014-08-02 19:29:58 -05:00
										 |  |  |     @type = type | 
					
						
							| 
									
										
										
										
											2013-07-27 00:11:45 -07:00
										 |  |  |     @compiler = compiler.to_sym | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def type_string | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  |     type.to_s.gsub(/cxx$/, "c++") | 
					
						
							| 
									
										
										
										
											2013-07-27 00:11:45 -07:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2014-08-02 19:29:59 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-20 12:03:48 +02:00
										 |  |  |   sig { returns(String) } | 
					
						
							| 
									
										
										
										
											2014-08-03 15:28:26 -05:00
										 |  |  |   def inspect | 
					
						
							|  |  |  |     "#<#{self.class.name}: #{compiler} #{type}>" | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2013-07-27 00:11:45 -07:00
										 |  |  | end |