Libraries say whether a search should be performed

This commit is contained in:
zv0n 2022-03-12 22:09:53 +01:00
parent 72937cf6f2
commit 1a495149b2
7 changed files with 19 additions and 0 deletions

View File

@ -54,6 +54,7 @@ std::vector< RenameLibrary > getLibraries(const std::vector<std::pair<std::strin
} }
rl.getName = ( const std::string(*)() ) dlsym( libhndl, "getName" ); rl.getName = ( const std::string(*)() ) dlsym( libhndl, "getName" );
rl.canRenameMultipleFiles = ( const bool(*)() ) dlsym( libhndl, "canRenameMultipleFiles" ); rl.canRenameMultipleFiles = ( const bool(*)() ) dlsym( libhndl, "canRenameMultipleFiles" );
rl.shouldPerformSearch = ( const bool(*)() ) dlsym( libhndl, "shouldPerformSearch" );
rl.config = library.second; rl.config = library.second;
result.push_back( rl ); result.push_back( rl );
} }

View File

@ -33,6 +33,7 @@ std::vector< std::pair<string, string> > getCustomKeyOptions(const string &key);
const string getCustomKeyDefault(const string &key); const string getCustomKeyDefault(const string &key);
const string getName(); const string getName();
const bool canRenameMultipleFiles(); const bool canRenameMultipleFiles();
const bool shouldPerformSearch();
} }
#endif // TV_RENAME_HPP #endif // TV_RENAME_HPP

View File

@ -85,6 +85,10 @@ std::string getLibrariesJson() {
result << " \"multiple_files\": " result << " \"multiple_files\": "
<< ( library.first->canRenameMultipleFiles() ? "true" << ( library.first->canRenameMultipleFiles() ? "true"
: "false" ) : "false" )
<< ",\n";
result << " \"should_search\": "
<< ( library.first->shouldPerformSearch() ? "true"
: "false" )
<< "\n },\n"; << "\n },\n";
} }
result.seekp( -2, std::ios_base::end ); result.seekp( -2, std::ios_base::end );

View File

@ -14,6 +14,7 @@ struct RenameLibrary {
const std::string ( *getCustomKeyDefault )(const std::string &); const std::string ( *getCustomKeyDefault )(const std::string &);
const std::string ( *getName )(); const std::string ( *getName )();
const bool ( *canRenameMultipleFiles )(); const bool ( *canRenameMultipleFiles )();
const bool ( *shouldPerformSearch )();
void *libhndl; void *libhndl;
std::string name; std::string name;
std::string config; std::string config;

View File

@ -68,3 +68,7 @@ const string getName() {
const bool canRenameMultipleFiles() { const bool canRenameMultipleFiles() {
return false; return false;
} }
const bool shouldPerformSearch() {
return false;
}

View File

@ -527,3 +527,7 @@ const string getName() {
const bool canRenameMultipleFiles() { const bool canRenameMultipleFiles() {
return false; return false;
} }
const bool shouldPerformSearch() {
return true;
}

View File

@ -652,3 +652,7 @@ const string getName() {
const bool canRenameMultipleFiles() { const bool canRenameMultipleFiles() {
return true; return true;
} }
const bool shouldPerformSearch() {
return true;
}