- Changement des entêtes dans le projets.

This commit is contained in:
Maximilien LEDOUX
2022-03-12 15:57:27 +01:00
parent 4975c4e454
commit f75948c3bb
14 changed files with 124 additions and 72 deletions

View File

@@ -36,26 +36,25 @@ func (repo ProtocolRepository) AddWriter(writer *protocol.IProtocolWriter) {
/*
ExecuteReader Permet d'exécuter un Reader et de récupérer la commande à renvoyer. La deuxième valeur de retour permet de savoir si une commande a put être exécuté
*/
func (repo ProtocolRepository) ExecuteReader(data string) (string, bool, func(reader *bufio.Reader) (string, bool)) {
func (repo ProtocolRepository) ExecuteReader(data string) (*protocol.ProtocolWriterResult, func(reader *bufio.Reader) *protocol.ProtocolWriterResult) {
for _, reader := range repo.protocolReaders {
if (*reader).Match(data) { // Exécuter si match
// Récupérer résultat à renvoyer (Donc donner ProtocolRepository aux reader ?!)
return (*reader).Execute(data)
}
}
return "", false, nil
return nil, nil
}
/*
ExecuteReader Permet d'exécuter un Wrier et de récupérer la commande construite avec nos argument et un indicateur de réussite.
*/
func (repo ProtocolRepository) ExecuteWriter(ruleName string, data ...string) (string, bool) {
func (repo ProtocolRepository) ExecuteWriter(ruleName string, data ...string) *protocol.ProtocolWriterResult {
protocolWriter, has := repo.protocolWriters[ruleName]
if has {
println("OHOH")
return (*protocolWriter).Execute(data...)
} else {
return "", false
return nil
}
}