Jump to content

EA (class library)

From EDM2

Public members of class EA:

Constructors

There are three public constructors:

EA(const IString& name,
   const void*    buffer,
   unsigned long  length,
   USHORT         type=EAT_BINARY,
   BYTE           flag=0);

EA(const IString& name="",
   const IString& value="",
   BYTE  flag=0);

EA(const IString& name,
   const EAList&  list,
   BYTE  flag=0);


The first constructor can be used to construct EAs of any type, the second constructs an EA of type EAT_ASCII and the third converts an EAList to a MV-EA.

Predefined types are defined in <bsedos.h>. The only valid value for the flag parameter besides 0 is FEA_NEEDEA. In the latter case the EA is marked as critical and only programs explicitly supporting EAs can process the file.

Data-member access functions

name()
This function returns the value of the name data-member of the EA.
const IString& name() const;
value()
Returns the value of the value data-member of the given object.
const IString& value() const;
type() ; Returns the value of the type data-member of the given object.
USHORT type() const;
typeAsString()
Converts the value of type (resp. the value of the type data-member of the given object) to a string. If the type is not one of the predefined EAT_ types, the functions return "Unknown(xxxx)" were xxxx is the value of the type in hex.
static IString typeAsString(USHORT type);
IString typeAsString() const;
flag()
This function returns the value of the flag data-member of the EA.
BYTE flag() const;


Functions to change data-members

setName()
Sets the name data-member of the given object to name.
EA& setName(const IString& name);
setValue()
Sets the value data-member of the given object to value.
EA& setValue(const IString& value);


setType()
Sets the type data-member of the given object to type. Predefined values for type are defined in <bsedos.h>.
EA& setType(USHORT type);
setFlag()
Sets the flag data-member of the given object. Valid values for flag are 0 and FEA_NEEDEA.
EA& setFlag(BYTE flag);

Functions for interaction with files

read()
Reads the EA with the given name from the file or directory specified by pathName or by fileHandle.

The file must be open or available for read access with deny-write sharing mode.

If the name data-member of the given EA-object is empty, an IInvalidRequest-exception is thrown.

EA& read(const char* pathName);
EA& read(HFILE fileHandle);
write()
Write the EA to the file or directory specified by pathName or by fileHandle.

The file must be open or available for write access with deny-read and deny-write sharing mode.

If the name data-member of the given EA-object is empty, an IInvalidRequest-exception is thrown.

EA& write(const char* pathName);
EA& write(HFILE fileHandle);


remove()
Deletes the EA with the given name from the file or directory specified by pathName or by fileHandle.

The file must be open or available for write access with deny-read and deny-write sharing mode.

If the name data-member of the given EA-object is empty, an IInvalidRequest-exception is thrown.

The given object is not changed.

EA& remove(const char* pathName);
EA& remove(HFILE fileHandle);


Functions for multi-valued EAs

codePage()
This function returns the codepage field of a MV-EA. If the given EA is not of type EAT_MVST or EAT_MVMT the function throws an IInvalidRequest-exception.
USHORT codePage() const;
numValues()
This function returns the number of individual EAs in a MV-EA. If the given EA is not of type EAT_MVST or EAT_MVMT the function throws an IInvalidRequest-exception.
USHORT numValues() const;