1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: versionhelper.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_testshl2.hxx"
35 #include "testshl/versionhelper.hxx"
37 #include <rtl/ustring.hxx>
38 #include <rtl/string.hxx>
40 // -----------------------------------------------------------------------------
41 VersionHelper::VersionHelper(rtl::OUString
const& _sDLLName
, GetOpt
& _aOptions
)
42 :DynamicLibraryHelper(_sDLLName
, _aOptions
),
45 // try to get the entry pointer
46 FktGetVersionInfoPtr pFunc
= (FktGetVersionInfoPtr
)
47 m_pModule
->getFunctionSymbol(
48 rtl::OUString::createFromAscii( "GetVersionInfo" ) );
52 const VersionInfo
*pVersion
= (pFunc
)();
57 //# void VersionHelper::print(std::ostream &stream)
59 //# stream << " Time:" << getTime() << std::endl;
60 //# stream << " Date:" << getDate() << std::endl;
61 //# stream << " Upd:" << getUpd() << std::endl;
62 //# stream << " Minor:" << getMinor() << std::endl;
63 //# stream << " Build:" << getBuild() << std::endl;
64 //# stream << "Inpath:" << getInpath() << std::endl;
67 //# std::ostream & operator <<( std::ostream &stream, VersionHelper &_aVersion )
69 //# _aVersion.print (stream);
73 // -----------------------------------------------------------------------------
75 bool VersionHelper::isOk() const
77 if (m_pInfo
!= NULL
) return true;
81 rtl::OString
VersionHelper::getTime() const
83 return m_pInfo
->pTime
;
85 rtl::OString
VersionHelper::getDate() const
87 return m_pInfo
->pDate
;
89 rtl::OString
VersionHelper::getUpd() const
93 rtl::OString
VersionHelper::getMinor() const
95 return m_pInfo
->pMinor
;
97 rtl::OString
VersionHelper::getBuild() const
99 return m_pInfo
->pBuild
;
101 rtl::OString
VersionHelper::getInpath() const
103 return m_pInfo
->pInpath
;
108 void VersionHelper::printall(FILE * out
)
112 rtl::OString aStr
= getTime();
113 fprintf(out
, " Time:%s\n", aStr
.getStr() );
114 fprintf(out
, " Date:%s\n", getDate().getStr() );
115 fprintf(out
, " Upd:%s\n", getUpd().getStr() );
116 fprintf(out
, " Minor:%s\n", getMinor().getStr() );
117 fprintf(out
, " Build:%s\n", getBuild().getStr() );
118 fprintf(out
, "Inpath:%s\n", getInpath().getStr());
124 fprintf(stderr
, "error: No version info found.\n");