1 |
douglas |
415 |
// Spectre 2 |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
|
|
#ifndef _Share_hpp_ |
8 |
|
|
#define _Share_hpp_ |
9 |
|
|
|
10 |
douglas |
428 |
#include "Error.hpp" |
11 |
douglas |
430 |
#include "Daemon.hpp" |
12 |
douglas |
415 |
|
13 |
|
|
#ifdef MENES_PRAGMA_ONCE |
14 |
|
|
#pragma once |
15 |
|
|
#endif |
16 |
|
|
|
17 |
|
|
class Share |
18 |
|
|
{ |
19 |
douglas |
428 |
private: |
20 |
|
|
ext::String host, name, owner, user, group; |
21 |
|
|
public: |
22 |
douglas |
431 |
Share::Share(const ext::String& host, const ext::String& name, const ext::String& owner = ext::String(), const ext::String& user = ext::String(), const ext::String& group = ext::String()) : host(host), name(name), owner(owner), user(user), group(group) {} |
23 |
douglas |
428 |
static ext::RedBlackMap<ext::String, ext::String> passwords; |
24 |
|
|
static api::ThreadMutex passwordsLock; |
25 |
|
|
const ext::String& getHost() const { return host; } |
26 |
|
|
const ext::String& getName() const { return name; } |
27 |
|
|
const ext::String& getOwner() const { return owner; } |
28 |
|
|
const ext::String& getUser() const { return user; } |
29 |
|
|
const ext::String& getGroup() const { return group; } |
30 |
|
|
ext::String getPassword() const; |
31 |
|
|
ext::String getUri() const { return "smb://" + operator ext::String(); } |
32 |
|
|
ext::String getService() const; |
33 |
|
|
ext::String getMount() const { return Spectre2::root + "/" + operator ext::String(); } |
34 |
|
|
bool mounted() const; |
35 |
|
|
bool mountable() const; |
36 |
|
|
operator ext::String() const { return host + "/" + name; } |
37 |
douglas |
431 |
bool operator==(const Share& share) const { return operator ext::String() == share.operator ext::String(); } |
38 |
|
|
bool operator!=(const Share& share) const { return operator ext::String() != share.operator ext::String(); } |
39 |
douglas |
428 |
bool operator<(const Share& share) const { return operator ext::String() < share.operator ext::String(); } |
40 |
douglas |
415 |
}; |
41 |
|
|
|
42 |
douglas |
428 |
inline ios::PrintWriter& operator<<(ios::PrintWriter& out, const Share& share) |
43 |
|
|
{ |
44 |
|
|
return out << share.operator ext::String(); |
45 |
|
|
} |
46 |
|
|
|
47 |
|
|
#endif//_Share_hpp_ |