Skip navigation.
Downloads | Product Documentation | Support

# JmsString Struct Reference

`#include <JmsCommon.h>`

## Data Fields
int | stringType
union {
char * string
struct {
void * data
JMS32I length
} uniString
} | uniOrC
int | allocatedSize

## Detailed Description

Used to represent java strings or C STRING

When used for input to a function
  When used as input, stringType must be set to CSTRING or UNISTRING. If stringType is CSTRING, then uniOrC.string should point to the UTF-8 encoded NULL-terminated C string. If stringType is UNISTRING then uniOrC.uniString.data should point to the multi-byte string (possibly with embedded NULL characters) and uniOrC.uniString.length should contain the amount of data in bytes. (So, for example if the string is a three character two-byte java string, length should contain six)

When used as output from a function
  When used as output, stringType must be set to CSTRING if the output should be represented as a UTF-8 encoded NULL-terminated C string or UNISTRING if the output should be represented as a two-byte character java string. If uniOrC.string (which also corresponds to uniOrC.uniString.data) is NULL, then the function will allocate memory for the output with malloc(). It is the responsibility of the caller of the function to later call free() on this memory. If uniOrC.string is not-NULL, then the amount of data available to be written into must be put into the allocatedSize member variable. If there is not enough space, the function will return JMS_NEED_SPACE and the amount of space needed will be placed in allocatedSize. In this case the function will have filled in as much of the data as possible.

## Field Documentation

int JmsString::allocatedSize

| Should be set to the size of the data available for output

void* JmsString::data

| The data portion of the string

JMS32I JmsString::length

| The size of data in bytes

char* JmsString::string

| A NULL terminated UTF-8 encoded C string

int JmsString::stringType

| The type of string represented on input or the type requested on output

union { ... } JmsString::uniOrC

| Describes either a C string or multi-byte string

struct { ... } JmsString::uniString

| Represents a muti-byte string

The documentation for this struct was generated from the following file:

- JmsCommon.h