nis-util  1.0.D108
lib/mount_point.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/mount_point.h>
00020 #include <lib/path_join.h>
00021 #include <lib/rcstring/accumulator.h>
00022 
00023 
00024 mount_point::~mount_point()
00025 {
00026 }
00027 
00028 
00029 mount_point::mount_point(
00030     const rcstring &a_path,
00031     const source_location &a_locn
00032 ) :
00033     path(a_path),
00034     locn(a_locn)
00035 {
00036 }
00037 
00038 
00039 mount_point::mount_point(const mount_point &rhs) :
00040     path(rhs.path),
00041     locn(rhs.locn)
00042 {
00043 }
00044 
00045 
00046 mount_point &
00047 mount_point::operator=(const mount_point &rhs)
00048 {
00049     if (this != &rhs)
00050     {
00051         path = rhs.path;
00052         locn = rhs.locn;
00053     }
00054     return *this;
00055 }
00056 
00057 
00058 mount_point
00059 mount_point::operator+(const mount_point &rhs)
00060     const
00061 {
00062     rcstring new_path = path_join(path, rhs.path);
00063     return mount_point(new_path, rhs.locn);
00064 }
00065 
00066 
00067 bool
00068 mount_point::is_absolute(void)
00069     const
00070 {
00071     return (path[0] == '/');
00072 }
00073 
00074 
00075 // vim: set ts=8 sw=4 et :