SAGA Adaptor CPI v.1.0
|
00001 #ifndef SAGA_SAGA_PACKAGES_DATA_LOGICAL_FILE_ADVERT_DIRECTORY_HPP 00002 #define SAGA_SAGA_PACKAGES_DATA_LOGICAL_FILE_ADVERT_DIRECTORY_HPP 00003 00004 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES) 00005 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/directory.hpp") 00006 #endif 00007 // Copyright (c) 2005-2009 Hartmut Kaiser 00008 // Copyright (c) 2007 Ole Weidner (oweidner@cct.lsu.edu) 00009 // 00010 // Distributed under the Boost Software License, Version 1.0. (See accompanying 00011 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 00012 00013 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES) 00014 #pragma wave option(output: null) 00015 #endif 00016 00017 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 00018 #pragma once 00019 #endif 00020 00021 // include stl 00022 #include <string> 00023 00024 // include dependent spec sections 00025 #include <saga/saga/util.hpp> 00026 #include <saga/saga/base.hpp> 00027 #include <saga/saga/call.hpp> 00028 #include <saga/saga/types.hpp> 00029 #include <saga/saga/object.hpp> 00030 #include <saga/saga/session.hpp> 00031 #include <saga/saga/detail/attribute.hpp> 00032 #include <saga/saga/detail/monitorable.hpp> 00033 00034 #include <saga/saga/packages/namespace/namespace_dir.hpp> 00035 #include <saga/saga/packages/advert/advert.hpp> 00036 00037 // suppress warnings about dependent classes not being exported from the dll 00038 #if defined(BOOST_MSVC) 00039 #pragma warning(push) 00040 #pragma warning(disable: 4251 4231 4275 4660) 00041 #endif 00042 00043 #ifdef SAGA_DEBUG 00044 #include <saga/saga/packages/filesystem/preprocessed/directory.hpp> 00045 #else 00046 00047 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES) 00048 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/directory.hpp") 00049 #endif 00050 00051 namespace saga 00052 { 00053 namespace advert { 00054 00055 namespace metrics 00056 { 00061 char const* const directory_created_entry = "directory.CreatedEntry"; 00062 00067 char const* const directory_modified_entry = "directory.ModifiedEntry"; 00068 00073 char const* const directory_deleted_entry = "directory.DeletedEntry"; 00074 } 00075 00082 class SAGA_ADVERT_PACKAGE_EXPORT directory 00083 : public saga::name_space::directory, public saga::detail::attribute<directory> 00084 { 00085 protected: 00087 00088 friend class saga::impl::advert_directory; 00089 00090 friend struct saga::detail::attribute<directory>; 00091 typedef saga::detail::attribute<directory> attribute_base; 00092 typedef saga::name_space::directory::monitorable_base monitorable_base; 00094 00095 private: 00096 // factory 00097 SAGA_CALL_CREATE_PRIV_3(session const&, saga::url const&, int) 00098 00099 // overload open methods from namespace_dir 00100 SAGA_CALL_PRIV_2(open, saga::url, int) 00101 SAGA_CALL_PRIV_2(open_dir, saga::url, int) 00102 SAGA_CALL_PRIV_3(find, std::string, std::vector<std::string>, int) 00103 00104 protected: 00106 00107 TR1::shared_ptr <saga::impl::advert_directory> get_impl_sp() const; 00108 saga::impl::advert_directory* get_impl() const; 00109 explicit directory(saga::impl::advert_directory *impl); 00111 00112 public: 00116 directory (saga::session const& s, saga::url url, 00117 int mode = saga::advert::ReadWrite); 00118 00122 explicit 00123 directory (saga::url url, int mode = saga::advert::ReadWrite); 00124 00127 explicit directory (saga::object const& other); 00128 00131 directory (void); 00132 00136 ~directory (void); 00137 00141 static directory create(session const& s, saga::url const& url, 00142 int mode = Read) 00143 { 00144 return directory(s, url, mode); 00145 } 00147 SAGA_CALL_CREATE_3_DEF_1(session const&, saga::url const&, int, Read) 00149 00152 static directory create(saga::url const& url, int mode = Read) 00153 { 00154 return directory(url, mode); 00155 } 00156 template <typename Tag> 00157 static saga::task create(saga::url const& url, int mode = Read) 00158 { 00159 return create<Tag>(detail::get_the_session(), url, mode); 00160 } 00161 00165 directory &operator= (saga::object const& o); 00166 00169 advert::entry open (saga::url url, int mode = saga::advert::Read) 00170 { 00171 saga::task t = openpriv (url, mode, saga::task_base::Sync()); 00172 return t.get_result<saga::advert::entry>(); 00173 } 00174 SAGA_CALL_PUB_2_DEF_1(open, saga::url, int, saga::advert::Read) 00175 00176 00179 advert::directory open_dir (saga::url url, int mode = saga::advert::Read) 00180 { 00181 saga::task t = open_dirpriv (url, mode, saga::task_base::Sync()); 00182 return t.get_result<saga::advert::directory>(); 00183 } 00184 SAGA_CALL_PUB_2_DEF_1(open_dir, saga::url, int, saga::advert::Read) 00185 00186 00189 std::vector<saga::url> 00190 find (std::string name, std::vector<std::string> pattern, 00191 int flags = saga::advert::None) 00192 { 00193 saga::task t = findpriv (name, pattern, flags, saga::task_base::Sync()); 00194 return t.get_result<std::vector<saga::url> >(); 00195 } 00196 SAGA_CALL_PUB_3_DEF_1 (find, std::string, 00197 std::vector<std::string>, int, saga::advert::None) 00198 00199 }; // class directory 00200 00201 }} // namespace saga::advert 00202 00203 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES) 00204 #pragma wave option(output: null) 00205 #endif 00206 00207 #endif // !defined(SAGA_DEBUG) 00208 00209 // re-enable warnings about dependent classes not being exported from the dll 00210 #if defined(BOOST_MSVC) 00211 #pragma warning(pop) 00212 #endif 00213 00214 #endif // SAGA_SAGA_PACKAGES_DATA_LOGICAL_FILE_ADVERT_DIRECTORY_HPP