- * Returns an array of the collation key values as 16-bit integers.
- * The caller owns the storage and must delete it.
- * @param values Output param of the collation key values.
- * @param count output parameter of the number of collation key values
- * @return a pointer to an array of 16-bit collation key values.
- */
- void adopt(uint8_t *values, int32_t count);
+ * Replaces the current bytes buffer with a new one of newCapacity
+ * and copies length bytes from the old buffer to the new one.
+ * @return the new buffer, or NULL if the allocation failed
+ */
+ uint8_t *reallocate(int32_t newCapacity, int32_t length);
+ /**
+ * Set a new length for a new sort key in the existing fBytes.
+ */
+ void setLength(int32_t newLength);
+
+ uint8_t *getBytes() {
+ return (fFlagAndLength >= 0) ? fUnion.fStackBuffer : fUnion.fFields.fBytes;
+ }
+ const uint8_t *getBytes() const {
+ return (fFlagAndLength >= 0) ? fUnion.fStackBuffer : fUnion.fFields.fBytes;
+ }
+ int32_t getCapacity() const {
+ return (fFlagAndLength >= 0) ? (int32_t)sizeof(fUnion) : fUnion.fFields.fCapacity;
+ }
+ int32_t getLength() const { return fFlagAndLength & 0x7fffffff; }