(
const string&
str,
size_t& verMajor,
size_t& verMinor,
size_t& verPatch)
66 CRegexpregex(
"(\\d\\d)\\.(\\d\\d)\\.(\\d+)");
77 static bool sValidateVersion(
size_t& reqMajor,
size_t& reqMinor,
size_t& reqPatch,
78 size_t& verMajor,
size_t& verMinor,
size_t& verPatch)
80 returnreqMajor == verMajor
;
94 stringappPkgName = appName;
99<<
"\' - duplicate package found. Replacing by App package.");
113 if( !dir.IsOpened() ){
115<<
"CPkgManager::ScanPackages(): directory \"" 116<< path.ToUTF8() <<
"\" does not exist" 122<<
"CPkgManager: scanning packages at \""<< path.ToUTF8() <<
"\"" 125 size_tdirs_scanned = 0, pkgs_loaded = 0, pkgs_failed = 0;
129 boolmore = dir.GetFirst( &dir_entry, wxEmptyString, wxDIR_DIRS );
131more = dir.GetNext( &dir_entry )
136wxFileName manf_file( path,
wxT(
"package.manifest") );
137manf_file.AppendDir( dir_entry );
138wxString manifest_path = manf_file.GetFullPath();
140 if( !manf_file.IsFileReadable() ){
142<<
"CPkgManager::ScanPackages(): manifest file \"" 143<< manifest_path.ToUTF8() <<
"\" is not accessible" 158<<
"CPkgManager::ScanPackages(): failed to load \"" 159<< manifest_path.ToUTF8() <<
"\"" 167 if( pkg_name.empty() ){
169<<
"CPkgManager::ScanPackages(): failed to load \"" 170<< manifest_path.ToUTF8() <<
"\"" 172 LOG_POST(
Error<<
" Error: Name field of manifest is empty");
177 size_tverMajor, verMinor, verPatch;
181<<
"CPkgManager::ScanPackages(): \'"<< pkg_name
182<<
"\' - invalid version \'"<<
version<<
"\'" 187 stringdll = manifest->GetMainDll();
190<<
"CPkgManager::ScanPackages(): failed to load \"" 191<< manifest_path.ToUTF8() <<
"\"" 193 LOG_POST(
Error<<
" Error: MainDll field of manifest is empty");
202wxFileName dll_file( manf_file.GetPath(), wxString( dll.c_str(), wxConvFile ) );
203 if( !dll_file.FileExists() ){
205<<
"CPkgManager::ScanPackages(): \'"<< pkg_name
206<<
"\' - main dll \""<< dll_file.GetFullPath().ToUTF8()
207<<
"\" does not exist" 212 stringpkg_key = pkg_name;
215 if(
find(pkg_key) !=
end() ){
217<<
"CPkgManager::ScanPackages(): \'"<< pkg_name
218<<
"\' - duplicate package found." 221<<
" \'"<< pkg_name <<
"\' ignored in \"" 222<< manf_file.GetPath().ToUTF8() <<
"\"" 228pkg_info.
m_Dir= manf_file.GetPath();
242<< dirs_scanned <<
" directories scanned, " 243<< pkgs_loaded <<
" package(s) read, " 244<< pkgs_failed <<
" package(s) skipped." 263 constobjects::CGuiPkgManifest& manifest = *pkg.
m_Manifest;
265objects::CGuiPkgManifest::TGuiPkgDependency, it,
266manifest.GetGuiPkgDependency()
268 constobjects::CGuiDependentPkg& dep = (*it)->GetGuiDependentPkg();
269 stringpkgKey = dep.GetName();
275 stringerrMsg =
"dependent package \'"+ dep.GetName() +
"\' not found.";
278<< manifest.GetName() <<
"\' : "<< errMsg);
289 stringerrMsg =
"dependent package \'"+ dep.GetName() +
"\' not valid.";
292 Info<<
"CPkgManager::ValidatePackage \'" 293<< manifest.GetName() <<
"\' : "<< errMsg
298 size_treqMajor, reqMinor, reqPatch;
302 stringerrMsg =
"failed to parse dependent package\'s \'" 303+ dep.GetName() +
"\' version: " 307<< manifest.GetName() <<
"\' : "<< errMsg);
312it2->second.m_VerMajor,
313it2->second.m_VerMinor,
314it2->second.m_VerPatch)) {
316 stringerrMsg =
"invalid dependent package version: \'" 317+ dep.GetName() +
"\' - "+
version+
".";
320<< manifest.GetName() <<
"\' : "<< errMsg);
335vector<string> pkgsToLoad;
351 ITERATE(vector<string>, iter, pkgsToLoad) {
360 std::copy( items.begin(), items.end(), back_inserter(pkgsToLoad) );
363 ITERATE(vector<string>, it, pkgsToLoad) {
385 #define LOCAL_LOG(message) LOG_POST(message) 387 #define LOCAL_LOG(message) void(0) 397 constobjects::CGuiPkgManifest& manifest = *pkg.
m_Manifest;
398 ITERATE(objects::CGuiPkgManifest::TGuiPkgDependency, it,
399manifest.GetGuiPkgDependency()) {
400 constobjects::CGuiDependentPkg& dep = (*it)->GetGuiDependentPkg();
401 stringpkgKey = dep.GetName();
421wxString dll_name = wxString( _dll_name.c_str(), wxConvFile );
423 LOG_POST(
Info<<
"Loading package \'"<< manifest.GetName() <<
"\'...");
424wxDynamicLibrary dll;
426 boolloaded =
false;
430 LOCAL_LOG(
Info<<
"Loading from \'"<< std_bin_path <<
"\'");
431wxString dll_path = wxFileName( std_bin_path, dll_name ).GetFullPath();
432 if( !dll.Load( dll_path, wxDL_GLOBAL | wxDL_VERBATIM ) ){
433 LOG_POST(
Warning<<
"Package \'"<< manifest.GetName() <<
"\' is set aside.");
442wxString dll_path = wxFileName( pkg.
m_Dir, dll_name ).GetFullPath();
443 if( !dll.Load( dll_path, wxDL_GLOBAL | wxDL_VERBATIM ) ){
444 LOG_POST(
Error<<
"Failed to load package dll "<< dll_path );
452wxString guiEntryName =
wxT(
"NCBIGBenchGetPackage");
454 if( !dll.HasSymbol( guiEntryName ) ){
455 LOG_POST(
Error<<
"No entry point NCBIGBenchGetPackage() is found.");
464 LOG_POST(
Error<<
"No entry point NCBIGBenchGetPackage() is retrieved.");
468unique_ptr<IGuiPackage> gui_package( entry_point() );
469 if( !gui_package.get() ){
474 LOCAL_LOG(
Info<<
"Initializing package "<< gui_package->GetName() <<
"...");
476 if( ! gui_package->Init() ){
477 LOG_POST(
Error<<
"Initialization of "<< gui_package->GetName() <<
" failed.");
483 LOG_POST(
Info<<
"Package \'"<< manifest.GetName() <<
"\' loaded successfully.");
492index > 0 && it !=
end(); ++it, index--) {
499pkg_name = it->first;
505 stringpkgKey = pkg_name;
514back_insert_iterator<vector<string> > dest(basePkgs);
515 copy(basePkgsSet.
begin(), basePkgsSet.
end(), dest);
525 ITERATE(objects::CGuiPkgManifest::TGuiPkgDependency, it,
526manifest->GetGuiPkgDependency()) {
527 constobjects::CGuiDependentPkg& dep = (*it)->GetGuiDependentPkg();
528 stringpkgKey = dep.GetName();
530 if(basePkgs.
find(pkgKey) != basePkgs.
end()) {
533basePkgs.
insert(pkgKey);
542 stringpkgKey = pkg_name;
547dependents.push_back(it->first);
557 stringpkgKey = pkg_name;
560 return(basePkgs.
find(pkgKey) != basePkgs.
end());
User-defined methods of the data storage class.
User-defined methods of the data storage class.
static string MakeKey(const string §ion, const string &key, const string &delim=CGuiRegistry::kDecimalDot)
create a key from a section and a subkey
CRegistryWriteView GetWriteView(const string §ion)
get a read-write view at a particular level.
bool HasField(const string &key) const
Does a field with this section and key exist in this view?
static CGuiRegistry & GetInstance()
access the application-wide singleton
CRegistryReadView GetReadView(const string §ion) const
get a read-only view at a particular level.
CPkgManager - application Package Manager.
class CRegistryReadView provides a nested hierarchical view at a particular key.
void GetStringVec(const string &key, vector< string > &val) const
void Set(const string &key, int val)
access a named key at this level, with no recursion
static wxString ResolvePath(const wxString &path, const wxString &rel_name)
Utility function to hide the platform specifics of locating our standard directories and files.
static void AddToPath(const wxString &path, EPathMode mode=ePath_Prepend)
PATH variable manipulators.
container_type::const_iterator const_iterator
container_type::iterator iterator
const_iterator begin() const
const_iterator end() const
iterator_bool insert(const value_type &val)
container_type::value_type value_type
const_iterator find(const key_type &key) const
iterator_bool insert(const value_type &val)
const_iterator begin() const
const_iterator find(const key_type &key) const
const_iterator end() const
static const char * str(char *buf, int n)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
element_type * release(void)
Release will release ownership of pointer to caller.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
#define NCBI_PLUGIN_SUFFIX
#define NCBI_PLUGIN_PREFIX
void Error(CExceptionArgs_Base &args)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string & GetMsg(void) const
Get message string.
void Warning(CExceptionArgs_Base &args)
void Info(CExceptionArgs_Base &args)
CConstRef< objects::CGuiPkgManifest > m_Manifest
void GetDependentPkgs(const string &pkg_name, vector< string > &dependents) const
void x_ValidatePackage(CPackageInfo &pkg)
void x_GetBasePkgs(const CPackageInfo &pkg, set< string > &basePkgs) const
const CPackageInfo * GetPkgInfo(int index, string &pkg_name) const
void AddDefaultPkg(const string &pkg_name)
bool DependsOn(const CPackageInfo &pkg, const string &pkg_name) const
void x_LoadPackage(CPackageInfo &pkg)
void GetBasePkgs(const string &pkg_name, vector< string > &basePkgs) const
void SetPackagesToLoad(const vector< string > &packages)
void ScanPackages(const wxString &path)
IGuiPackage *(* FPackageEntryPoint)()
vector< string > m_DefaultPkgs
void SetAppPkg(const string appName, size_t appVerMajor, size_t appVerMinor, size_t appVerPatch)
AutoPtr< IGuiPackage > m_Package
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
bool IsMatch(CTempString str, TMatch flags=fMatch_default)
Check existence substring which match a specified pattern.
CTempString GetSub(CTempString str, size_t idx=0) const
Get pattern/subpattern from previous GetMatch().
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
static string & ToUpper(string &str)
Convert string to upper case â string& version.
static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string.
const string version
version string
Define class Dll and for Portable DLL handling.
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
static const char * kPackagesToLoad
static bool sValidateVersion(size_t &reqMajor, size_t &reqMinor, size_t &reqPatch, size_t &verMajor, size_t &verMinor, size_t &verPatch)
static bool sParseVersion(const string &str, size_t &verMajor, size_t &verMinor, size_t &verPatch)
#define LOCAL_LOG(message)
C++ wrappers for the Perl-compatible regular expression (PCRE) library.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4