Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

PathResolver Class Reference

#include <PathResolver.h>

List of all members.

Public Types

enum  SearchPathStatus { Ok, EnvironmentVariableUndefined, UnknownDirectory }
enum  SearchPathStatus { Ok, EnvironmentVariableUndefined, UnknownDirectory }
enum  SearchType { LocalSearch, RecursiveSearch }
enum  SearchType { LocalSearch, RecursiveSearch }

Static Public Member Functions

SearchPathStatus check_search_path (const std::string &search_path)
SearchPathStatus check_search_path (const std::string &search_path)
std::string find_directory (const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
std::string find_directory (const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
std::string find_directory_from_list (const std::string &logical_file_name, const std::string &search_list, SearchType search_type=LocalSearch)
std::string find_directory_from_list (const std::string &logical_file_name, const std::string &search_list, SearchType search_type=LocalSearch)
std::string find_file (const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
std::string find_file (const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
std::string find_file_from_list (const std::string &logical_file_name, const std::string &search_list, SearchType search_type=LocalSearch)
std::string find_file_from_list (const std::string &logical_file_name, const std::string &search_list, SearchType search_type=LocalSearch)


Member Enumeration Documentation

enum PathResolver::SearchPathStatus
 

Enumeration values:
Ok 
EnvironmentVariableUndefined 
UnknownDirectory 
00010     {
00011       Ok,
00012       EnvironmentVariableUndefined,
00013       UnknownDirectory
00014     } SearchPathStatus;

enum PathResolver::SearchPathStatus
 

Enumeration values:
Ok 
EnvironmentVariableUndefined 
UnknownDirectory 
00010     {
00011       Ok,
00012       EnvironmentVariableUndefined,
00013       UnknownDirectory
00014     } SearchPathStatus;

enum PathResolver::SearchType
 

Enumeration values:
LocalSearch 
RecursiveSearch 
00017     {
00018       LocalSearch,
00019       RecursiveSearch
00020     } SearchType;

enum PathResolver::SearchType
 

Enumeration values:
LocalSearch 
RecursiveSearch 
00017     {
00018       LocalSearch,
00019       RecursiveSearch
00020     } SearchType;


Member Function Documentation

SearchPathStatus PathResolver::check_search_path const std::string &  search_path  )  [static]
 

  • search_path the name of a path-like environment variable
Returns:
the result of the verification. Can be one of Ok, EnvironmentVariableUndefined, UnknownDirectory

PathResolver::SearchPathStatus PathResolver::check_search_path const std::string &  search_path  )  [static]
 

  • search_path the name of a path-like environment variable
Returns:
the result of the verification. Can be one of Ok, EnvironmentVariableUndefined, UnknownDirectory
00599 {
00600   const char* path_env = ::getenv (search_path.c_str ());
00601 
00602   if (path_env == 0) return (EnvironmentVariableUndefined);
00603 
00604 #ifdef WIN32
00605   static const char path_separator = ';';
00606 #else
00607   static const char path_separator = ':';
00608 #endif
00609 
00610   std::string path_list (path_env);
00611 
00612   std::string::size_type pos = 0;
00613 
00614   for (int i = 0;;i++)
00615     {
00616       bool ending = false;
00617 
00618       std::string::size_type next = path_list.find (path_separator, pos);
00619 
00620       std::string path = path_list.substr (pos, next - pos);
00621 
00622       if (next == std::string::npos)
00623         {
00624           path = path_list.substr (pos);
00625           ending = true;
00626         }
00627       else
00628         {
00629           path = path_list.substr (pos, next - pos);
00630           pos = next + 1;
00631         }
00632 
00633       std::string real_name = "";
00634 
00635       if (!PR_test_exist (path, real_name, PR_directory))
00636         {
00637           return (UnknownDirectory);
00638         }
00639 
00640       if (ending) break;
00641     }
00642 
00643   return (Ok);
00644 }

std::string PathResolver::find_directory const std::string &  logical_file_name,
const std::string &  search_path,
SearchType  search_type = LocalSearch
[static]
 

  • logical_file_name the name of the directory to locate in the search path
  • search_path the name of a path-like environment variable
  • search_type characterizes the type of search. Can be either LocalSearch or RecursiveSearch
Returns:
the physical name of the located directory or empty string if not found

std::string PathResolver::find_directory const std::string &  logical_file_name,
const std::string &  search_path,
SearchType  search_type = LocalSearch
[static]
 

  • logical_file_name the name of the directory to locate in the search path
  • search_path the name of a path-like environment variable
  • search_type characterizes the type of search. Can be either LocalSearch or RecursiveSearch
Returns:
the physical name of the located directory or empty string if not found
00571 {
00572   const char* path_env = ::getenv (search_path.c_str ());
00573 
00574   std::string path_list;
00575 
00576   if (path_env != 0)
00577     {
00578       path_list = path_env;
00579     }
00580 
00581   return (find_directory_from_list (logical_file_name, path_list, search_type));
00582 }

std::string PathResolver::find_directory_from_list const std::string &  logical_file_name,
const std::string &  search_list,
SearchType  search_type = LocalSearch
[static]
 

  • logical_file_name the name of the directory to locate in the search path
  • search_list the prioritized list of possible locations separated by the usual path separator
  • search_type characterizes the type of search. Can be either LocalSearch or RecursiveSearch
Returns:
the physical name of the located directory or empty string if not found

std::string PathResolver::find_directory_from_list const std::string &  logical_file_name,
const std::string &  search_list,
SearchType  search_type = LocalSearch
[static]
 

  • logical_file_name the name of the directory to locate in the search path
  • search_list the prioritized list of possible locations separated by the usual path separator
  • search_type characterizes the type of search. Can be either LocalSearch or RecursiveSearch
Returns:
the physical name of the located directory or empty string if not found
00587 {
00588   std::string result;
00589 
00590   if (!PR_find_from_list (logical_file_name, search_list, PR_directory, search_type, result))
00591     {
00592       result = "";
00593     }
00594 
00595   return (result);
00596 }

std::string PathResolver::find_file const std::string &  logical_file_name,
const std::string &  search_path,
SearchType  search_type = LocalSearch
[static]
 

  • logical_file_name the name of the file to locate in the search path
  • search_path the name of a path-like environment variable
  • search_type characterizes the type of search. Can be either LocalSearch or RecursiveSearch
Returns:
the physical name of the located file or empty string if not found

std::string PathResolver::find_file const std::string &  logical_file_name,
const std::string &  search_path,
SearchType  search_type = LocalSearch
[static]
 

  • logical_file_name the name of the file to locate in the search path
  • search_path the name of a path-like environment variable
  • search_type characterizes the type of search. Can be either LocalSearch or RecursiveSearch
Returns:
the physical name of the located file or empty string if not found
00541 {
00542   const char* path_env = ::getenv (search_path.c_str ());
00543 
00544   std::string path_list;
00545 
00546   if (path_env != 0)
00547     {
00548       path_list = path_env;
00549     }
00550 
00551   return (find_file_from_list (logical_file_name, path_list, search_type));
00552 }

std::string PathResolver::find_file_from_list const std::string &  logical_file_name,
const std::string &  search_list,
SearchType  search_type = LocalSearch
[static]
 

  • logical_file_name the name of the file to locate in the search path
  • search_list the prioritized list of possible locations separated by the usual path separator
  • search_type characterizes the type of search. Can be either LocalSearch or RecursiveSearch
Returns:
the physical name of the located file or empty string if not found

std::string PathResolver::find_file_from_list const std::string &  logical_file_name,
const std::string &  search_list,
SearchType  search_type = LocalSearch
[static]
 

  • logical_file_name the name of the file to locate in the search path
  • search_list the prioritized list of possible locations separated by the usual path separator
  • search_type characterizes the type of search. Can be either LocalSearch or RecursiveSearch
Returns:
the physical name of the located file or empty string if not found
00557 {
00558   std::string result;
00559 
00560   if (!PR_find_from_list (logical_file_name, search_list, PR_regular_file, search_type, result))
00561     {
00562       result = "";
00563     }
00564 
00565   return (result);
00566 }


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 16:38:42 2011 for BOSS6.5.5 by  doxygen 1.3.9.1