Package org.freedesktop.gstreamer.gst
Class IdStr
java.lang.Object
org.javagi.base.ProxyInstance
org.freedesktop.gstreamer.gst.IdStr
- All Implemented Interfaces:
Proxy
A
GstIdStr is string type optimized for short strings and used for structure
names, structure field names and in other places.
Strings up to 16 bytes (including NUL terminator) are stored inline, other strings are stored on the heap.
GstIdStr s = GST_ID_STR_INIT;
gst_id_str_set (&s, "Hello, World!");
g_print ("%s\\n", gst_id_str_as_str (&s));
gst_id_str_clear (&s);
- Since:
- 1.26
-
Constructor Summary
ConstructorsConstructorDescriptionIdStr()Returns a newly heap allocated empty string.IdStr(MemorySegment address) Create a IdStr proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionasStr()voidclear()Clears this IdStr and sets it to the empty string.copy()Copies this IdStr into newly allocated heap memory.voidCopiessintod.voidfree()Freess.This should only be called for heap-allocatedGstIdStr.longgetLen()Returns the length ofs,exluding the NUL-terminator.static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the IdStr classvoidinit()Initializes a (usually stack-allocated) id strings.The newly-initialized id string will contain an empty string by default as value.booleanCompares this IdStr ands2for equality.booleanisEqualToStr(String s2) Compares this IdStr ands2for equality.booleanisEqualToStrWithLen(String s2, long len) Compares this IdStr ands2with lengthlenfor equality.voidMovessinto this IdStr and resetss.Read the value of the fieldpointer.voidSets this IdStr to the stringvalue.voidsetStaticStr(String value) Sets this IdStr to the stringvalue.valueneeds to be valid for the remaining lifetime of the process, e.g.voidsetStaticStrWithLen(String value, long len) Sets this IdStr to the stringvalueof lengthlen.valueneeds to be valid for the remaining lifetime of the process, e.g.voidsetWithLen(String value, long len) Sets this IdStr to the stringvalueof lengthlen.valuedoes not have to be NUL-terminated andlenshould not include the NUL-terminator.voidwritePointer(MemorySegment pointer) Write a value in the fieldpointer.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
IdStr
Create a IdStr proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
IdStr
public IdStr()Returns a newly heap allocated empty string.- Since:
- 1.26
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readPointer
Read the value of the fieldpointer.- Returns:
- The value of the field
pointer
-
writePointer
Write a value in the fieldpointer.- Parameters:
pointer- The new value for the fieldpointer
-
asStr
-
clear
public void clear()Clears this IdStr and sets it to the empty string.- Since:
- 1.26
-
copy
Copies this IdStr into newly allocated heap memory.- Returns:
- A heap-allocated copy of
s. - Since:
- 1.26
-
copyInto
-
free
public void free()Freess.This should only be called for heap-allocatedGstIdStr.- Since:
- 1.26
-
getLen
public long getLen()Returns the length ofs,exluding the NUL-terminator. This is equivalent to callingstrcmp()but potentially faster.- Since:
- 1.26
-
init
public void init()Initializes a (usually stack-allocated) id strings.The newly-initialized id string will contain an empty string by default as value.- Since:
- 1.26
-
isEqual
Compares this IdStr ands2for equality.- Parameters:
s2- AGstIdStr- Returns:
trueif this IdStr ands2are equal.- Since:
- 1.26
-
isEqualToStr
Compares this IdStr ands2for equality.- Parameters:
s2- A string- Returns:
trueif this IdStr ands2are equal.- Since:
- 1.26
-
isEqualToStrWithLen
Compares this IdStr ands2with lengthlenfor equality.s2does not have to be NUL-terminated andlenshould not include the NUL-terminator.This is generally faster than gst_id_str_is_equal_to_str() if the length is already known.
- Parameters:
s2- A stringlen- Length ofs2.- Returns:
trueif this IdStr ands2are equal.- Since:
- 1.26
-
move
Movessinto this IdStr and resetss.- Parameters:
s- The sourceGstIdStr- Since:
- 1.26
-
set
Sets this IdStr to the stringvalue.- Parameters:
value- A NUL-terminated string- Since:
- 1.26
-
setStaticStr
Sets this IdStr to the stringvalue.valueneeds to be valid for the remaining lifetime of the process, e.g. has to be a static string.- Parameters:
value- A NUL-terminated string- Since:
- 1.26
-
setStaticStrWithLen
Sets this IdStr to the stringvalueof lengthlen.valueneeds to be valid for the remaining lifetime of the process, e.g. has to be a static string.valuemust be NUL-terminated andlenshould not include the NUL-terminator.- Parameters:
value- A stringlen- Length of the string- Since:
- 1.26
-
setWithLen
Sets this IdStr to the stringvalueof lengthlen.valuedoes not have to be NUL-terminated andlenshould not include the NUL-terminator.- Parameters:
value- A stringlen- Length of the string- Since:
- 1.26
-