summaryrefslogtreecommitdiffstats
path: root/veslibrary/ves_cpplibrary/src/lib/encode/XKeyImp.cpp
blob: fd0cc7a59e226d5575684ab1e3f35a348fd390ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "XKeyImp.h"

XKeyImp::XKeyImp(const XString& keyName):
        keyName_(keyName)
{

}

void XKeyImp::setKeyValue(const XString& keyValue)
{
    comVals_["keyValue"] = keyValue;
}
            
void XKeyImp::setKeyOrder(XInteger keyOrder)
{
    comVals_["keyOrder"] = keyOrder;
}
            
void XKeyImp::setKeyName(const XString& keyName)
{
    comVals_["keyName"] = keyName;
}

json XKeyImp::toJson()
{
    try
    {
        json field = {
            {"keyName", keyName_}
        };

        //optional val
        
        field = mergeCommonValues(field, comVals_);

        return field;
    }
    catch (json::exception& e)
    {
        SPDLOG_ERROR("Fail to build XKey to json object:{}.", e.what());
        return json();
    }
}