From 1c4057a3b31fa55461973ad1a1e5f28b7fd6826d Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Tue, 27 Jan 2009 18:36:04 +0000 Subject: [PATCH] function to check whether a prompt was loaded and exists git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1247 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- core/AmPromptCollection.cpp | 13 +++++++++++++ core/AmPromptCollection.h | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/core/AmPromptCollection.cpp b/core/AmPromptCollection.cpp index 52710212..a6bdfa28 100644 --- a/core/AmPromptCollection.cpp +++ b/core/AmPromptCollection.cpp @@ -105,6 +105,19 @@ AmCachedAudioFile* AudioFileEntry::getAudio(){ return new AmCachedAudioFile(&cache); } +bool AmPromptCollection::hasPrompt(const string& name) { + string s = name; + std::map::iterator it=store.begin(); + + while (it != store.end()) { + if (!strcmp(it->first.c_str(), s.c_str())) + break; + it++; + } + return it != store.end(); + +} + int AmPromptCollection::addToPlaylist(const std::string& name, long sess_id, AmPlaylist& list, bool front, bool loop) { diff --git a/core/AmPromptCollection.h b/core/AmPromptCollection.h index 27c1d6ef..2e03dc7f 100644 --- a/core/AmPromptCollection.h +++ b/core/AmPromptCollection.h @@ -92,6 +92,12 @@ class AmPromptCollection { int setPrompt(const string& name, const string& filename, const char* mod_name); + + /** + * check whether prompt exists + */ + bool hasPrompt(const string& name); + /** * add the announcement identified with @param name * to the playlist @list