Added member ProgramOptions::firstValue()

This commit is contained in:
sigurdp 2013-12-04 11:49:05 +01:00
parent f2821cf9be
commit 4db4e44668
2 changed files with 21 additions and 2 deletions

View File

@ -1,7 +1,7 @@
//################################################################################################## //##################################################################################################
// //
// Custom Visualization Core library // Custom Visualization Core library
// Copyright (C) 2011-2013 Ceetron AS // Copyright (C) Ceetron Solutions AS
// //
// This library may be used under the terms of either the GNU General Public License or // This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows: // the GNU Lesser General Public License as follows:
@ -392,6 +392,7 @@ std::vector<String> ProgramOptions::values(const String& optionName) const
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -412,6 +413,23 @@ String ProgramOptions::combinedValues(const String& optionName) const
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::String ProgramOptions::firstValue(const String& optionName) const
{
const ParsedOption* parsedOption = findParsedOption(optionName);
if (parsedOption && parsedOption->m_values.size() > 0)
{
return parsedOption->m_values[0];
}
else
{
return String();
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
//################################################################################################## //##################################################################################################
// //
// Custom Visualization Core library // Custom Visualization Core library
// Copyright (C) 2011-2013 Ceetron AS // Copyright (C) Ceetron Solutions AS
// //
// This library may be used under the terms of either the GNU General Public License or // This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows: // the GNU Lesser General Public License as follows:
@ -88,6 +88,7 @@ public:
size_t valueCount(const String& optionName) const; size_t valueCount(const String& optionName) const;
std::vector<String> values(const String& optionName) const; std::vector<String> values(const String& optionName) const;
String combinedValues(const String& optionName) const; String combinedValues(const String& optionName) const;
String firstValue(const String& optionName) const;
std::vector<String> positionalParameters() const; std::vector<String> positionalParameters() const;