PageRenderTime 33ms CodeModel.GetById 19ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llversioninfo.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 136 lines | 72 code | 19 blank | 45 comment | 3 complexity | 2fe5cffbbf88e74276693039874671c2 MD5 | raw file
  1/** 
  2 * @file llversioninfo.cpp
  3 * @brief Routines to access the viewer version and build information
  4 * @author Martin Reddy
  5 *
  6 * $LicenseInfo:firstyear=2009&license=viewerlgpl$
  7 * Second Life Viewer Source Code
  8 * Copyright (C) 2010, Linden Research, Inc.
  9 * 
 10 * This library is free software; you can redistribute it and/or
 11 * modify it under the terms of the GNU Lesser General Public
 12 * License as published by the Free Software Foundation;
 13 * version 2.1 of the License only.
 14 * 
 15 * This library is distributed in the hope that it will be useful,
 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 18 * Lesser General Public License for more details.
 19 * 
 20 * You should have received a copy of the GNU Lesser General Public
 21 * License along with this library; if not, write to the Free Software
 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 23 * 
 24 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 25 * $/LicenseInfo$
 26 */
 27
 28#include "llviewerprecompiledheaders.h"
 29#include "llversioninfo.h"
 30
 31#include "llversionviewer.h"
 32
 33//
 34// Set the version numbers in indra/llcommon/llversionviewer.h
 35//
 36
 37//static
 38S32 LLVersionInfo::getMajor()
 39{
 40	return LL_VERSION_MAJOR;
 41}
 42
 43//static
 44S32 LLVersionInfo::getMinor()
 45{
 46	return LL_VERSION_MINOR;
 47}
 48
 49//static
 50S32 LLVersionInfo::getPatch()
 51{
 52	return LL_VERSION_PATCH;
 53}
 54
 55//static
 56S32 LLVersionInfo::getBuild()
 57{
 58	return LL_VERSION_BUILD;
 59}
 60
 61//static
 62const std::string &LLVersionInfo::getVersion()
 63{
 64	static std::string version("");
 65
 66	if (version.empty())
 67	{
 68		// cache the version string
 69		std::ostringstream stream;
 70		stream << LL_VERSION_MAJOR << "."
 71		       << LL_VERSION_MINOR << "."
 72		       << LL_VERSION_PATCH << "."
 73		       << LL_VERSION_BUILD;
 74		version = stream.str();
 75	}
 76
 77	return version;
 78}
 79
 80//static
 81const std::string &LLVersionInfo::getShortVersion()
 82{
 83	static std::string version("");
 84
 85	if (version.empty())
 86	{
 87		// cache the version string
 88		std::ostringstream stream;
 89		stream << LL_VERSION_MAJOR << "."
 90		       << LL_VERSION_MINOR << "."
 91		       << LL_VERSION_PATCH;
 92		version = stream.str();
 93	}
 94
 95	return version;
 96}
 97
 98namespace
 99{
100	/// Storage of the channel name the viewer is using.
101	//  The channel name is set by hardcoded constant, 
102	//  or by calling LLVersionInfo::resetChannel()
103	std::string sWorkingChannelName(LL_CHANNEL);
104
105	// Storage for the "version and channel" string.
106	// This will get reset too.
107	std::string sVersionChannel("");
108}
109
110//static
111const std::string &LLVersionInfo::getChannelAndVersion()
112{
113	if (sVersionChannel.empty())
114	{
115		// cache the version string
116		std::ostringstream stream;
117		stream << LLVersionInfo::getChannel()
118			   << " "
119			   << LLVersionInfo::getVersion();
120		sVersionChannel = stream.str();
121	}
122
123	return sVersionChannel;
124}
125
126//static
127const std::string &LLVersionInfo::getChannel()
128{
129	return sWorkingChannelName;
130}
131
132void LLVersionInfo::resetChannel(const std::string& channel)
133{
134	sWorkingChannelName = channel;
135	sVersionChannel.clear(); // Reset version and channel string til next use.
136}