class Arg
Defined at line 289 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
Represents a single argument from an argument list.
Public Methods
void Clear ()
Clears the argument.
Defined at line 295 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
uint16_t GetLength ()
Returns the length (number of characters) in the argument C string.
void CopyArgsToStringArray (Arg[] aArgs, char *[] aStrings)
Copies the argument string pointers from an `Arg` array to a C string array.
Parameters
uint8_t GetArgsLength (Arg[] aArgs)
Returns the length of argument array, i.e. number of consecutive non-empty arguments.
Parameters
bool IsEmpty ()
Indicates whether or not the argument is empty (i.e., reached the end of argument list).
Defined at line 303 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
const char * GetCString ()
Gets the argument as a C string.
Defined at line 317 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
char * GetCString ()
Gets the argument as C string.
Defined at line 324 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
template <typename Type>
otError ParseAs (Type & aValue)
Parses the argument as a specified value type.
Parameters
Template Parameters
void SetCString (char * aString)
Sets the argument with a given C string.
Parameters
Defined at line 331 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
bool operator!= (const char * aString)
Overload the operator `!=` to evaluate whether the argument is unequal to a given C string.
Parameters
Defined at line 354 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
otError ParseAsUint8 (uint8_t & aUint8)
Parses the argument as a `uint8_t` value.
The number is parsed as decimal or hex format (if contains `0x` or `0X` prefix).
Parameters
Defined at line 366 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
otError ParseAsUint16 (uint16_t & aUint16)
Parses the argument as a `uint16_t` value.
The number is parsed as decimal or hex format (if contains `0x` or `0X` prefix).
Parameters
Defined at line 378 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
otError ParseAsUint32 (uint32_t & aUint32)
Parses the argument as a `uint32_t` value.
The number is parsed as decimal or hex format (if contains `0x` or `0X` prefix).
Parameters
Defined at line 390 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
otError ParseAsUint64 (uint64_t & aUint64)
Parses the argument as a `uint64_t` value.
The number is parsed as decimal or hex format (if contains `0x` or `0X` prefix).
Parameters
Defined at line 402 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
otError ParseAsInt8 (int8_t & aInt8)
Parses the argument as a `int8_t` value.
The number is parsed as decimal or hex format (if contains `0x` or `0X` prefix). The string can start with
`+`/`-` sign.
Parameters
Defined at line 415 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
otError ParseAsInt16 (int16_t & aInt16)
Parses the argument as a `int16_t` value.
The number is parsed as decimal or hex format (if contains `0x` or `0X` prefix). The string can start with
`+`/`-` sign.
Parameters
Defined at line 428 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
otError ParseAsInt32 (int32_t & aInt32)
Parses the argument as a `int32_t` value.
The number is parsed as decimal or hex format (if contains `0x` or `0X` prefix). The string can start with
`+`/`-` sign.
Parameters
Defined at line 441 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
otError ParseAsBool (bool & aBool)
Parses the argument as a `bool` value.
Zero value is treated as `false`, non-zero value as `true`.
Parameters
Defined at line 453 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
otError ParseAsIp6Address (otIp6Address & aAddress)
Parses the argument as an IPv6 address.
Parameters
Defined at line 464 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
otError ParseAsIp4Address (otIp4Address & aAddress)
Parses the argument as an IPv4 address.
Parameters
Defined at line 477 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
otError ParseAsIp6Prefix (otIp6Prefix & aPrefix)
Parses the argument as an IPv6 prefix.
The string is parsed as `{IPv6Address}/{PrefixLength}`.
Parameters
Defined at line 492 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
otError ParseAsHexString (uint8_t * aBuffer, uint16_t aSize)
Parses the argument as a hex string into a byte array of fixed expected size.
Returns `kErrorNone` only when the hex string contains exactly
bytes (after parsing). If
there are fewer or more bytes in hex string that
the parsed bytes (up to
are copied into the
`aBuffer` and `kErrorInvalidArgs` is returned.
Parameters
Defined at line 521 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
template <uint16_t kBufferSize>
otError ParseAsHexString (uint8_t (&)[kBufferSize] aBuffer)
Parses the argument as a hex string into a a given fixed size array.
Returns `kErrorNone` only when the hex string contains exactly
bytes (after parsing).
If there are fewer or more bytes in hex string that
the parsed bytes (up to
are
copied into the `aBuffer` and `kErrorInvalidArgs` is returned.
Parameters
Template Parameters
Defined at line 540 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
otError ParseAsHexString (uint16_t & aSize, uint8_t * aBuffer)
Parses the argument as a hex string into a byte array.
Verifies that the parsed hex string bytes fit in
with its given
Parameters
Defined at line 557 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
template <>
otError ParseAs<unsigned char> (uint8_t & aValue)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Specializations of `Arg::ParseAs
<Type
>()` method.
Defined at line 618 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
template <>
otError ParseAs<unsigned short> (uint16_t & aValue)
Defined at line 620 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
template <>
otError ParseAs<unsigned int> (uint32_t & aValue)
Defined at line 622 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
template <>
otError ParseAs<unsigned long> (uint64_t & aValue)
Defined at line 624 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
template <>
otError ParseAs<bool> (bool & aValue)
Defined at line 626 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
template <>
otError ParseAs<signed char> (int8_t & aValue)
Defined at line 628 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
template <>
otError ParseAs<short> (int16_t & aValue)
Defined at line 630 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
template <>
otError ParseAs<int> (int32_t & aValue)
Defined at line 632 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
template <>
otError ParseAs<const char *> (const char *& aValue)
Defined at line 634 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
template <>
otError ParseAs<otIp6Address> (otIp6Address & aValue)
Defined at line 641 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
template <>
otError ParseAs<otIp6Prefix> (otIp6Prefix & aValue)
Defined at line 643 of file ../../third_party/openthread/src/core/utils/parse_cmdline.hpp
bool operator== (const char * aString)
Overload the operator `==` to evaluate whether the argument is equal to a given C string.
If the argument is empty (`IsEmpty()` is `true`) then comparing it using operator `==` with any C string will
return false.