Sophie

Sophie

distrib > * > 2009.0 > i586 > by-pkgid > a6711891ce757817bba854bf3f25205a > files > 1928

qtjambi-doc-4.3.3-3mdv2008.1.i586.rpm

<class name="QBitArray" doc="/**
&lt;p&gt;The &lt;a href=&quot;QBitArray.html#QBitArray()&quot;&gt;&lt;tt&gt;QBitArray&lt;/tt&gt;&lt;/a&gt; class provides an array of bits.&lt;/p&gt;
&lt;p&gt;A &lt;a href=&quot;QBitArray.html#QBitArray()&quot;&gt;&lt;tt&gt;QBitArray&lt;/tt&gt;&lt;/a&gt; is an array that gives access to individual bits and provides operators (AND&lt;/tt&gt;, OR&lt;/tt&gt;, XOR&lt;/tt&gt;, and NOT&lt;/tt&gt;) that work on entire arrays of bits. It uses implicit sharing&lt;/tt&gt; (copy-on-write) to reduce memory usage and to avoid the needless copying of data.&lt;/p&gt;
&lt;p&gt;The following code constructs a &lt;a href=&quot;QBitArray.html#QBitArray()&quot;&gt;&lt;tt&gt;QBitArray&lt;/tt&gt;&lt;/a&gt; containing 200 bits initialized to false (0):&lt;/p&gt;
&lt;pre&gt;    QBitArray ba(200);&lt;/pre&gt;
&lt;p&gt;To initialize the bits to true, either pass &lt;tt&gt;true&lt;/tt&gt; as second argument to the constructor, or call &lt;a href=&quot;QBitArray.html#fill(boolean, int)&quot;&gt;&lt;tt&gt;fill&lt;/tt&gt;&lt;/a&gt; later on.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;QBitArray.html#QBitArray()&quot;&gt;&lt;tt&gt;QBitArray&lt;/tt&gt;&lt;/a&gt; uses 0-based indexes, just like C++ arrays. To access the bit at a particular index position, you can use operator[](). On non-const bit arrays, operator[]() returns a reference to a bit that can be used on the left side of an assignment. For example:&lt;/p&gt;
&lt;pre&gt;    QBitArray ba;
    ba.resize(3);
    ba[0] = true;
    ba[1] = false;
    ba[2] = true;&lt;/pre&gt;
&lt;p&gt;For technical reasons, it is more efficient to use &lt;a href=&quot;QBitArray.html#testBit(int)&quot;&gt;&lt;tt&gt;testBit&lt;/tt&gt;&lt;/a&gt; and &lt;a href=&quot;QBitArray.html#setBit(int, boolean)&quot;&gt;&lt;tt&gt;setBit&lt;/tt&gt;&lt;/a&gt; to access bits in the array than operator[](). For example:&lt;/p&gt;
&lt;pre&gt;    QBitArray ba(3);
    ba.setBit(0, true);
    ba.setBit(1, false);
    ba.setBit(2, true);&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;QBitArray.html#QBitArray()&quot;&gt;&lt;tt&gt;QBitArray&lt;/tt&gt;&lt;/a&gt; supports &lt;tt&gt;&amp;amp;&lt;/tt&gt; (AND&lt;/tt&gt;), &lt;tt&gt;|&lt;/tt&gt; (OR&lt;/tt&gt;), &lt;tt&gt;^&lt;/tt&gt; (XOR&lt;/tt&gt;), &lt;tt&gt;~&lt;/tt&gt; (NOT&lt;/tt&gt;), as well as &lt;tt&gt;&amp;amp;=&lt;/tt&gt;, &lt;tt&gt;|=&lt;/tt&gt;, and &lt;tt&gt;^=&lt;/tt&gt;. These operators work in the same way as the built-in C++ bitwise operators of the same name. For example:&lt;/p&gt;
&lt;pre&gt;    QBitArray x(5);
    x.setBit(3, true);
&lt;span class=&quot;comment&quot;&gt;    // x: [ 0, 0, 0, 1, 0 ]&lt;/span&gt;

    QBitArray y(5);
    y.setBit(4, true);
&lt;span class=&quot;comment&quot;&gt;    // y: [ 0, 0, 0, 0, 1 ]&lt;/span&gt;

    x |= y;
