4fc282aa1e02d5dfe1be1be8be668ea7fee7e3c0
[platform/core/security/cert-svc.git] / vcore / src / dpl / test / src / value_separated_policies.cpp
1 /*
2  * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /*
17  * @file        value_separated_policies.cpp
18  * @author      Tomasz Iwanek (t.iwanek@samsung.com)
19  * @brief       ...
20  */
21
22 #include<dpl/test/value_separated_policies.h>
23 #include<dpl/foreach.h>
24
25 namespace VcoreDPL {
26
27 std::string CSVTokenizerPolicy::GetSeperators()
28 {
29     return ",";
30 }
31
32 bool CSVTokenizerPolicy::SkipEmpty()
33 {
34     return false;
35 }
36
37 void CSVTokenizerPolicy::PrepareValue(std::string &)
38 {
39 }
40
41 bool CSVTokenizerPolicy::TryAgainAtEnd(int)
42 {
43     return false;
44 }
45
46 bool CSVParserPolicy::SkipLine(const std::vector<std::string> & )
47 {
48     return false;
49 }
50
51 bool CSVParserPolicy::Validate(std::shared_ptr<std::vector<std::vector<std::string> > > & result)
52 {
53     int num = -1;
54     FOREACH(r, *result)
55     {
56         int size = r->size();
57         if(num != -1 && num != size)
58             return false;
59
60         num = size;
61     }
62     return true;
63 }
64
65 }