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
00070 friend class saga::impl::namespace_dir;
00071
00072 typedef saga::name_space::entry::monitorable_base monitorable_base;
00074
00075 private:
00076
00077 SAGA_CALL_CREATE_PRIV_3(session const&, saga::url, int)
00078
00079
00080 SAGA_CALL_PRIV_1(change_dir, saga::url)
00081 SAGA_CALL_CONST_PRIV_2(list, std::string, int)
00082 SAGA_CALL_CONST_PRIV_2(find, std::string, int)
00083
00084 SAGA_CALL_CONST_PRIV_1(read_link, saga::url)
00085 SAGA_CALL_CONST_PRIV_1(exists, saga::url)
00086 SAGA_CALL_CONST_PRIV_1(is_dir, saga::url)
00087 SAGA_CALL_CONST_PRIV_1(is_entry, saga::url)
00088 SAGA_CALL_CONST_PRIV_1(is_link, saga::url)
00089
00090
00091 SAGA_CALL_CONST_PRIV_0(get_num_entries)
00092 SAGA_CALL_CONST_PRIV_1(get_entry, std::size_t)
00093
00094
00095 SAGA_CALL_PRIV_3(copy, saga::url, saga::url, int)
00096 SAGA_CALL_PRIV_3(link, saga::url, saga::url, int)
00097 SAGA_CALL_PRIV_3(move, saga::url, saga::url, int)
00098 SAGA_CALL_PRIV_2(remove, saga::url, int)
00099 SAGA_CALL_PRIV_2(make_dir, saga::url, int)
00100
00101
00102 SAGA_CALL_PRIV_2(open, saga::url, int)
00103 SAGA_CALL_PRIV_2(open_dir, saga::url, int)
00104
00105
00106 SAGA_CALL_PRIV_3(copy, std::string, saga::url, int)
00107 SAGA_CALL_PRIV_3(link, std::string, saga::url, int)
00108 SAGA_CALL_PRIV_3(move, std::string, saga::url, int)
00109 SAGA_CALL_PRIV_2(remove, std::string, int)
00110
00111
00112 SAGA_CALL_PRIV_4(permissions_allow, saga::url, std::string, int, int)
00113 SAGA_CALL_PRIV_4(permissions_deny, saga::url, std::string, int, int)
00114 SAGA_CALL_PRIV_4(permissions_allow, std::string, std::string, int, int)
00115 SAGA_CALL_PRIV_4(permissions_deny, std::string, std::string, int, int)
00116
00117 protected:
00119
00120 directory (saga::impl::namespace_dir *);
00122
00123 public:
00128 directory (session const& s, saga::url url, int mode = Read,
00129 saga::object::type t = saga::object::NSDirectory);
00130
00135 explicit directory (saga::url url, int mode = Read,
00136 saga::object::type t = saga::object::NSDirectory);
00137
00142 explicit directory (saga::object const& o);
00143
00148 directory (void);
00149
00154 ~directory (void);
00155
00159 static directory create(session const & s, saga::url url, int mode = Read)
00160 {
00161 return directory(s, url, mode);
00162 }
00163 SAGA_CALL_CREATE_3_DEF_1(session const&, saga::url, int, Read)
00164
00165
00167 static directory create(saga::url url, int mode = Read)
00168 {
00169 return directory(url, mode);
00170 }
00171 template <typename Tag>
00172 static saga::task create(saga::url url, int mode = Read)
00173 {
00174 return create<Tag>(detail::get_the_session(), url, mode);
00175 }
00176
00181 directory &operator= (saga::object const& o);
00182
00188 void change_dir (saga::url target)
00189 {
00190 saga::task t = change_dirpriv(target, saga::task_base::Sync());
00191 t.get_result ();
00192 }
00194 SAGA_CALL_PUB_1_DEF_0(change_dir, saga::url)
00196
00197
00203 std::vector<saga::url> list (std::string pattern = "*",
00204 int flags = saga::name_space::None) const
00205 {
00206 saga::task t = listpriv(pattern, flags, saga::task_base::Sync());
00207 return t.get_result<std::vector<saga::url> >();
00208 }
00210 SAGA_CALL_CONST_PUB_2_DEF_2(list, std::string,
00211 "*", int, saga::name_space::None)
00213
00214
00221 std::vector<saga::url> find (std::string pattern,
00222 int flags = saga::name_space::Recursive) const
00223 {
00224 saga::task t = findpriv(pattern, flags, saga::task_base::Sync());
00225 return t.get_result<std::vector<saga::url> >();
00226 }
00228 SAGA_CALL_CONST_PUB_2_DEF_1(find, std::string,
00229 int, saga::name_space::Recursive)
00231
00237 saga::url read_link (saga::url url) const
00238 {
00239 saga::task t = read_linkpriv(url, saga::task_base::Sync());
00240 return t.get_result<saga::url>();
00241 }
00243 SAGA_CALL_CONST_PUB_1_DEF_0(read_link, saga::url)
00245
00246
00252 bool exists (saga::url url) const
00253 {
00254 saga::task t = existspriv(url, saga::task_base::Sync());
00255 return t.get_result<bool>();
00256 }
00258 SAGA_CALL_CONST_PUB_1_DEF_0(exists, saga::url)
00260
00261
00267 bool is_dir (saga::url url) const
00268 {
00269 saga::task t = is_dirpriv(url, saga::task_base::Sync());
00270 return t.get_result<bool>();
00271 }
00273 SAGA_CALL_CONST_PUB_1_DEF_0(is_dir, saga::url)
00275
00276
00282 bool is_entry (saga::url url) const
00283 {
00284 saga::task t = is_entrypriv(url, saga::task_base::Sync());
00285 return t.get_result<bool>();
00286 }
00288 SAGA_CALL_CONST_PUB_1_DEF_0(is_entry, saga::url)
00290
00291
00298 bool is_link (saga::url url) const
00299 {
00300 saga::task t = is_linkpriv(url, saga::task_base::Sync());
00301 return t.get_result<bool>();
00302 }
00304 SAGA_CALL_CONST_PUB_1_DEF_0 (is_link, saga::url)
00306
00307
00308 using entry::read_link;
00309 using entry::is_dir;
00310 using entry::is_entry;
00311 using entry::is_link;
00312
00318 std::size_t get_num_entries (void) const
00319 {
00320 saga::task t = get_num_entriespriv(saga::task_base::Sync());
00321 return t.get_result<std::size_t>();
00322 }
00324 SAGA_CALL_CONST_PUB_0_DEF_0(get_num_entries)
00326
00327
00334 saga::url get_entry (std::size_t entry) const
00335 {
00336 saga::task t = get_entrypriv(entry, saga::task_base::Sync());
00337 return t.get_result<saga::url>();
00338 }
00340 SAGA_CALL_CONST_PUB_1_DEF_0(get_entry, unsigned int)
00342
00350 void copy (saga::url source_url, saga::url dest_url,
00351 int flags = saga::name_space::None)
00352 {
00353 saga::task t = copypriv(source_url, dest_url, flags, saga::task_base::Sync());
00354 t.get_result ();
00355 }
00357 SAGA_CALL_PUB_3_DEF_1 (copy, saga::url, saga::url, int,
00358 saga::name_space::None)
00360
00361
00369 void copy (std::string source_url, saga::url dest_url,
00370 int flags = saga::name_space::None)
00371 {
00372 saga::task t = copypriv(source_url, dest_url, flags, saga::task_base::Sync());
00373 t.get_result ();
00374 }
00376 SAGA_CALL_PUB_3_DEF_1 (copy, std::string, saga::url, int,
00377 saga::name_space::None)
00379
00380
00388 void copy (char const * source_url, saga::url dest_url,
00389 int flags = saga::name_space::None)
00390 {
00391 saga::task t = copypriv(std::string(source_url), dest_url, flags, saga::task_base::Sync());
00392 t.get_result ();
00393 }
00395 template <class Tag>
00396 saga::task copy (char const * source_url, saga::url dest_url,
00397 int flags = saga::name_space::None)
00398 {
00399 return copypriv(std::string(source_url), dest_url, flags, Tag());
00400 }
00402
00413 void link (saga::url source_url, saga::url dest_url,
00414 int flags = saga::name_space::None)
00415 {
00416 saga::task t = linkpriv(source_url, dest_url, flags, saga::task_base::Sync());
00417 t.get_result ();
00418 }
00420 SAGA_CALL_PUB_3_DEF_1(link, saga::url, saga::url, int,
00421 saga::name_space::None)
00423
00424
00434 void link (std::string source_url, saga::url dest_url,
00435 int flags = saga::name_space::None)
00436 {
00437 saga::task t = linkpriv(source_url, dest_url, flags, saga::task_base::Sync());
00438 t.get_result ();
00439 }
00441 SAGA_CALL_PUB_3_DEF_1(link, std::string, saga::url, int,
00442 saga::name_space::None)
00444
00445
00455 void link (char const * source_url, saga::url dest_url,
00456 int flags = saga::name_space::None)
00457 {
00458 saga::task t = linkpriv(std::string(source_url), dest_url, flags, saga::task_base::Sync());
00459 t.get_result ();
00460 }
00462 template <class Tag>
00463 saga::task link (char const * source_url, saga::url dest_url,
00464 int flags = saga::name_space::None)
00465 {
00466 return linkpriv(std::string(source_url), dest_url, flags, Tag());
00467 }
00469
00480 void move (saga::url source_url, saga::url dest_url,
00481 int flags = saga::name_space::None)
00482 {
00483 saga::task t = movepriv(source_url, dest_url, flags, saga::task_base::Sync());
00484 t.get_result ();
00485 }
00487 SAGA_CALL_PUB_3_DEF_1(move, saga::url, saga::url, int,
00488 saga::name_space::None)
00490
00491
00501 void move (std::string source_url, saga::url dest_url,
00502 int flags = saga::name_space::None)
00503 {
00504 saga::task t = movepriv(source_url, dest_url, flags, saga::task_base::Sync());
00505 t.get_result ();
00506 }
00508 SAGA_CALL_PUB_3_DEF_1(move, std::string, saga::url, int,
00509 saga::name_space::None)
00511
00512
00522 void move (char const * source_url, saga::url dest_url,
00523 int flags = saga::name_space::None)
00524 {
00525 saga::task t = movepriv(std::string(source_url), dest_url, flags, saga::task_base::Sync());
00526 t.get_result ();
00527 }
00529 template <class Tag>
00530 saga::task move (char const * source_url, saga::url dest_url,
00531 int flags = saga::name_space::None)
00532 {
00533 return movepriv(std::string(source_url), dest_url, flags, Tag());
00534 }
00536
00542 void remove (saga::url url, int flags = saga::name_space::None)
00543 {
00544 saga::task t = removepriv(url, flags, saga::task_base::Sync());
00545 t.get_result ();
00546 }
00548 SAGA_CALL_PUB_2_DEF_1(remove, saga::url, int, saga::name_space::None)
00550
00556 void remove (std::string url, int flags = saga::name_space::None)
00557 {
00558 saga::task t = removepriv(url, flags, saga::task_base::Sync());
00559 t.get_result ();
00560 }
00562 SAGA_CALL_PUB_2_DEF_1(remove, std::string, int, saga::name_space::None)
00564
00570 void remove (char const * url, int flags = saga::name_space::None)
00571 {
00572 saga::task t = removepriv(std::string(url), flags, saga::task_base::Sync());
00573 t.get_result ();
00574 }
00576 template <class Tag>
00577 saga::task remove (char const * url, int flags = saga::name_space::None)
00578 {
00579 return removepriv(std::string(url), flags, Tag());
00580 }
00582
00583
00584 using entry::copy;
00585 using entry::link;
00586 using entry::move;
00587 using entry::remove;
00588
00595 void make_dir (saga::url url,
00596 int flags = saga::name_space::None)
00597 {
00598 saga::task t = make_dirpriv(url, flags, saga::task_base::Sync());
00599 t.get_result ();
00600 }
00602 SAGA_CALL_PUB_2_DEF_1(make_dir, saga::url, int, saga::name_space::None)
00604
00612 saga::name_space::entry open (saga::url url,
00613 int flags = saga::name_space::None)
00614 {
00615 saga::task t = openpriv(url, flags, saga::task_base::Sync());
00616 return t.get_result<saga::name_space::entry>();
00617 }
00619 SAGA_CALL_PUB_2_DEF_1(open, saga::url, int, saga::name_space::Read)
00621
00622
00629 saga::name_space::directory open_dir (saga::url url,
00630 int flags = saga::name_space::Read)
00631 {
00632 saga::task t = open_dirpriv(url, flags, saga::task_base::Sync());
00633 return t.get_result<saga::name_space::directory>();
00634 }
00636 SAGA_CALL_PUB_2_DEF_1(open_dir, saga::url, int, saga::name_space::Read)
00638
00639
00640 using entry::permissions_allow;
00641 using entry::permissions_deny;
00642
00652 void permissions_allow (saga::url target, std::string id,
00653 int perm, int flags = None)
00654 {
00655 saga::task t = permissions_allowpriv(target, id, perm, flags, saga::task_base::Sync());
00656 t.get_result ();
00657 }
00659 SAGA_CALL_PUB_4_DEF_1 (permissions_allow, saga::url, std::string,
00660 int, int, None)
00662
00672 void permissions_deny (saga::url target, std::string id,
00673 int perm, int flags = None)
00674 {
00675 saga::task t = permissions_denypriv(target, id, perm, flags, saga::task_base::Sync());
00676 t.get_result ();
00677 }
00679 SAGA_CALL_PUB_4_DEF_1 (permissions_deny, saga::url, std::string,
00680 int, int, None)
00682
00692 void permissions_allow (std::string target, std::string id,
00693 int perm, int flags = None)
00694 {
00695 saga::task t = permissions_allowpriv(target, id, perm, flags, saga::task_base::Sync());
00696 t.get_result ();
00697 }
00699 SAGA_CALL_PUB_4_DEF_1 (permissions_allow, std::string, std::string,
00700 int, int, None)
00702
00712 void permissions_deny (std::string target, std::string id,
00713 int perm, int flags = None)
00714 {
00715 saga::task t = permissions_denypriv(target, id, perm, flags, saga::task_base::Sync());
00716 t.get_result ();
00717 }
00719 SAGA_CALL_PUB_4_DEF_1 (permissions_deny, std::string, std::string,
00720 int, int, None)
00722
00732 void permissions_allow (char const * target, std::string id,
00733 int perm, int flags = None)
00734 {
00735 saga::task t = permissions_allowpriv(std::string(target), id, perm, flags,
00736 saga::task_base::Sync());
00737 t.get_result ();
00738 }
00740 template <class Tag>
00741 saga::task permissions_allow (char const * target, std::string id,
00742 int perm, int flags = None)
00743 {
00744 return permissions_allowpriv(std::string(target), id, perm, flags,
00745 Tag());
00746 }
00748
00758 void permissions_deny (char const * target, std::string id,
00759 int perm, int flags = None)
00760 {
00761 saga::task t = permissions_denypriv(std::string(target), id, perm, flags,
00762 saga::task_base::Sync());
00763 t.get_result ();
00764 }
00766 template <class Tag>
00767 saga::task permissions_deny (char const * target, std::string id,
00768 int perm, int flags = None)
00769 {
00770 return permissions_denypriv(std::string(target), id, perm, flags,
00771 Tag());
00772 }
00774 };
00775
00776 }}
00777
00778 #endif // !defined(SAGA_DEBUG)
00779
00780 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
00781 #pragma wave option(output: null)
00782 #endif
00783
00784 #if defined(BOOST_MSVC)
00785 #pragma warning(pop)
00786 #endif
00787
00788 #endif // SAGA_PACKAGES_DATA_NAMESPACEDIR_HPP
00789