libvtemm: Gnome::Vte::Pty::Master Class Reference

libvtemm 0.25.0

- Main Page
- Related Pages
- Modules
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions
Gnome::Vte::Pty::Master Class Reference

Master - class holding a descriptor for the master side of PTY pair. More...

`#include <libvtemm/ptymaster.h>`

List of all members.

## Public Member Functions
| Master (int d=-1, bool is_main=false)
| Sets descriptor for the master side of PTY pair to d.
| Master (const Master& master)
| Just a copy constructor.
| ~Master ()
| If master side of PTY pair is not equal to -1 and is set as main, it calls close().
Master& | operator= (Master& master)
| Just a copy constructor.
Glib::Pid | open (const std::string& command=std::string(), const StdStringArrayHandle& argv=StdStringArrayHandle(0, Glib::OWNERSHIP_NONE), const StdStringArrayHandle& env_add=StdStringArrayHandle(0, Glib::OWNERSHIP_NONE), const std::string& directory=std::string(), int columns=0, int rows=0, bool lastlog=false, bool utmp=false, bool wtmp=false)
| Start up the given binary (exact path, not interpreted at all) in a pseudo-terminal of its own, returning the child's PID and logging the session to the specified files.
Size | get_size () const
| Attempts to read the pseudo terminal's window size.
bool | set_size (int columns, int rows)
| Attempts to resize the pseudo terminal's window size.
void | set_utf8 (bool utf8=true)
| Try to let the kernel know that the terminal is or is not UTF-8.
int | get_pty () const
| Gets descriptor for the master side of the PTY pair.
void | close ()
| Close a pty.
void | set_is_main (bool setting=true)
| Sets this instance as main instance holding descriptor of the master side of PTY pair.
bool | get_is_main () const
| Checks if this instance is main instance.

## Detailed Description

Master - class holding a descriptor for the master side of PTY pair.

## Constructor & Destructor Documentation

Gnome::Vte::Pty::Master::Master | ( | int | d = `-1`,
|  | bool | is_main = `false`
| ) |  |

Sets descriptor for the master side of PTY pair to d.

Use other than default value at your own risk. Otherwise use open() to set a descriptor. It allows you to set this instance as a main instance.

Parameters:

  d | Descriptor for the master side of PTY pair. -1 by default.
  is_main | Setting for main instance.

Gnome::Vte::Pty::Master::Master | ( | const Master& | master | ) |

Just a copy constructor.

Copied instance won't be a main instance even if original is.

Parameters:

  master | Original master to copy.

Gnome::Vte::Pty::Master::~Master | ( |  | ) |

If master side of PTY pair is not equal to -1 and is set as main, it calls close().

Otherwise it does nothing.

## Member Function Documentation

bool Gnome::Vte::Pty::Master::get_is_main | ( |  | ) | const

Checks if this instance is main instance.

Returns:
  `true` if this instance is main instance.

int Gnome::Vte::Pty::Master::get_pty | ( |  | ) | const

Gets descriptor for the master side of the PTY pair.

Returns:
  Descriptor for the master side of the PTY pair.

Size Gnome::Vte::Pty::Master::get_size | ( |  | ) | const

Attempts to read the pseudo terminal's window size.

If something goes wrong, Gnome::Vte::Pty::Size::is_ok() will return `false` and `errno` will be set.

Returns:
  Gnome::Vte::Pty::Size instance holding number of columns and rows.

Glib::Pid Gnome::Vte::Pty::Master::open | ( | const std::string & | command = `std::string()`,
|  | const StdStringArrayHandle & | argv = `StdStringArrayHandle(0, Glib::OWNERSHIP_NONE)`,
|  | const StdStringArrayHandle & | env_add = `StdStringArrayHandle(0, Glib::OWNERSHIP_NONE)`,
|  | const std::string & | directory = `std::string()`,
|  | int | columns = `0`,
|  | int | rows = `0`,
|  | bool | lastlog = `false`,
|  | bool | utmp = `false`,
|  | bool | wtmp = `false`
| ) |  |

Start up the given binary (exact path, not interpreted at all) in a pseudo-terminal of its own, returning the child's PID and logging the session to the specified files.

Sets this instance as main instance.

Parameters:

  command | Command to be executed (not interpreted at all). If empty, fork will be executed.
  argv | Empty string terminated list of arguments given to executed binary (argv[0] should be a binary name). See Gnome::Vte::Terminal::fork_command() for description about format of this parameter.
  env_add | Empty string terminated list of environment variables to be added before executing a command. See Gnome::Vte::Terminal::fork_command() for description about format of this parameter.
  directory | Path where command have to be executed. If empty, path will be inherited from parent.
  columns | Number of columns of pty. If set to 0, compiled-in defaults will be used.
  rows | Number of rows of pty. If set to 0, compiled-in defaults will be used.
  lastlog | `true` if the session should be logged to the lastlog.
  utmp | `true` if the session should be logged to the utmp/utmpx log.
  wtmp | `true` if the session should be logged to the wtmp/wtmpx log.

Returns:
  Descriptor for the master side of the PTY pair.

Master& Gnome::Vte::Pty::Master::operator= | ( | Master& | master | ) |

Just a copy constructor.

Copied instance won't be a main instance even if original is.

Parameters:

  master | Original master to copy.

void Gnome::Vte::Pty::Master::set_is_main | ( | bool | setting = `true` | ) |

Sets this instance as main instance holding descriptor of the master side of PTY pair.

If this instance is main instance, then on its destruction close() will be called. This setting is not copied.

Parameters:

  setting | `true` if this instance is main instance.

bool Gnome::Vte::Pty::Master::set_size | ( | int | columns,
|  | int | rows
| ) |  |

Attempts to resize the pseudo terminal's window size.

If successful, the OS kernel will send `SIGWINCH` to the child process group, otherwise `false` will be returned and `errno` will be set.

Parameters:

  columns | The desired number of columns.
  rows | The desired number of rows.

Returns:
  `false` if there was an error, otherwise `true`.

void Gnome::Vte::Pty::Master::set_utf8 | ( | bool | utf8 = `true` | ) |

Try to let the kernel know that the terminal is or is not UTF-8.

Parameters:

  utf8 | `true` if the terminal is UTF-8.