"Fossies" - the Fresh Open Source Software Archive

Member "google-gadgets-for-linux-0.11.2/ggadget/memory_options.h" (15 Mar 2009, 2421 Bytes) of package /linux/misc/old/google-gadgets-for-linux-0.11.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2   Copyright 2008 Google Inc.
    3 
    4   Licensed under the Apache License, Version 2.0 (the "License");
    5   you may not use this file except in compliance with the License.
    6   You may obtain a copy of the License at
    7 
    8        http://www.apache.org/licenses/LICENSE-2.0
    9 
   10   Unless required by applicable law or agreed to in writing, software
   11   distributed under the License is distributed on an "AS IS" BASIS,
   12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13   See the License for the specific language governing permissions and
   14   limitations under the License.
   15 */
   16 
   17 #ifndef GGADGET_MEMORY_OPTIONS_H__
   18 #define GGADGET_MEMORY_OPTIONS_H__
   19 
   20 #include <map>
   21 #include <ggadget/common.h>
   22 #include <ggadget/signals.h>
   23 #include <ggadget/options_interface.h>
   24 
   25 namespace ggadget {
   26 
   27 /**
   28  * @ingroup Options
   29  *
   30  * In memory implementation of OptionsInterface.
   31  */
   32 class MemoryOptions : public OptionsInterface {
   33  public:
   34   /** Constructs a @c MemoryOptions instance without size limit. */
   35   MemoryOptions();
   36 
   37   /**
   38    * Constructs a @c MemoryOptions instance with size limit.
   39    * If new added value causes the total size of names and values execeeds
   40    * the size limit, the value will be rejected.
   41    */
   42   MemoryOptions(size_t size_limit);
   43   virtual ~MemoryOptions();
   44 
   45   virtual Connection *ConnectOnOptionChanged(
   46       Slot1<void, const char *> *handler);
   47   virtual size_t GetCount();
   48   virtual void Add(const char *name, const Variant &value);
   49   virtual bool Exists(const char *name);
   50   virtual Variant GetDefaultValue(const char *name);
   51   virtual void PutDefaultValue(const char *name, const Variant &value);
   52   virtual Variant GetValue(const char *name);
   53   virtual void PutValue(const char *name, const Variant &value);
   54   virtual void Remove(const char *name);
   55   virtual void RemoveAll();
   56   virtual void EncryptValue(const char *name);
   57   virtual bool IsEncrypted(const char *name);
   58 
   59   virtual Variant GetInternalValue(const char *name);
   60   virtual void PutInternalValue(const char *name, const Variant &value);
   61   virtual bool Flush();
   62   virtual void DeleteStorage();
   63   virtual bool EnumerateItems(
   64       Slot3<bool, const char *, const Variant &, bool> *callback);
   65   virtual bool EnumerateInternalItems(
   66       Slot2<bool, const char *, const Variant &> *callback);
   67 
   68  private:
   69   DISALLOW_EVIL_CONSTRUCTORS(MemoryOptions);
   70   class Impl;
   71   Impl *impl_;
   72 };
   73 
   74 } // namespace ggadget
   75 
   76 #endif  // GGADGET_MEMORY_OPTIONS_H__