PageRenderTime 59ms CodeModel.GetById 54ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/mordor/streams/std.cpp

http://github.com/mozy/mordor
C++ | 23 lines | 17 code | 5 blank | 1 comment | 4 complexity | 761977d338d2dc98256d033e44f77fa6 MD5 | raw file
 1// Copyright (c) 2009 - Mozy, Inc.
 2
 3#include "std.h"
 4
 5#include "mordor/exception.h"
 6
 7namespace Mordor {
 8
 9StdStream::StdStream(IOManager *ioManager, Scheduler *scheduler, int stream)
10{
11#ifdef WINDOWS
12    HANDLE hFile = GetStdHandle(stream);
13    if (hFile == INVALID_HANDLE_VALUE)
14        MORDOR_THROW_EXCEPTION_FROM_LAST_ERROR_API("GetStdHandle");
15    if (hFile == NULL)
16        MORDOR_THROW_EXCEPTION_FROM_ERROR_API(ERROR_FILE_NOT_FOUND, "GetStdHandle");
17    init(hFile, ioManager, scheduler, false);
18#else
19    init(stream, ioManager, scheduler, stream);
20#endif
21}
22
23}