All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HSEP::FileTool Class Reference

Provides accessories to read and write different types of structured files. More...

#include <FileTool.h>

Static Public Member Functions

static int store (ostream &pOutputRef, StringDictionary &pDictRef)
 Stores the specified dictionary into the provided stream, so it can be recovered calling the "retrieve" method.
 
static bool retrieve (StringDictionary &pDictRef, istream &pInputRef)
 Recovers a dictionary from the specified stream.
 
static int store (ostream &pOutputRef, StringArray &pArrayRef)
 Stores the specified array into the provided stream, so it can be recovered calling the "retrieve" method.
 
static bool retrieve (StringArray &pArrayRef, istream &pInputRef)
 Recovers an array from the specified stream.
 

Detailed Description

Provides accessories to read and write different types of structured files.

Definition at line 37 of file FileTool.h.

Member Function Documentation

bool HSEP::FileTool::retrieve ( StringDictionary pDictRef,
istream &  pInputRef 
)
static

Recovers a dictionary from the specified stream.

The stream format follows the pattern:

  key=value
  key=value

The empty lines or the ones start with the # character, won't be taken into consideration.

Parameters
pDictRef
pInputRef
Returns
true when at least one element was retrieved from the stream.
false when no elements were retrieved from the stream.

Definition at line 56 of file FileTool.cpp.

References HSEP::Dictionary< T >::clear(), HSEP::StringTool::drop(), HSEP::StringTool::ltrim(), and HSEP::Dictionary< T >::put().

+ Here is the call graph for this function:

bool HSEP::FileTool::retrieve ( StringArray pArrayRef,
istream &  pInputRef 
)
static

Recovers an array from the specified stream.

Each line is recovered as a different Array string element.

Parameters
pArrayRef
pInputRef
Returns

Definition at line 102 of file FileTool.cpp.

References HSEP::Array< T >::clear(), HSEP::StringTool::drop(), HSEP::StringTool::ltrim(), and HSEP::Array< T >::push().

+ Here is the call graph for this function:

int HSEP::FileTool::store ( ostream &  pOutputRef,
StringDictionary pDictRef 
)
static

Stores the specified dictionary into the provided stream, so it can be recovered calling the "retrieve" method.

The content on the stream will follow the pattern:

  key=value
  key=value
 
Parameters
pOutputRef
pDictRef
Returns
The quantity of stored items.

Definition at line 42 of file FileTool.cpp.

References HSEP::Dictionary< T >::forEach().

+ Here is the call graph for this function:

int HSEP::FileTool::store ( ostream &  pOutputRef,
StringArray pArrayRef 
)
static

Stores the specified array into the provided stream, so it can be recovered calling the "retrieve" method.

Each element is send as a different line to the stream.

Parameters
pOutputRef
pArrayRef
Returns
The quantity of stored items.

Definition at line 89 of file FileTool.cpp.

References HSEP::Array< T >::forEach().

+ Here is the call graph for this function:


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