Header file that contains the definitions of our Parser.
More...
#include <time.h>
#include <string.h>
#include <regex.h>
#include <stdlib.h>
#include "Search.h"
#include "List.h"
#include "Stack.h"
#include "Logger.h"
#include "Syscall.h"
#include <ctype.h>
Go to the source code of this file.
|
#define | FILE_PATH_REGEX "((\\.|\\.\\.)?\\/)?(([A-Z]|[a-z]|[0-9]| |-|_|'|\\.)+\\/?)+" |
|
Header file that contains the definitions of our Parser.
- Authors
- Maxime Lovino, Thomas Ibanez
- Date
- January 25, 2017
- Version
- 1.0
#define FILE_PATH_REGEX "((\\.|\\.\\.)?\\/)?(([A-Z]|[a-z]|[0-9]| |-|_|'|\\.)+\\/?)+" |
This is the Regular Expression that will be used to check the validity of a path
int evaluateAndSearch |
( |
const char ** |
expression, |
|
|
int |
exprLen, |
|
|
char * |
folder, |
|
|
List ** |
result |
|
) |
| |
Evaluates an expression and searches for matching files
- Parameters
-
expression | The expression to search with (as an array of terms) |
exprLen | The length of the expression |
folder | The folder to search from |
result | A List to put the results of the search in |
- Returns
- 0 if the search was ok, 1 otherwise
searchType getSearchType |
( |
const char * |
param, |
|
|
const char * |
arg |
|
) |
| |
Converts a search word to a searchType
- Parameters
-
param | the search word |
arg | the parameter linked to the search word |
- Returns
- the corresponding searchType or -1 if no match exists
int getSize |
( |
const char * |
sizeAsString | ) |
|
Converts a size with its Unit suffix (K, M, G, T) to the correct size
- Parameters
-
sizeAsString | The size with its suffix |
- Returns
- The size as an integer value
struct timespec* getTimeSpec |
( |
const char * |
date | ) |
|
Function to convert a date in YYYY-MM-DD format to a timespec
- Parameters
-
date | The date as a String in the format YYYY-MM-DD |
- Returns
- The date as a a pointer of struct timespec
int isBooleanOp |
( |
const char * |
word | ) |
|
Checks if a word is a boolean operator
- Parameters
-
- Returns
- 1 if it is a boolean operator, 0 otherwise
int isValidPath |
( |
const char * |
path | ) |
|
Function to check if a path is valid
- Parameters
-
path | The path we want to check |
- Returns
- 1 if the path is valid, 0 otherwise
int isValidSearch |
( |
searchType |
st, |
|
|
const char * |
arg |
|
) |
| |
Checks if a searchType has proper argument linked to it
- Parameters
-
st | The search type |
arg | The argument |
- Returns
- 1 if the search is valid, 0 otherwise
const void* prepareArgument |
( |
searchType |
st, |
|
|
const char * |
arg |
|
) |
| |
Function that returns a generic pointer to an argument for a search of a certain type It will actually return the pointer for the correct type depending on the search
- Parameters
-
st | The type of search |
arg | The argument as a string |
- Returns
- A pointer to the argument in the correct type
const char* trimArgument |
( |
searchType |
st, |
|
|
const char * |
arg |
|
) |
| |
Removes the + or - before a search argument if necessary
- Parameters
-
st | searchType |
arg | argument to trim |
- Returns
- Trimmed argument