Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a function to get the host corresponding to a given instance #28

Merged
merged 1 commit into from Nov 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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