class TurboRex::MSRPC::RPCBase::MIDL_SWITCHES

Constants

SWITCHES

Attributes

value[R]

Public Class Methods

new() click to toggle source
# File lib/turborex/msrpc/rpcbase.rb, line 327
def initialize
  @value = 0
end

Public Instance Methods

<<(switch)
Alias for: add
add(switch) click to toggle source
# File lib/turborex/msrpc/rpcbase.rb, line 331
def add(switch)
  return @value if has_switch?(switch)
  @value |= mapping_midl_switch(switch)
end
Also aliased as: <<
arch_64?() click to toggle source
# File lib/turborex/msrpc/rpcbase.rb, line 356
def arch_64?
  has_one_of_switches?(%w[win64 amd64 ia64])
end
has_all_of_switches?(switch) click to toggle source
# File lib/turborex/msrpc/rpcbase.rb, line 350
def has_all_of_switches?(switch)
  res = true
  switch.map {|s|res = false unless has_switch?(s)}
  res
end
has_one_of_switches?(switch) click to toggle source
# File lib/turborex/msrpc/rpcbase.rb, line 345
def has_one_of_switches?(switch)
  switch.each { |s| return true if has_switch?(s)  }
  false
end
has_switch?(switch) click to toggle source
# File lib/turborex/msrpc/rpcbase.rb, line 340
def has_switch?(switch)
  integer = mapping_midl_switch(switch)
  !integer.zero? && (@value & integer) == integer
end
mapping_midl_switch(switch) click to toggle source
# File lib/turborex/msrpc/rpcbase.rb, line 360
def mapping_midl_switch(switch)
  switch = [switch] if switch.is_a?(String)
  case switch
  when Array
    (switch & SWITCHES).map do |s| 
      2**SWITCHES.index(s) 
    end.inject(0, :+)
  when Integer
    SWITCHES.reject do |s|
      ((switch || 0) & 2**SWITCHES.index(s)).zero?
    end
  end
end
remove(switch) click to toggle source
# File lib/turborex/msrpc/rpcbase.rb, line 336
def remove(switch)
  @value &= ~mapping_midl_switch(switch)
end
to_array() click to toggle source
# File lib/turborex/msrpc/rpcbase.rb, line 374
def to_array
  mapping_midl_switch(@value)
end
to_s() click to toggle source
# File lib/turborex/msrpc/rpcbase.rb, line 378
def to_s
  mapping_midl_switch(@value).join(', ')
end