- Changement des entêtes dans le projets.
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user