nis-util  1.0.D108
lib/space/auto_master/row.cc
Go to the documentation of this file.
00001 //
00002 // nis-util - NIS Administration Utilities
00003 // Copyright (C) 2012 Peter Miller
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 2 of the License, or (at
00008 // your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License along
00016 // with this program. If not, see <http://www.gnu.org/licenses/>.
00017 //
00018 
00019 #include <lib/ac/string.h>
00020 
00021 #include <lib/space/auto_master/row.h>
00022 
00023 
00024 space_auto_master_row::~space_auto_master_row()
00025 {
00026 }
00027 
00028 
00029 space_auto_master_row::space_auto_master_row(
00030     const mount_point &a_key,
00031     const rcstring &a_options
00032 ) :
00033     key(a_key),
00034     options(a_options)
00035 {
00036     assert(options.empty() || options[0] == '-');
00037 }
00038 
00039 
00040 bool
00041 space_auto_master_row::has_associated_file(void)
00042     const
00043 {
00044     return false;
00045 }
00046 
00047 
00048 rcstring
00049 space_auto_master_row::get_filename(void)
00050     const
00051 {
00052     assert(!"this class of row doesn't have an associated file");
00053 }
00054 
00055 
00056 space_auto_master_row::keys_t
00057 space_auto_master_row::get_keys(void)
00058     const
00059 {
00060     return keys_t();
00061 }
00062 
00063 
00064 rcstring
00065 space_auto_master_row::extract_maptype(const rcstring &text)
00066 {
00067     const char *colon = strchr(text.c_str(), ':');
00068     if (!colon)
00069         return "nisplus";
00070     return rcstring(text.c_str(), colon - text.c_str());
00071 }
00072 
00073 
00074 rcstring
00075 space_auto_master_row::extract_mapname(const rcstring &text)
00076 {
00077     const char *colon = strchr(text.c_str(), ':');
00078     if (!colon)
00079         return text;
00080     return rcstring(colon + 1);
00081 }
00082 
00083 
00084 // vim: set ts=8 sw=4 et :