00001 #ifndef SAGA_PACKAGES_DATA_NAMESPACEDIR_HPP
00002 #define SAGA_PACKAGES_DATA_NAMESPACEDIR_HPP
00003
00004 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
00005 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/namespace_dir.hpp")
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
00015 #pragma wave option(output: null)
00016 #endif
00017
00018 #include <string>
00019
00020
00021 #include <saga/saga/call.hpp>
00022 #include <saga/saga/base.hpp>
00023 #include <saga/saga/session.hpp>
00024 #include <saga/saga/task.hpp>
00025 #include <saga/saga/permissions.hpp>
00026 #include <saga/saga/url.hpp>
00027
00028
00029 #include <saga/saga/packages/namespace/config.hpp>
00030 #include <saga/saga/packages/namespace/namespace_entry.hpp>
00031
00032
00033 #if defined(BOOST_MSVC)
00034 #pragma warning(push)
00035 #pragma warning(disable: 4251 4231 4275 4660)
00036 #endif
00037
00038 #ifdef SAGA_DEBUG
00039 #include <saga/saga/packages/description/preprocessed/namespace_dir.hpp>
00040 #else
00041
00042 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
00043 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/namespace_dir.hpp")
00044 #endif
00046 namespace saga
00047 {
00048 namespace name_space {
00049
00061 class SAGA_NAMESPACE_PACKAGE_EXPORT directory
00062 : public entry
00063 {
00064
00065 protected:
00067
00068 TR1::shared_ptr <saga::impl::namespace_dir> get_impl() const;
00069 typedef saga::name_space::entry::monitorable_base monitorable_base;
00071
00072 private:
00073
00074 SAGA_CALL_PRIV_1(change_dir, saga::url);
00075 SAGA_CALL_CONST_PRIV_2(list, std::string, int);
00076 SAGA_CALL_CONST_PRIV_2(find, std::string, int);
00077
00078 SAGA_CALL_CONST_PRIV_1(read_link, saga::url);
00079 SAGA_CALL_CONST_PRIV_1(exists, saga::url);
00080 SAGA_CALL_CONST_PRIV_1(is_dir, saga::url);
00081 SAGA_CALL_CONST_PRIV_1(is_entry, saga::url);
00082 SAGA_CALL_CONST_PRIV_1(is_link, saga::url);
00083
00084
00085 SAGA_CALL_CONST_PRIV_0(get_num_entries)
00086 SAGA_CALL_CONST_PRIV_1(get_entry, std::size_t);
00087
00088
00089 SAGA_CALL_PRIV_3(copy, saga::url, saga::url, int);
00090 SAGA_CALL_PRIV_3(link, saga::url, saga::url, int);
00091 SAGA_CALL_PRIV_3(move, saga::url, saga::url, int);
00092 SAGA_CALL_PRIV_2(remove, saga::url, int);
00093 SAGA_CALL_PRIV_2(make_dir, saga::url, int);
00094
00095
00096 SAGA_CALL_PRIV_2(open, saga::url, int);
00097 SAGA_CALL_PRIV_2(open_dir, saga::url, int);
00098
00099
00100 SAGA_CALL_PRIV_3(copy, std::string, saga::url, int);
00101 SAGA_CALL_PRIV_3(link, std::string, saga::url, int);
00102 SAGA_CALL_PRIV_3(move, std::string, saga::url, int);
00103 SAGA_CALL_PRIV_2(remove, std::string, int);
00104
00105
00106 SAGA_CALL_PRIV_4(permissions_allow, saga::url, std::string, int, int)
00107 SAGA_CALL_PRIV_4(permissions_deny, saga::url, std::string, int, int)
00108 SAGA_CALL_PRIV_4(permissions_allow, std::string, std::string, int, int)
00109 SAGA_CALL_PRIV_4(permissions_deny, std::string, std::string, int, int)
00110
00111 protected:
00113
00114 directory (saga::impl::namespace_dir *);
00116
00117 public:
00122 directory (session const& s, saga::url url, int mode = Read,
00123 saga::object::type t = saga::object::NSDirectory);
00124
00129 explicit directory (saga::url url, int mode = Read,
00130 saga::object::type t = saga::object::NSDirectory);
00131
00136 explicit directory (saga::object const& o);
00137
00142 directory (void);
00143
00148 ~directory (void);
00149
00154 directory &operator= (saga::object const& o);
00155
00161 void change_dir (saga::url target)
00162 {
00163 change_dirpriv(target, saga::task_base::Sync());
00164 }
00166 SAGA_CALL_PUB_1_DEF_0(change_dir, saga::url);
00168
00175 std::vector<saga::url> list (std::string pattern = "*",
00176 int flags = saga::name_space::None) const
00177 {
00178 saga::task t = listpriv(pattern, flags, saga::task_base::Sync());
00179 return t.get_result<std::vector<saga::url> >();
00180 }
00182 SAGA_CALL_CONST_PUB_2_DEF_2(list, std::string,
00183 "*", int, saga::name_space::None);
00185
00193 std::vector<saga::url> find (std::string pattern,
00194 int flags = saga::name_space::Recursive) const
00195 {
00196 saga::task t = findpriv(pattern, flags, saga::task_base::Sync());
00197 return t.get_result<std::vector<saga::url> >();
00198 }
00200 SAGA_CALL_CONST_PUB_2_DEF_1(find, std::string,
00201 int, saga::name_space::Recursive);
00203
00209 saga::url read_link (saga::url url) const
00210 {
00211 saga::task t = read_linkpriv(url, saga::task_base::Sync());
00212 return t.get_result<saga::url>();
00213 }
00215 SAGA_CALL_CONST_PUB_1_DEF_0(read_link, saga::url);
00217
00224 bool exists (saga::url url) const
00225 {
00226 saga::task t = existspriv(url, saga::task_base::Sync());
00227 return t.get_result<bool>();
00228 }
00230 SAGA_CALL_CONST_PUB_1_DEF_0(exists, saga::url)
00232
00233
00239 bool is_dir (saga::url url) const
00240 {
00241 saga::task t = is_dirpriv(url, saga::task_base::Sync());
00242 return t.get_result<bool>();
00243 }
00245 SAGA_CALL_CONST_PUB_1_DEF_0(is_dir, saga::url)
00247
00248
00254 bool is_entry (saga::url url) const
00255 {
00256 saga::task t = is_entrypriv(url, saga::task_base::Sync());
00257 return t.get_result<bool>();
00258 }
00260 SAGA_CALL_CONST_PUB_1_DEF_0(is_entry, saga::url)
00262
00263
00270 bool is_link (saga::url url) const
00271 {
00272 saga::task t = is_linkpriv(url, saga::task_base::Sync());
00273 return t.get_result<bool>();
00274 }
00276 SAGA_CALL_CONST_PUB_1_DEF_0 (is_link, saga::url)
00278
00279
00280 using entry::read_link;
00281 using entry::is_dir;
00282 using entry::is_entry;
00283 using entry::is_link;
00284
00290 std::size_t get_num_entries (void) const
00291 {
00292 saga::task t = get_num_entriespriv(saga::task_base::Sync());
00293 return t.get_result<std::size_t>();
00294 }
00296 SAGA_CALL_CONST_PUB_0_DEF_0(get_num_entries)
00298
00299
00306 saga::url get_entry (std::size_t entry) const
00307 {
00308 saga::task t = get_entrypriv(entry, saga::task_base::Sync());
00309 return t.get_result<saga::url>();
00310 }
00312 SAGA_CALL_CONST_PUB_1_DEF_0(get_entry, unsigned int)
00314
00322 void copy (saga::url source_url, saga::url dest_url,
00323 int flags = saga::name_space::None)
00324 {
00325 copypriv(source_url, dest_url, flags, saga::task_base::Sync());
00326 }
00328 SAGA_CALL_PUB_3_DEF_1 (copy, saga::url, saga::url, int,
00329 saga::name_space::None)
00331
00332
00340 void copy (std::string source_url, saga::url dest_url,
00341 int flags = saga::name_space::None)
00342 {
00343 copypriv(source_url, dest_url, flags, saga::task_base::Sync());
00344 }
00346 SAGA_CALL_PUB_3_DEF_1 (copy, std::string, saga::url, int,
00347 saga::name_space::None)
00349
00350
00358 void copy (char const * source_url, saga::url dest_url,
00359 int flags = saga::name_space::None)
00360 {
00361 copypriv(std::string(source_url), dest_url, flags, saga::task_base::Sync());
00362 }
00364 template <class Tag>
00365 saga::task copy (char const * source_url, saga::url dest_url,
00366 int flags = saga::name_space::None)
00367 {
00368 return copypriv(std::string(source_url), dest_url, flags, Tag());
00369 }
00371
00382 void link (saga::url source_url, saga::url dest_url,
00383 int flags = saga::name_space::None)
00384 {
00385 linkpriv(source_url, dest_url, flags, saga::task_base::Sync());
00386 }
00388 SAGA_CALL_PUB_3_DEF_1(link, saga::url, saga::url, int,
00389 saga::name_space::None)
00391
00392
00402 void link (std::string source_url, saga::url dest_url,
00403 int flags = saga::name_space::None)
00404 {
00405 linkpriv(source_url, dest_url, flags, saga::task_base::Sync());
00406 }
00408 SAGA_CALL_PUB_3_DEF_1(link, std::string, saga::url, int,
00409 saga::name_space::None)
00411
00412
00422 void link (char const * source_url, saga::url dest_url,
00423 int flags = saga::name_space::None)
00424 {
00425 linkpriv(std::string(source_url), dest_url, flags, saga::task_base::Sync());
00426 }
00428 template <class Tag>
00429 saga::task link (char const * source_url, saga::url dest_url,
00430 int flags = saga::name_space::None)
00431 {
00432 return linkpriv(std::string(source_url), dest_url, flags, Tag());
00433 }
00435
00446 void move (saga::url source_url, saga::url dest_url,
00447 int flags = saga::name_space::None)
00448 {
00449 movepriv(source_url, dest_url, flags, saga::task_base::Sync());
00450 }
00452 SAGA_CALL_PUB_3_DEF_1(move, saga::url, saga::url, int,
00453 saga::name_space::None)
00455
00456
00466 void move (std::string source_url, saga::url dest_url,
00467 int flags = saga::name_space::None)
00468 {
00469 movepriv(source_url, dest_url, flags, saga::task_base::Sync());
00470 }
00472 SAGA_CALL_PUB_3_DEF_1(move, std::string, saga::url, int,
00473 saga::name_space::None)
00475
00476
00486 void move (char const * source_url, saga::url dest_url,
00487 int flags = saga::name_space::None)
00488 {
00489 movepriv(std::string(source_url), dest_url, flags, saga::task_base::Sync());
00490 }
00492 template <class Tag>
00493 saga::task move (char const * source_url, saga::url dest_url,
00494 int flags = saga::name_space::None)
00495 {
00496 return movepriv(std::string(source_url), dest_url, flags, Tag());
00497 }
00499
00505 void remove (saga::url url, int flags = saga::name_space::None)
00506 {
00507 removepriv(url, flags, saga::task_base::Sync());
00508 }
00510 SAGA_CALL_PUB_2_DEF_1(remove, saga::url, int, saga::name_space::None)
00512
00518 void remove (std::string url, int flags = saga::name_space::None)
00519 {
00520 removepriv(url, flags, saga::task_base::Sync());
00521 }
00523 SAGA_CALL_PUB_2_DEF_1(remove, std::string, int, saga::name_space::None)
00525
00531 void remove (char const * url, int flags = saga::name_space::None)
00532 {
00533 removepriv(std::string(url), flags, saga::task_base::Sync());
00534 }
00536 template <class Tag>
00537 saga::task remove (char const * url, int flags = saga::name_space::None)
00538 {
00539 return removepriv(std::string(url), flags, Tag());
00540 }
00542
00543
00544 using entry::copy;
00545 using entry::link;
00546 using entry::move;
00547 using entry::remove;
00548
00555 void make_dir (saga::url url,
00556 int flags = saga::name_space::None)
00557 {
00558 make_dirpriv(url, flags, saga::task_base::Sync());
00559 }
00561 SAGA_CALL_PUB_2_DEF_1(make_dir, saga::url, int, saga::name_space::None)
00563
00571 saga::name_space::entry open (saga::url url,
00572 int flags = saga::name_space::None)
00573 {
00574 saga::task t = openpriv(url, flags, saga::task_base::Sync());
00575 return t.get_result<saga::name_space::entry>();
00576 }
00578 SAGA_CALL_PUB_2_DEF_1(open, saga::url, int, saga::name_space::Read)
00580
00581
00588 saga::name_space::directory open_dir (saga::url url,
00589 int flags = saga::name_space::Read)
00590 {
00591 saga::task t = open_dirpriv(url, flags, saga::task_base::Sync());
00592 return t.get_result<saga::name_space::directory>();
00593 }
00595 SAGA_CALL_PUB_2_DEF_1(open_dir, saga::url, int, saga::name_space::Read)
00597
00598
00599 using entry::permissions_allow;
00600 using entry::permissions_deny;
00601
00611 void permissions_allow (saga::url target, std::string id,
00612 int perm, int flags = None)
00613 {
00614 permissions_allowpriv(target, id, perm, flags, saga::task_base::Sync());
00615 }
00617 SAGA_CALL_PUB_4_DEF_1 (permissions_allow, saga::url, std::string,
00618 int, int, None)
00620
00630 void permissions_deny (saga::url target, std::string id,
00631 int perm, int flags = None)
00632 {
00633 permissions_denypriv(target, id, perm, flags, saga::task_base::Sync());
00634 }
00636 SAGA_CALL_PUB_4_DEF_1 (permissions_deny, saga::url, std::string,
00637 int, int, None)
00639
00649 void permissions_allow (std::string target, std::string id,
00650 int perm, int flags = None)
00651 {
00652 permissions_allowpriv(target, id, perm, flags, saga::task_base::Sync());
00653 }
00655 SAGA_CALL_PUB_4_DEF_1 (permissions_allow, std::string, std::string,
00656 int, int, None)
00658
00668 void permissions_deny (std::string target, std::string id,
00669 int perm, int flags = None)
00670 {
00671 permissions_denypriv(target, id, perm, flags, saga::task_base::Sync());
00672 }
00674 SAGA_CALL_PUB_4_DEF_1 (permissions_deny, std::string, std::string,
00675 int, int, None)
00677
00687 void permissions_allow (char const * target, std::string id,
00688 int perm, int flags = None)
00689 {
00690 permissions_allowpriv(std::string(target), id, perm, flags,
00691 saga::task_base::Sync());
00692 }
00694 template <class Tag>
00695 saga::task permissions_allow (char const * target, std::string id,
00696 int perm, int flags = None)
00697 {
00698 return permissions_allowpriv(std::string(target), id, perm, flags,
00699 Tag());
00700 }
00702
00712 void permissions_deny (char const * target, std::string id,
00713 int perm, int flags = None)
00714 {
00715 permissions_denypriv(std::string(target), id, perm, flags,
00716 saga::task_base::Sync());
00717 }
00719 template <class Tag>
00720 saga::task permissions_deny (char const * target, std::string id,
00721 int perm, int flags = None)
00722 {
00723 return permissions_denypriv(std::string(target), id, perm, flags,
00724 Tag());
00725 }
00727 };
00728
00729 }}
00730
00731 #endif // !defined(SAGA_DEBUG)
00732
00733 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
00734 #pragma wave option(output: null)
00735 #endif
00736
00737 #if defined(BOOST_MSVC)
00738 #pragma warning(pop)
00739 #endif
00740
00741 #endif // SAGA_PACKAGES_DATA_NAMESPACEDIR_HPP
00742