&lt;span class=&quot;comment&quot;&gt;    // x: [ 0, 0, 0, 1, 1 ]&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;For historical reasons, &lt;a href=&quot;QBitArray.html#QBitArray()&quot;&gt;&lt;tt&gt;QBitArray&lt;/tt&gt;&lt;/a&gt; distinguishes between a null bit array and an empty bit array. A &lt;i&gt;null&lt;/i&gt; bit array is a bit array that is initialized using &lt;a href=&quot;QBitArray.html#QBitArray()&quot;&gt;&lt;tt&gt;QBitArray&lt;/tt&gt;&lt;/a&gt;'s default constructor. An &lt;i&gt;empty&lt;/i&gt; bit array is any bit array with size 0. A null bit array is always empty, but an empty bit array isn't necessarily null:&lt;/p&gt;
&lt;pre&gt;    QBitArray().isNull();           &lt;span class=&quot;comment&quot;&gt;// returns true&lt;/span&gt;
    QBitArray().isEmpty();          &lt;span class=&quot;comment&quot;&gt;// returns true&lt;/span&gt;

    QBitArray(0).isNull();          &lt;span class=&quot;comment&quot;&gt;// returns false&lt;/span&gt;
    QBitArray(0).isEmpty();         &lt;span class=&quot;comment&quot;&gt;// returns true&lt;/span&gt;

    QBitArray(3).isNull();          &lt;span class=&quot;comment&quot;&gt;// returns false&lt;/span&gt;
    QBitArray(3).isEmpty();         &lt;span class=&quot;comment&quot;&gt;// returns false&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;All functions except &lt;a href=&quot;QBitArray.html#isNull()&quot;&gt;&lt;tt&gt;isNull&lt;/tt&gt;&lt;/a&gt; treat null bit arrays the same as empty bit arrays; for example, &lt;a href=&quot;QBitArray.html#QBitArray()&quot;&gt;&lt;tt&gt;QBitArray&lt;/tt&gt;&lt;/a&gt; compares equal to &lt;a href=&quot;QBitArray.html#QBitArray()&quot;&gt;&lt;tt&gt;QBitArray&lt;/tt&gt;&lt;/a&gt;(0). We recommend that you always use &lt;a href=&quot;QBitArray.html#isEmpty()&quot;&gt;&lt;tt&gt;isEmpty&lt;/tt&gt;&lt;/a&gt; and avoid &lt;a href=&quot;QBitArray.html#isNull()&quot;&gt;&lt;tt&gt;isNull&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QByteArray.html&quot;&gt;&lt;tt&gt;QByteArray&lt;/tt&gt;&lt;/a&gt;
@see &lt;tt&gt;QVector&lt;/tt&gt; */">
    <method name="public QBitArray(int size, boolean val)" doc="/**
&lt;p&gt;Constructs a bit array containing &lt;tt&gt;size&lt;/tt&gt; bits. The bits are initialized with &lt;tt&gt;val&lt;/tt&gt;, which defaults to false (0).&lt;/p&gt;
 */"/>
    <method name="public QBitArray(int size)" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QBitArray.html#QBitArray()&quot;&gt;&lt;tt&gt;QBitArray&lt;/tt&gt;&lt;/a&gt;(&lt;tt&gt;size&lt;/tt&gt;, false). */"/>
    <method name="public QBitArray(com.trolltech.qt.core.QBitArray other)" doc="/**
&lt;p&gt;Constructs a copy of &lt;tt&gt;other&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;This operation takes constant time&lt;/tt&gt;, because &lt;a href=&quot;QBitArray.html#QBitArray()&quot;&gt;&lt;tt&gt;QBitArray&lt;/tt&gt;&lt;/a&gt; is implicitly shared&lt;/tt&gt;. This makes returning a &lt;a href=&quot;QBitArray.html#QBitArray()&quot;&gt;&lt;tt&gt;QBitArray&lt;/tt&gt;&lt;/a&gt; from a function very fast. If a shared instance is modified, it will be copied (copy-on-write), and that takes linear time&lt;/tt&gt;.&lt;/p&gt;

@see &lt;tt&gt;operator=&lt;/tt&gt; */"/>
    <method name="public QBitArray()" doc="/**
&lt;p&gt;Constructs an empty bit array.&lt;/p&gt;

