/***************************************************************************

    source::worx xtree
    Copyright © 2024-2025 c.holzheuer
    christoph.holzheuer@gmail.com

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

***************************************************************************/


#include <xqdocumentstore.h>
#include <xqitem.h>
#include <QFile>

//! erzeugt ein docukument

XQDocument::XQDocument(const QString& aFileName, const QString& aFriendlyName, XQItem* aTreeItem, XQViewModel* aViewModel )
    : fileName{ aFileName }, friendlyName{ aFriendlyName }, treeItem{ aTreeItem }, viewModel{ aViewModel }
{

}



///
/// ---
///


//! destruktor

XQDocumentStore::~XQDocumentStore()
{
  //for (auto entry : *this)
  //  delete entry;
  //for( int i=0; i<size();++i)
  //  delete at(i);
}


//! erzeugt ein document eintrag

void XQDocumentStore::addDocument(const QString& aFileName, const QString& aFriendlyName, XQItem* aTreeItem, XQViewModel* aViewModel )
{
  XQDocument newDocument( aFileName, aFriendlyName, aTreeItem, aViewModel );
  addAtKey(  aFileName, newDocument );
  // attention: this assumes the presence of the 'ProjectID' value
  //addAlias( aFileName, aTreeItem->attribute(c_ProjectID) );
  //addAlias( aFileName, "fitze!" );
}

