是否可以在现有的GVariant中存储,设置或更新值

发布于 2025-01-30 12:50:44 字数 138 浏览 2 评论 0 原文

我有一个简单的浮点glib变体对象,我需要更新其值,但是似乎没有任何功能可以实现。

唯一的方法似乎是创建一个新的变体对象并更新所有对该对象的参考的位置。问题在于,很难更新引用,并且仅在已经存在的变体对象中设置值会容易得多。

有可能吗?

I have a simple floating-point glib variant object whose value I need to update, but there doesn't seem to be any functions to actually do that.

The only way seems to be to create a new variant object and update all places that have references to this object. The problem is that it's practically hard to impossible to update the references, and it would be much easier to just set the value inside the already existing variant object.

Is it even possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

可是我不能没有你 2025-02-06 12:50:44

no,在设计之后。这使得可以安全地跨多个线程使用。

更新 gvariant 的值的唯一方法是创建一个带有新值的新 gvariant

No, GVariant is immutable after construction by design. This makes it safe to use across multiple threads.

The only way to update the value of a GVariant is to create a new GVariant with the new value.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文