Author: sayer
Date: 2009-01-27 19:36:04 +0100 (Tue, 27 Jan 2009)
New Revision: 1247

Modified:
   trunk/core/AmPromptCollection.cpp
   trunk/core/AmPromptCollection.h
Log:
function to check whether a prompt was loaded and exists

Modified: trunk/core/AmPromptCollection.cpp
===================================================================
--- trunk/core/AmPromptCollection.cpp   2009-01-27 10:16:46 UTC (rev 1246)
+++ trunk/core/AmPromptCollection.cpp   2009-01-27 18:36:04 UTC (rev 1247)
@@ -105,6 +105,19 @@
   return new AmCachedAudioFile(&cache);
 }
 
+bool AmPromptCollection::hasPrompt(const string& name) {
+  string s = name;
+  std::map<std::string, AudioFileEntry*>::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) {

Modified: trunk/core/AmPromptCollection.h
===================================================================
--- trunk/core/AmPromptCollection.h     2009-01-27 10:16:46 UTC (rev 1246)
+++ trunk/core/AmPromptCollection.h     2009-01-27 18:36:04 UTC (rev 1247)
@@ -92,7 +92,13 @@
   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
    */

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to