首页 > 其他分享 >glib GVariant 3

glib GVariant 3

时间:2023-04-06 21:25:51浏览次数:36  
标签:glib bignum get variant value4 new GVariant floating

GVariant *value1, *value2, *value3, *value4;

value1 = g_variant_new ("y", 200);
value2 = g_variant_new ("b", TRUE);
value3 = g_variant_new ("d", 37.5);
value4 = g_variant_new ("x", G_GINT64_CONSTANT (998877665544332211));

 
  gdouble floating;
  gboolean truth;
  gint64 bignum;


  g_variant_get (value1, "y", NULL);      /* ignore the value. */
  g_variant_get (value2, "b", &truth);
  g_variant_get (value3, "d", &floating);
  g_variant_get (value4, "x", &bignum);
  g_message ("%d, %f, %d", truth, floating, bignum); 

  

标签:glib,bignum,get,variant,value4,new,GVariant,floating
From: https://www.cnblogs.com/hshy/p/17294211.html

相关文章

  • glib GVariant 2
    #include<stdio.h>#include<glib.h>#include<stdlib.h>#include<string.h>intmain(void){g_autoptr(GVariant)sessions=NULL;sessions=g_variant_new_parsed("[('2',uint321000,'nidhoe......
  • glib gmacros.h
    /*GLIB-LibraryofusefulroutinesforCprogramming*Copyright(C)1995-1997PeterMattis,SpencerKimballandJoshMacDonald**Thislibraryisfreesoftware;youcanredistributeitand/or*modifyitunderthetermsoftheGNULesserGeneral......
  • glib g_hash_table_lookup g_hash_table_remove
    这里会简单的说明一下例子中用到的api接口。GHashTable *g_hash_table_new(GHashFunc hash_func, GEqualFunc key_equal_func);功能:生成hash表。参数:hash_func创建hash值得函数,它为key创建一个hash值。这里可以用glib函数库里自带的g_str_hash。也可以用自......
  • glib g_hash_table_new g_hash_table_new_full
    这里会简单的说明一下例子中用到的api接口。GHashTable *g_hash_table_new(GHashFunc hash_func, GEqualFunc key_equal_func);功能:生成hash表。参数:hash_func创建hash值得函数,它为key创建一个hash值。这里可以用glib函数库里自带的g_str_hash。也可以用自......
  • glib 哈希调用
    glib:linux编译调用gccmain.c`pkg-config--libs--cflagsglib-2.0`-omain#include<stdio.h>#include<glib.h>#include<stdlib.h>#include<string.h>typedefstruct_Node{charkey[32];charvalue[32];}Node;staticvo......
  • glib GVariant
    GVariant*g_variant_new_boolean(gbooleanvalue){ gucharv=value; returng_variant_new_from_trusted(G_VARIANT_TYPE_BOOLEAN,&v,1);} typedefstruct_GVariantTypeGVariantType;/** *G_VARIANT_TYPE_BOOLEAN: * *Thetypeofavalueth......
  • Ubuntu切换glibc版本
    Ubuntu切换glibc版本glibc是GNU发布的C语言标准库,不同版本的glibc中函数实现不同,可能导致程序运行结果不同。这里介绍如何切换不同版本的glibc来运行程序首先,要安装patchelf,这是给elf文件打补丁(修改elf文件属性,包括使用的glibc版本)的工具gitclonehttps://github.com/NixOS/pa......
  • 详细介绍Glib 主事件循环轻度分析与编程应用
    glib是一个跨平台、用C语言编写的若干底层库的集合。编写案例最好能够结合glib源码,方便随时查看相关函数定义。glib实现了完整的事件循环分发机制。有一个主循环负责处理各种事件。事件通过事件源描述,常见的事件源文件描述符(文件、管道和socket)超时idle事件当然,也可以自......
  • glib库源码分析1
    /***g_main_loop_quit:*@loop:a#GMainLoop**Stopsa#GMainLoopfromrunning.Anycallstog_main_loop_run()*fortheloopwillreturn.**Notethatsourcesthathavealreadybeendispatchedwhen*g_main_loop_quit()iscalledwillstillbeexec......
  • Spring AOP、AspectJ、CGLIB
     静态代理和动态代理AOP代理则可分为静态代理和动态代理两大类,其中静态代理是指使用AOP框架提供的命令进行编译,从而在编译阶段就可生成AOP代理类,因此也称为编译时......