NodeDelegate.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005 Palmsource, Inc.
00003  * 
00004  * This software is licensed as described in the file LICENSE, which
00005  * you should have received as part of this distribution. The terms
00006  * are also available at http://www.openbinder.org/license.html.
00007  * 
00008  * This software consists of voluntary contributions made by many
00009  * individuals. For the exact contribution history, see the revision
00010  * history and logs, available at http://www.openbinder.org
00011  */
00012 
00013 #ifndef _STORAGE_NODEDELEGATE_H
00014 #define _STORAGE_NODEDELEGATE_H
00015 
00022 #include <storage/GenericNode.h>
00023 
00024 #include <support/INodeObserver.h>
00025 #include <support/Locker.h>
00026 
00027 #if _SUPPORTS_NAMESPACE
00028 namespace palmos {
00029 namespace storage {
00030 using namespace palmos::support;
00031 #endif
00032 
00037 
00038 
00050 class BNodeDelegate : public BGenericNode, public BnNodeObserver
00051 {
00052 public:
00053     // --------------------------------------------------------------
00057                                     BNodeDelegate(  const SContext& context,
00058                                                     const sptr<INode>& base);
00059 protected:
00060     virtual                         ~BNodeDelegate();
00061 public:
00062 
00064     virtual status_t                Link(const sptr<IBinder>& target, const SValue& bindings, uint32_t flags);
00066     virtual status_t                Unlink(const wptr<IBinder>& target, const SValue& bindings, uint32_t flags);
00068     inline  SContext                Context() { return BGenericNode::Context(); }
00069 
00071 
00072     // --------------------------------------------------------------
00078 
00080     inline  sptr<INode>             BaseNode() const { return m_baseNode; }
00081 
00082     virtual status_t                LookupEntry(const SString& entry, uint32_t flags, SValue* node);
00083     virtual SString                 MimeTypeLocked() const;
00084     virtual status_t                StoreMimeTypeLocked(const SString& value);
00085     virtual nsecs_t                 CreationDateLocked() const;
00086     virtual status_t                StoreCreationDateLocked(nsecs_t value);
00087     virtual nsecs_t                 ModifiedDateLocked() const;
00088     virtual status_t                StoreModifiedDateLocked(nsecs_t value);
00089 
00091 
00092     // --------------------------------------------------------------
00097 
00098     virtual void                    NodeChanged(const sptr<INode>& node, uint32_t flags, const SValue& hints);
00099     virtual void                    EntryCreated(const sptr<INode>& node, const SString& name, const sptr<IBinder>& entry);
00100     virtual void                    EntryModified(const sptr<INode>& node, const SString& name, const sptr<IBinder>& entry);
00101     virtual void                    EntryRemoved(const sptr<INode>& node, const SString& name);
00102     virtual void                    EntryRenamed(const sptr<INode>& node, const SString& old_name, const SString& new_name, const sptr<IBinder>& entry);
00103 
00105 
00106 private:
00107                                     BNodeDelegate(const BNodeDelegate&);
00108             BNodeDelegate&          operator=(const BNodeDelegate&);
00109 
00110             const sptr<INode>       m_baseNode;
00111             bool                    m_linkedToNode : 1;
00112 };
00113 
00114 // ==========================================================================
00115 // ==========================================================================
00116 
00119 #if _SUPPORTS_NAMESPACE
00120 } } // namespace palmos::storage
00121 #endif
00122 
00123 #endif // _STORAGE_NODEDELEGATE_H
00124