-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileID.cpp
More file actions
31 lines (27 loc) · 872 Bytes
/
FileID.cpp
File metadata and controls
31 lines (27 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "FileID.hpp"
#include "Printer.hpp"
FileID::FileID(string fileName, int iNode, string pathName):fileName(fileName),iNode(iNode),pathName(pathName), flag(false){
}
void FileID::print(ostream& out){
Printer::writeln(to_string(iNode), out);
Printer::writeln(pathName, out);
Printer::writeln(fileName, out);
}
void FileID::insertSniffWord(string& sniffWord, bool isSensitive){
int cnt{};
if(!isSensitive)
cnt = count(sniffWordsArr.begin(), sniffWordsArr.end(), sniffWord);
else{
for(string str: sniffWordsArr)
if(caseInsensitiveEquals(sniffWord , str))
cnt++;
}
if (cnt <= 0){
sniffWordsArr.push_back(sniffWord);
Printer::writeln(sniffWord+" was successfully added to sniffWordArr",cout);
}
else{
Printer::write(sniffWord + " is already in there\n", cout);
flag=true;
}
}