fwoop basis

basis

class ArgParser

Argument parser for command line arguments.

Public Types

enum ParseErr

Values:

enumerator InvalidType
enumerator ArgNotFound
enumerator TooManyPositionalArgs
enumerator PositionalBoolNotAllowed

Public Functions

ArgParser(const char **argv, int argc)

Construct a new Arg Parser object.

Parameters
  • argv – command line arguments

  • argc – number of command line arguments

std::error_code parse()

Attempt to parse the command line arguments that were given on construction.

Returns

std::error_code

template<typename T>
void addNamedArg(const std::string &name, const std::string &flag, const T &defaultVal, const std::string &helpMsg)

Add a named argument to parse.

Template Parameters

T – argument type

Parameters
  • name – argument name, only alphanumeric characters and ‘-’ or ‘_’ are allowed

  • flag – flag, only alphanumeric characters and ‘-’ or ‘_’ are allowed

  • defaultVal – default value for the argument when not parsed

  • helpMsg – help message to print for this argument

template<typename T>
void addPositionalArg(const std::string &name, const T &defaultVal, const std::string &helpMsg)
template<typename T>
T getNamedArg(const std::string &argName) const
template<typename T>
T getPositionalArg(const std::string &argName) const

Friends

friend std::ostream &operator<<(std::ostream &os, const ArgParser &parser)
class FileReader

This is used to read files.

Public Functions

explicit FileReader(const std::string &filename)
inline ~FileReader()
int open()
void close()
uint8_t *loadFile(uint32_t &length)
Iterator begin()
Iterator end()

Public Static Functions

static std::string getExtension(const std::string &filename)
class Iterator

Public Functions

Iterator(FileReader &reader, bool isEnd)
inline ~Iterator()
void operator++()
std::string operator*() const
bool operator==(const Iterator &lhs) const
inline bool operator!=(const Iterator &lhs) const
class Log

Public Types

enum Level

Values:

enumerator e_Debug
enumerator e_Info
enumerator e_Warn
enumerator e_Error

Public Functions

Log()
void setFormat(const std::string &formatStr)
template<typename ...Ts>
void debug(Ts&&... args)
template<typename ...Ts>
void info(Ts&&... args)
template<typename ...Ts>
void warn(Ts&&... args)
template<typename ...Ts>
void error(Ts&&... args)
void debug(const std::string &msg)
void info(const std::string &msg)
void warn(const std::string &msg)
void error(const std::string &msg)

Public Static Functions

static inline std::shared_ptr<Log> getDefault()
static inline void SetThreshold(Level lvl)
template<typename ...Ts>
static inline void Debug(Ts&&... args)
template<typename ...Ts>
static inline void Info(Ts&&... args)
template<typename ...Ts>
static inline void Warn(Ts&&... args)
template<typename ...Ts>
static inline void Error(Ts&&... args)
static inline void Debug(const std::string &msg)
static inline void Info(const std::string &msg)
static inline void Warn(const std::string &msg)
static inline void Error(const std::string &msg)
class SocketIO

Public Static Functions

template<typename T>
static std::error_code read(int fd, T *buffer, unsigned int bufferSize, unsigned int &bytesRead)
template<typename T>
static int write(int fd, T *out, unsigned int outLen)
class Tokenizer

Public Functions

Tokenizer(const std::string &parseString, char delim)
inline ~Tokenizer()
Iterator begin()
Iterator end()
bool operator==(const Tokenizer &rhs) const
class Iterator

Public Functions

Iterator(Tokenizer &tokenizer, bool isEnd)
inline ~Iterator()
void operator++()
std::string operator*() const
bool operator==(const Iterator &rhs) const
inline bool operator!=(const Iterator &rhs) const