Server configuration. More...
#include <CConfig.h>
Classes | |
class | CCell |
class | CCellEdge |
class | CName |
class | const_iterator |
Public Types | |
typedef std::map< OptionID, OptionValue > | CScreenOptions |
typedef std::pair< float, float > | CInterval |
typedef CCell::const_iterator | link_const_iterator |
typedef CCellMap::const_iterator | internal_const_iterator |
typedef CNameMap::const_iterator | all_const_iterator |
Public Member Functions | |
manipulators | |
bool | addScreen (const CString &name) |
Add screen. | |
bool | renameScreen (const CString &oldName, const CString &newName) |
Rename screen. | |
void | removeScreen (const CString &name) |
Remove screen. | |
void | removeAllScreens () |
Remove all screens. | |
bool | addAlias (const CString &canonical, const CString &alias) |
Add alias. | |
bool | removeAlias (const CString &alias) |
Remove alias. | |
bool | removeAliases (const CString &canonical) |
Remove aliases. | |
void | removeAllAliases () |
Remove all aliases. | |
bool | connect (const CString &srcName, EDirection srcSide, float srcStart, float srcEnd, const CString &dstName, float dstStart, float dstEnd) |
Connect screens. | |
bool | disconnect (const CString &srcName, EDirection srcSide) |
Disconnect screens. | |
bool | disconnect (const CString &srcName, EDirection srcSide, float position) |
Disconnect screens. | |
void | setSynergyAddress (const CNetworkAddress &) |
Set server address. | |
bool | addOption (const CString &name, OptionID option, OptionValue value) |
Add a screen option. | |
bool | removeOption (const CString &name, OptionID option) |
Remove a screen option. | |
bool | removeOptions (const CString &name) |
Remove a screen options. | |
CInputFilter * | getInputFilter () |
Get the hot key input filter. | |
accessors | |
| |
bool | isValidScreenName (const CString &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. | |
bool | isScreen (const CString &name) const |
Test for screen name. | |
bool | isCanonicalName (const CString &name) const |
Test for canonical screen name. | |
CString | getCanonicalName (const CString &name) const |
Get canonical name. | |
CString | getNeighbor (const CString &, EDirection, float position, float *positionOut) const |
Get neighbor. | |
bool | hasNeighbor (const CString &, EDirection) const |
Check for neighbor. | |
bool | hasNeighbor (const CString &, EDirection, float start, float end) const |
Check for neighbor. | |
link_const_iterator | beginNeighbor (const CString &) const |
Get beginning neighbor iterator. | |
link_const_iterator | endNeighbor (const CString &) const |
Get ending neighbor iterator. | |
const CNetworkAddress & | getSynergyAddress () const |
Get the server address. | |
const CScreenOptions * | getOptions (const CString &name) const |
Get the screen options. | |
bool | hasLockToScreenAction () const |
Check for lock to screen action. | |
bool | operator== (const CConfig &) const |
Compare configurations. | |
bool | operator!= (const CConfig &) const |
Compare configurations. | |
void | read (CConfigReadContext &context) |
Read configuration. | |
std::istream & | operator>> (std::istream &, CConfig &) |
Read configuration. | |
std::ostream & | operator<< (std::ostream &, const CConfig &) |
Write configuration. | |
static const char * | dirName (EDirection) |
Get direction name. | |
static CString | formatInterval (const CInterval &) |
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.
Definition at line 53 of file CConfig.h.
bool CConfig::addAlias | ( | const CString & | canonical, | |
const CString & | 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.
Definition at line 141 of file CConfig.cpp.
bool CConfig::addOption | ( | const CString & | 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.
Definition at line 277 of file CConfig.cpp.
bool CConfig::addScreen | ( | const CString & | name | ) |
Add screen.
Adds a screen, returning true iff successful. If a screen or alias with the given name exists then it fails.
Definition at line 39 of file CConfig.cpp.
bool CConfig::connect | ( | const CString & | srcName, | |
EDirection | srcSide, | |||
float | srcStart, | |||
float | srcEnd, | |||
const CString & | 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].
Definition at line 216 of file CConfig.cpp.
References getCanonicalName().
const char * CConfig::dirName | ( | EDirection | dir | ) | [static] |
Get direction name.
Returns the name of a direction (for debugging).
Definition at line 617 of file CConfig.cpp.
bool CConfig::disconnect | ( | const CString & | srcName, | |
EDirection | srcSide, | |||
float | position | |||
) |
Disconnect screens.
Removes the connections created by connect() on side srcSide
covering position position
. Returns false if srcName
is unknown.
Definition at line 254 of file CConfig.cpp.
bool CConfig::disconnect | ( | const CString & | srcName, | |
EDirection | srcSide | |||
) |
Disconnect screens.
Removes all connections created by connect() on side srcSide
. Returns false if srcName
is unknown.
Definition at line 237 of file CConfig.cpp.
CString CConfig::formatInterval | ( | const CInterval & | x | ) | [static] |
Get interval as string.
Returns an interval as a parseable string.
Definition at line 633 of file CConfig.cpp.
References CStringUtil::print().
CString CConfig::getCanonicalName | ( | const CString & | 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.
Definition at line 441 of file CConfig.cpp.
Referenced by beginNeighbor(), connect(), endNeighbor(), getNeighbor(), hasNeighbor(), isCanonicalName(), removeScreen(), and renameScreen().
CInputFilter * CConfig::getInputFilter | ( | ) |
Get the hot key input filter.
Returns the hot key input filter. Clients can modify hotkeys using that object.
Definition at line 627 of file CConfig.cpp.
Referenced by CHotkeyOptions::doModal().
CString CConfig::getNeighbor | ( | const CString & | srcName, | |
EDirection | 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 NULL
.
Definition at line 453 of file CConfig.cpp.
References getCanonicalName().
const CConfig::CScreenOptions * CConfig::getOptions | ( | const CString & | name | ) | const |
Get the screen options.
Returns all the added options for the named screen. Returns NULL if the screen is unknown and an empty collection if there are no options.
Definition at line 526 of file CConfig.cpp.
bool CConfig::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.
Definition at line 545 of file CConfig.cpp.
Referenced by CServer::setConfig().
bool CConfig::hasNeighbor | ( | const CString & | srcName, | |
EDirection | 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.
Definition at line 489 of file CConfig.cpp.
References getCanonicalName().
bool CConfig::hasNeighbor | ( | const CString & | srcName, | |
EDirection | srcSide | |||
) | const |
Check for neighbor.
Returns true
if the screen has a neighbor anywhere along the edge given by the direction.
Definition at line 483 of file CConfig.cpp.
bool CConfig::isCanonicalName | ( | const CString & | name | ) | const |
Test for canonical screen name.
Returns true iff name
is the canonical name of a screen.
Definition at line 434 of file CConfig.cpp.
References CStringUtil::CaselessCmp::equal(), and getCanonicalName().
bool CConfig::isScreen | ( | const CString & | name | ) | const |
Test for screen name.
Returns true iff name
names a screen.
Definition at line 428 of file CConfig.cpp.
Referenced by CServer::adoptClient(), CServer::CServer(), and CServer::setConfig().
bool CConfig::isValidScreenName | ( | const CString & | name | ) | const |
Test screen name validity.
Returns true iff name
is a valid screen name.
Definition at line 346 of file CConfig.cpp.
void CConfig::read | ( | CConfigReadContext & | context | ) |
Read configuration.
Reads a configuration from a context. Throws XConfigRead on error and context is unchanged.
Definition at line 607 of file CConfig.cpp.
bool CConfig::removeAlias | ( | const CString & | 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.
Definition at line 160 of file CConfig.cpp.
bool CConfig::removeAliases | ( | const CString & | canonical | ) |
Remove aliases.
Removes all aliases for a canonical screen name. It returns false if the canonical name is unknown, otherwise returns true.
Definition at line 180 of file CConfig.cpp.
void CConfig::removeAllAliases | ( | ) |
Remove all aliases.
This removes all aliases but not the screens.
Definition at line 202 of file CConfig.cpp.
void CConfig::removeAllScreens | ( | ) |
Remove all screens.
Removes all screens, aliases, and connections.
Definition at line 134 of file CConfig.cpp.
bool CConfig::removeOption | ( | const CString & | 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.
Definition at line 300 of file CConfig.cpp.
bool CConfig::removeOptions | ( | const CString & | name | ) |
Remove a screen options.
Removes all options and values from the named screen. Returns true iff name
is a known screen.
Definition at line 323 of file CConfig.cpp.
void CConfig::removeScreen | ( | const CString & | 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.
Definition at line 103 of file CConfig.cpp.
References getCanonicalName().
bool CConfig::renameScreen | ( | const CString & | oldName, | |
const CString & | newName | |||
) |
Rename screen.
Renames a screen. All references to the name are updated. Returns true iff successful.
Definition at line 56 of file CConfig.cpp.
References CStringUtil::CaselessCmp::equal(), and getCanonicalName().
void CConfig::setSynergyAddress | ( | const CNetworkAddress & | addr | ) |
Set server address.
Set the synergy listen addresses. There is no default address so this must be called to run a server using this configuration.
Definition at line 271 of file CConfig.cpp.
std::ostream& operator<< | ( | std::ostream & | , | |
const CConfig & | ||||
) | [friend] |
Write configuration.
Writes a configuration to a stream.
std::istream& operator>> | ( | std::istream & | , | |
CConfig & | ||||
) | [friend] |
Read configuration.
Reads a configuration from a stream. Throws XConfigRead on error.