TPIE

v1.1rc1-6-g0c97303
win32.h
Go to the documentation of this file.
1 // -*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*-
2 // vi:set ts=4 sts=4 sw=4 noet :
3 // Copyright 2009, 2010, The TPIE development team
4 //
5 // This file is part of TPIE.
6 //
7 // TPIE is free software: you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License as published by the
9 // Free Software Foundation, either version 3 of the License, or (at your
10 // option) any later version.
11 //
12 // TPIE is distributed in the hope that it will be useful, but WITHOUT ANY
13 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 // License for more details.
16 //
17 // You should have received a copy of the GNU Lesser General Public License
18 // along with TPIE. If not, see <http://www.gnu.org/licenses/>
19 
23 
24 #ifndef _TPIE_FILE_ACCESSOR_WIN32_H
25 #define _TPIE_FILE_ACCESSOR_WIN32_H
26 
27 #include <tpie/config.h>
28 
29 #include <io.h>
30 #include <windows.h>
31 #undef NO_ERROR
32 
34 namespace tpie {
35 namespace file_accessor {
36 
40 
41 class win32 {
42 private:
43  HANDLE m_fd;
44  DWORD m_creationFlag;
45 
46 public:
47  inline win32();
48  inline ~win32() {close_i();}
49 
50  inline void open_wo(const std::string & path);
51  inline void open_ro(const std::string & path);
52  inline bool try_open_rw(const std::string & path);
53  inline void open_rw_new(const std::string & path);
54 
55  inline void read_i(void * data, memory_size_type size);
56  inline void write_i(const void * data, memory_size_type size);
57  inline void seek_i(stream_size_type offset);
58  inline void close_i();
59  inline void truncate_i(stream_size_type bytes);
60  inline bool is_open() const;
61 
62  inline void set_cache_hint(cache_hint cacheHint);
63 };
64 
65 }
66 }
67 
68 #include <tpie/file_accessor/win32.inl>
69 
70 #endif //_TPIE_FILE_ACCESSOR_WIN32_H
cache_hint
Definition: cache_hint.h:28
Reads and writes stream headers, user data and blocks from TPIE streams.
Win32 file accessor.
Definition: win32.h:41