EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CommandHelper.h File Reference
#include "ConsoleCommands.h"
Include dependency graph for CommandHelper.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int cmd_find_nth_noneq (const Seperator &args, int n)
 
std::string cmd_parse_eq_arg (const Seperator &args, const char *name)
 

Function Documentation

int cmd_find_nth_noneq ( const Seperator args,
int  n 
)

Definition at line 8 of file CommandHelper.cpp.

References Seperator::arg(), and Seperator::argCount().

Referenced by Command_unspawn().

8  {
9  int c = 0;
10  for (int i = 0; i < args.argCount(); i++) {
11  std::string arg = args.arg(i);
12  size_t pos = arg.find("=");
13 
14  // Didn't find = in string
15  if (pos == std::string::npos) {
16  c++;
17  if (c == n) {
18  return i;
19  }
20  }
21  }
22  return -1;
23 }
const std::string & arg(size_t index) const
Definition: Seperator.h:43
size_t argCount() const
Definition: Seperator.h:44

Here is the call graph for this function:

Here is the caller graph for this function:

std::string cmd_parse_eq_arg ( const Seperator args,
const char *  name 
)

Definition at line 26 of file CommandHelper.cpp.

References Seperator::arg(), Seperator::argCount(), and codelog.

Referenced by Command_unspawn().

26  {
27  for (int i = 1; i < args.argCount(); i++) {
28  std::string arg = args.arg(i);
29  size_t pos = arg.find(name);
30  codelog(COMMAND__ERROR, "cmd_parse_eq_arg: %d name '%s' arg '%s' pos: '%d'",
31  i, name, arg.c_str(), pos);
32  if (pos == std::string::npos) {
33  continue;
34  }
35  if (strlen(name) >= arg.size()) {
36  continue;
37  }
38  codelog(COMMAND__ERROR, " returning: '%s'", arg.c_str() + strlen(name));
39  return std::string(arg.c_str() + strlen(name));
40  }
41 
42  return std::string();
43 }
const std::string & arg(size_t index) const
Definition: Seperator.h:43
size_t argCount() const
Definition: Seperator.h:44
#define codelog(type, fmt,...)
Definition: logsys.h:128

Here is the call graph for this function:

Here is the caller graph for this function: