- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Search for |

# directory.hpp

Go to the documentation of this file.

    00001 #ifndef SAGA_DIRECTORY_HPP
    00002 #define SAGA_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) 2005-2007 Andre Merzky (andre@merzky.net)
    00009 //  Copyright (c) 2007 Ole Weidner (oweidner@cct.lsu.edu)
    00010 //
    00011 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
    00012 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
    00013
    00014 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
    00015 #pragma wave option(output: null)
    00016 #endif
    00017
    00018 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
    00019 #pragma once
    00020 #endif
    00021
    00022 // include stl
    00023 #include <string>
    00024
    00025 // include dependent spec sections
    00026 #include <saga/saga/call.hpp>
    00027 #include <saga/saga/base.hpp>
    00028 #include <saga/saga/types.hpp>
    00029 #include <saga/saga/object.hpp>
    00030 #include <saga/saga/session.hpp>
    00031
    00032 #include <saga/saga/packages/namespace/namespace_dir.hpp>
    00033 #include <saga/saga/packages/file/file.hpp>
    00034
    00035 // suppress warnings about dependent classes not being exported from the dll
    00036 #if defined(BOOST_MSVC)
    00037 #pragma warning(push)
    00038 #pragma warning(disable: 4251 4231 4275 4660)
    00039 #endif
    00040
    00041 #ifdef SAGA_DEBUG
    00042 #include <saga/saga/packages/file/preprocessed/directory.hpp>
    00043 #else
    00044
    00045 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
    00046 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/directory.hpp")
    00047 #endif
    00049 namespace saga { namespace filesystem {
    00050
    00055     class SAGA_FILE_PACKAGE_EXPORT directory
    00056         : public saga::name_space::directory
    00057     {
    00058     private:
    00060         // factory
    00061         SAGA_CALL_CREATE_PRIV_3(session const&, saga::url, int)
    00062
    00063
    00064         SAGA_CALL_PRIV_1 (get_size, saga::url)
    00065         SAGA_CALL_PRIV_1 (is_file, saga::url)
    00066
    00067         SAGA_CALL_PRIV_2 (open, saga::url, int)
    00068         SAGA_CALL_PRIV_2 (open_dir, saga::url, int)
    00070
    00071     protected:
    00073
    00074         TR1::shared_ptr <saga::impl::directory> get_impl_sp() const;
    00075         saga::impl::directory* get_impl() const;
    00076         friend class saga::impl::directory;
    00077         explicit directory (saga::impl::directory * init);
    00079
    00080 public:
    00085         directory (session const & s, saga::url url,
    00086                    int mode = ReadWrite);
    00087
    00092         explicit directory (saga::url url, int mode = ReadWrite);
    00093
    00098         explicit directory (saga::object const& o);
    00099
    00104         directory (void);
    00105
    00110         ~directory (void);
    00111
    00115         static directory create(session const& s, saga::url url, int mode = Read)
    00116         {
    00117             return directory(s, url, mode);
    00118         }
    00119         SAGA_CALL_CREATE_3_DEF_1(session const&, saga::url, int, Read)
    00120
    00121
    00123         static directory create(saga::url url, int mode = Read)
    00124         {
    00125             return directory(url, mode);
    00126         }
    00127         template <typename Tag>
    00128         static saga::task create(saga::url url, int mode = Read)
    00129         {
    00130             return create<Tag>(detail::get_the_session(), url, mode);
    00131         }
    00132
    00137         directory &operator= (saga::object const& o);
    00138
    00146         saga::off_t get_size(saga::url url)
    00147         {
    00148             saga::task t = get_sizepriv(url, saga::task_base::Sync());
    00149             return t.get_result<saga::off_t>();
    00150         }
    00152         SAGA_CALL_PUB_1_DEF_0 (get_size, saga::url)
    00154
    00160         bool is_file(saga::url url)
    00161         {
    00162             saga::task t = is_filepriv(url, saga::task_base::Sync());
    00163             return t.get_result<bool>();
    00164         }
    00166         SAGA_CALL_PUB_1_DEF_0(is_file, saga::url)
    00168
    00177         saga::filesystem::file open(saga::url url,
    00178             int flags = saga::filesystem::Read)
    00179         {
    00180             saga::task t = openpriv(url, flags, saga::task_base::Sync());
    00181             return t.get_result<saga::filesystem::file>();
    00182         }
    00184         SAGA_CALL_PUB_2_DEF_1(open, saga::url, int, saga::filesystem::Read)
    00186
    00195         saga::filesystem::directory open_dir(saga::url url,
    00196             int flags = saga::filesystem::ReadWrite)
    00197         {
    00198             saga::task t = open_dirpriv(url, flags, saga::task_base::Sync());
    00199             return t.get_result<saga::filesystem::directory>();
    00200         }
    00202         SAGA_CALL_PUB_2_DEF_1(open_dir, saga::url, int,
    00203                               saga::filesystem::ReadWrite)
    00205
    00206     }; // directory
    00207
    00208 }} // namespace saga::filesystem
    00209
    00210 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
    00211 #pragma wave option(output: null)
    00212 #endif
    00213
    00214 #endif // !defined(SAGA_DEBUG)
    00215
    00216 // re-enable warnings about dependent classes not being exported from the dll
    00217 #if defined(BOOST_MSVC)
    00218 #pragma warning(pop)
    00219 #endif
    00220
    00221 #endif // SAGA_DIRECTORY_HPP