class RLTK::CG::ConstantString

A sub-class of {ConstantArray} specifically for holding strings.

Public Class Methods

new(string, null_terminate = true, context = nil) click to toggle source

Create a new constant string value.

@param [String] string Sting to turn into a value. @param [Boolean] null_terminate To null terminate the string or not. @param [Context, nil] context Context in which to create the value.

# File lib/rltk/cg/value.rb, line 435
def initialize(string, null_terminate = true, context = nil)
        @type = ArrayType.new(Int8Type)

        @ptr =
        if context
                Bindings.const_string_in_context(check_type(context, Context, 'context'), string, string.length, null_terminate.to_i)
        else
                Bindings.const_string(string, string.length, null_terminate.to_i)
        end
end