1 /* 2 *Copyright (C) 2018 Laurent Tréguier 3 * 4 *This file is part of DLS. 5 * 6 *DLS is free software: you can redistribute it and/or modify 7 *it under the terms of the GNU General Public License as published by 8 *the Free Software Foundation, either version 3 of the License, or 9 *(at your option) any later version. 10 * 11 *DLS is distributed in the hope that it will be useful, 12 *but WITHOUT ANY WARRANTY; without even the implied warranty of 13 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 *GNU General Public License for more details. 15 * 16 *You should have received a copy of the GNU General Public License 17 *along with DLS. If not, see <http://www.gnu.org/licenses/>. 18 * 19 */ 20 21 module dls.protocol.interfaces.client; 22 23 private abstract class RegistrationBase 24 { 25 string id; 26 string method; 27 28 private this(string id, string method) 29 { 30 this.id = id; 31 this.method = method; 32 } 33 } 34 35 package interface RegistrationOptionsBase 36 { 37 } 38 39 class Registration(R : RegistrationOptionsBase) : RegistrationBase 40 { 41 import std.typecons : Nullable; 42 43 Nullable!R registerOptions; 44 45 this(string id = string.init, string method = string.init, 46 Nullable!R registerOptions = Nullable!R.init) 47 { 48 super(id, method); 49 this.registerOptions = registerOptions; 50 } 51 } 52 53 class TextDocumentRegistrationOptions : RegistrationOptionsBase 54 { 55 import dls.protocol.definitions : DocumentSelector; 56 import std.typecons : Nullable; 57 58 Nullable!DocumentSelector documentSelector; 59 60 this(Nullable!DocumentSelector documentSelector = Nullable!DocumentSelector.init) 61 { 62 this.documentSelector = documentSelector; 63 } 64 } 65 66 class RegistrationParams(R) 67 { 68 Registration!R[] registrations; 69 70 this(Registration!R[] registrations = Registration!R[].init) 71 { 72 this.registrations = registrations; 73 } 74 } 75 76 class Unregistration : RegistrationBase 77 { 78 this(string id = string.init, string method = string.init) 79 { 80 super(id, method); 81 } 82 } 83 84 class UnregistrationParams 85 { 86 Unregistration[] unregistrations; 87 88 this(Unregistration[] unregistrations = Unregistration[].init) 89 { 90 this.unregistrations = unregistrations; 91 } 92 }