Browse Source

refactoring: function names changed

remotes/origin/develop
Eric Bagus 11 months ago
parent
commit
4ff0403e7d
  1. 7
      src/inputHandler.c
  2. 6
      src/inputHandler.h

7
src/inputHandler.c

@ -1,7 +1,8 @@
#include "inputHandler.h" #include "inputHandler.h"
#include <string.h> #include <string.h>
int getOperationId(char symbol) {
// return operation id for a specific symbol
int getOperationIdBySymbol(char symbol) {
int id = 0; int id = 0;
switch (symbol) { switch (symbol) {
case '+': case '+':
@ -23,7 +24,7 @@ int getOperationId(char symbol) {
} }
// returns operation symbol for a specific operation id // returns operation symbol for a specific operation id
char getOperationSymbol(int id) {
char getOperationSymbolById(int id) {
char symbol = ' '; char symbol = ' ';
switch (id) { switch (id) {
case 1: case 1:
@ -45,7 +46,7 @@ char getOperationSymbol(int id) {
} }
// Checking if operation id is available // Checking if operation id is available
int isOperationValid(int id) {
int isOperationIdValid(int id) {
if(id < 0 || id > 7) return 0; if(id < 0 || id > 7) return 0;
return 1; return 1;
} }

6
src/inputHandler.h

@ -1,10 +1,10 @@
#ifndef THEADMIRALS_INPUTHANDLER_H #ifndef THEADMIRALS_INPUTHANDLER_H
#define THEADMIRALS_INPUTHANDLER_H #define THEADMIRALS_INPUTHANDLER_H
int getOperationId(char);
int getOperationIdBySymbol(char);
char getOperationSymbol(int);
char getOperationSymbolById(int);
int isOperationValid(int);
int isOperationIdValid(int);
#endif //THEADMIRALS_INPUTHANDLER_H #endif //THEADMIRALS_INPUTHANDLER_H
Loading…
Cancel
Save