Class: Qt::Enum

Inherits:
Object show all
Defined in:
lib/Qt/qtruby4.rb

Overview

If a C++ enum was converted to an ordinary ruby Integer, the name of the type is lost. The enum type name is needed for overloaded method resolution when two methods differ only by an enum type.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(n, enum_type) ⇒ Enum

Returns a new instance of Enum


325
326
327
328
# File 'lib/Qt/qtruby4.rb', line 325

def initialize(n, enum_type)
  @value = n
  @type = enum_type
end

Instance Attribute Details

#typeObject

Returns the value of attribute type


324
325
326
# File 'lib/Qt/qtruby4.rb', line 324

def type
  @type
end

#valueObject

Returns the value of attribute value


324
325
326
# File 'lib/Qt/qtruby4.rb', line 324

def value
  @value
end

Instance Method Details

#%(n) ⇒ Object


342
343
344
# File 'lib/Qt/qtruby4.rb', line 342

def %(n)
  return @value % n.to_i
end

#&(n) ⇒ Object


352
353
354
# File 'lib/Qt/qtruby4.rb', line 352

def &(n)
  return Enum.new(@value & n.to_i, @type)
end

#*(n) ⇒ Object


336
337
338
# File 'lib/Qt/qtruby4.rb', line 336

def *(n)
  return @value * n.to_i
end

#**(n) ⇒ Object


345
346
347
# File 'lib/Qt/qtruby4.rb', line 345

def **(n)
  return @value ** n.to_i
end

#+(n) ⇒ Object


330
331
332
# File 'lib/Qt/qtruby4.rb', line 330

def +(n)
  return @value + n.to_i
end

#-(n) ⇒ Object


333
334
335
# File 'lib/Qt/qtruby4.rb', line 333

def -(n)
  return @value - n.to_i
end

#/(n) ⇒ Object


339
340
341
# File 'lib/Qt/qtruby4.rb', line 339

def /(n)
  return @value / n.to_i
end

#<(n) ⇒ Object


361
362
363
# File 'lib/Qt/qtruby4.rb', line 361

def <(n)
  return @value < n.to_i
end

#<<(n) ⇒ Object


373
374
375
# File 'lib/Qt/qtruby4.rb', line 373

def <<(n)
  return Enum.new(@value << n.to_i, @type)
end

#<=(n) ⇒ Object


364
365
366
# File 'lib/Qt/qtruby4.rb', line 364

def <=(n)
  return @value <= n.to_i
end

#==(n) ⇒ Object


380
# File 'lib/Qt/qtruby4.rb', line 380

def ==(n) return @value == n.to_i end

#>(n) ⇒ Object


367
368
369
# File 'lib/Qt/qtruby4.rb', line 367

def >(n)
  return @value > n.to_i
end

#>=(n) ⇒ Object


370
371
372
# File 'lib/Qt/qtruby4.rb', line 370

def >=(n)
  return @value >= n.to_i
end

#>>(n) ⇒ Object


376
377
378
# File 'lib/Qt/qtruby4.rb', line 376

def >>(n)
  return Enum.new(@value >> n.to_i, @type)
end

#^(n) ⇒ Object


355
356
357
# File 'lib/Qt/qtruby4.rb', line 355

def ^(n)
  return Enum.new(@value ^ n.to_i, @type)
end

#coerce(n) ⇒ Object


386
387
388
# File 'lib/Qt/qtruby4.rb', line 386

def coerce(n)
  [n, @value]
end

#inspectObject


390
391
392
# File 'lib/Qt/qtruby4.rb', line 390

def inspect
  to_s
end

#pretty_print(pp) ⇒ Object


394
395
396
# File 'lib/Qt/qtruby4.rb', line 394

def pretty_print(pp)
  pp.text "#<%s:0x%8.8x @type=%s, @value=%d>" % [self.class.name, object_id, type, value]
end

#to_fObject


383
# File 'lib/Qt/qtruby4.rb', line 383

def to_f() return @value.to_f end

#to_iObject


381
# File 'lib/Qt/qtruby4.rb', line 381

def to_i() return @value end

#to_sObject


384
# File 'lib/Qt/qtruby4.rb', line 384

def to_s() return @value.to_s end

#|(n) ⇒ Object


349
350
351
# File 'lib/Qt/qtruby4.rb', line 349

def |(n)
  return Enum.new(@value | n.to_i, @type)
end

#~Object


358
359
360
# File 'lib/Qt/qtruby4.rb', line 358

def ~()
  return ~ @value
end