mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 02:46:49 +00:00
Fix style of #7269 after Vlad's comments
This commit is contained in:
committed by
wraitii
parent
dba968013f
commit
ce197de0b0
@@ -112,6 +112,11 @@ OsPath CmdLineArgs::GetArg0() const
|
||||
return m_Arg0;
|
||||
}
|
||||
|
||||
const CmdLineArgs::ArgsT& CmdLineArgs::GetArgs() const
|
||||
{
|
||||
return m_Args;
|
||||
}
|
||||
|
||||
std::vector<CStr> CmdLineArgs::GetArgsWithoutName() const
|
||||
{
|
||||
return m_ArgsWithoutName;
|
||||
@@ -123,7 +128,7 @@ template<> void Script::ToJSVal<CmdLineArgs>(const ScriptRequest& rq, JS::Mutabl
|
||||
return;
|
||||
|
||||
std::unordered_map<CStr, std::vector<CStr>> args;
|
||||
for (const std::pair<CStr, CStr>& arg : val.m_Args)
|
||||
for (const std::pair<CStr, CStr>& arg : val.GetArgs())
|
||||
args.emplace(arg.first, std::vector<CStr>{}).first->second.emplace_back(arg.second);
|
||||
|
||||
JS::RootedValue argVal(rq.cx);
|
||||
|
||||
@@ -21,21 +21,18 @@
|
||||
#include "lib/os_path.h"
|
||||
#include "ps/containers/Span.h"
|
||||
#include "ps/CStr.h"
|
||||
#include "scriptinterface/ScriptTypes.h"
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
class ScriptRequest;
|
||||
|
||||
namespace Script {
|
||||
template<typename T>
|
||||
void ToJSVal(const ScriptRequest& rq, JS::MutableHandleValue ret, const T& val);
|
||||
}
|
||||
|
||||
class CmdLineArgs
|
||||
{
|
||||
public:
|
||||
using ArgsT = std::vector<std::pair<CStr, CStr>>;
|
||||
|
||||
CmdLineArgs() {}
|
||||
|
||||
/**
|
||||
@@ -72,16 +69,17 @@ public:
|
||||
*/
|
||||
OsPath GetArg0() const;
|
||||
|
||||
/**
|
||||
* Returns all arguments that don't have a name (string started with '-').
|
||||
*/
|
||||
const ArgsT& GetArgs() const;
|
||||
|
||||
/**
|
||||
* Returns all arguments that don't have a name (string started with '-').
|
||||
*/
|
||||
std::vector<CStr> GetArgsWithoutName() const;
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
friend void Script::ToJSVal(const ScriptRequest& rq, JS::MutableHandleValue ret, const T& val);
|
||||
|
||||
typedef std::vector<std::pair<CStr, CStr> > ArgsT;
|
||||
ArgsT m_Args;
|
||||
OsPath m_Arg0;
|
||||
std::vector<CStr> m_ArgsWithoutName;
|
||||
|
||||
Reference in New Issue
Block a user