edelib  2.1.0
EdbusObjectPath.h
1 /*
2  * $Id: EdbusObjectPath.h 2839 2009-09-28 11:36:20Z karijes $
3  *
4  * D-BUS stuff
5  * Copyright (c) 2008 edelib authors
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 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 License
18  * along with this library. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef __EDELIB_EDBUSOBJECTPATH_H__
22 #define __EDELIB_EDBUSOBJECTPATH_H__
23 
24 #include "String.h"
25 
26 EDELIB_NS_BEGIN
27 
58 class EDELIB_API EdbusObjectPath {
59 private:
60  String val;
61  EdbusObjectPath& operator=(const EdbusObjectPath&);
62 
63 public:
68 
75  EdbusObjectPath(const char* str);
76 
81 
85  ~EdbusObjectPath();
86 
95  void append(const char* str);
96 
100  void clear(void);
101 
105  const char* path(void) const { return val.c_str(); }
106 
112  bool operator==(const EdbusObjectPath& other) { return val == other.val; }
113 
119  bool operator!=(const EdbusObjectPath& other) { return !operator==(other); }
120 
127  static bool valid_element(const char* str);
128 
135  static bool valid_path(const char* str);
136 
144  static bool valid_path(const EdbusObjectPath& path) { return valid_path(path.path()); }
145 };
146 
151 inline EdbusObjectPath& operator<<(EdbusObjectPath& p, const char* el) {
152  p.append(el);
153  return p;
154 }
155 
156 EDELIB_NS_END
157 #endif
const char * path(void) const
Definition: EdbusObjectPath.h:105
bool operator!=(const EdbusObjectPath &other)
Definition: EdbusObjectPath.h:119
bool operator==(const EdbusObjectPath &other)
Definition: EdbusObjectPath.h:112
Represents D-Bus object path.
Definition: EdbusObjectPath.h:58
A (relatively simple) string implementation.
Definition: String.h:82
static bool valid_path(const EdbusObjectPath &path)
Definition: EdbusObjectPath.h:144
EdbusList & operator<<(EdbusList &lst, const EdbusData &val)
Definition: EdbusList.h:219
void append(const char *str)