1 // Written in the D programming language. 2 3 /** 4 A type for representing the aqid object of the 9P / Styx protocol. 5 6 Copyright: LightHouse Software, 2021 7 License: $(HTTP https://github.com/aquaratixc/ESL-License, Experimental Software License 1.0). 8 Authors: Oleg Bakharev, 9 Ilya Pertsev 10 */ 11 module styx2000.protobj.aqid; 12 13 private { 14 import std.conv : to; 15 import std..string : format; 16 17 import styx2000.lowlevel.endianness; 18 19 import styx2000.protobj.styxobject; 20 21 import styx2000.protobj.qid; 22 } 23 24 public { 25 import styx2000.protoconst.qids; 26 } 27 28 /** 29 A class that provides a type for the aqid field in some Styx messages. Inherits methods from the Qid class and the StyxObject class. 30 See_Also: 31 https://web.archive.org/web/20201029184954/https://powerman.name/Inferno/man/5/0intro.html 32 */ 33 class Aqid : Qid 34 { 35 /** 36 A constructor that creates a unique qid number based on the parameters passed to it. 37 If it is called without parameters, then the type will be STYX_QID_TYPE.QTFILE and zero values for the remaining parameters. 38 Params: 39 type = Type of qid. 40 vers = Unique 32-bit version number for file or directory. 41 path = Unique 64-bit path number for file or directory. 42 43 Typical usage: 44 ---- 45 Aqid aqid = new Aqid(STYX_QID_TYPE.QTFILE, 0, 12345678); 46 ---- 47 */ 48 this(STYX_QID_TYPE type = STYX_QID_TYPE.QTFILE, uint vers = 0, ulong path = 0) 49 { 50 super(type, vers, path); 51 } 52 53 /// Convenient string representation of an object for printing 54 override string toString() 55 { 56 return format( 57 `Aqid(type=%s, vers=%d, path=%d)`, 58 _type.to!string, 59 _vers, 60 _path 61 ); 62 } 63 64 /// An alias for easier packing into a byte array without having to manually call the pack() method 65 alias pack this; 66 }