Sha256: 86d1c6270d603715baa5270ff7c97532cc775a0889c3c096721e7b0a88989605

Contents?: true

Size: 964 Bytes

Versions: 4

Compression:

Stored size: 964 Bytes

Contents

#include "MutableStringImpl.h"
#include <stdlib.h>
#include "string.h"

namespace rho {
namespace ruby {


MutableStringImpl::MutableStringImpl(bool is_mutable) {
    BASIC_TYPES basicType = BASIC_TYPES::String;
    if (is_mutable) {
        basicType = BASIC_TYPES::MutableString;
    }
    setBasicType(basicType);
    mString = NULL;
}
    
MutableStringImpl::MutableStringImpl() {
    mString = NULL;
}


MutableStringImpl::~MutableStringImpl() {
    if (mString != NULL) {
        free(mString);
    }
}

const char* MutableStringImpl::getClassName() {
    return "String";
}

const char* MutableStringImpl::getUTF8() {
    return (const char*)mString;
}

void MutableStringImpl::setUTF8(const char* utf8_string) {
    if (mString != NULL) {
        free(mString);
    }
    mString = NULL;
    if (utf8_string != NULL) {
        int len = (int)strlen(utf8_string);
        mString = (char*)malloc(len+1);
        strcpy(mString, utf8_string);
    }
}


}
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rhodes-7.6.0 platform/shared/rhoruby/impl/MutableStringImpl.cpp
rhodes-7.5.1 platform/shared/rhoruby/impl/MutableStringImpl.cpp
rhodes-7.4.1 platform/shared/rhoruby/impl/MutableStringImpl.cpp
rhodes-7.1.17 platform/shared/rhoruby/impl/MutableStringImpl.cpp