@see &lt;a href=&quot;QBitArray.html#isEmpty()&quot;&gt;&lt;tt&gt;isEmpty&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean at(int i)" doc="/**
&lt;p&gt;Returns the value of the bit at index position &lt;tt&gt;i&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;i&lt;/tt&gt; must be a valid index position in the bit array (i.e&amp;#x2e;, 0 &amp;lt;= &lt;tt&gt;i&lt;/tt&gt; &amp;lt; &lt;a href=&quot;QBitArray.html#size()&quot;&gt;&lt;tt&gt;size&lt;/tt&gt;&lt;/a&gt;).&lt;/p&gt;

@see &lt;tt&gt;operator[]&lt;/tt&gt; */"/>
    <method name="public final void clear()" doc="/**
&lt;p&gt;Clears the contents of the bit array and makes it empty.&lt;/p&gt;

@see &lt;a href=&quot;QBitArray.html#resize(int)&quot;&gt;&lt;tt&gt;resize&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QBitArray.html#isEmpty()&quot;&gt;&lt;tt&gt;isEmpty&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void clearBit(int i)" doc="/**
&lt;p&gt;Sets the bit at index position &lt;tt&gt;i&lt;/tt&gt; to 0.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;i&lt;/tt&gt; must be a valid index position in the bit array (i.e&amp;#x2e;, 0 &amp;lt;= &lt;tt&gt;i&lt;/tt&gt; &amp;lt; &lt;a href=&quot;QBitArray.html#size()&quot;&gt;&lt;tt&gt;size&lt;/tt&gt;&lt;/a&gt;).&lt;/p&gt;

@see &lt;a href=&quot;QBitArray.html#setBit(int, boolean)&quot;&gt;&lt;tt&gt;setBit&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QBitArray.html#toggleBit(int)&quot;&gt;&lt;tt&gt;toggleBit&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final int count(boolean on)" doc="/**
&lt;p&gt;If &lt;tt&gt;on&lt;/tt&gt; is true, this function returns the number of 1-bits stored in the bit array; otherwise the number of 0-bits is returned.&lt;/p&gt;
 */"/>
    <method name="public final int count()" doc="/**
&lt;p&gt;Same as &lt;a href=&quot;QBitArray.html#size()&quot;&gt;&lt;tt&gt;size&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;
 */"/>
    <method name="public final void fill(boolean val, int first, int last)" doc="/**
&lt;p&gt;Sets bits at index positions &lt;tt&gt;first&lt;/tt&gt; up to and excluding &lt;tt&gt;last&lt;/tt&gt; to &lt;tt&gt;val&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;first&lt;/tt&gt; and &lt;tt&gt;last&lt;/tt&gt; must be a valid index position in the bit array (i.e&amp;#x2e;, 0 &amp;lt;= &lt;tt&gt;first&lt;/tt&gt; &amp;lt;= &lt;a href=&quot;QBitArray.html#size()&quot;&gt;&lt;tt&gt;size&lt;/tt&gt;&lt;/a&gt; and 0 &amp;lt;= &lt;tt&gt;last&lt;/tt&gt; &amp;lt;= &lt;a href=&quot;QBitArray.html#size()&quot;&gt;&lt;tt&gt;size&lt;/tt&gt;&lt;/a&gt;).&lt;/p&gt;
 */"/>
    <method name="public final boolean fill(boolean val, int size)" doc="/**
&lt;p&gt;Sets every bit in the bit array to &lt;tt&gt;val&lt;/tt&gt;, returning true if successful; otherwise returns false. If &lt;tt&gt;size&lt;/tt&gt; is different from -1 (the default), the bit array is resized to &lt;tt&gt;size&lt;/tt&gt; beforehand.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre&gt;    QBitArray ba(8);
    ba.fill(true);
&lt;span class=&quot;comment&quot;&gt;    // ba: [ 1, 1, 1, 1, 1, 1, 1, 1 ]&lt;/span&gt;

    ba.fill(false, 2);
&lt;span class=&quot;comment&quot;&gt;    // ba: [ 0, 0 ]&lt;/span&gt;&lt;/pre&gt;

@see &lt;a href=&quot;QBitArray.html#resize(int)&quot;&gt;&lt;tt&gt;resize&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean fill(boolean val)" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QBitArray.html#fill(boolean, int)&quot;&gt;fill&lt;/tt&gt;&lt;/a&gt;(&lt;tt&gt;val&lt;/tt&gt;, -1). */"/>
    <method name="public final boolean isEmpty()" doc="/**
&lt;p&gt;Returns true if this bit array has size 0; otherwise returns false.&lt;/p&gt;

@see &lt;a href=&quot;QBitArray.html#size()&quot;&gt;&lt;tt&gt;size&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean isNull()" doc="/**
&lt;p&gt;Returns true if this bit array is null; otherwise returns false.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre&gt;    QBitArray().isNull();           &lt;span class=&quot;comment&quot;&gt;// returns true&lt;/span&gt;
    QBitArray(0).isNull();          &lt;span class=&quot;comment&quot;&gt;// returns false&lt;/span&gt;
    QBitArray(3).isNull();          &lt;span class=&quot;comment&quot;&gt;// returns false&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Qt makes a distinction between null bit arrays and empty bit arrays for historical reasons. For most applications, what matters is whether or not a bit array contains any data, and this can be determined using &lt;a href=&quot;QBitArray.html#isEmpty()&quot;&gt;&lt;tt&gt;isEmpty&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QBitArray.html#isEmpty()&quot;&gt;&lt;tt&gt;isEmpty&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void writeTo(com.trolltech.qt.core.QDataStream arg__1)"/>
    <method name="public final void readFrom(com.trolltech.qt.core.QDataStream arg__1)"/>
    <method name="public final void resize(int size)" doc="/**
&lt;p&gt;Resizes the bit array to &lt;tt&gt;size&lt;/tt&gt; bits.&lt;/p&gt;
&lt;p&gt;If &lt;tt&gt;size&lt;/tt&gt; is greater than the current size, the bit array is extended to make it &lt;tt&gt;size&lt;/tt&gt; bits with the extra bits added to the end. The new bits are initialized to false (0).&lt;/p&gt;
&lt;p&gt;If &lt;tt&gt;size&lt;/tt&gt; is less than the current size, bits are removed from the end.&lt;/p&gt;

@see &lt;a href=&quot;QBitArray.html#size()&quot;&gt;&lt;tt&gt;size&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void setBit(int i)" doc="/**
&lt;p&gt;Sets the bit at index position &lt;tt&gt;i&lt;/tt&gt; to 1.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;i&lt;/tt&gt; must be a valid index position in the bit array (i.e&amp;#x2e;, 0 &amp;lt;= &lt;tt&gt;i&lt;/tt&gt; &amp;lt; &lt;a href=&quot;QBitArray.html#size()&quot;&gt;&lt;tt&gt;size&lt;/tt&gt;&lt;/a&gt;).&lt;/p&gt;

@see &lt;a href=&quot;QBitArray.html#clearBit(int)&quot;&gt;&lt;tt&gt;clearBit&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QBitArray.html#toggleBit(int)&quot;&gt;&lt;tt&gt;toggleBit&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void setBit(int i, boolean val)" doc="/**
&lt;p&gt;Sets the bit at index position &lt;tt&gt;i&lt;/tt&gt; to &lt;tt&gt;val&lt;/tt&gt;.&lt;/p&gt;
 */"/>
    <method name="public final int size()" doc="/**
&lt;p&gt;Returns the number of bits stored in the bit array.&lt;/p&gt;

@see &lt;a href=&quot;QBitArray.html#resize(int)&quot;&gt;&lt;tt&gt;resize&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean testBit(int i)" doc="/**
&lt;p&gt;Returns true if the bit at index position &lt;tt&gt;i&lt;/tt&gt; is 1; otherwise returns false.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;i&lt;/tt&gt; must be a valid index position in the bit array (i.e&amp;#x2e;, 0 &amp;lt;= &lt;tt&gt;i&lt;/tt&gt; &amp;lt; &lt;a href=&quot;QBitArray.html#size()&quot;&gt;&lt;tt&gt;size&lt;/tt&gt;&lt;/a&gt;).&lt;/p&gt;

@see &lt;a href=&quot;QBitArray.html#setBit(int, boolean)&quot;&gt;&lt;tt&gt;setBit&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QBitArray.html#clearBit(int)&quot;&gt;&lt;tt&gt;clearBit&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean toggleBit(int i)" doc="/**
&lt;p&gt;Inverts the value of the bit at index position &lt;tt&gt;i&lt;/tt&gt;, returning the previous value of that bit as either true (if it was set) or false (if it was unset).&lt;/p&gt;
&lt;p&gt;If the previous value was 0, the new value will be 1. If the previous value was 1, the new value will be 0.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;i&lt;/tt&gt; must be a valid index position in the bit array (i.e&amp;#x2e;, 0 &amp;lt;= &lt;tt&gt;i&lt;/tt&gt; &amp;lt; &lt;a href=&quot;QBitArray.html#size()&quot;&gt;&lt;tt&gt;size&lt;/tt&gt;&lt;/a&gt;).&lt;/p&gt;

@see &lt;a href=&quot;QBitArray.html#setBit(int, boolean)&quot;&gt;&lt;tt&gt;setBit&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QBitArray.html#clearBit(int)&quot;&gt;&lt;tt&gt;clearBit&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void truncate(int pos)" doc="/**
&lt;p&gt;Truncates the bit array at index position &lt;tt&gt;pos&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;If &lt;tt&gt;pos&lt;/tt&gt; is beyond the end of the array, nothing happens.&lt;/p&gt;

@see &lt;a href=&quot;QBitArray.html#resize(int)&quot;&gt;&lt;tt&gt;resize&lt;/tt&gt;&lt;/a&gt; */"/>
</class>