Skip to content

Commit

Permalink
Merge pull request #28 from rdumusc/master
Browse files Browse the repository at this point in the history
Add a function to get the host corresponding to a given instance
  • Loading branch information
tribal-tec committed Nov 3, 2015
2 parents 17269ba + d062ff3 commit 85da478
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -24,7 +24,7 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake
include(GitExternal)

set(VERSION_MAJOR "1")
set(VERSION_MINOR "2")
set(VERSION_MINOR "3")
set(VERSION_PATCH "0")
set(VERSION_ABI 2)

Expand Down
2 changes: 2 additions & 0 deletions doc/Changelog.md
Expand Up @@ -3,6 +3,8 @@

# git master {#master}

* Add a function to get the host corresponding to a given instance.

# Release 1.2 (02-11-2015) {#Release010200}

* Added a new library ServusQt: Provides servus::qt::ItemModel which implements
Expand Down
3 changes: 1 addition & 2 deletions servus/qt/itemModel.cpp
Expand Up @@ -191,8 +191,7 @@ QVariant ItemModel::data( const QModelIndex& index_, const int role ) const
if( item->children().isEmpty( ))
return QVariant();
return QString::fromStdString(
_impl->service.get( item->objectName().toStdString(),
"servus_host" ));
_impl->service.getHost( item->objectName().toStdString( )));
default:
return QVariant();
}
Expand Down
5 changes: 5 additions & 0 deletions servus/servus.cpp
Expand Up @@ -318,6 +318,11 @@ Strings Servus::getKeys( const std::string& instance ) const
return _impl->getKeys( instance );
}

const std::string& Servus::getHost( const std::string& instance ) const
{
return get( instance, "servus_host" );
}

bool Servus::containsKey( const std::string& instance,
const std::string& key ) const
{
Expand Down
3 changes: 3 additions & 0 deletions servus/servus.h
Expand Up @@ -168,6 +168,9 @@ class Servus
/** @return all keys discovered on the given instance. @version 1.1 */
SERVUS_API Strings getKeys( const std::string& instance ) const;

/** @return the host corresponding to the given instance. @version 1.3 */
SERVUS_API const std::string& getHost( const std::string& instance ) const;

/** @return true if the given key was discovered. @version 1.1 */
SERVUS_API bool containsKey( const std::string& instance,
const std::string& key ) const;
Expand Down

0 comments on commit 85da478

Please sign in to comment.