MICO Platform
 All Classes Namespaces Functions Variables Friends
Uri.hpp
1 #ifndef URI_HPP
2 #define URI_HPP
3 
4 #include <string>
5 #include <sstream>
6 
7 namespace mico {
8 namespace persistence {
9 namespace model {
10 
22 class URI {
23 
24 private:
25  std::string uri;
26 
27  // find split position according to algorithm in class description
28  std::size_t split() const;
29 
30  std::ostream& print(std::ostream& os) const { os << "URI("<<uri<<")"; return os; }
31 
32 public:
33 
34  URI(const std::string& uri) : uri(uri) {}
35  URI(const char* uri) : uri(uri) {}
36  URI(const mico::persistence::model::URI& uri) : uri(uri.uri) {}
37 
41  std::string getLocalName() const { return uri.substr(split()); }
42 
46  std::string getNamespace() const { return uri.substr(0,split()); }
47 
48 
52  inline const std::string& stringValue() const { return uri; }
53 
54 
55  inline bool operator==(const mico::persistence::model::URI& u) const { return uri == u.uri; }
56  inline bool operator==(const std::string& s) const { return uri == s; }
57  inline bool operator==(const char* s) const { return uri == s; }
58  inline bool operator!=(const std::string& s) const { return uri != s; }
59  inline bool operator!=(const char* s) const { return uri != s; }
60 };
61 
62 
63 }}}
64 
65 #endif // URI_HPP
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in c...
Definition: http_client.cpp:23
std::string getLocalName() const
Gets the local name of this URI.
Definition: Uri.hpp:41
std::string getNamespace() const
Gets the namespace of this URI.
Definition: Uri.hpp:46
const std::string & stringValue() const
Returns the String-value of a Value object.
Definition: Uri.hpp:52
A URI.
Definition: Uri.hpp:22