# Path: libxyz/core/utils.py
# def bstring(bstr, enc=None):
#     """
#     Return encoded byte string
#     """
# 
#     if isinstance(bstr, str):
#         return bstr
#     
#     if enc is None:
#         enc = xyzenc
# 
#     if not isinstance(bstr, unicode):
#         return str(bstr)
# 
#     return bstr.encode(enc, 'replace')
# 
# def ustring(string, enc=None):
#     """
#     Return unicode string
#     """
# 
#     if isinstance(string, unicode):
#         return string
# 
#     if enc is None:
#         enc = xyzenc
# 
#     if not isinstance(string, str):
#         return unicode(string)
# 
#     # String
#     return string.decode(enc, 'replace')
# 
# Path: libxyz/vfs/types.py
# class VFSTypeBase(object):
# class VFSTypeFile(VFSTypeBase):
# class VFSTypeBlock(VFSTypeBase):
# class VFSTypeChar(VFSTypeBase):
# class VFSTypeDir(VFSTypeBase):
# class VFSTypeLink(VFSTypeBase):
# class VFSTypeFifo(VFSTypeBase):
# class VFSTypeSocket(VFSTypeBase):
# class VFSTypeUnknown(VFSTypeBase):
#     def __unicode__(self):
#     def __repr__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
# 
# Path: libxyz/vfs/util.py
# def get_file_type(st_mode):
# def format_size(size):
# def split_path(path):
# def get_user(uid=None):
# def get_group(gid=None):


import os
from libxyz.core.utils import bstring, ustring
from libxyz.vfs import types, util
# Max E. Kuznecov ~syhpoon <syhpoon@syhpoon.name> 2008
#
# This file is part of XYZCommander.
# XYZCommander is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# XYZCommander 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 Lesser Public License for more details.
# You should have received a copy of the GNU Lesser Public License
# along with XYZCommander. If not, see <http://www.gnu.org/licenses/>.



class VFSObject(object):
    """
    Abstract interface for VFS objects
    """

    def __init__(self, xyz, path, full_path, ext_path, driver, parent,
                 enc=None, **kwargs):
        self.xyz = xyz
        self.enc = enc or xyzenc
        # Internal VFS path
        self.path = bstring(path, self.enc)
        # Full VFS path
        self.full_path = bstring(full_path, self.enc)
        # External VFS path

# Path: libxyz/core/utils.py
# def bstring(bstr, enc=None):
#     """
#     Return encoded byte string
#     """
# 
#     if isinstance(bstr, str):
#         return bstr
#     
#     if enc is None:
#         enc = xyzenc
# 
#     if not isinstance(bstr, unicode):
#         return str(bstr)
# 
#     return bstr.encode(enc, 'replace')
# 
# def ustring(string, enc=None):
#     """
#     Return unicode string
#     """
# 
#     if isinstance(string, unicode):
#         return string
# 
#     if enc is None:
#         enc = xyzenc
# 
#     if not isinstance(string, str):
#         return unicode(string)
# 
#     # String
#     return string.decode(enc, 'replace')
# 
# Path: libxyz/vfs/types.py
# class VFSTypeBase(object):
# class VFSTypeFile(VFSTypeBase):
# class VFSTypeBlock(VFSTypeBase):
# class VFSTypeChar(VFSTypeBase):
# class VFSTypeDir(VFSTypeBase):
# class VFSTypeLink(VFSTypeBase):
# class VFSTypeFifo(VFSTypeBase):
# class VFSTypeSocket(VFSTypeBase):
# class VFSTypeUnknown(VFSTypeBase):
#     def __unicode__(self):
#     def __repr__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
# 
# Path: libxyz/vfs/util.py
# def get_file_type(st_mode):
# def format_size(size):
# def split_path(path):
# def get_user(uid=None):
# def get_group(gid=None):


# Path: libxyz/vfs/vfsobj.py
import os
from libxyz.core.utils import bstring, ustring
from libxyz.vfs import types, util

# Max E. Kuznecov ~syhpoon <syhpoon@syhpoon.name> 2008
#
# This file is part of XYZCommander.
# XYZCommander is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# XYZCommander 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 Lesser Public License for more details.
# You should have received a copy of the GNU Lesser Public License
# along with XYZCommander. If not, see <http://www.gnu.org/licenses/>.



class VFSObject(object):
    """
    Abstract interface for VFS objects
    """

    def __init__(self, xyz, path, full_path, ext_path, driver, parent,
                 enc=None, **kwargs):
        self.xyz = xyz
        self.enc = enc or xyzenc
        # Internal VFS path
        self.path = bstring(path, self.enc)
        # Full VFS path
        self.full_path = bstring(full_path, self.enc)
        # External VFS path

        self.ext_path = bstring(ext_path, self.enc)