Click
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | List of all members
IntArg Class Reference

Parser class for integers. More...

#include <args.hh>

Inheritance diagram for IntArg:
NumArg BoundedIntArg SaturatingIntArg

Public Types

typedef uint32_t limb_type
 
- Public Types inherited from NumArg
enum  {
  status_ok = 0 , status_inval = EINVAL , status_range = ERANGE , status_notsup ,
  status_unitless
}
 

Public Member Functions

 IntArg (int b=0)
 
const char * parse (const char *begin, const char *end, bool is_signed, int size, limb_type *value, int nlimb)
 
template<typename V >
bool parse_saturating (const String &str, V &result, const ArgContext &args=blank_args)
 
template<typename V >
String unparse (const V &v)
 
template<typename V >
bool parse (const String &str, V &result, const ArgContext &args=blank_args)
 

Public Attributes

int base
 
int status
 

Protected Member Functions

void range_error (const ArgContext &args, bool is_signed, click_int_large_t value)
 

Static Protected Member Functions

static const char * span (const char *begin, const char *end, bool is_signed, int &b)
 

Detailed Description

Parser class for integers.

IntArg(base) reads integers in base base. base defaults to 0, which means arguments are parsed in base 10 by default, but prefixes 0x, 0, and 0b parse hexadecimal, octal, and binary numbers, respectively.

Integer overflow is treated as an error.

See also
SaturatingIntArg, BoundedIntArg

The documentation for this class was generated from the following files: