object: update to_string callback to use b_stream instead of b_stringstream

This commit is contained in:
2025-06-27 21:47:55 +01:00
parent 579a9e8505
commit c54d51d381
9 changed files with 237 additions and 51 deletions

View File

@@ -1,10 +1,11 @@
#include "object.h"
#include <blue/core/stream.h>
#include <blue/object/object.h>
#include <blue/object/type.h>
#include <blue/object/string.h>
#include <blue/core/stringstream.h>
#include <stdlib.h>
#include <blue/object/type.h>
#include <stdio.h>
#include <stdlib.h>
void b_object_init(struct b_object *obj, struct b_object_type *type)
{
@@ -40,7 +41,7 @@ void b_release(struct b_object *obj)
free(obj);
}
void b_to_string(struct b_object *obj, struct b_stringstream *out)
void b_to_string(struct b_object *obj, struct b_stream *out)
{
if (obj->ob_type->t_to_string) {
obj->ob_type->t_to_string(obj, out);
@@ -52,7 +53,7 @@ void b_to_string(struct b_object *obj, struct b_stringstream *out)
name = obj->ob_type->t_name;
}
b_stringstream_addf(out, "<%s@%p>", name, obj);
b_stream_write_fmt(out, NULL, "<%s@%p>", name, obj);
}
b_object_type_id b_typeid(const struct b_object *obj)