+struct keys_st {
+public:
+ keys_st(size_t arg)
+ {
+ _lengths.resize(arg);
+ _keys.resize(arg);
+
+ for (size_t x= 0; x < _keys.size(); x++)
+ {
+ char uuid_string[37];
+
+ if (HAVE_LIBUUID)
+ {
+ uuid_t out;
+ uuid_generate(out);
+
+ uuid_unparse(out, uuid_string);
+ uuid_string[36]= 0;
+ _keys[x]= strdup(uuid_string);
+ _lengths[x]= 36;
+ }
+ else // We just use a number and pad the string if UUID is not available
+ {
+ memset(uuid_string, 'x', sizeof(uuid_string));
+ int key_length= snprintf(uuid_string, sizeof(uuid_string), "%u", uint32_t(x));
+ (void)key_length;
+ _keys[x]= strdup(uuid_string);
+ _lengths[x]= 36;
+ }
+ }
+ }
+
+ ~keys_st()
+ {
+ for (libtest::vchar_t::iterator iter= _keys.begin();
+ iter != _keys.end();
+ iter++)
+ {
+ ::free(*iter);
+ }
+ }
+
+ libtest::vchar_t::iterator begin()
+ {
+ return _keys.begin();
+ }
+
+ libtest::vchar_t::iterator end()
+ {
+ return _keys.end();
+ }
+
+ size_t size() const
+ {
+ return _keys.size();
+ }
+
+ std::vector<size_t>& lengths()
+ {
+ return _lengths;
+ }
+
+ libtest::vchar_t& keys()
+ {
+ return _keys;
+ }
+
+ size_t* lengths_ptr()
+ {
+ return &_lengths[0];
+ }
+
+ char** keys_ptr()
+ {
+ return &_keys[0];
+ }
+
+ char* key_at(size_t arg)
+ {
+ return _keys[arg];
+ }
+
+ size_t length_at(size_t arg)
+ {
+ return _lengths[arg];
+ }
+
+private:
+ libtest::vchar_t _keys;
+ std::vector<size_t> _lengths;
+};
+