1------------------------------------------------------------------------------ 2-- -- 3-- Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet -- 4-- Copyright (C) 2000-2015, AdaCore -- 5-- -- 6-- This library is free software; you can redistribute it and/or modify it -- 7-- under terms of the GNU General Public License as published by the Free -- 8-- Software Foundation; either version 3, or (at your option) any later -- 9-- version. This library is distributed in the hope that it will be useful, -- 10-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- 11-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- 12-- -- 13-- As a special exception under Section 7 of GPL version 3, you are granted -- 14-- additional permissions described in the GCC Runtime Library Exception, -- 15-- version 3.1, as published by the Free Software Foundation. -- 16-- -- 17-- You should have received a copy of the GNU General Public License and -- 18-- a copy of the GCC Runtime Library Exception along with this program; -- 19-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- 20-- <http://www.gnu.org/licenses/>. -- 21-- -- 22------------------------------------------------------------------------------ 23 24pragma Style_Checks (Off); 25pragma Warnings (Off, "*is already use-visible*"); 26with GtkAda.Types; use GtkAda.Types; 27with Gtkada.Bindings; use Gtkada.Bindings; 28pragma Warnings(Off); -- might be unused 29with Interfaces.C.Strings; use Interfaces.C.Strings; 30pragma Warnings(On); 31 32package body Glib.Variant is 33 34 function From_Object_Free 35 (B : access Gvariant'Class) return Gvariant 36 is 37 Result : constant Gvariant := Gvariant (B.all); 38 begin 39 Glib.g_free (B.all'Address); 40 return Result; 41 end From_Object_Free; 42 43 function From_Object (Object : System.Address) return Gvariant is 44 S : Gvariant; 45 begin 46 S.Set_Object (Object); 47 return S; 48 end From_Object; 49 50 ----------- 51 -- G_New -- 52 ----------- 53 54 procedure G_New (Self : out Gvariant_Type; Type_String : UTF8_String) is 55 function Internal 56 (Type_String : Interfaces.C.Strings.chars_ptr) return Gvariant_Type; 57 pragma Import (C, Internal, "g_variant_type_new"); 58 Tmp_Type_String : Interfaces.C.Strings.chars_ptr := New_String (Type_String); 59 Tmp_Return : Gvariant_Type; 60 begin 61 Tmp_Return := Internal (Tmp_Type_String); 62 Free (Tmp_Type_String); 63 Self := Tmp_Return; 64 end G_New; 65 66 ------------------- 67 -- G_New_Boolean -- 68 ------------------- 69 70 procedure G_New_Boolean (Self : out Gvariant; Value : Boolean) is 71 function Internal (Value : Glib.Gboolean) return System.Address; 72 pragma Import (C, Internal, "g_variant_new_boolean"); 73 begin 74 Self.Set_Object (Internal (Boolean'Pos (Value))); 75 end G_New_Boolean; 76 77 ---------------- 78 -- G_New_Byte -- 79 ---------------- 80 81 procedure G_New_Byte (Self : out Gvariant; Value : Guchar) is 82 function Internal (Value : Guchar) return System.Address; 83 pragma Import (C, Internal, "g_variant_new_byte"); 84 begin 85 Self.Set_Object (Internal (Value)); 86 end G_New_Byte; 87 88 ---------------------- 89 -- G_New_Bytestring -- 90 ---------------------- 91 92 procedure G_New_Bytestring (Self : out Gvariant; String : Gint_Array) is 93 function Internal (String : System.Address) return System.Address; 94 pragma Import (C, Internal, "g_variant_new_bytestring"); 95 begin 96 Self.Set_Object (Internal (String (String'First)'Address)); 97 end G_New_Bytestring; 98 99 ---------------------------- 100 -- G_New_Bytestring_Array -- 101 ---------------------------- 102 103 procedure G_New_Bytestring_Array 104 (Self : out Gvariant; 105 Strv : GNAT.Strings.String_List; 106 Length : Gssize) 107 is 108 function Internal 109 (Strv : Interfaces.C.Strings.chars_ptr_array; 110 Length : Gssize) return System.Address; 111 pragma Import (C, Internal, "g_variant_new_bytestring_array"); 112 Tmp_Strv : Interfaces.C.Strings.chars_ptr_array := From_String_List (Strv); 113 Tmp_Return : System.Address; 114 begin 115 Tmp_Return := Internal (Tmp_Strv, Length); 116 GtkAda.Types.Free (Tmp_Strv); 117 Self.Set_Object (Tmp_Return); 118 end G_New_Bytestring_Array; 119 120 ---------------------- 121 -- G_New_Dict_Entry -- 122 ---------------------- 123 124 procedure G_New_Dict_Entry 125 (Self : out Gvariant; 126 Key : Gvariant; 127 Value : Gvariant) 128 is 129 function Internal 130 (Key : System.Address; 131 Value : System.Address) return System.Address; 132 pragma Import (C, Internal, "g_variant_new_dict_entry"); 133 begin 134 Self.Set_Object (Internal (Get_Object (Key), Get_Object (Value))); 135 end G_New_Dict_Entry; 136 137 ---------------------- 138 -- G_New_Dict_Entry -- 139 ---------------------- 140 141 procedure G_New_Dict_Entry 142 (Self : out Gvariant_Type; 143 Key : Gvariant_Type; 144 Value : Gvariant_Type) 145 is 146 function Internal 147 (Key : Gvariant_Type; 148 Value : Gvariant_Type) return Gvariant_Type; 149 pragma Import (C, Internal, "g_variant_type_new_dict_entry"); 150 begin 151 Self := Internal (Key, Value); 152 end G_New_Dict_Entry; 153 154 ------------------ 155 -- G_New_Double -- 156 ------------------ 157 158 procedure G_New_Double (Self : out Gvariant; Value : Gdouble) is 159 function Internal (Value : Gdouble) return System.Address; 160 pragma Import (C, Internal, "g_variant_new_double"); 161 begin 162 Self.Set_Object (Internal (Value)); 163 end G_New_Double; 164 165 ------------------ 166 -- G_New_Handle -- 167 ------------------ 168 169 procedure G_New_Handle (Self : out Gvariant; Value : Gint32) is 170 function Internal (Value : Gint32) return System.Address; 171 pragma Import (C, Internal, "g_variant_new_handle"); 172 begin 173 Self.Set_Object (Internal (Value)); 174 end G_New_Handle; 175 176 ----------------- 177 -- G_New_Int16 -- 178 ----------------- 179 180 procedure G_New_Int16 (Self : out Gvariant; Value : Gint16) is 181 function Internal (Value : Gint16) return System.Address; 182 pragma Import (C, Internal, "g_variant_new_int16"); 183 begin 184 Self.Set_Object (Internal (Value)); 185 end G_New_Int16; 186 187 ----------------- 188 -- G_New_Int32 -- 189 ----------------- 190 191 procedure G_New_Int32 (Self : out Gvariant; Value : Gint32) is 192 function Internal (Value : Gint32) return System.Address; 193 pragma Import (C, Internal, "g_variant_new_int32"); 194 begin 195 Self.Set_Object (Internal (Value)); 196 end G_New_Int32; 197 198 ----------------- 199 -- G_New_Int64 -- 200 ----------------- 201 202 procedure G_New_Int64 (Self : out Gvariant; Value : Gint64) is 203 function Internal (Value : Gint64) return System.Address; 204 pragma Import (C, Internal, "g_variant_new_int64"); 205 begin 206 Self.Set_Object (Internal (Value)); 207 end G_New_Int64; 208 209 ----------------------- 210 -- G_New_Object_Path -- 211 ----------------------- 212 213 procedure G_New_Object_Path 214 (Self : out Gvariant; 215 Object_Path : UTF8_String) 216 is 217 function Internal 218 (Object_Path : Interfaces.C.Strings.chars_ptr) 219 return System.Address; 220 pragma Import (C, Internal, "g_variant_new_object_path"); 221 Tmp_Object_Path : Interfaces.C.Strings.chars_ptr := New_String (Object_Path); 222 Tmp_Return : System.Address; 223 begin 224 Tmp_Return := Internal (Tmp_Object_Path); 225 Free (Tmp_Object_Path); 226 Self.Set_Object (Tmp_Return); 227 end G_New_Object_Path; 228 229 ---------------- 230 -- G_New_Objv -- 231 ---------------- 232 233 procedure G_New_Objv 234 (Self : out Gvariant; 235 Strv : GNAT.Strings.String_List; 236 Length : Gssize) 237 is 238 function Internal 239 (Strv : Interfaces.C.Strings.chars_ptr_array; 240 Length : Gssize) return System.Address; 241 pragma Import (C, Internal, "g_variant_new_objv"); 242 Tmp_Strv : Interfaces.C.Strings.chars_ptr_array := From_String_List (Strv); 243 Tmp_Return : System.Address; 244 begin 245 Tmp_Return := Internal (Tmp_Strv, Length); 246 GtkAda.Types.Free (Tmp_Strv); 247 Self.Set_Object (Tmp_Return); 248 end G_New_Objv; 249 250 --------------------- 251 -- G_New_Signature -- 252 --------------------- 253 254 procedure G_New_Signature (Self : out Gvariant; Signature : UTF8_String) is 255 function Internal 256 (Signature : Interfaces.C.Strings.chars_ptr) return System.Address; 257 pragma Import (C, Internal, "g_variant_new_signature"); 258 Tmp_Signature : Interfaces.C.Strings.chars_ptr := New_String (Signature); 259 Tmp_Return : System.Address; 260 begin 261 Tmp_Return := Internal (Tmp_Signature); 262 Free (Tmp_Signature); 263 Self.Set_Object (Tmp_Return); 264 end G_New_Signature; 265 266 ------------------ 267 -- G_New_String -- 268 ------------------ 269 270 procedure G_New_String (Self : out Gvariant; String : UTF8_String) is 271 function Internal 272 (String : Interfaces.C.Strings.chars_ptr) return System.Address; 273 pragma Import (C, Internal, "g_variant_new_string"); 274 Tmp_String : Interfaces.C.Strings.chars_ptr := New_String (String); 275 Tmp_Return : System.Address; 276 begin 277 Tmp_Return := Internal (Tmp_String); 278 Free (Tmp_String); 279 Self.Set_Object (Tmp_Return); 280 end G_New_String; 281 282 ---------------- 283 -- G_New_Strv -- 284 ---------------- 285 286 procedure G_New_Strv 287 (Self : out Gvariant; 288 Strv : GNAT.Strings.String_List; 289 Length : Gssize) 290 is 291 function Internal 292 (Strv : Interfaces.C.Strings.chars_ptr_array; 293 Length : Gssize) return System.Address; 294 pragma Import (C, Internal, "g_variant_new_strv"); 295 Tmp_Strv : Interfaces.C.Strings.chars_ptr_array := From_String_List (Strv); 296 Tmp_Return : System.Address; 297 begin 298 Tmp_Return := Internal (Tmp_Strv, Length); 299 GtkAda.Types.Free (Tmp_Strv); 300 Self.Set_Object (Tmp_Return); 301 end G_New_Strv; 302 303 ----------------------- 304 -- G_New_Take_String -- 305 ----------------------- 306 307 procedure G_New_Take_String (Self : out Gvariant; String : UTF8_String) is 308 function Internal 309 (String : Interfaces.C.Strings.chars_ptr) return System.Address; 310 pragma Import (C, Internal, "g_variant_new_take_string"); 311 Tmp_String : Interfaces.C.Strings.chars_ptr := New_String (String); 312 Tmp_Return : System.Address; 313 begin 314 Tmp_Return := Internal (Tmp_String); 315 Free (Tmp_String); 316 Self.Set_Object (Tmp_Return); 317 end G_New_Take_String; 318 319 ------------------ 320 -- G_New_Uint16 -- 321 ------------------ 322 323 procedure G_New_Uint16 (Self : out Gvariant; Value : Guint16) is 324 function Internal (Value : Guint16) return System.Address; 325 pragma Import (C, Internal, "g_variant_new_uint16"); 326 begin 327 Self.Set_Object (Internal (Value)); 328 end G_New_Uint16; 329 330 ------------------ 331 -- G_New_Uint32 -- 332 ------------------ 333 334 procedure G_New_Uint32 (Self : out Gvariant; Value : Guint32) is 335 function Internal (Value : Guint32) return System.Address; 336 pragma Import (C, Internal, "g_variant_new_uint32"); 337 begin 338 Self.Set_Object (Internal (Value)); 339 end G_New_Uint32; 340 341 ------------------ 342 -- G_New_Uint64 -- 343 ------------------ 344 345 procedure G_New_Uint64 (Self : out Gvariant; Value : Guint64) is 346 function Internal (Value : Guint64) return System.Address; 347 pragma Import (C, Internal, "g_variant_new_uint64"); 348 begin 349 Self.Set_Object (Internal (Value)); 350 end G_New_Uint64; 351 352 ------------------- 353 -- G_New_Variant -- 354 ------------------- 355 356 procedure G_New_Variant (Self : out Gvariant; Value : Gvariant) is 357 function Internal (Value : System.Address) return System.Address; 358 pragma Import (C, Internal, "g_variant_new_variant"); 359 begin 360 Self.Set_Object (Internal (Get_Object (Value))); 361 end G_New_Variant; 362 363 -------------------------- 364 -- Gvariant_New_Boolean -- 365 -------------------------- 366 367 function Gvariant_New_Boolean (Value : Boolean) return Gvariant is 368 function Internal (Value : Glib.Gboolean) return System.Address; 369 pragma Import (C, Internal, "g_variant_new_boolean"); 370 Self : Gvariant; 371 begin 372 Self.Set_Object (Internal (Boolean'Pos (Value))); 373 return Self; 374 end Gvariant_New_Boolean; 375 376 ----------------------- 377 -- Gvariant_New_Byte -- 378 ----------------------- 379 380 function Gvariant_New_Byte (Value : Guchar) return Gvariant is 381 function Internal (Value : Guchar) return System.Address; 382 pragma Import (C, Internal, "g_variant_new_byte"); 383 Self : Gvariant; 384 begin 385 Self.Set_Object (Internal (Value)); 386 return Self; 387 end Gvariant_New_Byte; 388 389 ----------------------------- 390 -- Gvariant_New_Bytestring -- 391 ----------------------------- 392 393 function Gvariant_New_Bytestring (String : Gint_Array) return Gvariant is 394 function Internal (String : System.Address) return System.Address; 395 pragma Import (C, Internal, "g_variant_new_bytestring"); 396 Self : Gvariant; 397 begin 398 Self.Set_Object (Internal (String (String'First)'Address)); 399 return Self; 400 end Gvariant_New_Bytestring; 401 402 ----------------------------------- 403 -- Gvariant_New_Bytestring_Array -- 404 ----------------------------------- 405 406 function Gvariant_New_Bytestring_Array 407 (Strv : GNAT.Strings.String_List; 408 Length : Gssize) return Gvariant 409 is 410 function Internal 411 (Strv : Interfaces.C.Strings.chars_ptr_array; 412 Length : Gssize) return System.Address; 413 pragma Import (C, Internal, "g_variant_new_bytestring_array"); 414 Tmp_Strv : Interfaces.C.Strings.chars_ptr_array := From_String_List (Strv); 415 Tmp_Return : System.Address; 416 Self : Gvariant; 417 begin 418 Tmp_Return := Internal (Tmp_Strv, Length); 419 GtkAda.Types.Free (Tmp_Strv); 420 Self.Set_Object (Tmp_Return); 421 return Self; 422 end Gvariant_New_Bytestring_Array; 423 424 ----------------------------- 425 -- Gvariant_New_Dict_Entry -- 426 ----------------------------- 427 428 function Gvariant_New_Dict_Entry 429 (Key : Gvariant; 430 Value : Gvariant) return Gvariant 431 is 432 function Internal 433 (Key : System.Address; 434 Value : System.Address) return System.Address; 435 pragma Import (C, Internal, "g_variant_new_dict_entry"); 436 Self : Gvariant; 437 begin 438 Self.Set_Object (Internal (Get_Object (Key), Get_Object (Value))); 439 return Self; 440 end Gvariant_New_Dict_Entry; 441 442 ------------------------- 443 -- Gvariant_New_Double -- 444 ------------------------- 445 446 function Gvariant_New_Double (Value : Gdouble) return Gvariant is 447 function Internal (Value : Gdouble) return System.Address; 448 pragma Import (C, Internal, "g_variant_new_double"); 449 Self : Gvariant; 450 begin 451 Self.Set_Object (Internal (Value)); 452 return Self; 453 end Gvariant_New_Double; 454 455 ------------------------- 456 -- Gvariant_New_Handle -- 457 ------------------------- 458 459 function Gvariant_New_Handle (Value : Gint32) return Gvariant is 460 function Internal (Value : Gint32) return System.Address; 461 pragma Import (C, Internal, "g_variant_new_handle"); 462 Self : Gvariant; 463 begin 464 Self.Set_Object (Internal (Value)); 465 return Self; 466 end Gvariant_New_Handle; 467 468 ------------------------ 469 -- Gvariant_New_Int16 -- 470 ------------------------ 471 472 function Gvariant_New_Int16 (Value : Gint16) return Gvariant is 473 function Internal (Value : Gint16) return System.Address; 474 pragma Import (C, Internal, "g_variant_new_int16"); 475 Self : Gvariant; 476 begin 477 Self.Set_Object (Internal (Value)); 478 return Self; 479 end Gvariant_New_Int16; 480 481 ------------------------ 482 -- Gvariant_New_Int32 -- 483 ------------------------ 484 485 function Gvariant_New_Int32 (Value : Gint32) return Gvariant is 486 function Internal (Value : Gint32) return System.Address; 487 pragma Import (C, Internal, "g_variant_new_int32"); 488 Self : Gvariant; 489 begin 490 Self.Set_Object (Internal (Value)); 491 return Self; 492 end Gvariant_New_Int32; 493 494 ------------------------ 495 -- Gvariant_New_Int64 -- 496 ------------------------ 497 498 function Gvariant_New_Int64 (Value : Gint64) return Gvariant is 499 function Internal (Value : Gint64) return System.Address; 500 pragma Import (C, Internal, "g_variant_new_int64"); 501 Self : Gvariant; 502 begin 503 Self.Set_Object (Internal (Value)); 504 return Self; 505 end Gvariant_New_Int64; 506 507 ------------------------------ 508 -- Gvariant_New_Object_Path -- 509 ------------------------------ 510 511 function Gvariant_New_Object_Path 512 (Object_Path : UTF8_String) return Gvariant 513 is 514 function Internal 515 (Object_Path : Interfaces.C.Strings.chars_ptr) 516 return System.Address; 517 pragma Import (C, Internal, "g_variant_new_object_path"); 518 Tmp_Object_Path : Interfaces.C.Strings.chars_ptr := New_String (Object_Path); 519 Tmp_Return : System.Address; 520 Self : Gvariant; 521 begin 522 Tmp_Return := Internal (Tmp_Object_Path); 523 Free (Tmp_Object_Path); 524 Self.Set_Object (Tmp_Return); 525 return Self; 526 end Gvariant_New_Object_Path; 527 528 ----------------------- 529 -- Gvariant_New_Objv -- 530 ----------------------- 531 532 function Gvariant_New_Objv 533 (Strv : GNAT.Strings.String_List; 534 Length : Gssize) return Gvariant 535 is 536 function Internal 537 (Strv : Interfaces.C.Strings.chars_ptr_array; 538 Length : Gssize) return System.Address; 539 pragma Import (C, Internal, "g_variant_new_objv"); 540 Tmp_Strv : Interfaces.C.Strings.chars_ptr_array := From_String_List (Strv); 541 Tmp_Return : System.Address; 542 Self : Gvariant; 543 begin 544 Tmp_Return := Internal (Tmp_Strv, Length); 545 GtkAda.Types.Free (Tmp_Strv); 546 Self.Set_Object (Tmp_Return); 547 return Self; 548 end Gvariant_New_Objv; 549 550 ---------------------------- 551 -- Gvariant_New_Signature -- 552 ---------------------------- 553 554 function Gvariant_New_Signature (Signature : UTF8_String) return Gvariant is 555 function Internal 556 (Signature : Interfaces.C.Strings.chars_ptr) return System.Address; 557 pragma Import (C, Internal, "g_variant_new_signature"); 558 Tmp_Signature : Interfaces.C.Strings.chars_ptr := New_String (Signature); 559 Tmp_Return : System.Address; 560 Self : Gvariant; 561 begin 562 Tmp_Return := Internal (Tmp_Signature); 563 Free (Tmp_Signature); 564 Self.Set_Object (Tmp_Return); 565 return Self; 566 end Gvariant_New_Signature; 567 568 ------------------------- 569 -- Gvariant_New_String -- 570 ------------------------- 571 572 function Gvariant_New_String (String : UTF8_String) return Gvariant is 573 function Internal 574 (String : Interfaces.C.Strings.chars_ptr) return System.Address; 575 pragma Import (C, Internal, "g_variant_new_string"); 576 Tmp_String : Interfaces.C.Strings.chars_ptr := New_String (String); 577 Tmp_Return : System.Address; 578 Self : Gvariant; 579 begin 580 Tmp_Return := Internal (Tmp_String); 581 Free (Tmp_String); 582 Self.Set_Object (Tmp_Return); 583 return Self; 584 end Gvariant_New_String; 585 586 ----------------------- 587 -- Gvariant_New_Strv -- 588 ----------------------- 589 590 function Gvariant_New_Strv 591 (Strv : GNAT.Strings.String_List; 592 Length : Gssize) return Gvariant 593 is 594 function Internal 595 (Strv : Interfaces.C.Strings.chars_ptr_array; 596 Length : Gssize) return System.Address; 597 pragma Import (C, Internal, "g_variant_new_strv"); 598 Tmp_Strv : Interfaces.C.Strings.chars_ptr_array := From_String_List (Strv); 599 Tmp_Return : System.Address; 600 Self : Gvariant; 601 begin 602 Tmp_Return := Internal (Tmp_Strv, Length); 603 GtkAda.Types.Free (Tmp_Strv); 604 Self.Set_Object (Tmp_Return); 605 return Self; 606 end Gvariant_New_Strv; 607 608 ------------------------------ 609 -- Gvariant_New_Take_String -- 610 ------------------------------ 611 612 function Gvariant_New_Take_String (String : UTF8_String) return Gvariant is 613 function Internal 614 (String : Interfaces.C.Strings.chars_ptr) return System.Address; 615 pragma Import (C, Internal, "g_variant_new_take_string"); 616 Tmp_String : Interfaces.C.Strings.chars_ptr := New_String (String); 617 Tmp_Return : System.Address; 618 Self : Gvariant; 619 begin 620 Tmp_Return := Internal (Tmp_String); 621 Free (Tmp_String); 622 Self.Set_Object (Tmp_Return); 623 return Self; 624 end Gvariant_New_Take_String; 625 626 ------------------------- 627 -- Gvariant_New_Uint16 -- 628 ------------------------- 629 630 function Gvariant_New_Uint16 (Value : Guint16) return Gvariant is 631 function Internal (Value : Guint16) return System.Address; 632 pragma Import (C, Internal, "g_variant_new_uint16"); 633 Self : Gvariant; 634 begin 635 Self.Set_Object (Internal (Value)); 636 return Self; 637 end Gvariant_New_Uint16; 638 639 ------------------------- 640 -- Gvariant_New_Uint32 -- 641 ------------------------- 642 643 function Gvariant_New_Uint32 (Value : Guint32) return Gvariant is 644 function Internal (Value : Guint32) return System.Address; 645 pragma Import (C, Internal, "g_variant_new_uint32"); 646 Self : Gvariant; 647 begin 648 Self.Set_Object (Internal (Value)); 649 return Self; 650 end Gvariant_New_Uint32; 651 652 ------------------------- 653 -- Gvariant_New_Uint64 -- 654 ------------------------- 655 656 function Gvariant_New_Uint64 (Value : Guint64) return Gvariant is 657 function Internal (Value : Guint64) return System.Address; 658 pragma Import (C, Internal, "g_variant_new_uint64"); 659 Self : Gvariant; 660 begin 661 Self.Set_Object (Internal (Value)); 662 return Self; 663 end Gvariant_New_Uint64; 664 665 -------------------------- 666 -- Gvariant_New_Variant -- 667 -------------------------- 668 669 function Gvariant_New_Variant (Value : Gvariant) return Gvariant is 670 function Internal (Value : System.Address) return System.Address; 671 pragma Import (C, Internal, "g_variant_new_variant"); 672 Self : Gvariant; 673 begin 674 Self.Set_Object (Internal (Get_Object (Value))); 675 return Self; 676 end Gvariant_New_Variant; 677 678 ----------------------- 679 -- Gvariant_Type_New -- 680 ----------------------- 681 682 function Gvariant_Type_New 683 (Type_String : UTF8_String) return Gvariant_Type 684 is 685 function Internal 686 (Type_String : Interfaces.C.Strings.chars_ptr) return Gvariant_Type; 687 pragma Import (C, Internal, "g_variant_type_new"); 688 Tmp_Type_String : Interfaces.C.Strings.chars_ptr := New_String (Type_String); 689 Tmp_Return : Gvariant_Type; 690 Self : Gvariant_Type; 691 begin 692 Tmp_Return := Internal (Tmp_Type_String); 693 Free (Tmp_Type_String); 694 Self := Tmp_Return; 695 return Self; 696 end Gvariant_Type_New; 697 698 ---------------------------------- 699 -- Gvariant_Type_New_Dict_Entry -- 700 ---------------------------------- 701 702 function Gvariant_Type_New_Dict_Entry 703 (Key : Gvariant_Type; 704 Value : Gvariant_Type) return Gvariant_Type 705 is 706 function Internal 707 (Key : Gvariant_Type; 708 Value : Gvariant_Type) return Gvariant_Type; 709 pragma Import (C, Internal, "g_variant_type_new_dict_entry"); 710 Self : Gvariant_Type; 711 begin 712 Self := Internal (Key, Value); 713 return Self; 714 end Gvariant_Type_New_Dict_Entry; 715 716 -------------- 717 -- Byteswap -- 718 -------------- 719 720 function Byteswap (Self : Gvariant) return Gvariant is 721 function Internal (Self : System.Address) return System.Address; 722 pragma Import (C, Internal, "g_variant_byteswap"); 723 begin 724 return From_Object (Internal (Get_Object (Self))); 725 end Byteswap; 726 727 ------------------------- 728 -- Check_Format_String -- 729 ------------------------- 730 731 function Check_Format_String 732 (Self : Gvariant; 733 Format_String : UTF8_String; 734 Copy_Only : Boolean) return Boolean 735 is 736 function Internal 737 (Self : System.Address; 738 Format_String : Interfaces.C.Strings.chars_ptr; 739 Copy_Only : Glib.Gboolean) return Glib.Gboolean; 740 pragma Import (C, Internal, "g_variant_check_format_string"); 741 Tmp_Format_String : Interfaces.C.Strings.chars_ptr := New_String (Format_String); 742 Tmp_Return : Glib.Gboolean; 743 begin 744 Tmp_Return := Internal (Get_Object (Self), Tmp_Format_String, Boolean'Pos (Copy_Only)); 745 Free (Tmp_Format_String); 746 return Tmp_Return /= 0; 747 end Check_Format_String; 748 749 -------------- 750 -- Classify -- 751 -------------- 752 753 function Classify (Self : Gvariant) return GVariant_Class is 754 function Internal (Self : System.Address) return GVariant_Class; 755 pragma Import (C, Internal, "g_variant_classify"); 756 begin 757 return Internal (Get_Object (Self)); 758 end Classify; 759 760 -------------------------- 761 -- Dup_Bytestring_Array -- 762 -------------------------- 763 764 function Dup_Bytestring_Array 765 (Self : Gvariant; 766 Length : access Gsize) return GNAT.Strings.String_List 767 is 768 function Internal 769 (Self : System.Address; 770 Acc_Length : access Gsize) return chars_ptr_array_access; 771 pragma Import (C, Internal, "g_variant_dup_bytestring_array"); 772 Acc_Length : aliased Gsize; 773 Tmp_Return : chars_ptr_array_access; 774 begin 775 Tmp_Return := Internal (Get_Object (Self), Acc_Length'Access); 776 if Length /= null then 777 Length.all := Acc_Length; 778 end if; 779 return To_String_List_And_Free (Tmp_Return); 780 end Dup_Bytestring_Array; 781 782 -------------- 783 -- Dup_Objv -- 784 -------------- 785 786 function Dup_Objv 787 (Self : Gvariant; 788 Length : access Gsize) return GNAT.Strings.String_List 789 is 790 function Internal 791 (Self : System.Address; 792 Acc_Length : access Gsize) return chars_ptr_array_access; 793 pragma Import (C, Internal, "g_variant_dup_objv"); 794 Acc_Length : aliased Gsize; 795 Tmp_Return : chars_ptr_array_access; 796 begin 797 Tmp_Return := Internal (Get_Object (Self), Acc_Length'Access); 798 if Length /= null then 799 Length.all := Acc_Length; 800 end if; 801 return To_String_List_And_Free (Tmp_Return); 802 end Dup_Objv; 803 804 ---------------- 805 -- Dup_String -- 806 ---------------- 807 808 function Dup_String 809 (Self : Gvariant; 810 Length : access Gsize) return UTF8_String 811 is 812 function Internal 813 (Self : System.Address; 814 Acc_Length : access Gsize) return Interfaces.C.Strings.chars_ptr; 815 pragma Import (C, Internal, "g_variant_dup_string"); 816 Acc_Length : aliased Gsize; 817 Tmp_Return : Interfaces.C.Strings.chars_ptr; 818 begin 819 Tmp_Return := Internal (Get_Object (Self), Acc_Length'Access); 820 Length.all := Acc_Length; 821 return Gtkada.Bindings.Value_And_Free (Tmp_Return); 822 end Dup_String; 823 824 ---------------- 825 -- Dup_String -- 826 ---------------- 827 828 function Dup_String (Self : Gvariant_Type) return UTF8_String is 829 function Internal 830 (Self : Gvariant_Type) return Interfaces.C.Strings.chars_ptr; 831 pragma Import (C, Internal, "g_variant_type_dup_string"); 832 begin 833 return Gtkada.Bindings.Value_And_Free (Internal (Self)); 834 end Dup_String; 835 836 -------------- 837 -- Dup_Strv -- 838 -------------- 839 840 function Dup_Strv 841 (Self : Gvariant; 842 Length : access Gsize) return GNAT.Strings.String_List 843 is 844 function Internal 845 (Self : System.Address; 846 Acc_Length : access Gsize) return chars_ptr_array_access; 847 pragma Import (C, Internal, "g_variant_dup_strv"); 848 Acc_Length : aliased Gsize; 849 Tmp_Return : chars_ptr_array_access; 850 begin 851 Tmp_Return := Internal (Get_Object (Self), Acc_Length'Access); 852 if Length /= null then 853 Length.all := Acc_Length; 854 end if; 855 return To_String_List_And_Free (Tmp_Return); 856 end Dup_Strv; 857 858 ----------------- 859 -- Get_Boolean -- 860 ----------------- 861 862 function Get_Boolean (Self : Gvariant) return Boolean is 863 function Internal (Self : System.Address) return Glib.Gboolean; 864 pragma Import (C, Internal, "g_variant_get_boolean"); 865 begin 866 return Internal (Get_Object (Self)) /= 0; 867 end Get_Boolean; 868 869 -------------- 870 -- Get_Byte -- 871 -------------- 872 873 function Get_Byte (Self : Gvariant) return Guchar is 874 function Internal (Self : System.Address) return Guchar; 875 pragma Import (C, Internal, "g_variant_get_byte"); 876 begin 877 return Internal (Get_Object (Self)); 878 end Get_Byte; 879 880 -------------------------- 881 -- Get_Bytestring_Array -- 882 -------------------------- 883 884 function Get_Bytestring_Array 885 (Self : Gvariant; 886 Length : access Gsize) return GNAT.Strings.String_List 887 is 888 function Internal 889 (Self : System.Address; 890 Acc_Length : access Gsize) return chars_ptr_array_access; 891 pragma Import (C, Internal, "g_variant_get_bytestring_array"); 892 Acc_Length : aliased Gsize; 893 Tmp_Return : chars_ptr_array_access; 894 begin 895 Tmp_Return := Internal (Get_Object (Self), Acc_Length'Access); 896 if Length /= null then 897 Length.all := Acc_Length; 898 end if; 899 return To_String_List_And_Free (Tmp_Return); 900 end Get_Bytestring_Array; 901 902 --------------------- 903 -- Get_Child_Value -- 904 --------------------- 905 906 function Get_Child_Value (Self : Gvariant; Index : Gsize) return Gvariant is 907 function Internal 908 (Self : System.Address; 909 Index : Gsize) return System.Address; 910 pragma Import (C, Internal, "g_variant_get_child_value"); 911 begin 912 return From_Object (Internal (Get_Object (Self), Index)); 913 end Get_Child_Value; 914 915 ---------------- 916 -- Get_Double -- 917 ---------------- 918 919 function Get_Double (Self : Gvariant) return Gdouble is 920 function Internal (Self : System.Address) return Gdouble; 921 pragma Import (C, Internal, "g_variant_get_double"); 922 begin 923 return Internal (Get_Object (Self)); 924 end Get_Double; 925 926 ---------------- 927 -- Get_Handle -- 928 ---------------- 929 930 function Get_Handle (Self : Gvariant) return Gint32 is 931 function Internal (Self : System.Address) return Gint32; 932 pragma Import (C, Internal, "g_variant_get_handle"); 933 begin 934 return Internal (Get_Object (Self)); 935 end Get_Handle; 936 937 --------------- 938 -- Get_Int16 -- 939 --------------- 940 941 function Get_Int16 (Self : Gvariant) return Gint16 is 942 function Internal (Self : System.Address) return Gint16; 943 pragma Import (C, Internal, "g_variant_get_int16"); 944 begin 945 return Internal (Get_Object (Self)); 946 end Get_Int16; 947 948 --------------- 949 -- Get_Int32 -- 950 --------------- 951 952 function Get_Int32 (Self : Gvariant) return Gint32 is 953 function Internal (Self : System.Address) return Gint32; 954 pragma Import (C, Internal, "g_variant_get_int32"); 955 begin 956 return Internal (Get_Object (Self)); 957 end Get_Int32; 958 959 --------------- 960 -- Get_Int64 -- 961 --------------- 962 963 function Get_Int64 (Self : Gvariant) return Gint64 is 964 function Internal (Self : System.Address) return Gint64; 965 pragma Import (C, Internal, "g_variant_get_int64"); 966 begin 967 return Internal (Get_Object (Self)); 968 end Get_Int64; 969 970 --------------- 971 -- Get_Maybe -- 972 --------------- 973 974 function Get_Maybe (Self : Gvariant) return Gvariant is 975 function Internal (Self : System.Address) return System.Address; 976 pragma Import (C, Internal, "g_variant_get_maybe"); 977 begin 978 return From_Object (Internal (Get_Object (Self))); 979 end Get_Maybe; 980 981 --------------------- 982 -- Get_Normal_Form -- 983 --------------------- 984 985 function Get_Normal_Form (Self : Gvariant) return Gvariant is 986 function Internal (Self : System.Address) return System.Address; 987 pragma Import (C, Internal, "g_variant_get_normal_form"); 988 begin 989 return From_Object (Internal (Get_Object (Self))); 990 end Get_Normal_Form; 991 992 -------------- 993 -- Get_Objv -- 994 -------------- 995 996 function Get_Objv 997 (Self : Gvariant; 998 Length : access Gsize) return GNAT.Strings.String_List 999 is 1000 function Internal 1001 (Self : System.Address; 1002 Acc_Length : access Gsize) return chars_ptr_array_access; 1003 pragma Import (C, Internal, "g_variant_get_objv"); 1004 Acc_Length : aliased Gsize; 1005 Tmp_Return : chars_ptr_array_access; 1006 begin 1007 Tmp_Return := Internal (Get_Object (Self), Acc_Length'Access); 1008 if Length /= null then 1009 Length.all := Acc_Length; 1010 end if; 1011 return To_String_List_And_Free (Tmp_Return); 1012 end Get_Objv; 1013 1014 -------------- 1015 -- Get_Size -- 1016 -------------- 1017 1018 function Get_Size (Self : Gvariant) return Gsize is 1019 function Internal (Self : System.Address) return Gsize; 1020 pragma Import (C, Internal, "g_variant_get_size"); 1021 begin 1022 return Internal (Get_Object (Self)); 1023 end Get_Size; 1024 1025 ---------------- 1026 -- Get_String -- 1027 ---------------- 1028 1029 function Get_String 1030 (Self : Gvariant; 1031 Length : access Gsize) return UTF8_String 1032 is 1033 function Internal 1034 (Self : System.Address; 1035 Acc_Length : access Gsize) return Interfaces.C.Strings.chars_ptr; 1036 pragma Import (C, Internal, "g_variant_get_string"); 1037 Acc_Length : aliased Gsize; 1038 Tmp_Return : Interfaces.C.Strings.chars_ptr; 1039 begin 1040 Tmp_Return := Internal (Get_Object (Self), Acc_Length'Access); 1041 if Length /= null then 1042 Length.all := Acc_Length; 1043 end if; 1044 return Gtkada.Bindings.Value_Allowing_Null (Tmp_Return); 1045 end Get_String; 1046 1047 -------------- 1048 -- Get_Strv -- 1049 -------------- 1050 1051 function Get_Strv 1052 (Self : Gvariant; 1053 Length : access Gsize) return GNAT.Strings.String_List 1054 is 1055 function Internal 1056 (Self : System.Address; 1057 Acc_Length : access Gsize) return chars_ptr_array_access; 1058 pragma Import (C, Internal, "g_variant_get_strv"); 1059 Acc_Length : aliased Gsize; 1060 Tmp_Return : chars_ptr_array_access; 1061 begin 1062 Tmp_Return := Internal (Get_Object (Self), Acc_Length'Access); 1063 if Length /= null then 1064 Length.all := Acc_Length; 1065 end if; 1066 return To_String_List_And_Free (Tmp_Return); 1067 end Get_Strv; 1068 1069 -------------- 1070 -- Get_Type -- 1071 -------------- 1072 1073 function Get_Type (Self : Gvariant) return Gvariant_Type is 1074 function Internal (Self : System.Address) return Gvariant_Type; 1075 pragma Import (C, Internal, "g_variant_get_type"); 1076 begin 1077 return Internal (Get_Object (Self)); 1078 end Get_Type; 1079 1080 --------------------- 1081 -- Get_Type_String -- 1082 --------------------- 1083 1084 function Get_Type_String (Self : Gvariant) return UTF8_String is 1085 function Internal 1086 (Self : System.Address) return Interfaces.C.Strings.chars_ptr; 1087 pragma Import (C, Internal, "g_variant_get_type_string"); 1088 begin 1089 return Gtkada.Bindings.Value_Allowing_Null (Internal (Get_Object (Self))); 1090 end Get_Type_String; 1091 1092 ---------------- 1093 -- Get_Uint16 -- 1094 ---------------- 1095 1096 function Get_Uint16 (Self : Gvariant) return Guint16 is 1097 function Internal (Self : System.Address) return Guint16; 1098 pragma Import (C, Internal, "g_variant_get_uint16"); 1099 begin 1100 return Internal (Get_Object (Self)); 1101 end Get_Uint16; 1102 1103 ---------------- 1104 -- Get_Uint32 -- 1105 ---------------- 1106 1107 function Get_Uint32 (Self : Gvariant) return Guint32 is 1108 function Internal (Self : System.Address) return Guint32; 1109 pragma Import (C, Internal, "g_variant_get_uint32"); 1110 begin 1111 return Internal (Get_Object (Self)); 1112 end Get_Uint32; 1113 1114 ---------------- 1115 -- Get_Uint64 -- 1116 ---------------- 1117 1118 function Get_Uint64 (Self : Gvariant) return Guint64 is 1119 function Internal (Self : System.Address) return Guint64; 1120 pragma Import (C, Internal, "g_variant_get_uint64"); 1121 begin 1122 return Internal (Get_Object (Self)); 1123 end Get_Uint64; 1124 1125 ----------------- 1126 -- Get_Variant -- 1127 ----------------- 1128 1129 function Get_Variant (Self : Gvariant) return Gvariant is 1130 function Internal (Self : System.Address) return System.Address; 1131 pragma Import (C, Internal, "g_variant_get_variant"); 1132 begin 1133 return From_Object (Internal (Get_Object (Self))); 1134 end Get_Variant; 1135 1136 ---------- 1137 -- Hash -- 1138 ---------- 1139 1140 function Hash (Self : Gvariant) return Guint is 1141 function Internal (Self : System.Address) return Guint; 1142 pragma Import (C, Internal, "g_variant_hash"); 1143 begin 1144 return Internal (Get_Object (Self)); 1145 end Hash; 1146 1147 ---------- 1148 -- Init -- 1149 ---------- 1150 1151 function Init (Self : Gvariant_Iter; Value : Gvariant) return Gsize is 1152 function Internal 1153 (Self : Gvariant_Iter; 1154 Value : System.Address) return Gsize; 1155 pragma Import (C, Internal, "g_variant_iter_init"); 1156 begin 1157 return Internal (Self, Get_Object (Value)); 1158 end Init; 1159 1160 -------------- 1161 -- Is_Array -- 1162 -------------- 1163 1164 function Is_Array (Self : Gvariant_Type) return Boolean is 1165 function Internal (Self : Gvariant_Type) return Glib.Gboolean; 1166 pragma Import (C, Internal, "g_variant_type_is_array"); 1167 begin 1168 return Internal (Self) /= 0; 1169 end Is_Array; 1170 1171 -------------- 1172 -- Is_Basic -- 1173 -------------- 1174 1175 function Is_Basic (Self : Gvariant_Type) return Boolean is 1176 function Internal (Self : Gvariant_Type) return Glib.Gboolean; 1177 pragma Import (C, Internal, "g_variant_type_is_basic"); 1178 begin 1179 return Internal (Self) /= 0; 1180 end Is_Basic; 1181 1182 ------------------ 1183 -- Is_Container -- 1184 ------------------ 1185 1186 function Is_Container (Self : Gvariant) return Boolean is 1187 function Internal (Self : System.Address) return Glib.Gboolean; 1188 pragma Import (C, Internal, "g_variant_is_container"); 1189 begin 1190 return Internal (Get_Object (Self)) /= 0; 1191 end Is_Container; 1192 1193 ------------------ 1194 -- Is_Container -- 1195 ------------------ 1196 1197 function Is_Container (Self : Gvariant_Type) return Boolean is 1198 function Internal (Self : Gvariant_Type) return Glib.Gboolean; 1199 pragma Import (C, Internal, "g_variant_type_is_container"); 1200 begin 1201 return Internal (Self) /= 0; 1202 end Is_Container; 1203 1204 ----------------- 1205 -- Is_Definite -- 1206 ----------------- 1207 1208 function Is_Definite (Self : Gvariant_Type) return Boolean is 1209 function Internal (Self : Gvariant_Type) return Glib.Gboolean; 1210 pragma Import (C, Internal, "g_variant_type_is_definite"); 1211 begin 1212 return Internal (Self) /= 0; 1213 end Is_Definite; 1214 1215 ------------------- 1216 -- Is_Dict_Entry -- 1217 ------------------- 1218 1219 function Is_Dict_Entry (Self : Gvariant_Type) return Boolean is 1220 function Internal (Self : Gvariant_Type) return Glib.Gboolean; 1221 pragma Import (C, Internal, "g_variant_type_is_dict_entry"); 1222 begin 1223 return Internal (Self) /= 0; 1224 end Is_Dict_Entry; 1225 1226 ----------------- 1227 -- Is_Floating -- 1228 ----------------- 1229 1230 function Is_Floating (Self : Gvariant) return Boolean is 1231 function Internal (Self : System.Address) return Glib.Gboolean; 1232 pragma Import (C, Internal, "g_variant_is_floating"); 1233 begin 1234 return Internal (Get_Object (Self)) /= 0; 1235 end Is_Floating; 1236 1237 -------------- 1238 -- Is_Maybe -- 1239 -------------- 1240 1241 function Is_Maybe (Self : Gvariant_Type) return Boolean is 1242 function Internal (Self : Gvariant_Type) return Glib.Gboolean; 1243 pragma Import (C, Internal, "g_variant_type_is_maybe"); 1244 begin 1245 return Internal (Self) /= 0; 1246 end Is_Maybe; 1247 1248 -------------------- 1249 -- Is_Normal_Form -- 1250 -------------------- 1251 1252 function Is_Normal_Form (Self : Gvariant) return Boolean is 1253 function Internal (Self : System.Address) return Glib.Gboolean; 1254 pragma Import (C, Internal, "g_variant_is_normal_form"); 1255 begin 1256 return Internal (Get_Object (Self)) /= 0; 1257 end Is_Normal_Form; 1258 1259 ---------------- 1260 -- Is_Of_Type -- 1261 ---------------- 1262 1263 function Is_Of_Type 1264 (Self : Gvariant; 1265 The_Type : Gvariant_Type) return Boolean 1266 is 1267 function Internal 1268 (Self : System.Address; 1269 The_Type : Gvariant_Type) return Glib.Gboolean; 1270 pragma Import (C, Internal, "g_variant_is_of_type"); 1271 begin 1272 return Internal (Get_Object (Self), The_Type) /= 0; 1273 end Is_Of_Type; 1274 1275 ------------------- 1276 -- Is_Subtype_Of -- 1277 ------------------- 1278 1279 function Is_Subtype_Of 1280 (Self : Gvariant_Type; 1281 Supertype : Gvariant_Type) return Boolean 1282 is 1283 function Internal 1284 (Self : Gvariant_Type; 1285 Supertype : Gvariant_Type) return Glib.Gboolean; 1286 pragma Import (C, Internal, "g_variant_type_is_subtype_of"); 1287 begin 1288 return Internal (Self, Supertype) /= 0; 1289 end Is_Subtype_Of; 1290 1291 -------------- 1292 -- Is_Tuple -- 1293 -------------- 1294 1295 function Is_Tuple (Self : Gvariant_Type) return Boolean is 1296 function Internal (Self : Gvariant_Type) return Glib.Gboolean; 1297 pragma Import (C, Internal, "g_variant_type_is_tuple"); 1298 begin 1299 return Internal (Self) /= 0; 1300 end Is_Tuple; 1301 1302 ---------------- 1303 -- Is_Variant -- 1304 ---------------- 1305 1306 function Is_Variant (Self : Gvariant_Type) return Boolean is 1307 function Internal (Self : Gvariant_Type) return Glib.Gboolean; 1308 pragma Import (C, Internal, "g_variant_type_is_variant"); 1309 begin 1310 return Internal (Self) /= 0; 1311 end Is_Variant; 1312 1313 -------------- 1314 -- Iter_New -- 1315 -------------- 1316 1317 function Iter_New (Self : Gvariant) return Gvariant_Iter is 1318 function Internal (Self : System.Address) return Gvariant_Iter; 1319 pragma Import (C, Internal, "g_variant_iter_new"); 1320 begin 1321 return Internal (Get_Object (Self)); 1322 end Iter_New; 1323 1324 ------------------ 1325 -- Lookup_Value -- 1326 ------------------ 1327 1328 function Lookup_Value 1329 (Self : Gvariant; 1330 Key : UTF8_String; 1331 Expected_Type : Gvariant_Type) return Gvariant 1332 is 1333 function Internal 1334 (Self : System.Address; 1335 Key : Interfaces.C.Strings.chars_ptr; 1336 Expected_Type : Gvariant_Type) return System.Address; 1337 pragma Import (C, Internal, "g_variant_lookup_value"); 1338 Tmp_Key : Interfaces.C.Strings.chars_ptr := New_String (Key); 1339 Tmp_Return : System.Address; 1340 begin 1341 Tmp_Return := Internal (Get_Object (Self), Tmp_Key, Expected_Type); 1342 Free (Tmp_Key); 1343 return From_Object (Tmp_Return); 1344 end Lookup_Value; 1345 1346 ---------------- 1347 -- N_Children -- 1348 ---------------- 1349 1350 function N_Children (Self : Gvariant) return Gsize is 1351 function Internal (Self : System.Address) return Gsize; 1352 pragma Import (C, Internal, "g_variant_n_children"); 1353 begin 1354 return Internal (Get_Object (Self)); 1355 end N_Children; 1356 1357 ---------------- 1358 -- Next_Value -- 1359 ---------------- 1360 1361 function Next_Value (Self : Gvariant_Iter) return Gvariant is 1362 function Internal (Self : Gvariant_Iter) return System.Address; 1363 pragma Import (C, Internal, "g_variant_iter_next_value"); 1364 begin 1365 return From_Object (Internal (Self)); 1366 end Next_Value; 1367 1368 ----------------- 1369 -- Peek_String -- 1370 ----------------- 1371 1372 function Peek_String (Self : Gvariant_Type) return UTF8_String is 1373 function Internal 1374 (Self : Gvariant_Type) return Interfaces.C.Strings.chars_ptr; 1375 pragma Import (C, Internal, "g_variant_type_peek_string"); 1376 begin 1377 return Gtkada.Bindings.Value_Allowing_Null (Internal (Self)); 1378 end Peek_String; 1379 1380 ----------- 1381 -- Print -- 1382 ----------- 1383 1384 function Print 1385 (Self : Gvariant; 1386 Type_Annotate : Boolean) return UTF8_String 1387 is 1388 function Internal 1389 (Self : System.Address; 1390 Type_Annotate : Glib.Gboolean) 1391 return Interfaces.C.Strings.chars_ptr; 1392 pragma Import (C, Internal, "g_variant_print"); 1393 begin 1394 return Gtkada.Bindings.Value_And_Free (Internal (Get_Object (Self), Boolean'Pos (Type_Annotate))); 1395 end Print; 1396 1397 ------------------ 1398 -- Print_String -- 1399 ------------------ 1400 1401 function Print_String 1402 (Self : Gvariant; 1403 String : Glib.String.Gstring; 1404 Type_Annotate : Boolean) return Glib.String.Gstring 1405 is 1406 function Internal 1407 (Self : System.Address; 1408 String : Glib.String.Gstring; 1409 Type_Annotate : Glib.Gboolean) return access Glib.String.Gstring; 1410 pragma Import (C, Internal, "g_variant_print_string"); 1411 begin 1412 return From_Object_Free (Internal (Get_Object (Self), String, Boolean'Pos (Type_Annotate))); 1413 end Print_String; 1414 1415 --------- 1416 -- Ref -- 1417 --------- 1418 1419 function Ref (Self : Gvariant) return Gvariant is 1420 function Internal (Self : System.Address) return System.Address; 1421 pragma Import (C, Internal, "g_variant_ref"); 1422 begin 1423 return From_Object (Internal (Get_Object (Self))); 1424 end Ref; 1425 1426 -------------- 1427 -- Ref_Sink -- 1428 -------------- 1429 1430 function Ref_Sink (Self : Gvariant) return Gvariant is 1431 function Internal (Self : System.Address) return System.Address; 1432 pragma Import (C, Internal, "g_variant_ref_sink"); 1433 begin 1434 return From_Object (Internal (Get_Object (Self))); 1435 end Ref_Sink; 1436 1437 ----------- 1438 -- Store -- 1439 ----------- 1440 1441 procedure Store (Self : Gvariant; Data : System.Address) is 1442 procedure Internal (Self : System.Address; Data : System.Address); 1443 pragma Import (C, Internal, "g_variant_store"); 1444 begin 1445 Internal (Get_Object (Self), Data); 1446 end Store; 1447 1448 -------------- 1449 -- Take_Ref -- 1450 -------------- 1451 1452 function Take_Ref (Self : Gvariant) return Gvariant is 1453 function Internal (Self : System.Address) return System.Address; 1454 pragma Import (C, Internal, "g_variant_take_ref"); 1455 begin 1456 return From_Object (Internal (Get_Object (Self))); 1457 end Take_Ref; 1458 1459 ----------- 1460 -- Unref -- 1461 ----------- 1462 1463 procedure Unref (Self : Gvariant) is 1464 procedure Internal (Self : System.Address); 1465 pragma Import (C, Internal, "g_variant_unref"); 1466 begin 1467 Internal (Get_Object (Self)); 1468 end Unref; 1469 1470 -------------------- 1471 -- Is_Object_Path -- 1472 -------------------- 1473 1474 function Is_Object_Path (String : UTF8_String) return Boolean is 1475 function Internal 1476 (String : Interfaces.C.Strings.chars_ptr) return Glib.Gboolean; 1477 pragma Import (C, Internal, "g_variant_is_object_path"); 1478 Tmp_String : Interfaces.C.Strings.chars_ptr := New_String (String); 1479 Tmp_Return : Glib.Gboolean; 1480 begin 1481 Tmp_Return := Internal (Tmp_String); 1482 Free (Tmp_String); 1483 return Tmp_Return /= 0; 1484 end Is_Object_Path; 1485 1486 ------------------ 1487 -- Is_Signature -- 1488 ------------------ 1489 1490 function Is_Signature (String : UTF8_String) return Boolean is 1491 function Internal 1492 (String : Interfaces.C.Strings.chars_ptr) return Glib.Gboolean; 1493 pragma Import (C, Internal, "g_variant_is_signature"); 1494 Tmp_String : Interfaces.C.Strings.chars_ptr := New_String (String); 1495 Tmp_Return : Glib.Gboolean; 1496 begin 1497 Tmp_Return := Internal (Tmp_String); 1498 Free (Tmp_String); 1499 return Tmp_Return /= 0; 1500 end Is_Signature; 1501 1502 ----------- 1503 -- Parse -- 1504 ----------- 1505 1506 function Parse 1507 (The_Type : Gvariant_Type; 1508 Text : UTF8_String; 1509 Limit : UTF8_String := ""; 1510 Endptr : GNAT.Strings.String_List) return Gvariant 1511 is 1512 function Internal 1513 (The_Type : Gvariant_Type; 1514 Text : Interfaces.C.Strings.chars_ptr; 1515 Limit : Interfaces.C.Strings.chars_ptr; 1516 Endptr : Interfaces.C.Strings.chars_ptr_array) 1517 return System.Address; 1518 pragma Import (C, Internal, "g_variant_parse"); 1519 Tmp_Text : Interfaces.C.Strings.chars_ptr := New_String (Text); 1520 Tmp_Limit : Interfaces.C.Strings.chars_ptr; 1521 Tmp_Endptr : Interfaces.C.Strings.chars_ptr_array := From_String_List (Endptr); 1522 Tmp_Return : System.Address; 1523 begin 1524 if Limit = "" then 1525 Tmp_Limit := Interfaces.C.Strings.Null_Ptr; 1526 else 1527 Tmp_Limit := New_String (Limit); 1528 end if; 1529 Tmp_Return := Internal (The_Type, Tmp_Text, Tmp_Limit, Tmp_Endptr); 1530 GtkAda.Types.Free (Tmp_Endptr); 1531 Free (Tmp_Limit); 1532 Free (Tmp_Text); 1533 return From_Object (Tmp_Return); 1534 end Parse; 1535 1536 ------------------------------- 1537 -- Parse_Error_Print_Context -- 1538 ------------------------------- 1539 1540 function Parse_Error_Print_Context 1541 (Error : Glib.Error.GError; 1542 Source_Str : UTF8_String) return UTF8_String 1543 is 1544 function Internal 1545 (Error : Glib.Error.GError; 1546 Source_Str : Interfaces.C.Strings.chars_ptr) 1547 return Interfaces.C.Strings.chars_ptr; 1548 pragma Import (C, Internal, "g_variant_parse_error_print_context"); 1549 Tmp_Source_Str : Interfaces.C.Strings.chars_ptr := New_String (Source_Str); 1550 Tmp_Return : Interfaces.C.Strings.chars_ptr; 1551 begin 1552 Tmp_Return := Internal (Error, Tmp_Source_Str); 1553 Free (Tmp_Source_Str); 1554 return Gtkada.Bindings.Value_And_Free (Tmp_Return); 1555 end Parse_Error_Print_Context; 1556 1557 ----------------------- 1558 -- Parse_Error_Quark -- 1559 ----------------------- 1560 1561 function Parse_Error_Quark return Glib.GQuark is 1562 function Internal return Glib.GQuark; 1563 pragma Import (C, Internal, "g_variant_parse_error_quark"); 1564 begin 1565 return Internal; 1566 end Parse_Error_Quark; 1567 1568 ---------------------------- 1569 -- Parser_Get_Error_Quark -- 1570 ---------------------------- 1571 1572 function Parser_Get_Error_Quark return Glib.GQuark is 1573 function Internal return Glib.GQuark; 1574 pragma Import (C, Internal, "g_variant_parser_get_error_quark"); 1575 begin 1576 return Internal; 1577 end Parser_Get_Error_Quark; 1578 1579 --------------------- 1580 -- String_Is_Valid -- 1581 --------------------- 1582 1583 function String_Is_Valid (Type_String : UTF8_String) return Boolean is 1584 function Internal 1585 (Type_String : Interfaces.C.Strings.chars_ptr) return Glib.Gboolean; 1586 pragma Import (C, Internal, "g_variant_type_string_is_valid"); 1587 Tmp_Type_String : Interfaces.C.Strings.chars_ptr := New_String (Type_String); 1588 Tmp_Return : Glib.Gboolean; 1589 begin 1590 Tmp_Return := Internal (Tmp_Type_String); 1591 Free (Tmp_Type_String); 1592 return Tmp_Return /= 0; 1593 end String_Is_Valid; 1594 1595end Glib.Variant; 1596