- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileFactory.cpp
More file actions
Latest commit
27 lines (24 loc) · 834 Bytes
/
Copy pathFileFactory.cpp
File metadata and controls
27 lines (24 loc) · 834 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
#include"FileFactory.h"
#include"File.h"
#include"CppFile.h"
#include"ObjectFile.h"
usingnamespacestd;
const CppFile& FileFactory::get_cpp_file(const string& filename, set<string>& seen) {
auto it = name_to_cppfile.find(filename);
if(it == name_to_cppfile.end()) {
CppFile file{filename, seen};
it = name_to_cppfile.insert(make_pair(filename, file)).first;
}
return it->second;
}
const CppFile& FileFactory::get_cpp_file(const std::string& filename) {
set<string> seen;
returnget_cpp_file(filename, seen);
}
const ObjectFile& FileFactory::get_obj_file(const std::string& filename) {
auto it = name_to_objfile.find(filename);
if(it == name_to_objfile.end()) {
it = name_to_objfile.insert(make_pair(filename, ObjectFile{filename})).first;
}
return it->second;
}