1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module glib.Uuid; 26 27 private import glib.Str; 28 private import glib.c.functions; 29 public import glib.c.types; 30 public import gtkc.glibtypes; 31 32 33 /** */ 34 public struct Uuid 35 { 36 37 /** 38 * Parses the string @str and verify if it is a UUID. 39 * 40 * The function accepts the following syntax: 41 * 42 * - simple forms (e.g. `f81d4fae-7dec-11d0-a765-00a0c91e6bf6`) 43 * 44 * Note that hyphens are required within the UUID string itself, 45 * as per the aforementioned RFC. 46 * 47 * Params: 48 * str = a string representing a UUID 49 * 50 * Returns: %TRUE if @str is a valid UUID, %FALSE otherwise. 51 * 52 * Since: 2.52 53 */ 54 public static bool stringIsValid(string str) 55 { 56 return g_uuid_string_is_valid(Str.toStringz(str)) != 0; 57 } 58 59 /** 60 * Generates a random UUID (RFC 4122 version 4) as a string. It has the same 61 * randomness guarantees as #GRand, so must not be used for cryptographic 62 * purposes such as key generation, nonces, salts or one-time pads. 63 * 64 * Returns: A string that should be freed with g_free(). 65 * 66 * Since: 2.52 67 */ 68 public static string stringRandom() 69 { 70 auto retStr = g_uuid_string_random(); 71 72 scope(exit) Str.freeString(retStr); 73 return Str.toString(retStr); 74 } 75 }