- case pointer_P: return apr_psprintf(pool, "^%s", type->data.data.type == NULL ? "v" : Unparse(pool, type->data.data.type));
- case bit_P: return apr_psprintf(pool, "b%zu", type->data.data.size);
- case char_P: return "c";
- case double_P: return "d";
- case float_P: return "f";
- case int_P: return "i";
- case long_P: return "l";
- case longlong_P: return "q";
- case short_P: return "s";
- case void_P: return "v";
- case struct_P: return apr_psprintf(pool, "{%s=%s}", type->name == NULL ? "?" : type->name, Unparse(pool, &type->data.signature));
- }
+template <>
+const char *Primitive<char>::Encode(CYPool &pool) const {
+ return "c";
+}
+
+template <>
+const char *Primitive<double>::Encode(CYPool &pool) const {
+ return "d";
+}
+
+template <>
+const char *Primitive<float>::Encode(CYPool &pool) const {
+ return "f";
+}
+
+template <>
+const char *Primitive<signed char>::Encode(CYPool &pool) const {
+ return "c";
+}
+
+template <>
+const char *Primitive<signed int>::Encode(CYPool &pool) const {
+ return "i";
+}
+
+#ifdef __SIZEOF_INT128__
+template <>
+const char *Primitive<signed __int128>::Encode(CYPool &pool) const {
+ return "t";
+}
+#endif
+
+template <>
+const char *Primitive<signed long int>::Encode(CYPool &pool) const {
+ return "l";
+}
+
+template <>
+const char *Primitive<signed long long int>::Encode(CYPool &pool) const {
+ return "q";
+}
+
+template <>
+const char *Primitive<signed short int>::Encode(CYPool &pool) const {
+ return "s";
+}
+
+template <>
+const char *Primitive<unsigned char>::Encode(CYPool &pool) const {
+ return "C";
+}
+
+template <>
+const char *Primitive<unsigned int>::Encode(CYPool &pool) const {
+ return "I";
+}
+
+#ifdef __SIZEOF_INT128__
+template <>
+const char *Primitive<unsigned __int128>::Encode(CYPool &pool) const {
+ return "T";
+}
+#endif
+
+template <>
+const char *Primitive<unsigned long int>::Encode(CYPool &pool) const {
+ return "L";
+}
+
+template <>
+const char *Primitive<unsigned long long int>::Encode(CYPool &pool) const {
+ return "Q";
+}
+
+template <>
+const char *Primitive<unsigned short int>::Encode(CYPool &pool) const {
+ return "S";
+}
+
+const char *Void::Encode(CYPool &pool) const {
+ return "v";
+}
+
+const char *Unknown::Encode(CYPool &pool) const {
+ return "?";
+}
+
+const char *String::Encode(CYPool &pool) const {
+ return "*";
+}
+
+#ifdef CY_OBJECTIVEC
+const char *Meta::Encode(CYPool &pool) const {
+ return "#";
+}
+
+const char *Selector::Encode(CYPool &pool) const {
+ return ":";
+}
+#endif
+
+const char *Bits::Encode(CYPool &pool) const {
+ return pool.strcat("b", pool.itoa(size), NULL);
+}
+
+const char *Pointer::Encode(CYPool &pool) const {
+ return pool.strcat("^", type.Encode(pool), NULL);
+}
+
+const char *Array::Encode(CYPool &pool) const {
+ return pool.strcat("[", pool.itoa(size), type.Encode(pool), "]", NULL);
+}
+
+#ifdef CY_OBJECTIVEC
+const char *Object::Encode(CYPool &pool) const {
+ return name == NULL ? "@" : pool.strcat("@\"", name, "\"", NULL);
+}
+#endif
+
+const char *Enum::Encode(CYPool &pool) const {
+ return type.Encode(pool);
+}