com.trolltech.qt.core
Class QStringRef

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.core.QStringRef
All Implemented Interfaces:
QtJambiInterface

public class QStringRef
extends QtJambiObject


Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Constructor Summary
QStringRef()
          Constructs an empty string reference.
QStringRef(QNativePointer string)
          Constructs a string reference to the given string.
QStringRef(QNativePointer string, int position, int size)
          Constructs a string reference to the range of characters in the given string specified by the starting position and length in characters.
QStringRef(QStringRef other)
          Constructs a copy of the other string reference.
 
Method Summary
 QStringRef appendTo(QNativePointer string)
          Appends the string reference to string, and returns a new reference to the combined string data.
 char at(int i)
          Returns the character at the given index position in the string reference.
 void clear()
          Clears the contents of the string reference by making it null and empty.
 QNativePointer constData()
          Same as unicode().
 int count()
          Returns the number of characters in this string.
 QNativePointer data()
          Same as unicode().
static QStringRef fromNativePointer(QNativePointer nativePointer)
          This function returns the QStringRef instance pointed to by nativePointer
 int hashCode()
          
 boolean isEmpty()
          Returns true if the string reference has no characters; otherwise returns false.
 boolean isNull()
          Returns true if string() returns a null pointer or a pointer to a null string; otherwise returns true.
 int length()
          Returns the number of characters in this substring.
static QNativePointer nativePointerArray(QStringRef[] array)
          This function returns a QNativePointer that is pointing to the specified QStringRef array.
 QNativePointer operator_assign(QNativePointer string)
          Constructs a string reference to the given string and assigns it to this string reference, returning the result.
 QNativePointer operator_assign(QStringRef other)
          Assigns the other string reference to this string reference, and returns the result.
 int position()
          Returns the starting position in the referenced string that is referred to by the string reference.
 int size()
          Returns the number of characters referred to by the string reference.
 QNativePointer string()
          Returns a pointer to the string referred to by the string reference, or 0 if it does not reference a string.
 java.lang.String toString()
          Returns a string representation of this QStringRef.
 QNativePointer unicode()
          Returns a Unicode representation of the string reference.
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QStringRef

public QStringRef(QNativePointer string)
Constructs a string reference to the given string.


QStringRef

public QStringRef()
Constructs an empty string reference.


QStringRef

public QStringRef(QStringRef other)
Constructs a copy of the other string reference.


QStringRef

public QStringRef(QNativePointer string,
                  int position,
                  int size)
Constructs a string reference to the range of characters in the given string specified by the starting position and length in characters. Warning: This function exists to improve performance as much as possible, and performs no bounds checking. For program correctness, position and length must describe a valid substring of string. This means that the starting position must be positive or 0 and smaller than \a string's length, and length must be positive or 0 but smaller than the string's length minus the starting position; i.e, 0 <= position < string->length() and 0 <= length <= string->length() - position must both be satisfied.

Method Detail

appendTo

public final QStringRef appendTo(QNativePointer string)
Appends the string reference to string, and returns a new reference to the combined string data.


at

public final char at(int i)
Returns the character at the given index position in the string reference. The position must be a valid index position in the string (i.e., 0 <= position < size()).


clear

public final void clear()
Clears the contents of the string reference by making it null and empty.


constData

public final QNativePointer constData()
Same as unicode().

Returns:

count

public final int count()
Returns the number of characters in this string.


data

public final QNativePointer data()
Same as unicode().


isEmpty

public final boolean isEmpty()
Returns true if the string reference has no characters; otherwise returns false. A string reference is empty if its size is zero.


isNull

public final boolean isNull()
Returns true if string() returns a null pointer or a pointer to a null string; otherwise returns true.


length

public final int length()
Returns the number of characters in this substring.


operator_assign

public final QNativePointer operator_assign(QStringRef other)
Assigns the other string reference to this string reference, and returns the result.


operator_assign

public final QNativePointer operator_assign(QNativePointer string)
Constructs a string reference to the given string and assigns it to this string reference, returning the result.


position

public final int position()
Returns the starting position in the referenced string that is referred to by the string reference.


size

public final int size()
Returns the number of characters referred to by the string reference.


string

public final QNativePointer string()
Returns a pointer to the string referred to by the string reference, or 0 if it does not reference a string.


toString

public final java.lang.String toString()
Returns a string representation of this QStringRef.

Overrides:
toString in class java.lang.Object

unicode

public final QNativePointer unicode()
Returns a Unicode representation of the string reference. Since the data stems directly from the referenced string, it is not null-terminated unless the string reference includes the string's null terminator.


fromNativePointer

public static QStringRef fromNativePointer(QNativePointer nativePointer)
This function returns the QStringRef instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

nativePointerArray

public static QNativePointer nativePointerArray(QStringRef[] array)
This function returns a QNativePointer that is pointing to the specified QStringRef array.

Parameters:
array - the array that the returned pointer will point to.
Returns:
a QNativePointer that is pointing to the specified array.

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object