Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
deskflow::server::Config Class Reference

Server configuration. More...

#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 InputFiltergetInputFilter ()
 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 NetworkAddressgetDeskflowAddress () const
 Get the server address.
const ScreenOptionsgetOptions (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.

Detailed Description

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.

Member Typedef Documentation

◆ all_const_iterator

using deskflow::server::Config::all_const_iterator = NameMap::const_iterator

◆ internal_const_iterator

using deskflow::server::Config::internal_const_iterator = CellMap::const_iterator

◆ Interval

using deskflow::server::Config::Interval = std::pair<float, float>

◆ link_const_iterator

using deskflow::server::Config::link_const_iterator = Cell::const_iterator

◆ ScreenOptions

Constructor & Destructor Documentation

◆ Config()

deskflow::server::Config::Config ( IEventQueue * events)
explicit

◆ ~Config()

virtual deskflow::server::Config::~Config ( )
virtualdefault

Member Function Documentation

◆ addAlias()

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.

◆ addOption()

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.

◆ addScreen()

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.

◆ begin()

Config::const_iterator deskflow::server::Config::begin ( ) const

Get beginning (canonical) screen name iterator.

◆ beginAll()

Config::all_const_iterator deskflow::server::Config::beginAll ( ) const

Get beginning screen name iterator.

◆ beginNeighbor()

Config::link_const_iterator deskflow::server::Config::beginNeighbor ( const std::string & srcName) const

Get beginning neighbor iterator.

◆ connect()

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].

◆ dirName()

const char * deskflow::server::Config::dirName ( Direction dir)
static

Get direction name.

Returns the name of a direction (for debugging).

◆ disconnect() [1/2]

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.

◆ disconnect() [2/2]

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.

◆ end()

Config::const_iterator deskflow::server::Config::end ( ) const

Get ending (canonical) screen name iterator.

◆ endAll()

Config::all_const_iterator deskflow::server::Config::endAll ( ) const

Get ending screen name iterator.

◆ endNeighbor()

Config::link_const_iterator deskflow::server::Config::endNeighbor ( const std::string & srcName) const

Get ending neighbor iterator.

◆ formatInterval()

std::string deskflow::server::Config::formatInterval ( const Interval & x)
static

Get interval as string.

Returns an interval as a parseable string.

◆ getCanonicalName()

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.

◆ getDeskflowAddress()

const NetworkAddress & deskflow::server::Config::getDeskflowAddress ( ) const

Get the server address.

◆ getInputFilter()

InputFilter * deskflow::server::Config::getInputFilter ( )
virtual

Get the hot key input filter.

Returns the hot key input filter. Clients can modify hotkeys using that object.

◆ getNeighbor()

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.

◆ getOptions()

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.

◆ hasLockToScreenAction()

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.

◆ hasNeighbor() [1/2]

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.

◆ hasNeighbor() [2/2]

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.

◆ isCanonicalName()

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.

◆ isScreen()

bool deskflow::server::Config::isScreen ( const std::string & name) const
virtual

Test for screen name.

Returns true iff name names a screen.

◆ isValidScreenName()

bool deskflow::server::Config::isValidScreenName ( const std::string & name) const

Test screen name validity.

Returns true iff name is a valid screen name.

◆ operator!=()

bool deskflow::server::Config::operator!= ( const Config & x) const

Compare configurations.

◆ operator==()

bool deskflow::server::Config::operator== ( const Config & x) const

Compare configurations.

◆ read()

void deskflow::server::Config::read ( ConfigReadContext & context)

Read configuration.

Reads a configuration from a context. Throws XConfigRead on error and context is unchanged.

◆ removeAlias()

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.

◆ removeAliases()

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.

◆ removeAllAliases()

void deskflow::server::Config::removeAllAliases ( )

Remove all aliases.

This removes all aliases but not the screens.

◆ removeAllScreens()

void deskflow::server::Config::removeAllScreens ( )

Remove all screens.

Removes all screens, aliases, and connections.

◆ removeOption()

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.

◆ removeOptions()

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.

◆ removeScreen()

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.

◆ renameScreen()

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.

◆ setDeskflowAddress()

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.

◆ operator<<

std::ostream & operator<< ( std::ostream & s,
const Config & config )
friend

Write configuration.

Writes a configuration to a stream.

◆ operator>>

std::istream & operator>> ( std::istream & s,
Config & config )
friend

Read configuration.

Reads a configuration from a stream. Throws XConfigRead on error.


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