equal
deleted
inserted
replaced
34 |
34 |
35 // Environment |
35 // Environment |
36 StaticReadProperty<TString, &Environment::GetNewLine> Environment::NewLine; |
36 StaticReadProperty<TString, &Environment::GetNewLine> Environment::NewLine; |
37 |
37 |
38 |
38 |
39 //-------------------------------------------------------------------------------------------------- |
39 Platform& Platform::GetInstance() { |
40 |
40 |
41 Platform& Platform::GetInstance() { |
|
42 //Lock lock(true); |
|
43 #ifdef WINDOWS |
41 #ifdef WINDOWS |
44 static WindowsPlatform instance; |
42 static WindowsPlatform instance; |
45 #endif // WINDOWS |
43 #endif // WINDOWS |
|
44 |
46 #ifdef LINUX |
45 #ifdef LINUX |
47 static LinuxPlatform instance; |
46 static LinuxPlatform instance; |
48 #endif // LINUX |
47 #endif // LINUX |
|
48 |
49 #ifdef MAC |
49 #ifdef MAC |
50 static MacPlatform instance; |
50 static MacPlatform instance; |
51 #endif // MAC |
51 #endif // MAC |
52 return instance; |
52 return instance; |
53 } |
53 } |
54 |
|
55 //-------------------------------------------------------------------------------------------------- |
|
56 |
54 |
57 |
55 |
58 Library::Library() { |
56 Library::Library() { |
59 Initialize(); |
57 Initialize(); |
60 } |
58 } |
84 } |
82 } |
85 } |
83 } |
86 |
84 |
87 void Library::LoadDependencies() { |
85 void Library::LoadDependencies() { |
88 if (FDependentLibraryNames != NULL && FDependenciesLibraries != NULL) { |
86 if (FDependentLibraryNames != NULL && FDependenciesLibraries != NULL) { |
89 for (std::vector<TString>::const_iterator iterator = FDependentLibraryNames->begin(); |
87 for (std::vector<TString>::const_iterator iterator = |
|
88 FDependentLibraryNames->begin(); |
90 iterator != FDependentLibraryNames->end(); iterator++) { |
89 iterator != FDependentLibraryNames->end(); iterator++) { |
91 Library* library = new Library(); |
90 Library* library = new Library(); |
92 |
91 |
93 if (library->Load(*iterator) == true) { |
92 if (library->Load(*iterator) == true) { |
94 FDependenciesLibraries->push_back(library); |
93 FDependenciesLibraries->push_back(library); |
100 } |
99 } |
101 } |
100 } |
102 |
101 |
103 void Library::UnloadDependencies() { |
102 void Library::UnloadDependencies() { |
104 if (FDependenciesLibraries != NULL) { |
103 if (FDependenciesLibraries != NULL) { |
105 for (std::vector<Library*>::const_iterator iterator = FDependenciesLibraries->begin(); |
104 for (std::vector<Library*>::const_iterator iterator = |
|
105 FDependenciesLibraries->begin(); |
106 iterator != FDependenciesLibraries->end(); iterator++) { |
106 iterator != FDependenciesLibraries->end(); iterator++) { |
107 Library* library = *iterator; |
107 Library* library = *iterator; |
108 |
108 |
109 if (library != NULL) { |
109 if (library != NULL) { |
110 library->Unload(); |
110 library->Unload(); |
130 Platform& platform = Platform::GetInstance(); |
130 Platform& platform = Platform::GetInstance(); |
131 FModule = platform.LoadLibrary(FileName); |
131 FModule = platform.LoadLibrary(FileName); |
132 |
132 |
133 if (FModule == NULL) { |
133 if (FModule == NULL) { |
134 Messages& messages = Messages::GetInstance(); |
134 Messages& messages = Messages::GetInstance(); |
135 platform.ShowMessage(messages.GetMessage(LIBRARY_NOT_FOUND), FileName); |
135 platform.ShowMessage(messages.GetMessage(LIBRARY_NOT_FOUND), |
|
136 FileName); |
136 result = false; |
137 result = false; |
137 } else { |
138 } else { |
138 fname = PlatformString(FileName).toStdString(); |
139 fname = PlatformString(FileName).toStdString(); |
139 } |
140 } |
140 } |
141 } |
167 void Library::AddDependencies(const std::vector<TString> &Dependencies) { |
168 void Library::AddDependencies(const std::vector<TString> &Dependencies) { |
168 if (Dependencies.size() > 0) { |
169 if (Dependencies.size() > 0) { |
169 InitializeDependencies(); |
170 InitializeDependencies(); |
170 |
171 |
171 if (FDependentLibraryNames != NULL) { |
172 if (FDependentLibraryNames != NULL) { |
172 for (std::vector<TString>::const_iterator iterator = FDependentLibraryNames->begin(); |
173 for (std::vector<TString>::const_iterator iterator = |
|
174 FDependentLibraryNames->begin(); |
173 iterator != FDependentLibraryNames->end(); iterator++) { |
175 iterator != FDependentLibraryNames->end(); iterator++) { |
174 TString fileName = *iterator; |
176 TString fileName = *iterator; |
175 AddDependency(fileName); |
177 AddDependency(fileName); |
176 } |
178 } |
177 } |
179 } |
178 } |
180 } |
179 } |
181 } |
180 //-------------------------------------------------------------------------------------------------- |
|