llvm/third-party/benchmark/src/commandlineflags.cc

// Copyright 2015 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "commandlineflags.h"

#include <algorithm>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <limits>
#include <map>
#include <utility>

#include "../src/string_util.h"

namespace benchmark {
namespace {

// Parses 'str' for a 32-bit signed integer.  If successful, writes
// the result to *value and returns true; otherwise leaves *value
// unchanged and returns false.
bool ParseInt32(const std::string& src_text, const char* str, int32_t* value) {}

// Parses 'str' for a double.  If successful, writes the result to *value and
// returns true; otherwise leaves *value unchanged and returns false.
bool ParseDouble(const std::string& src_text, const char* str, double* value) {}

// Parses 'str' into KV pairs. If successful, writes the result to *value and
// returns true; otherwise leaves *value unchanged and returns false.
bool ParseKvPairs(const std::string& src_text, const char* str,
                  std::map<std::string, std::string>* value) {}

// Returns the name of the environment variable corresponding to the
// given flag.  For example, FlagToEnvVar("foo") will return
// "BENCHMARK_FOO" in the open-source version.
static std::string FlagToEnvVar(const char* flag) {}

}  // namespace

BENCHMARK_EXPORT
bool BoolFromEnv(const char* flag, bool default_val) {}

BENCHMARK_EXPORT
int32_t Int32FromEnv(const char* flag, int32_t default_val) {}

BENCHMARK_EXPORT
double DoubleFromEnv(const char* flag, double default_val) {}

BENCHMARK_EXPORT
const char* StringFromEnv(const char* flag, const char* default_val) {}

BENCHMARK_EXPORT
std::map<std::string, std::string> KvPairsFromEnv(
    const char* flag, std::map<std::string, std::string> default_val) {}

// Parses a string as a command line flag.  The string should have
// the format "--flag=value".  When def_optional is true, the "=value"
// part can be omitted.
//
// Returns the value of the flag, or nullptr if the parsing failed.
const char* ParseFlagValue(const char* str, const char* flag,
                           bool def_optional) {}

BENCHMARK_EXPORT
bool ParseBoolFlag(const char* str, const char* flag, bool* value) {}

BENCHMARK_EXPORT
bool ParseInt32Flag(const char* str, const char* flag, int32_t* value) {}

BENCHMARK_EXPORT
bool ParseDoubleFlag(const char* str, const char* flag, double* value) {}

BENCHMARK_EXPORT
bool ParseStringFlag(const char* str, const char* flag, std::string* value) {}

BENCHMARK_EXPORT
bool ParseKeyValueFlag(const char* str, const char* flag,
                       std::map<std::string, std::string>* value) {}

BENCHMARK_EXPORT
bool IsFlag(const char* str, const char* flag) {}

BENCHMARK_EXPORT
bool IsTruthyFlagValue(const std::string& value) {}

}  // end namespace benchmark