Deskflow 1.22.0.197
Keyboard and mouse sharing utility
|
#include <Config.h>
Classes | |
class | CellEdge |
class | const_iterator |
Public Types | |
using | ScreenOptions = std::map<OptionID, OptionValue> |
using | Interval = std::pair<float, float> |
using | link_const_iterator = Cell::const_iterator |
using | internal_const_iterator = CellMap::const_iterator |
using | all_const_iterator = NameMap::const_iterator |
Public Member Functions | |
Config (IEventQueue *events) | |
virtual | ~Config ()=default |
manipulators | |
bool | addScreen (const std::string &name) |
Add screen. | |
bool | renameScreen (const std::string &oldName, const std::string &newName) |
Rename screen. | |
void | removeScreen (const std::string &name) |
Remove screen. | |
void | removeAllScreens () |
Remove all screens. | |
bool | addAlias (const std::string &canonical, const std::string &alias) |
Add alias. | |
bool | removeAlias (const std::string &alias) |
Remove alias. | |
bool | removeAliases (const std::string &canonical) |
Remove aliases. | |
void | removeAllAliases () |
Remove all aliases. | |
bool | connect (const std::string &srcName, Direction srcSide, float srcStart, float srcEnd, const std::string &dstName, float dstStart, float dstEnd) |
Connect screens. | |
bool | disconnect (const std::string &srcName, Direction srcSide) |
Disconnect screens. | |
bool | disconnect (const std::string &srcName, Direction srcSide, float position) |
Disconnect screens. | |
void | setDeskflowAddress (const NetworkAddress &) |
Set server address. | |
bool | addOption (const std::string &name, OptionID option, OptionValue value) |
Add a screen option. | |
bool | removeOption (const std::string &name, OptionID option) |
Remove a screen option. | |
bool | removeOptions (const std::string &name) |
Remove a screen options. | |
virtual InputFilter * | getInputFilter () |
Get the hot key input filter. |
accessors | |
bool | isValidScreenName (const std::string &name) const |
Test screen name validity. | |
const_iterator | begin () const |
Get beginning (canonical) screen name iterator. | |
const_iterator | end () const |
Get ending (canonical) screen name iterator. | |
all_const_iterator | beginAll () const |
Get beginning screen name iterator. | |
all_const_iterator | endAll () const |
Get ending screen name iterator. | |
virtual bool | isScreen (const std::string &name) const |
Test for screen name. | |
bool | isCanonicalName (const std::string &name) const |
Test for canonical screen name. | |
std::string | getCanonicalName (const std::string &name) const |
Get canonical name. | |
std::string | getNeighbor (const std::string &, Direction, float position, float *positionOut) const |
Get neighbor. | |
bool | hasNeighbor (const std::string &, Direction) const |
Check for neighbor. | |
bool | hasNeighbor (const std::string &, Direction, float start, float end) const |
Check for neighbor. | |
link_const_iterator | beginNeighbor (const std::string &) const |
Get beginning neighbor iterator. | |
link_const_iterator | endNeighbor (const std::string &) const |
Get ending neighbor iterator. | |
const NetworkAddress & | getDeskflowAddress () const |
Get the server address. | |
const ScreenOptions * | getOptions (const std::string &name) const |
Get the screen options. | |
bool | hasLockToScreenAction () const |
Check for lock to screen action. | |
bool | operator== (const Config &) const |
Compare configurations. | |
bool | operator!= (const Config &) const |
Compare configurations. | |
void | read (ConfigReadContext &context) |
Read configuration. | |
std::istream & | operator>> (std::istream &s, Config &config) |
Read configuration. | |
std::ostream & | operator<< (std::ostream &s, const Config &config) |
Write configuration. | |
static const char * | dirName (Direction) |
Get direction name. | |
static std::string | formatInterval (const Interval &) |
Get interval as string. |
Server configuration.
This class holds server configuration information. That includes the names of screens and their aliases, the links between them, and network addresses.
Note that case is preserved in screen names but is ignored when comparing names. Screen names and their aliases share a namespace and must be unique.
using deskflow::server::Config::all_const_iterator = NameMap::const_iterator |
using deskflow::server::Config::internal_const_iterator = CellMap::const_iterator |
using deskflow::server::Config::Interval = std::pair<float, float> |
using deskflow::server::Config::link_const_iterator = Cell::const_iterator |
using deskflow::server::Config::ScreenOptions = std::map<OptionID, OptionValue> |
|
explicit |
|
virtualdefault |
bool deskflow::server::Config::addAlias | ( | const std::string & | canonical, |
const std::string & | alias ) |
Add alias.
Adds an alias for a screen name. An alias can be used any place the canonical screen name can (except addScreen()). Returns false if the alias name already exists or the canonical name is unknown, otherwise returns true.
bool deskflow::server::Config::addOption | ( | const std::string & | name, |
OptionID | option, | ||
OptionValue | value ) |
Add a screen option.
Adds an option and its value to the named screen. Replaces the existing option's value if there is one. Returns true iff name
is a known screen.
bool deskflow::server::Config::addScreen | ( | const std::string & | name | ) |
Add screen.
Adds a screen, returning true iff successful. If a screen or alias with the given name exists then it fails.
Config::const_iterator deskflow::server::Config::begin | ( | ) | const |
Get beginning (canonical) screen name iterator.
Config::all_const_iterator deskflow::server::Config::beginAll | ( | ) | const |
Get beginning screen name iterator.
Config::link_const_iterator deskflow::server::Config::beginNeighbor | ( | const std::string & | srcName | ) | const |
Get beginning neighbor iterator.
bool deskflow::server::Config::connect | ( | const std::string & | srcName, |
Direction | srcSide, | ||
float | srcStart, | ||
float | srcEnd, | ||
const std::string & | dstName, | ||
float | dstStart, | ||
float | dstEnd ) |
Connect screens.
Establishes a one-way connection between portions of opposite edges of two screens. Each portion is described by an interval defined by two numbers, the start and end of the interval half-open on the end. The numbers range from 0 to 1, inclusive, for the left/top to the right/bottom. The user will be able to jump from the srcStart
to srcSend
interval of srcSide
of screen srcName
to the opposite side of screen dstName
in the interval dstStart
and dstEnd
when both screens are connected to the server and the user isn't locked to a screen. Returns false if srcName
is unknown. srcStart
must be less than or equal to srcEnd
and dstStart
must be less then or equal to dstEnd
and all of srcStart
, srcEnd
, dstStart
, or dstEnd
must be inside the range [0,1].
|
static |
Get direction name.
Returns the name of a direction (for debugging).
bool deskflow::server::Config::disconnect | ( | const std::string & | srcName, |
Direction | srcSide ) |
Disconnect screens.
Removes all connections created by connect() on side srcSide
. Returns false if srcName
is unknown.
bool deskflow::server::Config::disconnect | ( | const std::string & | srcName, |
Direction | srcSide, | ||
float | position ) |
Disconnect screens.
Removes the connections created by connect() on side srcSide
covering position position
. Returns false if srcName
is unknown.
Config::const_iterator deskflow::server::Config::end | ( | ) | const |
Get ending (canonical) screen name iterator.
Config::all_const_iterator deskflow::server::Config::endAll | ( | ) | const |
Get ending screen name iterator.
Config::link_const_iterator deskflow::server::Config::endNeighbor | ( | const std::string & | srcName | ) | const |
Get ending neighbor iterator.
|
static |
Get interval as string.
Returns an interval as a parseable string.
std::string deskflow::server::Config::getCanonicalName | ( | const std::string & | name | ) | const |
Get canonical name.
Returns the canonical name of a screen or the empty string if the name is unknown. Returns the canonical name if one is given.
const NetworkAddress & deskflow::server::Config::getDeskflowAddress | ( | ) | const |
Get the server address.
|
virtual |
Get the hot key input filter.
Returns the hot key input filter. Clients can modify hotkeys using that object.
std::string deskflow::server::Config::getNeighbor | ( | const std::string & | srcName, |
Direction | srcSide, | ||
float | position, | ||
float * | positionOut ) const |
Get neighbor.
Returns the canonical screen name of the neighbor in the given direction (set through connect()) at position position
. Returns the empty string if there is no neighbor in that direction, otherwise saves the position on the neighbor in positionOut
if it's not nullptr
.
const Config::ScreenOptions * deskflow::server::Config::getOptions | ( | const std::string & | name | ) | const |
Get the screen options.
Returns all the added options for the named screen. Returns nullptr if the screen is unknown and an empty collection if there are no options.
bool deskflow::server::Config::hasLockToScreenAction | ( | ) | const |
Check for lock to screen action.
Returns true
if this configuration has a lock to screen action. This is for backwards compatible support of ScrollLock locking.
bool deskflow::server::Config::hasNeighbor | ( | const std::string & | srcName, |
Direction | srcSide ) const |
Check for neighbor.
Returns true
if the screen has a neighbor anywhere along the edge given by the direction.
bool deskflow::server::Config::hasNeighbor | ( | const std::string & | srcName, |
Direction | srcSide, | ||
float | start, | ||
float | end ) const |
Check for neighbor.
Returns true
if the screen has a neighbor in the given range along the edge given by the direction.
bool deskflow::server::Config::isCanonicalName | ( | const std::string & | name | ) | const |
Test for canonical screen name.
Returns true iff name
is the canonical name of a screen.
|
virtual |
Test for screen name.
Returns true iff name
names a screen.
bool deskflow::server::Config::isValidScreenName | ( | const std::string & | name | ) | const |
Test screen name validity.
Returns true iff name
is a valid screen name.
bool deskflow::server::Config::operator!= | ( | const Config & | x | ) | const |
Compare configurations.
bool deskflow::server::Config::operator== | ( | const Config & | x | ) | const |
Compare configurations.
void deskflow::server::Config::read | ( | ConfigReadContext & | context | ) |
Read configuration.
Reads a configuration from a context. Throws XConfigRead on error and context is unchanged.
bool deskflow::server::Config::removeAlias | ( | const std::string & | alias | ) |
Remove alias.
Removes an alias for a screen name. It returns false if the alias is unknown or a canonical name, otherwise returns true.
bool deskflow::server::Config::removeAliases | ( | const std::string & | canonical | ) |
Remove aliases.
Removes all aliases for a canonical screen name. It returns false if the canonical name is unknown, otherwise returns true.
void deskflow::server::Config::removeAllAliases | ( | ) |
Remove all aliases.
This removes all aliases but not the screens.
void deskflow::server::Config::removeAllScreens | ( | ) |
Remove all screens.
Removes all screens, aliases, and connections.
bool deskflow::server::Config::removeOption | ( | const std::string & | name, |
OptionID | option ) |
Remove a screen option.
Removes an option and its value from the named screen. Does nothing if the option doesn't exist on the screen. Returns true iff name
is a known screen.
bool deskflow::server::Config::removeOptions | ( | const std::string & | name | ) |
Remove a screen options.
Removes all options and values from the named screen. Returns true iff name
is a known screen.
void deskflow::server::Config::removeScreen | ( | const std::string & | name | ) |
Remove screen.
Removes a screen. This also removes aliases for the screen and disconnects any connections to the screen. name
may be an alias.
bool deskflow::server::Config::renameScreen | ( | const std::string & | oldName, |
const std::string & | newName ) |
Rename screen.
Renames a screen. All references to the name are updated. Returns true iff successful.
void deskflow::server::Config::setDeskflowAddress | ( | const NetworkAddress & | addr | ) |
Set server address.
Set the deskflow listen addresses. There is no default address so this must be called to run a server using this configuration.
|
friend |
Write configuration.
Writes a configuration to a stream.
|
friend |
Read configuration.
Reads a configuration from a stream. Throws XConfigRead on error.