| 1 | /* -*- c-basic-offset: 2 -*- */ |
| 2 | /* |
| 3 | Copyright(C) 2010 Tetsuro IKEDA |
| 4 | Copyright(C) 2010-2013 Kentoku SHIBA |
| 5 | Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com> |
| 6 | |
| 7 | This library is free software; you can redistribute it and/or |
| 8 | modify it under the terms of the GNU Lesser General Public |
| 9 | License as published by the Free Software Foundation; either |
| 10 | version 2.1 of the License, or (at your option) any later version. |
| 11 | |
| 12 | This library is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | Lesser General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU Lesser General Public |
| 18 | License along with this library; if not, write to the Free Software |
| 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
| 21 | |
| 22 | #ifndef MRN_PATH_MAPPER_HPP_ |
| 23 | #define MRN_PATH_MAPPER_HPP_ |
| 24 | |
| 25 | #include <mrn_constants.hpp> |
| 26 | |
| 27 | namespace mrn { |
| 28 | class PathMapper { |
| 29 | public: |
| 30 | static char *default_path_prefix; |
| 31 | static char *default_mysql_data_home_path; |
| 32 | |
| 33 | PathMapper(const char *original_mysql_path, |
| 34 | const char *path_prefix=default_path_prefix, |
| 35 | const char *mysql_data_home_path=default_mysql_data_home_path); |
| 36 | const char *db_path(); |
| 37 | const char *db_name(); |
| 38 | const char *table_name(); |
| 39 | const char *mysql_table_name(); |
| 40 | const char *mysql_path(); |
| 41 | bool is_internal_table_name(); |
| 42 | bool is_temporary_table_name(); |
| 43 | private: |
| 44 | const char *original_mysql_path_; |
| 45 | const char *path_prefix_; |
| 46 | const char *mysql_data_home_path_; |
| 47 | char db_path_[MRN_MAX_PATH_SIZE]; |
| 48 | char db_name_[MRN_MAX_PATH_SIZE]; |
| 49 | char table_name_[MRN_MAX_PATH_SIZE]; |
| 50 | char mysql_table_name_[MRN_MAX_PATH_SIZE]; |
| 51 | char mysql_path_[MRN_MAX_PATH_SIZE]; |
| 52 | }; |
| 53 | } |
| 54 | |
| 55 | #endif /* MRN_PATH_MAPPER_HPP_ */ |
| 56 | |