//////////////////////////////////////////////////////////////////////////////// /*! @file FolderNode.h A node of RANet Knowledgebase that can have attributes. - Part of RANet - Research Assistant Net Library (based on ANSI C++). - Copyright(C) 1994-2013, Viktor E. Bursian, St.Petersburg, Russia. Viktor.Bursian@mail.ioffe.ru */////////////////////////////////////////////////////////////////////////////// #ifndef FolderNode_H #define FolderNode_H #include "Nodes.h" #include "Attribute.h" namespace RA { //------------------------------------------------------------------------------ //ANNOUNCE_CLASS(sFolderNode) //already predeclared in NodeLocation.h //-------------------------------------------------------------- sFolderNode --- /*! Simplest node of RANet Knowledgebase that can have attributes (also, a base class for all such nodes). */ class RANet_EXPORT sFolderNode : public sNode { STORABLE(sFolderNode) public://types enum tAttrListIOStatus {cToBeLoaded ,cSaved ,cRefreshed ,cChanged }; public: virtual ~sFolderNode (); explicit sFolderNode (sString docket =sString()); virtual sString Text (eTextFormat /*F=Plain*/ ,eTextDetalization D=Casual ); //!< visual representation for user sString Docket (); virtual void SetDocket (rcsString new_docket); virtual bool HasAttributes (); virtual bool AttrsHaveToBeSaved () const; virtual bool AttrsHaveToBeRefreshed () const; public://the following two members are used by for_each_* macros //they should never be used directly const std::list & Attributes () const { return TheAttributes; } QMutex * AttrListMutexPtr () { return &AttrListMutex; } protected: virtual sNodePtr GetAttr (sAttrName); virtual void SetAttr (sAttribute); virtual sNodePtr AscribeAttr (sAttribute); // virtual bool AscribeModel (sNodePtr ModelPtr); // virtual bool DelAttr (rsAttributeFinger); // //if successful, argument is shifted to the next // //attribute; othervise it remains unchanged virtual void DelAttr (sAttrName); virtual void DelAttr (sNodePtr value_ptr); virtual void DeleteAllAttributes (); protected: virtual void CopyFrom (psNode); private: void SetAttribute (sAttribute); void SetNamelessAttribute (sNodePtr); void SetNamedAttribute (sAttribute); sNodePtr AscribeAttribute (sAttribute); void AppendAttribute (sAttribute); // virtual void RemoveAttribute (sAttribute); void MergeAttrList (std::list &); virtual bool AllocateAttributes (); // virtual bool Strip (); private: //fields QMutex AttrListMutex; tAttrListIOStatus AttrListIOStatus; sTime AttrListStatusTimeStamp; std::list TheAttributes; //!@todo{Net} Docket: rename to Tag; (?)new sence sString TheDocket; friend class sNet; }; //------------------------------------------------------------------------------ } //namespace RA #endif