# This file was automatically generated by SWIG (https://www.swig.org).
# Version 4.5.1
#
# Do not make changes to this file unless you know what you are doing - modify
# the SWIG interface file instead.

package libdnf5::utils;
use base qw(Exporter);
use base qw(DynaLoader);
require libdnf5::exception;
package libdnf5::utilsc;
bootstrap libdnf5::utils;
package libdnf5::utils;
@EXPORT = qw();

# ---------- BASE METHODS -------------

package libdnf5::utils;

sub TIEHASH {
    my ($classname,$obj) = @_;
    return bless $obj, $classname;
}

sub CLEAR { }

sub FIRSTKEY { }

sub NEXTKEY { }

sub FETCH {
    my ($self,$field) = @_;
    my $member_func = "swig_${field}_get";
    $self->$member_func();
}

sub STORE {
    my ($self,$field,$newval) = @_;
    my $member_func = "swig_${field}_set";
    $self->$member_func($newval);
}

sub this {
    my $ptr = shift;
    return tied(%$ptr);
}


# ------- FUNCTION WRAPPERS --------

package libdnf5::utils;

*is_glob_pattern = *libdnf5::utilsc::is_glob_pattern;
*is_file_pattern = *libdnf5::utilsc::is_file_pattern;

############# Class : libdnf5::utils::Locale ##############

package libdnf5::utils::Locale;
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
@ISA = qw( libdnf5::utils );
%OWNER = ();
%ITERATORS = ();
sub new {
    my $pkg = shift;
    my $self = libdnf5::utilsc::new_Locale(@_);
    bless $self, $pkg if defined($self);
}

sub DESTROY {
    return unless $_[0]->isa('HASH');
    my $self = tied(%{$_[0]});
    return unless defined $self;
    delete $ITERATORS{$self};
    if (exists $OWNER{$self}) {
        libdnf5::utilsc::delete_Locale($self);
        delete $OWNER{$self};
    }
}

*get_cpp_locale = *libdnf5::utilsc::Locale_get_cpp_locale;
*get_c_locale = *libdnf5::utilsc::Locale_get_c_locale;
sub DISOWN {
    my $self = shift;
    my $ptr = tied(%$self);
    delete $OWNER{$ptr};
}

sub ACQUIRE {
    my $self = shift;
    my $ptr = tied(%$self);
    $OWNER{$ptr} = 1;
}


############# Class : libdnf5::utils::Locker ##############

package libdnf5::utils::Locker;
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
@ISA = qw( libdnf5::utils );
%OWNER = ();
%ITERATORS = ();
sub DESTROY {
    return unless $_[0]->isa('HASH');
    my $self = tied(%{$_[0]});
    return unless defined $self;
    delete $ITERATORS{$self};
    if (exists $OWNER{$self}) {
        libdnf5::utilsc::delete_Locker($self);
        delete $OWNER{$self};
    }
}

sub new {
    my $pkg = shift;
    my $self = libdnf5::utilsc::new_Locker(@_);
    bless $self, $pkg if defined($self);
}

*lock = *libdnf5::utilsc::Locker_lock;
*read_lock = *libdnf5::utilsc::Locker_read_lock;
*write_lock = *libdnf5::utilsc::Locker_write_lock;
*write_content = *libdnf5::utilsc::Locker_write_content;
*read_content = *libdnf5::utilsc::Locker_read_content;
*unlock = *libdnf5::utilsc::Locker_unlock;
*open_file = *libdnf5::utilsc::Locker_open_file;
*get_path = *libdnf5::utilsc::Locker_get_path;
sub DISOWN {
    my $self = shift;
    my $ptr = tied(%$self);
    delete $OWNER{$ptr};
}

sub ACQUIRE {
    my $self = shift;
    my $ptr = tied(%$self);
    $OWNER{$ptr} = 1;
}


# ------- VARIABLE STUBS --------

package libdnf5::utils;

*LockAccess_READ = *libdnf5::utilsc::LockAccess_READ;
*LockAccess_WRITE = *libdnf5::utilsc::LockAccess_WRITE;
*LockBlocking_NON_BLOCKING = *libdnf5::utilsc::LockBlocking_NON_BLOCKING;
*LockBlocking_BLOCKING = *libdnf5::utilsc::LockBlocking_BLOCKING;
1;
