Qore Magic Module  0.0.2
Qore::Magic::Magic Class Reference

A low level wrapper around libmagic. More...

#include <magic.dox.h>

Public Member Functions

string buffer (data data)
 Returns magic info for a data buffer. More...
 
string buffer (data data, softint flags)
 Returns magic info for a data buffer. More...
 
 constructor ()
 Constructs a dummy. More...
 
 constructor (softint flags)
 Constructs specialized instance. More...
 
string file (softstring fileName)
 Returns magic info for a file (path) More...
 
string file (softstring fileName, softint flags)
 Returns magic info for a file (path) More...
 
 setFlags (softint flags)
 Resets new flags/features based on libmagic Constants. More...
 

Detailed Description

A low level wrapper around libmagic.

Restrictions:
Qore::PO_NO_FILESYSTEM

Example of use:

1 Magic m(MAGIC_MIME_TYPE);
2 printf("%y\n", m.file("/etc/resolv.conf"));

Resulting in:

"inode/symlink; charset=binary"

Member Function Documentation

string Qore::Magic::Magic::buffer ( data  data)

Returns magic info for a data buffer.

Restrictions:
Qore::PO_NO_FILESYSTEM
Parameters
dataa data to file to be examined
Return values
stringa text with requested info
string Qore::Magic::Magic::buffer ( data  data,
softint  flags 
)

Returns magic info for a data buffer.

Restrictions:
Qore::PO_NO_FILESYSTEM
Parameters
dataa data to file to be examined
flagssettings flags
Return values
stringa text with requested info
Qore::Magic::Magic::constructor ( )

Constructs a dummy.

See also
MAGIC_NONE instance
Qore::Magic::Magic::constructor ( softint  flags)

Constructs specialized instance.

Parameters
flagsfeatures set based on libmagic Constants
string Qore::Magic::Magic::file ( softstring  fileName)

Returns magic info for a file (path)

Restrictions:
Qore::PO_NO_FILESYSTEM
Parameters
fileNamea path to file to be examined
Return values
stringa text with requested info
string Qore::Magic::Magic::file ( softstring  fileName,
softint  flags 
)

Returns magic info for a file (path)

Restrictions:
Qore::PO_NO_FILESYSTEM
Parameters
fileNamea path to file to be examined
flagssettings flags
Return values
stringa text with requested info
Qore::Magic::Magic::setFlags ( softint  flags)

Resets new flags/features based on libmagic Constants.

Parameters
flagsNew flags to replace old settings.

The documentation for this class was generated from the following file: