Class RuCodeGen::ValueIncapsulator
In: lib/rucodegen/value_incapsulator.rb
Parent: Object

Класс, который содержит описания C++ класса для шаблона ValueIncapsulator.

Methods

Classes and Modules

Module RuCodeGen::ValueIncapsulator::Generation

Constants

ATTR_DEFAULT_VALUE = :default   Ключ, который определяет начальное значение атрибута.
GETTER_RETURNS_VALUE = :getter_returns_value   Ключ, которые заставляет getter возвращать значение атрибута, а не ссылку на атрибут.

Attributes

class_name  [R]  Имя класса в C++.

Public Class methods

Метаметоды, которые упростят создание getter-ов и setter-ов для атрибутов ValueIncapsulator.

[Source]

# File lib/rucodegen/value_incapsulator.rb, line 105
        def self.getter_setter_for( a_attribute )
                class_eval %Q{
                        def get_#{a_attribute}
                                @#{a_attribute}
                        end
                        def #{a_attribute}( a_value )
                                @#{a_attribute} = a_value
                        end
                }
        end

Конструктор.

a_class_name
имя класса в C++.

[Source]

# File lib/rucodegen/value_incapsulator.rb, line 122
        def initialize( a_class_name )
                @class_name = a_class_name
                @attr_prefix = ""
                @attr_suffix = ""
                @getter_prefix = ""
                @setter_prefix = ""
                @attributes = []
                @decl_file = nil
                @impl_file = nil
        end

Public Instance methods

Добавить еще один атрибут.

a_name
имя атрибута.
a_type
имя типа атрибута.
a_props
Hash с необязательными параметрами атрибута.

[Source]

# File lib/rucodegen/value_incapsulator.rb, line 150
        def attr( a_name, a_type, a_props = {} )
                a = ClassAttribute.new( a_name, a_type )
                a.default = a_props[ ATTR_DEFAULT_VALUE ] if
                                a_props.has_key? ATTR_DEFAULT_VALUE

                a.getter_returns_value if a_props.has_key?( GETTER_RETURNS_VALUE ) and
                                true == a_props[ GETTER_RETURNS_VALUE ]

                @attributes << a
        end

Получить список атрибутов.

[Source]

# File lib/rucodegen/value_incapsulator.rb, line 141
        def get_attributes
                @attributes
        end

[Validate]

Hosted by uCoz