1 // Written in the D programming language.
2 
3 /**
4 A type for representing the ename 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.ename;
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 ename field in some Styx messages. Inherits methods from the Name class and StyxObject class. 
23 	See_Also:
24 		https://web.archive.org/web/20201029184954/https://powerman.name/Inferno/man/5/0intro.html
25 */
26 class Ename : Name
27 {
28 	/**
29 	A constructor that creates an object of the Ename class with the given parameter in the form of some string value representing error message. 
30 	If called without parameters, then the default parameter is empty string value. 
31     Params:
32     name = Text of error message.
33     
34     Typical usage:
35     ----
36     Ename ename = new Ename(`Wrong filename`);
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 getEname = getName;	
46 	/// An alias that allows you to call a setter method without accessing the base Name class
47 	alias setEname = setName;	
48 	
49 	/// Convenient string representation of an object for printing 
50 	override string toString()
51 	{
52 		return format(
53 			`Ename(error="%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 }