root / windows / trunk / libs / poco / include / Poco / LogFile_WIN32U.h @ 23

View | Annotate | Download (2.4 KB)

1 23 jake
//
2 23 jake
// LogFile_WIN32U.h
3 23 jake
//
4 23 jake
// $Id: //poco/1.3/Foundation/include/Poco/LogFile_WIN32U.h#3 $
5 23 jake
//
6 23 jake
// Library: Foundation
7 23 jake
// Package: Logging
8 23 jake
// Module:  LogFile
9 23 jake
//
10 23 jake
// Definition of the LogFileImpl class using the Windows file APIs.
11 23 jake
//
12 23 jake
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
13 23 jake
// and Contributors.
14 23 jake
//
15 23 jake
// Permission is hereby granted, free of charge, to any person or organization
16 23 jake
// obtaining a copy of the software and accompanying documentation covered by
17 23 jake
// this license (the "Software") to use, reproduce, display, distribute,
18 23 jake
// execute, and transmit the Software, and to prepare derivative works of the
19 23 jake
// Software, and to permit third-parties to whom the Software is furnished to
20 23 jake
// do so, all subject to the following:
21 23 jake
//
22 23 jake
// The copyright notices in the Software and this entire statement, including
23 23 jake
// the above license grant, this restriction and the following disclaimer,
24 23 jake
// must be included in all copies of the Software, in whole or in part, and
25 23 jake
// all derivative works of the Software, unless such copies or derivative
26 23 jake
// works are solely in the form of machine-executable object code generated by
27 23 jake
// a source language processor.
28 23 jake
//
29 23 jake
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 23 jake
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 23 jake
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
32 23 jake
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
33 23 jake
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
34 23 jake
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
35 23 jake
// DEALINGS IN THE SOFTWARE.
36 23 jake
//
37 23 jake
38 23 jake
39 23 jake
#ifndef Foundation_LogFile_WIN32U_INCLUDED
40 23 jake
#define Foundation_LogFile_WIN32U_INCLUDED
41 23 jake
42 23 jake
43 23 jake
#include "Poco/Foundation.h"
44 23 jake
#include "Poco/Timestamp.h"
45 23 jake
#include "Poco/UnWindows.h"
46 23 jake
47 23 jake
48 23 jake
namespace Poco {
49 23 jake
50 23 jake
51 23 jake
class Foundation_API LogFileImpl
52 23 jake
        /// The implementation of LogFile for Windows.
53 23 jake
        /// The native filesystem APIs are used for
54 23 jake
        /// total control over locking behavior.
55 23 jake
{
56 23 jake
public:
57 23 jake
        LogFileImpl(const std::string& path);
58 23 jake
        ~LogFileImpl();
59 23 jake
        void writeImpl(const std::string& text);
60 23 jake
        UInt64 sizeImpl() const;
61 23 jake
        Timestamp creationDateImpl() const;
62 23 jake
        const std::string& pathImpl() const;
63 23 jake
64 23 jake
private:
65 23 jake
        void createFile();
66 23 jake
67 23 jake
        std::string _path;
68 23 jake
        HANDLE      _hFile;
69 23 jake
        Timestamp   _creationDate;
70 23 jake
};
71 23 jake
72 23 jake
73 23 jake
} // namespace Poco
74 23 jake
75 23 jake
76 23 jake
#endif // Foundation_LogFile_WIN32U_INCLUDED