]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/ValueParser.cpp
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / cpp / DataBoardTest / DataBoard / ValueParser.cpp
1 #include "ValueParser.h"
2
3 #include "DataBoardRepository.h"
4 #include "DataValueRepository.h"
5
6 namespace Databoard {
7         namespace Value {
8
9                 void parse(std::string fileName, Databoard::Value::DataValueRepository* &dataValueRepository, Databoard::Type::DataBoardRepository* dataBoardRepository)
10                 {
11                         if(dataValueRepository == NULL)
12                         {
13                                 dataValueRepository = new DataValueRepository();
14                         }
15
16                         if(dataBoardRepository != NULL)
17                         {
18                                 dataValueRepository->open(fileName, dataBoardRepository);
19                         }
20                 }
21
22                 DATABOARD_API Databoard::Value::Value* parse(std::string fileName, Databoard::Type::DataType* dataType)
23                 {
24                         if(dataType != NULL)
25                         {
26                                 Databoard::Value::DataValueRepository* dataValueRepository = new DataValueRepository();
27
28                                 Databoard::Value::Value* value = dataValueRepository->open(fileName, dataType);
29
30                                 delete dataValueRepository;
31                                 dataValueRepository = 0;
32
33                                 return value;
34                         }
35
36                         return NULL;
37                 }
38
39
40                 void free(DataValueRepository* dataValueRepository)
41                 {
42                         if(dataValueRepository != NULL)
43                         {
44                                 delete dataValueRepository;
45                         }
46                 }
47         }
48 }