/*
 * registryfile.h by Matthias Braun <matze@braunis.de>
 *
 * Copyright (C) 2002 Atomic Blue (info@planeshift.it, http://www.atomicblue.org) 
 *
 *
 * 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 (version 2 of the License)
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */
#ifndef __UPDATER_REGOBJECT_H__
#define __UPDATER_REGOBJECT_H__

#include <psstdint.h>

#include <csutil/parray.h>
#include <csutil/csstring.h>
#include "md5.h"

namespace updater
{

/** This class holds a file and it's attributes in the registry.
 */
class RegistryFile
{
public:
    // Flags (note: not all implemented yet)
    enum
    {
    FLAG_EXECUTABLE = 0x00000001,
    FLAG_TEXTFILE   = 0x00000002,
    FLAG_LINK    = 0x00000004,
    FLAG_CONFIGFILE = 0x00000010
    };

    RegistryFile ();
    RegistryFile (const char* path, uint32_t flags);
    ~RegistryFile ();

    bool operator < (const RegistryFile& other) const;
    bool operator == (const RegistryFile& other) const;

    csString file;            /// Path of the file
    csString link;            /// Destination if it's a link
    csString parentZip;     /// Path to parent ZIP file if any
    MD5Sum parentMD5;       /// MD5 for parent zip
    size_t parentSize; // Size for parent zip

    uint32_t flags;            /// flags
    size_t size;            /// size of the file
    
    //Zip things
    bool    inZip;          /// In a zip file?
    bool    removeFromZip;  /// Shall we remove the file?
    csString zipFile;       /// Internal path of the file

    /** md5 sum of the file (NULL or "" when not calculated yet) */
    MD5Sum md5;
};

typedef csPDelArray<RegistryFile> FileList;

} // end of namespace updater

#endif
