sbStringMap.cpp
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 :miv */
3 /*
4 //
5 // BEGIN SONGBIRD GPL
6 //
7 // This file is part of the Songbird web player.
8 //
9 // Copyright(c) 2005-2009 POTI, Inc.
10 // http://songbirdnest.com
11 //
12 // This file may be licensed under the terms of of the
13 // GNU General Public License Version 2 (the "GPL").
14 //
15 // Software distributed under the License is distributed
16 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
17 // express or implied. See the GPL for the specific language
18 // governing rights and limitations.
19 //
20 // You should have received a copy of the GPL along with this
21 // program. If not, go to http://www.gnu.org/licenses/gpl.html
22 // or write to the Free Software Foundation, Inc.,
23 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 // END SONGBIRD GPL
26 //
27 */
28 
29 #include "sbStringMap.h"
30 
34 
36 {
37  mMap.Init();
38 }
39 
41 {
42 }
43 
44 /* AString Find (in AString key); */
45 NS_IMETHODIMP sbStringMap::Get(const nsAString & aKey, nsAString & aValue)
46 {
47  nsString value;
48  PRBool const found = mMap.Get(aKey, &value);
49  if (!found) {
50  aValue.SetIsVoid(PR_TRUE);
51  }
52  else {
53  aValue = value;
54  }
55  return NS_OK;
56 }
57 
58 // sbIStringMapWritable implementation
59 /* void Set (in AString key, in AString value); */
60 NS_IMETHODIMP sbStringMap::Set(const nsAString & key, const nsAString & value)
61 {
62  PRBool const success = mMap.Put(nsString(key), nsString(value));
63  NS_ENSURE_TRUE(success, NS_ERROR_OUT_OF_MEMORY);
64  return NS_OK;
65 }
66 
67 /* void Clear (); */
68 NS_IMETHODIMP sbStringMap::Clear()
69 {
70  mMap.Clear();
71  return NS_OK;
72 }
return NS_OK
onPageChanged aValue
Definition: FeedWriter.js:1395
NS_IMPL_ISUPPORTS2(sbStringMap, sbIStringMap, sbIMutableStringMap) sbStringMap
Definition: sbStringMap.cpp:31
nsDataHashtable< nsStringHashKey, nsString > mMap
Definition: sbStringMap.h:60
countRef value
Definition: FeedWriter.js:1423
virtual ~sbStringMap()
Definition: sbStringMap.cpp:40