Skip to content
Snippets Groups Projects
  • Nat Goodspeed's avatar
    cfd17448
    CHOP-960: Validate cmd_line.xml for map-to real settings.xml vars. · cfd17448
    Nat Goodspeed authored
    A small, fixed set of cmd_line.xml switches can't reasonably be mapped to
    settings variables, mostly because they affect the settings machinery itself.
    Other than those, every new cmd_line.xml switch should map-to a settings
    variable. Validate that only the known set does not have map-to; validate that
    map-to variable actually exists.
    cfd17448
    History
    CHOP-960: Validate cmd_line.xml for map-to real settings.xml vars.
    Nat Goodspeed authored
    A small, fixed set of cmd_line.xml switches can't reasonably be mapped to
    settings variables, mostly because they affect the settings machinery itself.
    Other than those, every new cmd_line.xml switch should map-to a settings
    variable. Validate that only the known set does not have map-to; validate that
    map-to variable actually exists.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
llcommandlineparser.cpp 18.88 KiB
/**
 * @file llcommandlineparser.cpp
 * @brief The LLCommandLineParser class definitions
 *
 * $LicenseInfo:firstyear=2007&license=viewerlgpl$
 * Second Life Viewer Source Code
 * Copyright (C) 2010, Linden Research, Inc.
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation;
 * version 2.1 of the License only.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * 
 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 * $/LicenseInfo$
 */ 

#include "llviewerprecompiledheaders.h"
#include "llcommandlineparser.h"

// *NOTE: The boost::lexical_cast generates 
// the warning C4701(local used with out assignment) in VC7.1.
// Disable the warning for the boost includes.
#if _MSC_VER
#   pragma warning(push)
#   pragma warning( disable : 4701 )
#else
// NOTE: For the other platforms?
#endif

#include <boost/program_options.hpp>
#include <boost/bind.hpp>
#include <boost/tokenizer.hpp>
#include <boost/assign/list_of.hpp>

#if _MSC_VER
#   pragma warning(pop)
#endif

#include "llsdserialize.h"
#include "llerror.h"
#include <string>
#include <set>
#include <iostream>
#include <sstream>

#include "llcontrol.h"

namespace po = boost::program_options;

// *NOTE:MEP - Currently the boost object reside in file scope.
// This has a couple of negatives, they are always around and 
// there can be only one instance of each. 
// The plus is that the boost-ly-ness of this implementation is 
// hidden from the rest of the world. 
// Its importatnt to realize that multiple LLCommandLineParser objects 
// will all have this single repository of option escs and parsed options.
// This could be good or bad, and probably won't matter for most use cases.
namespace 
{
    // List of command-line switches that can't map-to settings variables.