PhoenixInkscape  2.0.0
Generate multiple png files with svg inkscape files
data_file.h File Reference
#include "data_stream.h"
+ Include dependency graph for data_file.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename T >
bool data_load (const std::string &fileName, T &data)
 Load data from a message. More...
 
template<typename T >
bool data_load (const std::string &fileName, T *data, size_t nbElement)
 Load data from a message. More...
 
template<typename T >
bool data_load (FILE *iter, T &data)
 Load data from a message. More...
 
template<typename T >
bool data_load (FILE *iter, T *data, size_t nbElement)
 Load data from a message. More...
 
template<typename T >
bool data_save (const std::string &fileName, const T &data)
 Save data in a message. More...
 
template<typename T >
bool data_save (const std::string &fileName, const T *data, size_t nbElement)
 Save data in a message. More...
 
template<typename T >
bool data_save (FILE *iter, const T &data)
 Save data in a message. More...
 
template<typename T >
bool data_save (FILE *iter, const T *data, size_t nbElement)
 Save data in a message. More...
 

Function Documentation

◆ data_load() [1/4]

template<typename T >
bool data_load ( const std::string &  fileName,
T &  data 
)

Load data from a message.

Parameters
fileName: name of the file to be read
[out]data: data to be loaded from the message
Returns
true on success, false otherwise

Definition at line 93 of file data_file.h.

93  {
94  FILE* iter = fopen(fileName.c_str(), "r");
95  if(iter == NULL){
96  return false;
97  }
99  fclose(iter);
100  return b;
101 }
Generic DataStream class.

◆ data_load() [2/4]

template<typename T >
bool data_load ( const std::string &  fileName,
T *  data,
size_t  nbElement 
)

Load data from a message.

Parameters
fileName: name of the file to be read
[out]data: data to be loaded from the message
nbElement: number of elements in the data
Returns
true on success, false otherwise

Definition at line 110 of file data_file.h.

110  {
111  FILE* iter = fopen(fileName.c_str(), "r");
112  if(iter == NULL){
113  return false;
114  }
115  bool b(DataStream<FILE*, DataStreamMode::READ, T>::data_stream(iter, data, nbElement));
116  fclose(iter);
117  return b;
118 }

◆ data_load() [3/4]

template<typename T >
bool data_load ( FILE *  iter,
T &  data 
)

Load data from a message.

Parameters
[out]iter: message to be read
[out]data: data to be loaded from the message
Returns
true on success, false otherwise

Definition at line 39 of file data_file.h.

39  {
41 }
static bool data_stream(Stream &ds, T &data)
Dummy function to catch if a type is not specialised.

References DataStream< Stream, Mode, T >::data_stream().

Referenced by pinkscape_loadSlideMap(), testShadokFile(), testShadokTypeFile(), testSimpleListPairValue(), testSimpleListValue(), testSimpleMapValue(), testSimpleTableFile(), testSimpleValue(), testSimpleVectorPairValue(), and testSimpleVectorValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ data_load() [4/4]

template<typename T >
bool data_load ( FILE *  iter,
T *  data,
size_t  nbElement 
)

Load data from a message.

Parameters
[out]iter: message to be read
[out]data: data to be loaded from the message
nbElement: number of elements in the data
Returns
true on success, false otherwise

Definition at line 50 of file data_file.h.

50  {
51  return DataStream<FILE*, DataStreamMode::READ, T>::data_stream(iter, data, nbElement);
52 }

References DataStream< Stream, Mode, T >::data_stream().

+ Here is the call graph for this function:

◆ data_save() [1/4]

template<typename T >
bool data_save ( const std::string &  fileName,
const T &  data 
)

Save data in a message.

Parameters
fileName: name of the file to be written
data: data to be saved in the message
Returns
true on success, false otherwise

Definition at line 60 of file data_file.h.

60  {
61  FILE* iter = fopen(fileName.c_str(), "w");
62  if(iter == NULL){
63  return false;
64  }
66  fclose(iter);
67  return b;
68 }

◆ data_save() [2/4]

template<typename T >
bool data_save ( const std::string &  fileName,
const T *  data,
size_t  nbElement 
)

Save data in a message.

Parameters
fileName: name of the file to be written
data: data to be saved in the message
nbElement: number of elements in the data
Returns
true on success, false otherwise

Definition at line 77 of file data_file.h.

77  {
78  FILE* iter = fopen(fileName.c_str(), "w");
79  if(iter == NULL){
80  return false;
81  }
82  bool b(DataStream<FILE*, DataStreamMode::WRITE, T>::data_stream(iter, (T*)data, nbElement));
83  fclose(iter);
84  return b;
85 }

◆ data_save() [3/4]

template<typename T >
bool data_save ( FILE *  iter,
const T &  data 
)

Save data in a message.

Parameters
[out]iter: message to be written
data: data to be saved in the message
Returns
true on success, false otherwise

Definition at line 18 of file data_file.h.

18  {
20 }

References DataStream< Stream, Mode, T >::data_stream().

Referenced by pinkscape_saveSlideMap(), testShadokFile(), testShadokTypeFile(), testSimpleListPairValue(), testSimpleListValue(), testSimpleMapValue(), testSimpleTableFile(), testSimpleValue(), testSimpleVectorPairValue(), and testSimpleVectorValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ data_save() [4/4]

template<typename T >
bool data_save ( FILE *  iter,
const T *  data,
size_t  nbElement 
)

Save data in a message.

Parameters
[out]iter: message to be written
data: data to be saved in the message
nbElement: number of elements in the data
Returns
true on success, false otherwise

Definition at line 29 of file data_file.h.

29  {
30  return DataStream<FILE*, DataStreamMode::WRITE, T>::data_stream(iter, (T*)data, nbElement);
31 }

References DataStream< Stream, Mode, T >::data_stream().

+ Here is the call graph for this function: