libzypp: zypp::Errno Class Reference

libzypp 17.25.10

Public Member Functions | Private Attributes | Related Functions | List of all members
zypp::Errno Class Reference

Convenience `errno` wrapper. More...

`#include <Errno.h>`

## Public Member Functions
| Errno ()
| Default ctor: `errno`. More...
| Errno (bool error_r)
| Ctor set to `errno` if error condition, else `0`. More...
| Errno (int errno_r)
| Ctor taking an explicit errno value. More...
int | get () const
| Return the stored errno. More...
| operator int () const
| Allow implicit conversion to `int`. More...
std::string | asString () const
| Return human readable error string. More...

## Private Attributes
int | _errno

## Related Functions
(Note that these are not member functions.)
std::ostream & | operator<< (std::ostream &str, const Errno &obj)
| Stream output. More...

## Detailed Description

Convenience `errno` wrapper.

Definition at line 25 of file Errno.h.

## Constructor & Destructor Documentation

## ◆ Errno() [1/3]

zypp::Errno::Errno | ( |  | ) |
| inline

Default ctor: `errno`.

Definition at line 29 of file Errno.h.

## ◆ Errno() [2/3]

zypp::Errno::Errno | ( | bool | error_r | ) |
| inline

Ctor set to `errno` if error condition, else `0`.

int ret = ::write( fd, buffer, size );
DBG << "write returns: " << Errno( ret != size ) << end;
// on success: "write returns: [0-Success]"
// on error e.g.: "write returns: [11-Resource temporarily unavailable]"
DBG
#define DBG
Definition: Logger.h:90
zypp::Errno::Errno
Errno()
Default ctor: errno.
Definition: Errno.h:29
zypp::base::sysconfig::write
bool write(const Pathname &path_r, const std::string &key_r, const std::string &val_r, const std::string &newcomment_r)
Add or change a value in sysconfig file path_r.
Definition: Sysconfig.cc:80

Definition at line 39 of file Errno.h.

## ◆ Errno() [3/3]

zypp::Errno::Errno | ( | int | errno_r | ) |
| inline

Ctor taking an explicit errno value.

Definition at line 42 of file Errno.h.

## Member Function Documentation

## ◆ get()

int zypp::Errno::get | ( |  | ) | const
| inline

Return the stored errno.

Definition at line 46 of file Errno.h.

## ◆ operator int()

zypp::Errno::operator int | ( |  | ) | const
| inline

Allow implicit conversion to `int`.

Definition at line 49 of file Errno.h.

## ◆ asString()

std::string zypp::Errno::asString | ( |  | ) | const
| inline

Return human readable error string.

Definition at line 52 of file Errno.h.

## Friends And Related Function Documentation

## ◆ operator<<()

std::ostream & operator<< | ( | std::ostream & | str,
|  | const Errno & | obj
| ) |  |
| related

Stream output.

Definition at line 59 of file Errno.h.

## Member Data Documentation

## ◆ _errno

int zypp::Errno::_errno
| private

Definition at line 55 of file Errno.h.

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

- zypp/base/Errno.h