Browse Subversion Repository
Contents of /common/SearchFilePath.h
Parent Directory
| Revision Log
Revision 279 -
( show annotations)
( download)
( as text)
Wed Mar 12 05:28:19 2008 UTC
(16 years, 2 months ago)
by satofumi
File MIME type: text/x-chdr
File size: 934 byte(s)
adjust tab index
| 1 |
#ifndef SEARCH_FILE_PATH_H |
| 2 |
#define SEARCH_FILE_PATH_H |
| 3 |
|
| 4 |
/*! |
| 5 |
\file |
| 6 |
\brief ファイルのパス探索 |
| 7 |
|
| 8 |
\author Satofumi KAMIMURA |
| 9 |
|
| 10 |
$Id$ |
| 11 |
*/ |
| 12 |
|
| 13 |
#include <string> |
| 14 |
#include <vector> |
| 15 |
|
| 16 |
|
| 17 |
namespace beego { |
| 18 |
/*! |
| 19 |
\brief 複数パスからのファイルの探索 |
| 20 |
|
| 21 |
\param full_path [o] 探索結果のフルパス |
| 22 |
\param fname [i] ファイル名 |
| 23 |
\param dir_path [i] パス文字列の配列 |
| 24 |
|
| 25 |
\retval true ファイル探索に成功、full_path に探索結果のフルパスが格納される |
| 26 |
\retval false ファイル探索に失敗 |
| 27 |
|
| 28 |
使用例 |
| 29 |
\code |
| 30 |
// ./beegoconf または ~/.beego/beegoconf の探索 |
| 31 |
std::vector<std::string> search_path; |
| 32 |
search_path.push_back("./"); |
| 33 |
search_path.push_back("~/.beego/"); |
| 34 |
|
| 35 |
std::string config_file; |
| 36 |
if (searchFilePath(config_file, "beegoconf", search_path)) { |
| 37 |
... |
| 38 |
} \endcode |
| 39 |
*/ |
| 40 |
extern bool searchFilePath(std::string& full_path, const char* fname, |
| 41 |
const std::vector<std::string>& dir_path); |
| 42 |
}; |
| 43 |
|
| 44 |
#endif /* SEARCH_FILE_PATH_H */ |
|