Esempio n. 1
0
        CCodeExpression serialize_basic(BasicTypeInfo basic_type, CCodeExpression expr)
        {
            var new_call = new CCodeFunctionCall(new CCodeIdentifier("g_variant_new_" + basic_type.type_name));

            new_call.add_argument(expr);
            return(new_call);
        }
Esempio n. 2
0
 bool get_basic_type_info(string signature, out BasicTypeInfo basic_type)
 {
     foreach (BasicTypeInfo info in basic_types)
     {
         if (info.signature == signature)
         {
             basic_type = info;
             return(true);
         }
     }
     basic_type = new BasicTypeInfo();
     return(false);
 }
Esempio n. 3
0
        CCodeExpression deserialize_basic(BasicTypeInfo basic_type, CCodeExpression variant_expr, bool transfer = false)
        {
            var get_call = new CCodeFunctionCall(new CCodeIdentifier("g_variant_get_" + basic_type.type_name));

            get_call.add_argument(variant_expr);

            if (basic_type.is_string)
            {
                if (transfer)
                {
                    get_call.call = new CCodeIdentifier("g_variant_get_string");
                }
                else
                {
                    get_call.call = new CCodeIdentifier("g_variant_dup_string");
                }
                get_call.add_argument(new CCodeConstant("NULL"));
            }

            return(get_call);
        }