1 // Written in the D programming language. 2 3 /** 4 A type for representing the uname 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.uname; 12 13 private { 14 import std..string : format; 15 16 import styx2000.protobj.styxobject; 17 18 import styx2000.protobj.name; 19 } 20 21 /** 22 A class that provides a type for the uname field in some Styx messages. Inherits methods from the Name class and the StyxObject class. 23 See_Also: 24 https://web.archive.org/web/20201029184954/https://powerman.name/Inferno/man/5/0intro.html 25 */ 26 class Uname : Name 27 { 28 /** 29 A constructor that creates an object of the Uname class with the given parameter in the form of some string value representing uname. 30 If called without parameters, then the default parameter is empty string value. 31 Params: 32 name = String value for user name. 33 34 Typical usage: 35 ---- 36 Uname uname = new Uname(`user`); 37 ---- 38 */ 39 this(string name = "") 40 { 41 super(name); 42 } 43 44 /// An alias that allows you to call a getter method without accessing the base Name class 45 alias getUname = getName; 46 /// An alias that allows you to call a setter method without accessing the base Name class 47 alias setUname = setName; 48 49 /// Convenient string representation of an object for printing 50 override string toString() 51 { 52 return format( 53 `Uname(uname=%s)`, 54 _name == "" ? `""` : _name 55 ); 56 } 57 58 /// An alias for easier packing into a byte array without having to manually call the pack() method 59 alias pack this; 60 }