/*
 * registryfile.cpp 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.
 *
 */
#include <psconfig.h>

#include "registryfile.h"

#include "updaterglobals.h"

namespace updater
{

RegistryFile::RegistryFile ()
{
    flags = 0;
    size = 0;
    inZip = false;
    removeFromZip = false;
    parentZip = "";
    parentSize = 0;
}

RegistryFile::RegistryFile (const char* newfile, uint32_t newflags)
    : file(newfile), flags(newflags), size(0)
{
    inZip = false;
    removeFromZip = false;
    parentSize = 0;
}

RegistryFile::~RegistryFile ()
{
}

bool RegistryFile::operator < (const RegistryFile& other) const
{
    // we're not using strcmp here because this might give different results
    // based on locale setting
    const char* p1 = file;
    const char* p2 = other.file;
    while (*p1 != 0 && *p2 != 0)
    {
    if (*p1<*p2)
        return true;
    if (*p1>*p2)
        return false;
    p1++;
    p2++;
    }
    
    if (*p1==0 && *p2!=0)
    return true;
    
    return false;
}

bool RegistryFile::operator == (const RegistryFile& other) const
{
    return file == other.file && flags == other.flags && size == other.size
           && md5 == other.md5; 
}

} // end of namespace updater

