38 char * username = va_arg(* params,
char *);
40 if (NULL != username) {
41 size_t nusername = va_arg(* params,
size_t);
42 char * email = va_arg(* params,
char *);
43 size_t nemail = va_arg(* params,
size_t);
44 char * firstname = va_arg(* params,
char *);
45 size_t nfirstname = va_arg(* params,
size_t);
46 char * surname = va_arg(* params,
char *);
47 size_t nsurname = va_arg(* params,
size_t);
57 memcpy(this->username, username, nusername);
58 this->username[nusername] =
'\0';
60 this->email = this->username + nusername + 1;
61 memcpy(this->email, email, nemail);
62 this->email[nemail] =
'\0';
64 this->firstname = this->email + nemail + 1;
65 memcpy(this->firstname, firstname, nfirstname);
66 this->firstname[nfirstname] =
'\0';
68 this->surname = this->firstname + nfirstname + 1;
69 memcpy(this->surname, surname, nsurname);
70 this->surname[nsurname] =
'\0';
72 this->nusername = (
size_t *)(this->surname + nsurname + 1);
73 *this->nusername = nusername;
75 this->nemail = this->nusername + 1;
76 *this->nemail = nemail;
78 this->nfirstname = this->nemail + 1;
79 *this->nfirstname = nfirstname;
81 this->nsurname = this->nfirstname + 1;
82 *this->nsurname = nsurname;
94 if (NULL != this->username) {
103 unsigned char ** serialized,
104 size_t * nserialized)
109 *this->nusername + 1 +
111 *this->nfirstname + 1 +
112 *this->nsurname + 1 +
117 memcpy(*serialized, this->username, *nserialized);
124 const unsigned char * serialized,
128 size_t * user_data_sizes;
131 memcpy(this->username, serialized, nserialized);
134 (
size_t *)(this->username + nserialized - 4 *
sizeof(
size_t));
136 this->nusername = user_data_sizes;
137 this->nemail = user_data_sizes + 1;
138 this->nfirstname = user_data_sizes + 2;
139 this->nsurname = user_data_sizes + 3;
141 this->email = this->username + *this->nusername + 1;
142 this->firstname = this->email + *this->nemail + 1;
143 this->surname = this->firstname + *this->nfirstname + 1;
153 (
unsigned char *)this->username,
static void userDtor(void *_this)
static void userUnserialize(void *_this, const unsigned char *serialized, size_t nserialized)
INIT_IFACE(Class, userCtor, userDtor, NULL)
static int userCtor(void *_this, va_list *params)
CREATE_CLASS(User, NULL, IFACE(Class), IFACE(Serializable), IFACE(Indexable))
Uuid uuidVersion3(const unsigned char *, size_t, Uuid)
static void userSerialize(void *_this, unsigned char **serialized, size_t *nserialized)
static Uuid userIndexUuid(void *_this, Uuid namespace)