Program Listing for File arguments.hpp

Return to documentation for file (include/catch_ros2/arguments.hpp)

// Copyright 2023 Nick Morales.
//
// 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.


#ifndef CATCH_ROS2__ARGUMENTS_HPP_
#define CATCH_ROS2__ARGUMENTS_HPP_

#include <vector>
#include <string>

namespace catch_ros2
{
class SimulateArgs
{
public:
  explicit SimulateArgs(const std::string & args, bool omit_executable_path = false);

  explicit SimulateArgs(const std::vector<std::string> args, bool omit_executable_path = false);

  int argc() const;

  const char * const * argv() const;

private:
  std::vector<std::string> args_ {};

  std::vector<char *> argv_vec_ {};

  void generate_argv_vec_();
};


class SplitROSArgs
{
public:
  SplitROSArgs(const int argc, const char * const * argv);

  int argc() const;

  int argc_without_ros() const;

  const char * const * argv() const;

  const char * const * argv_without_ros() const;

private:
  const int argc_;

  const char * const * argv_;

  SimulateArgs args_without_ros_;
};


std::vector<std::string> tokenize(const std::string & input_string);
}  // namespace catch_ros2

#endif  // CATCH_ROS2__ARGUMENTS_HPP_