Re-organized sub-directory by category
[staging/basesystem.git] / service / native / framework_unified / client / NS_XMLConfigeParser / library / include / ns_config_parser_XML.h
1 /*
2  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
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 //////////////////////////////////////////////////////////////////////////////////////////////////
18 /// \ingroup MY 14 Platfom Software Team
19 /// \brief   Internal Header for ns_config_parser_XML.c
20 ///
21 ///  These functions are used to read  from and write to XML file.
22 ///
23 ///
24 //////////////////////////////////////////////////////////////////////////////////////////////////
25
26 #ifndef FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_XML_H_
27 #define FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_XML_H_
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33
34 #include <ns_config_parser_internal.h>
35 #define BUFFERSIZE 200
36 #define ZERO 0
37
38 ////////////////////////////////////////////////////////////////////////////////////////////
39 /// XMLGetValue:
40 /// Function : get value for given key.
41 ///
42 /// \param [in] pCurrNode
43 ///       xmlNodePtr - pCurrNode is a Pointer to node of XML tree.
44 /// \param [in] pNodePath
45 ///       const char * - pNodePath is a Pointer to path of Current XML node.
46 /// \param [in] pUserKey
47 ///       const char * - pUserKey is a Pointer to Key provided by user.
48 /// \param [in] pReturnValue
49 ///       char * - pReturnValue is a Pointer to value to be returned corresponding to Key.
50 /// \param [in] pReturnState
51 ///       int * -  pReturnState is updated depending upon user provided Key\n
52 ///                    returns 0 if user passed valid key.\n
53 ///                returns 1 if user passed invalid key.\n
54 /// \return  status
55 ///             void
56 ///////////////////////////////////////////////////////////////////////////////////////////
57 void XMLGetValue(xmlNodePtr pcurrnode , const char *pnodepath, const char *puserkey, char *preturnvalue,
58                  int *preturnstate);
59
60 ////////////////////////////////////////////////////////////////////////////////////////////
61 /// XMLUpdateOldValue:
62 /// Function : update value corresponding to given user key.
63 ///
64 /// \param [in] pCurrNode
65 ///       xmlNodePtr - pCurrNode is a Pointer to node of XML tree.
66 /// \param [in] pNodePath
67 ///       const char * - pNodePath is a Pointer to path of Current XML node.
68 /// \param [in] pUserKey
69 ///       const char * - pUserKey is a Pointer to Key provided by user.
70 /// \param [in] pValue
71 ///       const char * - pValue is a Pointer to the new value for attribute or text.
72 /// \param [in] pReturnState
73 ///       int * - returns 0 if user passed valid key.\n
74 ///                     returns -6 if old value is not updated with new value.\n
75 /// \return status
76 ///             void
77 ///////////////////////////////////////////////////////////////////////////////////////////
78 void XMLUpdateOldValue(xmlNodePtr pcurrnode , const char *pnodepath, const char *puserkey, const char *preturnvalue,
79                        int *preturnstate);
80
81 ////////////////////////////////////////////////////////////////////////////////////////////
82 /// XMLUpdateOldValueWithNewValue:
83 /// Function : Traverse all nodes of XML tree read value to given node,compare with old value,\n
84 ///            if old value matched then write new value in place of old value.
85 ///
86 /// \param [in] pCurrNode
87 ///       xmlNodePtr - pCurrNode is a Pointer to node of XML tree.
88 /// \param [in] pNodePath
89 ///       const char * -pNodePath is a Pointer to path of Current XML node.
90 /// \param [in] pUserKey
91 ///       const char * -pUserKey is a Pointer to Key provided by user.
92 /// \param [in] pOldValue
93 ///       const char * - pOldValue is a Pointer to the old value for attribute or text of key passed.
94 /// \param [in] pNewValue
95 ///       const char * -pNewValue is a Pointer to the new value for attribute or text to be assigned to the key.
96 /// \param [in] pReturnState
97 ///       int * - returns 0 if user passed valid key.\n
98 ///                     returns -6 if old value is not updated with new value.\n
99 /// \return status
100 ///             void
101 ///////////////////////////////////////////////////////////////////////////////////////////
102 void XMLUpdateOldValueWithNewValue(xmlNodePtr pcurrnode , const char *pnodepath, const char *puserkey,
103                                    const char *poldvalue,  const char *pnewvalue, int *preturnstate);
104
105
106
107 #ifdef __cplusplus
108 }
109 #endif
110
111 #endif  // FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_XML_H_
112
113 // EOF