
/*---------------------------------------------------------------------------*/
/* http_vfs_entry.h                                                          */
/* copyright (c) innovaphone 2015                                            */
/*                                                                           */
/*---------------------------------------------------------------------------*/

class HTTPVfsEntry : public btree {
protected:
    char * name;
    btree * childs;
    HTTPVfsEntry * parent;
    HTTPDataSource * dataSource;

    void RemoveChild(HTTPVfsEntry * child);

public:
    HTTPVfsEntry(const char * name, HTTPVfsEntry * parent);
    ~HTTPVfsEntry();

    virtual int btree_compare(void * key);
    virtual int btree_compare(class btree * b);

    //HTTPVfsEntry * GetChilds() { return childs; }
    HTTPVfsEntry * FindChild(const char * name);
    HTTPDataSource * GetDataSource() { return dataSource; }

    void AddChild(HTTPVfsEntry * child) { childs = childs->btree_put(child); }
    void SetDataSource(HTTPDataSource * dataSource) { this->dataSource = dataSource; }
    void RemoveDataSourceRecursive(HTTPDataSource * dataSource);
    const char * GetName() { return this->name; }
};
