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
00102 friend struct saga::detail::monitorable<entry>;
00103 friend struct saga::detail::permissions<entry>;
00104 friend class saga::impl::namespace_entry;
00105
00106 typedef saga::detail::monitorable<entry> monitorable_base;
00108
00109 private:
00110
00111 SAGA_CALL_CREATE_PRIV_3(session const&, saga::url, int)
00112
00113
00114 SAGA_CALL_CONST_PRIV_0(get_url)
00115 SAGA_CALL_CONST_PRIV_0(get_cwd)
00116 SAGA_CALL_CONST_PRIV_0(get_name)
00117
00118
00119 SAGA_CALL_CONST_PRIV_0(read_link)
00120 SAGA_CALL_CONST_PRIV_0(is_dir)
00121 SAGA_CALL_CONST_PRIV_0(is_entry)
00122 SAGA_CALL_CONST_PRIV_0(is_link)
00123
00124
00125 SAGA_CALL_PRIV_2(copy, saga::url, int)
00126 SAGA_CALL_PRIV_2(link, saga::url, int)
00127 SAGA_CALL_PRIV_2(move, saga::url, int)
00128 SAGA_CALL_PRIV_1(remove, int)
00129
00130 SAGA_CALL_PRIV_1(close, double)
00131
00132
00133 SAGA_CALL_PRIV_3(permissions_allow, std::string, int, int)
00134 SAGA_CALL_PRIV_3(permissions_deny, std::string, int, int)
00135
00136 protected:
00138
00139 explicit entry (saga::impl::namespace_entry * init);
00141
00142 public:
00147 entry (session const & s, saga::url url, int mode = Read,
00148 saga::object::type t = saga::object::NSEntry);
00149
00154 explicit
00155 entry (saga::url url, int mode = Read,
00156 saga::object::type t = saga::object::NSEntry);
00157
00162 explicit entry (saga::object const& o);
00163
00168 entry (void);
00169
00174 ~entry (void);
00175
00179 static entry create(session const & s, saga::url url, int mode = Read)
00180 {
00181 return entry(s, url, mode);
00182 }
00183 SAGA_CALL_CREATE_3_DEF_1(session const&, saga::url, int, Read)
00184
00185
00187 static entry create(saga::url url, int mode = Read)
00188 {
00189 return entry(url, mode);
00190 }
00191 template <typename Tag>
00192 static saga::task create(saga::url url, int mode = Read)
00193 {
00194 return create<Tag>(detail::get_the_session(), url, mode);
00195 }
00196
00201 entry &operator= (saga::object const& o);
00202
00208 saga::url get_url() const
00209 {
00210 saga::task t = get_urlpriv(saga::task_base::Sync());
00211 return t.get_result<saga::url>();
00212 }
00213 SAGA_CALL_CONST_PUB_0_DEF_0(get_url)
00214
00215
00220 saga::url get_cwd() const
00221 {
00222 saga::task t = get_cwdpriv(saga::task_base::Sync());
00223 return t.get_result<saga::url>();
00224 }
00225 SAGA_CALL_CONST_PUB_0_DEF_0(get_cwd)
00226
00227
00232 saga::url get_name() const
00233 {
00234 saga::task t = get_namepriv(saga::task_base::Sync());
00235 return t.get_result<saga::url>();
00236 }
00237 SAGA_CALL_CONST_PUB_0_DEF_0(get_name)
00238
00239
00244 saga::url read_link() const
00245 {
00246 saga::task t = read_linkpriv(saga::task_base::Sync());
00247 return t.get_result<saga::url>();
00248 }
00249 SAGA_CALL_CONST_PUB_0_DEF_0(read_link)
00250
00251
00256 bool is_dir() const
00257 {
00258 saga::task t = is_dirpriv(saga::task_base::Sync());
00259 return t.get_result<bool>();
00260 }
00261 SAGA_CALL_CONST_PUB_0_DEF_0(is_dir)
00262
00263
00268 bool is_entry() const
00269 {
00270 saga::task t = is_entrypriv(saga::task_base::Sync());
00271 return t.get_result<bool>();
00272 }
00273 SAGA_CALL_CONST_PUB_0_DEF_0(is_entry)
00274
00275
00280 bool is_link () const
00281 {
00282 saga::task t = is_linkpriv(saga::task_base::Sync());
00283 return t.get_result<bool>();
00284 }
00285 SAGA_CALL_CONST_PUB_0_DEF_0(is_link)
00286
00287
00293 void copy(saga::url target, int flags = saga::name_space::None)
00294 {
00295 saga::task t = copypriv(target, flags, saga::task_base::Sync());
00296 t.get_result ();
00297 }
00298 SAGA_CALL_PUB_2_DEF_1 (copy, saga::url, int, saga::name_space::None)
00299
00300
00306 void link (saga::url target, int flags = saga::name_space::None)
00307 {
00308 saga::task t = linkpriv(target, flags, saga::task_base::Sync());
00309 t.get_result ();
00310 }
00311 SAGA_CALL_PUB_2_DEF_1 (link, saga::url, int, saga::name_space::None)
00312
00313
00319 void move (saga::url target, int flags = saga::name_space::None)
00320 {
00321 saga::task t = movepriv(target, flags, saga::task_base::Sync());
00322 t.get_result ();
00323 }
00324 SAGA_CALL_PUB_2_DEF_1 (move, saga::url, int, saga::name_space::None)
00325
00326
00331 void remove (int flags = saga::name_space::None)
00332 {
00333 saga::task t = removepriv(flags, saga::task_base::Sync());
00334 t.get_result ();
00335 }
00336 SAGA_CALL_PUB_1_DEF_1 (remove, int, saga::name_space::None)
00337
00338
00342 void close (double timeout = 0.0)
00343 {
00344 saga::task t = closepriv(timeout, saga::task_base::Sync());
00345 t.get_result ();
00346 }
00347 SAGA_CALL_PUB_1_DEF_1 (close, double, 0.0)
00348
00349
00350 using saga::detail::permissions<entry>::permissions_allow;
00351 using saga::detail::permissions<entry>::permissions_deny;
00352
00361 void permissions_allow (std::string id, int perm, int flags)
00362 {
00363 saga::task t = permissions_allowpriv(id, perm, flags, saga::task_base::Sync());
00364 t.get_result ();
00365 }
00366 SAGA_CALL_PUB_3_DEF_0 (permissions_allow, std::string, int, int)
00367
00368
00376 void permissions_deny (std::string id, int perm, int flags)
00377 {
00378 saga::task t = permissions_denypriv(id, perm, flags, saga::task_base::Sync());
00379 t.get_result ();
00380 }
00381 SAGA_CALL_PUB_3_DEF_0 (permissions_deny, std::string, int, int)
00382
00383 };
00384
00385 }}
00386
00387 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
00388 #pragma wave option(output: null)
00389 #endif
00390 #endif // !defined(SAGA_DEBUG)
00391
00392
00393 #if defined(BOOST_MSVC)
00394 #pragma warning(pop)
00395 #endif
00396
00397 #endif // SAGA_PACKAGES_DATA_NAMESPACEENTRY_HPP
00398