edelib
2.0.0
|
00001 /* 00002 * $Id: EdbusObjectPath.h 2839 2009-09-28 11:36:20Z karijes $ 00003 * 00004 * D-BUS stuff 00005 * Copyright (c) 2008 edelib authors 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public License 00018 * along with this library. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #ifndef __EDELIB_EDBUSOBJECTPATH_H__ 00022 #define __EDELIB_EDBUSOBJECTPATH_H__ 00023 00024 #include "String.h" 00025 00026 EDELIB_NS_BEGIN 00027 00058 class EDELIB_API EdbusObjectPath { 00059 private: 00060 String val; 00061 EdbusObjectPath& operator=(const EdbusObjectPath&); 00062 00063 public: 00067 EdbusObjectPath(); 00068 00075 EdbusObjectPath(const char* str); 00076 00080 EdbusObjectPath(const EdbusObjectPath&); 00081 00085 ~EdbusObjectPath(); 00086 00095 void append(const char* str); 00096 00100 void clear(void); 00101 00105 const char* path(void) const { return val.c_str(); } 00106 00112 bool operator==(const EdbusObjectPath& other) { return val == other.val; } 00113 00119 bool operator!=(const EdbusObjectPath& other) { return !operator==(other); } 00120 00127 static bool valid_element(const char* str); 00128 00135 static bool valid_path(const char* str); 00136 00144 static bool valid_path(const EdbusObjectPath& path) { return valid_path(path.path()); } 00145 }; 00146 00151 inline EdbusObjectPath& operator<<(EdbusObjectPath& p, const char* el) { 00152 p.append(el); 00153 return p; 00154 } 00155 00156 EDELIB_NS_END 00157 #endif