00001 #ifndef SAGA_PACKAGES_DATA_NAMESPACEENTRY_HPP
00002 #define SAGA_PACKAGES_DATA_NAMESPACEENTRY_HPP
00003
00004 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
00005 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/namespace_entry.hpp")
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
00015 #pragma wave option(preserve: 0, output: null)
00016 #endif
00017
00018
00019 #include <string>
00020
00021
00022 #include <saga/saga/call.hpp>
00023 #include <saga/saga/base.hpp>
00024 #include <saga/saga/object.hpp>
00025 #include <saga/saga/session.hpp>
00026 #include <saga/saga/task.hpp>
00027 #include <saga/saga/permissions.hpp>
00028 #include <saga/saga/url.hpp>
00029
00030
00031 #include <saga/saga/packages/namespace/config.hpp>
00032
00033 #include <saga/saga/detail/monitorable.hpp>
00034 #include <saga/saga/detail/permissions.hpp>
00035
00036
00037 #if defined(BOOST_MSVC)
00038 #pragma warning(push)
00039 #pragma warning(disable: 4251 4231 4275 4660)
00040 #endif
00041
00042 #ifdef SAGA_DEBUG
00043 #include <saga/saga/packages/description/preprocessed/namespace_entry.hpp>
00044 #else
00045
00046 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
00047 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/namespace_entry.hpp")
00048 #endif
00050 namespace saga
00051 {
00056 namespace name_space {
00057
00065 enum flags
00066 {
00067 Unknown = -1,
00068 None = 0,
00069 Overwrite = 1,
00070 Recursive = 2,
00071 Dereference = 4,
00072 Create = 8,
00073 Exclusive = 16,
00074 Lock = 32,
00075 CreateParents = 64,
00076
00077
00078 Read = 512,
00079 Write = 1024,
00080 ReadWrite = Read | Write
00081
00082 };
00083
00091 class SAGA_NAMESPACE_PACKAGE_EXPORT entry
00092 : public saga::object,
00093 public saga::detail::monitorable<entry>,
00094 public saga::detail::permissions<entry>
00095 {
00096
00097 protected:
00099
00100 TR1::shared_ptr <saga::impl::namespace_entry> get_impl (void) const;
00101 friend struct saga::detail::monitorable<entry>;
00102 friend struct saga::detail::permissions<entry>;
00103 typedef saga::detail::monitorable<entry> monitorable_base;
00105
00106 private:
00107
00108 SAGA_CALL_CONST_PRIV_0(get_url)
00109 SAGA_CALL_CONST_PRIV_0(get_cwd)
00110 SAGA_CALL_CONST_PRIV_0(get_name)
00111
00112
00113 SAGA_CALL_CONST_PRIV_0(read_link)
00114 SAGA_CALL_CONST_PRIV_0(is_dir)
00115 SAGA_CALL_CONST_PRIV_0(is_entry)
00116 SAGA_CALL_CONST_PRIV_0(is_link)
00117
00118
00119 SAGA_CALL_PRIV_2(copy, saga::url, int)
00120 SAGA_CALL_PRIV_2(link, saga::url, int)
00121 SAGA_CALL_PRIV_2(move, saga::url, int)
00122 SAGA_CALL_PRIV_1(remove, int)
00123
00124 SAGA_CALL_PRIV_1(close, double)
00125
00126
00127 SAGA_CALL_PRIV_3(permissions_allow, std::string, int, int)
00128 SAGA_CALL_PRIV_3(permissions_deny, std::string, int, int)
00129
00130 protected:
00132
00133 explicit entry (saga::impl::namespace_entry * init);
00135
00136 public:
00141 entry (session const & s, saga::url url, int mode = Read,
00142 saga::object::type t = saga::object::NSEntry);
00143
00148 explicit
00149 entry (saga::url url, int mode = Read,
00150 saga::object::type t = saga::object::NSEntry);
00151
00156 explicit entry (saga::object const& o);
00157
00162 entry (void);
00163
00168 ~entry (void);
00169
00174 entry &operator= (saga::object const& o);
00175
00181 saga::url get_url() const
00182 {
00183 saga::task t = get_urlpriv(saga::task_base::Sync());
00184 return t.get_result<saga::url>();
00185 }
00186 SAGA_CALL_CONST_PUB_0_DEF_0(get_url)
00187
00188
00193 saga::url get_cwd() const
00194 {
00195 saga::task t = get_cwdpriv(saga::task_base::Sync());
00196 return t.get_result<saga::url>();
00197 }
00198 SAGA_CALL_CONST_PUB_0_DEF_0(get_cwd)
00199
00200
00205 saga::url get_name() const
00206 {
00207 saga::task t = get_namepriv(saga::task_base::Sync());
00208 return t.get_result<saga::url>();
00209 }
00210 SAGA_CALL_CONST_PUB_0_DEF_0(get_name)
00211
00212
00217 saga::url read_link() const
00218 {
00219 saga::task t = read_linkpriv(saga::task_base::Sync());
00220 return t.get_result<saga::url>();
00221 }
00222 SAGA_CALL_CONST_PUB_0_DEF_0(read_link)
00223
00224
00229 bool is_dir() const
00230 {
00231 saga::task t = is_dirpriv(saga::task_base::Sync());
00232 return t.get_result<bool>();
00233 }
00234 SAGA_CALL_CONST_PUB_0_DEF_0(is_dir)
00235
00236
00241 bool is_entry() const
00242 {
00243 saga::task t = is_entrypriv(saga::task_base::Sync());
00244 return t.get_result<bool>();
00245 }
00246 SAGA_CALL_CONST_PUB_0_DEF_0(is_entry)
00247
00248
00253 bool is_link () const
00254 {
00255 saga::task t = is_linkpriv(saga::task_base::Sync());
00256 return t.get_result<bool>();
00257 }
00258 SAGA_CALL_CONST_PUB_0_DEF_0(is_link)
00259
00260
00266 void copy(saga::url target, int flags = saga::name_space::None)
00267 {
00268 copypriv(target, flags, saga::task_base::Sync());
00269 }
00270 SAGA_CALL_PUB_2_DEF_1 (copy, saga::url, int, saga::name_space::None)
00271
00272
00278 void link (saga::url target, int flags = saga::name_space::None)
00279 {
00280 linkpriv(target, flags, saga::task_base::Sync());
00281 }
00282 SAGA_CALL_PUB_2_DEF_1 (link, saga::url, int, saga::name_space::None)
00283
00284
00290 void move (saga::url target, int flags = saga::name_space::None)
00291 {
00292 movepriv(target, flags, saga::task_base::Sync());
00293 }
00294 SAGA_CALL_PUB_2_DEF_1 (move, saga::url, int, saga::name_space::None)
00295
00296
00301 void remove (int flags = saga::name_space::None)
00302 {
00303 removepriv(flags, saga::task_base::Sync());
00304 }
00305 SAGA_CALL_PUB_1_DEF_1 (remove, int, saga::name_space::None)
00306
00307
00311 void close (double timeout = 0.0)
00312 {
00313 closepriv(timeout, saga::task_base::Sync());
00314 }
00315 SAGA_CALL_PUB_1_DEF_1 (close, double, 0.0)
00316
00317
00318 using saga::detail::permissions<entry>::permissions_allow;
00319 using saga::detail::permissions<entry>::permissions_deny;
00320
00329 void permissions_allow (std::string id, int perm, int flags)
00330 {
00331 permissions_allowpriv(id, perm, flags, saga::task_base::Sync());
00332 }
00333 SAGA_CALL_PUB_3_DEF_0 (permissions_allow, std::string, int, int)
00334
00335
00343 void permissions_deny (std::string id, int perm, int flags)
00344 {
00345 permissions_denypriv(id, perm, flags, saga::task_base::Sync());
00346 }
00347 SAGA_CALL_PUB_3_DEF_0 (permissions_deny, std::string, int, int)
00348
00349 };
00350
00351 }}
00352
00353 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
00354 #pragma wave option(output: null)
00355 #endif
00356 #endif // !defined(SAGA_DEBUG)
00357
00358
00359 #if defined(BOOST_MSVC)
00360 #pragma warning(pop)
00361 #endif
00362
00363 #endif // SAGA_PACKAGES_DATA_NAMESPACEENTRY_HPP
00364