integer->parent.declaration->id = CTF_TYPE_INTEGER;
integer->declaration.len = size;
integer->declaration.base = BT_CTF_INTEGER_BASE_DECIMAL;
- integer->declaration.encoding = CTF_STRING_NONE;
+ integer->declaration.encoding = BT_CTF_STRING_ENCODING_NONE;
bt_ctf_field_type_init(&integer->parent, TRUE);
return &integer->parent;
}
return ret;
}
-enum ctf_string_encoding bt_ctf_field_type_integer_get_encoding(
+enum bt_ctf_string_encoding bt_ctf_field_type_integer_get_encoding(
struct bt_ctf_field_type *type)
{
- enum ctf_string_encoding ret = CTF_STRING_UNKNOWN;
+ enum bt_ctf_string_encoding ret = BT_CTF_STRING_ENCODING_UNKNOWN;
struct bt_ctf_field_type_integer *integer;
if (!type || type->declaration->id != CTF_TYPE_INTEGER) {
}
int bt_ctf_field_type_integer_set_encoding(struct bt_ctf_field_type *type,
- enum ctf_string_encoding encoding)
+ enum bt_ctf_string_encoding encoding)
{
int ret = 0;
struct bt_ctf_field_type_integer *integer;
if (!type || type->frozen ||
(type->declaration->id != CTF_TYPE_INTEGER) ||
- (encoding < CTF_STRING_NONE) ||
- (encoding >= CTF_STRING_UNKNOWN)) {
+ (encoding < BT_CTF_STRING_ENCODING_NONE) ||
+ (encoding >= BT_CTF_STRING_ENCODING_UNKNOWN)) {
ret = -1;
goto end;
}
string->parent.declaration = &string->declaration.p;
string->parent.declaration->id = CTF_TYPE_STRING;
bt_ctf_field_type_init(&string->parent, TRUE);
- string->declaration.encoding = CTF_STRING_UTF8;
+ string->declaration.encoding = BT_CTF_STRING_ENCODING_UTF8;
string->parent.declaration->alignment = CHAR_BIT;
return &string->parent;
}
-enum ctf_string_encoding bt_ctf_field_type_string_get_encoding(
+enum bt_ctf_string_encoding bt_ctf_field_type_string_get_encoding(
struct bt_ctf_field_type *type)
{
struct bt_ctf_field_type_string *string;
- enum ctf_string_encoding ret = CTF_STRING_UNKNOWN;
+ enum bt_ctf_string_encoding ret = BT_CTF_STRING_ENCODING_UNKNOWN;
if (!type || (type->declaration->id != CTF_TYPE_STRING)) {
goto end;
}
int bt_ctf_field_type_string_set_encoding(struct bt_ctf_field_type *type,
- enum ctf_string_encoding encoding)
+ enum bt_ctf_string_encoding encoding)
{
int ret = 0;
struct bt_ctf_field_type_string *string;
if (!type || type->declaration->id != CTF_TYPE_STRING ||
- (encoding != CTF_STRING_UTF8 &&
- encoding != CTF_STRING_ASCII)) {
+ (encoding != BT_CTF_STRING_ENCODING_UTF8 &&
+ encoding != BT_CTF_STRING_ENCODING_ASCII)) {
ret = -1;
goto end;
}
}
static
-const char *get_encoding_string(enum ctf_string_encoding encoding)
+const char *get_encoding_string(enum bt_ctf_string_encoding encoding)
{
const char *encoding_string;
switch (encoding) {
- case CTF_STRING_NONE:
+ case BT_CTF_STRING_ENCODING_NONE:
encoding_string = "none";
break;
- case CTF_STRING_ASCII:
+ case BT_CTF_STRING_ENCODING_ASCII:
encoding_string = "ASCII";
break;
- case CTF_STRING_UTF8:
+ case BT_CTF_STRING_ENCODING_UTF8:
encoding_string = "UTF8";
break;
default:
BT_CTF_BYTE_ORDER_NETWORK,
};
+enum bt_ctf_string_encoding {
+ BT_CTF_STRING_ENCODING_NONE = CTF_STRING_NONE,
+ BT_CTF_STRING_ENCODING_UTF8 = CTF_STRING_UTF8,
+ BT_CTF_STRING_ENCODING_ASCII = CTF_STRING_ASCII,
+ BT_CTF_STRING_ENCODING_UNKNOWN = CTF_STRING_UNKNOWN,
+};
+
enum bt_ctf_scope {
BT_CTF_SCOPE_UNKNOWN = -1,
BT_CTF_SCOPE_ENV = 0,
*
* @param integer Integer type.
*
- * Returns the string field's encoding on success, CTF_STRING_UNKNOWN on error.
+ * Returns the string field's encoding on success,
+ * BT_CTF_STRING_ENCODING_UNKNOWN on error.
*/
-extern enum ctf_string_encoding bt_ctf_field_type_integer_get_encoding(
+extern enum bt_ctf_string_encoding bt_ctf_field_type_integer_get_encoding(
struct bt_ctf_field_type *integer);
/*
* a text character.
*
* @param integer Integer type.
- * @param encoding Integer output encoding, defaults to CTF_STRING_ENCODING_NONE
+ * @param encoding Integer output encoding, defaults to
+ * BT_CTF_STRING_ENCODING_NONE
*
* Returns 0 on success, a negative value on error.
*/
extern int bt_ctf_field_type_integer_set_encoding(
struct bt_ctf_field_type *integer,
- enum ctf_string_encoding encoding);
+ enum bt_ctf_string_encoding encoding);
/**
* bt_ctf_field_type_integer_get_mapped_clock: get an integer type's mapped clock.
*
* @param string_type String type.
*
- * Returns the string's encoding on success, a CTF_STRING_UNKNOWN on error.
+ * Returns the string's encoding on success, a BT_CTF_STRING_ENCODING_UNKNOWN
+ * on error.
*/
-extern enum ctf_string_encoding bt_ctf_field_type_string_get_encoding(
+extern enum bt_ctf_string_encoding bt_ctf_field_type_string_get_encoding(
struct bt_ctf_field_type *string_type);
/*
* Set the string type's encoding.
*
* @param string_type String type.
- * @param encoding String field encoding, default CTF_STRING_ENCODING_ASCII.
- * Valid values are CTF_STRING_ENCODING_ASCII and CTF_STRING_ENCODING_UTF8.
+ * @param encoding String field encoding, default BT_CTF_STRING_ENCODING_ASCII.
+ * Valid values are BT_CTF_STRING_ENCODING_ASCII and
+ * BT_CTF_STRING_ENCODING_UTF8.
*
* Returns 0 on success, a negative value on error.
*/
extern int bt_ctf_field_type_string_set_encoding(
struct bt_ctf_field_type *string_type,
- enum ctf_string_encoding encoding);
+ enum bt_ctf_string_encoding encoding);
/*
* bt_ctf_field_type_get_alignment: get a field type's alignment.
BT_CTF_INTEGER_BASE_HEXADECIMAL,
"bt_ctf_field_type_integer_get_base returns a correct value");
- ok(bt_ctf_field_type_integer_set_encoding(NULL, CTF_STRING_ASCII) < 0,
+ ok(bt_ctf_field_type_integer_set_encoding(NULL,
+ BT_CTF_STRING_ENCODING_ASCII) < 0,
"bt_ctf_field_type_integer_set_encoding handles NULL correctly");
ok(bt_ctf_field_type_integer_set_encoding(uint_12_type,
- (enum ctf_string_encoding) 123) < 0,
+ (enum bt_ctf_string_encoding) 123) < 0,
"bt_ctf_field_type_integer_set_encoding handles invalid encodings correctly");
ok(bt_ctf_field_type_integer_set_encoding(uint_12_type,
- CTF_STRING_UTF8) == 0,
+ BT_CTF_STRING_ENCODING_UTF8) == 0,
"Set integer type encoding to UTF8");
- ok(bt_ctf_field_type_integer_get_encoding(NULL) == CTF_STRING_UNKNOWN,
+ ok(bt_ctf_field_type_integer_get_encoding(NULL) ==
+ BT_CTF_STRING_ENCODING_UNKNOWN,
"bt_ctf_field_type_integer_get_encoding handles NULL correctly");
- ok(bt_ctf_field_type_integer_get_encoding(uint_12_type) == CTF_STRING_UTF8,
+ ok(bt_ctf_field_type_integer_get_encoding(uint_12_type) ==
+ BT_CTF_STRING_ENCODING_UTF8,
"bt_ctf_field_type_integer_get_encoding returns a correct value");
int_16_type = bt_ctf_field_type_integer_create(16);
string_type = bt_ctf_field_type_string_create();
ok(string_type, "Create a string type");
ok(bt_ctf_field_type_string_set_encoding(string_type,
- CTF_STRING_NONE),
+ BT_CTF_STRING_ENCODING_NONE),
"Reject invalid \"None\" string encoding");
ok(bt_ctf_field_type_string_set_encoding(string_type,
42),
"Reject invalid string encoding");
ok(bt_ctf_field_type_string_set_encoding(string_type,
- CTF_STRING_ASCII) == 0,
+ BT_CTF_STRING_ENCODING_ASCII) == 0,
"Set string encoding to ASCII");
ok(bt_ctf_field_type_string_get_encoding(NULL) ==
- CTF_STRING_UNKNOWN,
+ BT_CTF_STRING_ENCODING_UNKNOWN,
"bt_ctf_field_type_string_get_encoding handles NULL correctly");
ok(bt_ctf_field_type_string_get_encoding(string_type) ==
- CTF_STRING_ASCII,
+ BT_CTF_STRING_ENCODING_ASCII,
"bt_ctf_field_type_string_get_encoding returns the correct value");
structure_seq_type = bt_ctf_field_type_structure_create();