1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license that can
* be found in the License.html file in the root of the source tree.
*/
#if defined(STREAM_MISSING)
#else
#include <iostream>
#endif
#include <fstream>
#include "ZenLib/Ztring.h"
#ifdef __WINDOWS__
#undef __TEXT
#include <windows.h>
#endif
//---------------------------------------------------------------------------
#ifndef ConfigH
#define ConfigH
//---------------------------------------------------------------------------
// Return value for parsing
enum DaemonReturnValue
{
DAEMON_RETURN_ERROR = -1,
DAEMON_RETURN_NONE = 0,
DAEMON_RETURN_FINISH = 1,
};
//---------------------------------------------------------------------------
//Get command line args in main()
#ifdef UNICODE
#ifdef _WIN32
#define GETCOMMANDLINE() \
MediaInfoNameSpace::Char** argv=CommandLineToArgvW(GetCommandLineW(), &argc); \
#else //WIN32
#define GETCOMMANDLINE() \
std::vector<MediaInfoNameSpace::String> argv; \
for (int Pos=0; Pos<argc; Pos++) \
{ \
ZenLib::Ztring A; \
A.From_Local(argv_ansi[Pos]); \
argv.push_back(A); \
} \
#endif //WIN32
#else //UNICODE
#define GETCOMMANDLINE() \
MediaInfoNameSpace::Char** argv=argv_ansi; \
#endif //UNICODE
//---------------------------------------------------------------------------
//Write to terminal
inline void STRINGOUT(ZenLib::Ztring Text)
{
#ifdef UNICODE
#if defined(STREAM_MISSING)
wprintf(L"%ls\n", Text.c_str());
#elif defined(_MSC_VER)
std::wcout<<Text.c_str()<<std::endl;
#else //_MSC_VER
std::cout<<Text.To_Local().c_str()<<std::endl;
#endif //_MSC_VER
#else // UNICODE
#if defined(STREAM_MISSING)
fprintf(stdout, "%s\n", Text.c_str());
#else
std::cout<<Text.c_str()<<std::endl;
#endif //_MSC_VER
#endif // UNICODE
}
inline void STRINGERR(ZenLib::Ztring Text)
{
#ifdef UNICODE
#if defined(STREAM_MISSING)
fwprintf(stderr, L"%ls\n", Text.c_str());
#elif defined(_MSC_VER)
std::wcerr<<Text.c_str()<<std::endl;
#else //_MSC_VER
std::cerr<<Text.To_Local().c_str()<<std::endl;
#endif //_MSC_VER
#else // UNICODE
#if defined(STREAM_MISSING)
fprintf(stderr, "%s\n", Text.c_str());
#else
std::cerr<<Text.c_str()<<std::endl;
#endif //_MSC_VER
#endif // UNICODE
}
inline void TEXTOUT(const char* Text)
{
STRINGOUT(ZenLib::Ztring().From_ISO_8859_1(Text));
}
#endif
|