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_sp() const;
00069 saga::impl::namespace_dir* get_impl() const;
00070
00071 friend class saga::impl::namespace_dir;
00072
00073 typedef saga::name_space::entry::monitorable_base monitorable_base;
00075
00076 private:
00077
00078 SAGA_CALL_CREATE_PRIV_3(session const&, saga::url, int)
00079
00080
00081 SAGA_CALL_PRIV_1(change_dir, saga::url)
00082 SAGA_CALL_CONST_PRIV_2(list, std::string, int)
00083 SAGA_CALL_CONST_PRIV_2(find, std::string, int)
00084
00085 SAGA_CALL_CONST_PRIV_1(read_link, saga::url)
00086 SAGA_CALL_CONST_PRIV_1(exists, saga::url)
00087 SAGA_CALL_CONST_PRIV_1(is_dir, saga::url)
00088 SAGA_CALL_CONST_PRIV_1(is_entry, saga::url)
00089 SAGA_CALL_CONST_PRIV_1(is_link, saga::url)
00090
00091
00092 SAGA_CALL_CONST_PRIV_0(get_num_entries)
00093 SAGA_CALL_CONST_PRIV_1(get_entry, std::size_t)
00094
00095
00096 SAGA_CALL_PRIV_3(copy, saga::url, saga::url, int)
00097 SAGA_CALL_PRIV_3(link, saga::url, saga::url, int)
00098 SAGA_CALL_PRIV_3(move, saga::url, saga::url, int)
00099 SAGA_CALL_PRIV_2(remove, saga::url, int)
00100 SAGA_CALL_PRIV_2(make_dir, saga::url, int)
00101
00102
00103 SAGA_CALL_PRIV_2(open, saga::url, int)
00104 SAGA_CALL_PRIV_2(open_dir, saga::url, int)
00105
00106
00107 SAGA_CALL_PRIV_3(copy, std::string, saga::url, int)
00108 SAGA_CALL_PRIV_3(link, std::string, saga::url, int)
00109 SAGA_CALL_PRIV_3(move, std::string, saga::url, int)
00110 SAGA_CALL_PRIV_2(remove, std::string, int)
00111
00112
00113 SAGA_CALL_PRIV_4(permissions_allow, saga::url, std::string, int, int)
00114 SAGA_CALL_PRIV_4(permissions_deny, saga::url, std::string, int, int)
00115 SAGA_CALL_PRIV_4(permissions_allow, std::string, std::string, int, int)
00116 SAGA_CALL_PRIV_4(permissions_deny, std::string, std::string, int, int)
00117
00118 protected:
00120
00121 directory (saga::impl::namespace_dir *);
00123
00124 public:
00129 directory (session const& s, saga::url url, int mode = Read,
00130 saga::object::type t = saga::object::NSDirectory);
00131
00136 explicit directory (saga::url url, int mode = Read,
00137 saga::object::type t = saga::object::NSDirectory);
00138
00143 explicit directory (saga::object const& o);
00144
00149 directory (void);
00150
00155 ~directory (void);
00156
00160 static directory create(session const & s, saga::url url, int mode = Read)
00161 {
00162 return directory(s, url, mode);
00163 }
00164 SAGA_CALL_CREATE_3_DEF_1(session const&, saga::url, int, Read)
00165
00166
00168 static directory create(saga::url url, int mode = Read)
00169 {
00170 return directory(url, mode);
00171 }
00172 template <typename Tag>
00173 static saga::task create(saga::url url, int mode = Read)
00174 {
00175 return create<Tag>(detail::get_the_session(), url, mode);
00176 }
00177
00182 directory &operator= (saga::object const& o);
00183
00190 void change_dir (saga::url target)
00191 {
00192 saga::task t = change_dirpriv(target, saga::task_base::Sync());
00193 t.get_result ();
00194 }
00196 SAGA_CALL_PUB_1_DEF_0(change_dir, saga::url)
00198
00199
00206 std::vector<saga::url> list (std::string pattern = "*",
00207 int flags = saga::name_space::None) const
00208 {
00209 saga::task t = listpriv(pattern, flags, saga::task_base::Sync());
00210 return t.get_result<std::vector<saga::url> >();
00211 }
00213 SAGA_CALL_CONST_PUB_2_DEF_2(list, std::string,
00214 "*", int, saga::name_space::None)
00216
00217
00225 std::vector<saga::url> find (std::string pattern,
00226 int flags = saga::name_space::Recursive) const
00227 {
00228 saga::task t = findpriv(pattern, flags, saga::task_base::Sync());
00229 return t.get_result<std::vector<saga::url> >();
00230 }
00232 SAGA_CALL_CONST_PUB_2_DEF_1(find, std::string,
00233 int, saga::name_space::Recursive)
00235
00242 saga::url read_link (saga::url url) const
00243 {
00244 saga::task t = read_linkpriv(url, saga::task_base::Sync());
00245 return t.get_result<saga::url>();
00246 }
00248 SAGA_CALL_CONST_PUB_1_DEF_0(read_link, saga::url)
00250
00251
00258 bool exists (saga::url url) const
00259 {
00260 saga::task t = existspriv(url, saga::task_base::Sync());
00261 return t.get_result<bool>();
00262 }
00264 SAGA_CALL_CONST_PUB_1_DEF_0(exists, saga::url)
00266
00267
00274 bool is_dir (saga::url url) const
00275 {
00276 saga::task t = is_dirpriv(url, saga::task_base::Sync());
00277 return t.get_result<bool>();
00278 }
00280 SAGA_CALL_CONST_PUB_1_DEF_0(is_dir, saga::url)
00282
00283
00290 bool is_entry (saga::url url) const
00291 {
00292 saga::task t = is_entrypriv(url, saga::task_base::Sync());
00293 return t.get_result<bool>();
00294 }
00296 SAGA_CALL_CONST_PUB_1_DEF_0(is_entry, saga::url)
00298
00299
00307 bool is_link (saga::url url) const
00308 {
00309 saga::task t = is_linkpriv(url, saga::task_base::Sync());
00310 return t.get_result<bool>();
00311 }
00313 SAGA_CALL_CONST_PUB_1_DEF_0 (is_link, saga::url)
00315
00316
00317 using entry::read_link;
00318 using entry::is_dir;
00319 using entry::is_entry;
00320 using entry::is_link;
00321
00328 std::size_t get_num_entries (void) const
00329 {
00330 saga::task t = get_num_entriespriv(saga::task_base::Sync());
00331 return t.get_result<std::size_t>();
00332 }
00334 SAGA_CALL_CONST_PUB_0_DEF_0(get_num_entries)
00336
00337
00345 saga::url get_entry (std::size_t entry) const
00346 {
00347 saga::task t = get_entrypriv(entry, saga::task_base::Sync());
00348 return t.get_result<saga::url>();
00349 }
00351 SAGA_CALL_CONST_PUB_1_DEF_0(get_entry, unsigned int)
00353
00361 void copy (saga::url source_url, saga::url dest_url,
00362 int flags = saga::name_space::None)
00363 {
00364 saga::task t = copypriv(source_url, dest_url, flags, saga::task_base::Sync());
00365 t.get_result ();
00366 }
00368 SAGA_CALL_PUB_3_DEF_1 (copy, saga::url, saga::url, int,
00369 saga::name_space::None)
00371
00372
00380 void copy (std::string source_url, saga::url dest_url,
00381 int flags = saga::name_space::None)
00382 {
00383 saga::task t = copypriv(source_url, dest_url, flags, saga::task_base::Sync());
00384 t.get_result ();
00385 }
00387 SAGA_CALL_PUB_3_DEF_1 (copy, std::string, saga::url, int,
00388 saga::name_space::None)
00390
00391
00399 void copy (char const * source_url, saga::url dest_url,
00400 int flags = saga::name_space::None)
00401 {
00402 saga::task t = copypriv(std::string(source_url), dest_url, flags, saga::task_base::Sync());
00403 t.get_result ();
00404 }
00406 template <class Tag>
00407 saga::task copy (char const * source_url, saga::url dest_url,
00408 int flags = saga::name_space::None)
00409 {
00410 return copypriv(std::string(source_url), dest_url, flags, Tag());
00411 }
00413
00424 void link (saga::url source_url, saga::url dest_url,
00425 int flags = saga::name_space::None)
00426 {
00427 saga::task t = linkpriv(source_url, dest_url, flags, saga::task_base::Sync());
00428 t.get_result ();
00429 }
00431 SAGA_CALL_PUB_3_DEF_1(link, saga::url, saga::url, int,
00432 saga::name_space::None)
00434
00435
00445 void link (std::string source_url, saga::url dest_url,
00446 int flags = saga::name_space::None)
00447 {
00448 saga::task t = linkpriv(source_url, dest_url, flags, saga::task_base::Sync());
00449 t.get_result ();
00450 }
00452 SAGA_CALL_PUB_3_DEF_1(link, std::string, saga::url, int,
00453 saga::name_space::None)
00455
00456
00466 void link (char const * source_url, saga::url dest_url,
00467 int flags = saga::name_space::None)
00468 {
00469 saga::task t = linkpriv(std::string(source_url), dest_url, flags, saga::task_base::Sync());
00470 t.get_result ();
00471 }
00473 template <class Tag>
00474 saga::task link (char const * source_url, saga::url dest_url,
00475 int flags = saga::name_space::None)
00476 {
00477 return linkpriv(std::string(source_url), dest_url, flags, Tag());
00478 }
00480
00491 void move (saga::url source_url, saga::url dest_url,
00492 int flags = saga::name_space::None)
00493 {
00494 saga::task t = movepriv(source_url, dest_url, flags, saga::task_base::Sync());
00495 t.get_result ();
00496 }
00498 SAGA_CALL_PUB_3_DEF_1(move, saga::url, saga::url, int,
00499 saga::name_space::None)
00501
00502
00512 void move (std::string source_url, saga::url dest_url,
00513 int flags = saga::name_space::None)
00514 {
00515 saga::task t = movepriv(source_url, dest_url, flags, saga::task_base::Sync());
00516 t.get_result ();
00517 }
00519 SAGA_CALL_PUB_3_DEF_1(move, std::string, saga::url, int,
00520 saga::name_space::None)
00522
00523
00533 void move (char const * source_url, saga::url dest_url,
00534 int flags = saga::name_space::None)
00535 {
00536 saga::task t = movepriv(std::string(source_url), dest_url, flags, saga::task_base::Sync());
00537 t.get_result ();
00538 }
00540 template <class Tag>
00541 saga::task move (char const * source_url, saga::url dest_url,
00542 int flags = saga::name_space::None)
00543 {
00544 return movepriv(std::string(source_url), dest_url, flags, Tag());
00545 }
00547
00553 void remove (saga::url url, int flags = saga::name_space::None)
00554 {
00555 saga::task t = removepriv(url, flags, saga::task_base::Sync());
00556 t.get_result ();
00557 }
00559 SAGA_CALL_PUB_2_DEF_1(remove, saga::url, int, saga::name_space::None)
00561
00567 void remove (std::string url, int flags = saga::name_space::None)
00568 {
00569 saga::task t = removepriv(url, flags, saga::task_base::Sync());
00570 t.get_result ();
00571 }
00573 SAGA_CALL_PUB_2_DEF_1(remove, std::string, int, saga::name_space::None)
00575
00581 void remove (char const * url, int flags = saga::name_space::None)
00582 {
00583 saga::task t = removepriv(std::string(url), flags, saga::task_base::Sync());
00584 t.get_result ();
00585 }
00587 template <class Tag>
00588 saga::task remove (char const * url, int flags = saga::name_space::None)
00589 {
00590 return removepriv(std::string(url), flags, Tag());
00591 }
00593
00594
00595 using entry::copy;
00596 using entry::link;
00597 using entry::move;
00598 using entry::remove;
00599
00606 void make_dir (saga::url url,
00607 int flags = saga::name_space::None)
00608 {
00609 saga::task t = make_dirpriv(url, flags, saga::task_base::Sync());
00610 t.get_result ();
00611 }
00613 SAGA_CALL_PUB_2_DEF_1(make_dir, saga::url, int, saga::name_space::None)
00615
00624 saga::name_space::entry open (saga::url url,
00625 int flags = saga::name_space::None)
00626 {
00627 saga::task t = openpriv(url, flags, saga::task_base::Sync());
00628 return t.get_result<saga::name_space::entry>();
00629 }
00631 SAGA_CALL_PUB_2_DEF_1(open, saga::url, int, saga::name_space::Read)
00633
00634
00642 saga::name_space::directory open_dir (saga::url url,
00643 int flags = saga::name_space::Read)
00644 {
00645 saga::task t = open_dirpriv(url, flags, saga::task_base::Sync());
00646 return t.get_result<saga::name_space::directory>();
00647 }
00649 SAGA_CALL_PUB_2_DEF_1(open_dir, saga::url, int, saga::name_space::Read)
00651
00652
00653 using entry::permissions_allow;
00654 using entry::permissions_deny;
00655
00666 void permissions_allow (saga::url target, std::string id,
00667 int perm, int flags = None)
00668 {
00669 saga::task t = permissions_allowpriv(target, id, perm, flags, saga::task_base::Sync());
00670 t.get_result ();
00671 }
00673 SAGA_CALL_PUB_4_DEF_1 (permissions_allow, saga::url, std::string,
00674 int, int, None)
00676
00687 void permissions_deny (saga::url target, std::string id,
00688 int perm, int flags = None)
00689 {
00690 saga::task t = permissions_denypriv(target, id, perm, flags, saga::task_base::Sync());
00691 t.get_result ();
00692 }
00694 SAGA_CALL_PUB_4_DEF_1 (permissions_deny, saga::url, std::string,
00695 int, int, None)
00697
00708 void permissions_allow (std::string target, std::string id,
00709 int perm, int flags = None)
00710 {
00711 saga::task t = permissions_allowpriv(target, id, perm, flags, saga::task_base::Sync());
00712 t.get_result ();
00713 }
00715 SAGA_CALL_PUB_4_DEF_1 (permissions_allow, std::string, std::string,
00716 int, int, None)
00718
00729 void permissions_deny (std::string target, std::string id,
00730 int perm, int flags = None)
00731 {
00732 saga::task t = permissions_denypriv(target, id, perm, flags, saga::task_base::Sync());
00733 t.get_result ();
00734 }
00736 SAGA_CALL_PUB_4_DEF_1 (permissions_deny, std::string, std::string,
00737 int, int, None)
00739
00750 void permissions_allow (char const * target, std::string id,
00751 int perm, int flags = None)
00752 {
00753 saga::task t = permissions_allowpriv(std::string(target), id, perm, flags,
00754 saga::task_base::Sync());
00755 t.get_result ();
00756 }
00758 template <class Tag>
00759 saga::task permissions_allow (char const * target, std::string id,
00760 int perm, int flags = None)
00761 {
00762 return permissions_allowpriv(std::string(target), id, perm, flags,
00763 Tag());
00764 }
00766
00777 void permissions_deny (char const * target, std::string id,
00778 int perm, int flags = None)
00779 {
00780 saga::task t = permissions_denypriv(std::string(target), id, perm, flags,
00781 saga::task_base::Sync());
00782 t.get_result ();
00783 }
00785 template <class Tag>
00786 saga::task permissions_deny (char const * target, std::string id,
00787 int perm, int flags = None)
00788 {
00789 return permissions_denypriv(std::string(target), id, perm, flags,
00790 Tag());
00791 }
00793 };
00794
00795 }}
00796
00797 #endif // !defined(SAGA_DEBUG)
00798
00799 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
00800 #pragma wave option(output: null)
00801 #endif
00802
00803 #if defined(BOOST_MSVC)
00804 #pragma warning(pop)
00805 #endif
00806
00807 #endif // SAGA_PACKAGES_DATA_NAMESPACEDIR_HPP
00808