1 /* 2 * Copyright (C) 2014 The Android Open Source Project 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 #ifndef SYNCML_DM_DDF_H 18 #define SYNCML_DM_DDF_H 19 20 #ifndef __cplusplus 21 #error "This is a C++ header file; it requires C++ to compile." 22 #endif 23 24 /*================================================================================================== 25 26 Header Name: dmMetaDataManager.h 27 28 General Description: This file contains declaration of the DMMetaDataManager class 29 30 ==================================================================================================*/ 31 32 #include "dm_tree_class.H" 33 #include "SyncML_DM_FileHandle.H" 34 #include "dmMetaDataNode.h" 35 #include "dmtoken.h" 36 37 typedef BOOLEAN (*SYNCML_DM_MDF_CBACK)(DMNode* pNode, PDmtNode ptrPluginNode, CPCHAR szNodeName, CPCHAR szOrigName); 38 39 40 class DMMetaDataVector : public DMVector<UINT32> 41 { 42 }; 43 44 class DMMetaPCharVector : public DMVector<CPCHAR> 45 { 46 }; 47 48 /** 49 * DMMetaNodeLocator represents a locator of Meta Data node stored in a cache 50 */ 51 struct DMMetaNodeLocator 52 { 53 /** 54 * Default constructor 55 */ 56 DMMetaNodeLocator() 57 { 58 m_szName = NULL; 59 m_nOffset = 0; 60 m_wAccessType = 0; 61 } 62 63 /** 64 * Constructor that sets values of structures 65 * \param szName [in] - node name 66 * \param offset [in] - offset of a node in the MDF file 67 * \param wAccessType [in] - node access type 68 * \param oPath [in] - full MDF path 69 */ 70 DMMetaNodeLocator(CPCHAR szName, 71 UINT32 offset, 72 SYNCML_DM_ACCESS_TYPE_T wAccessType, 73 const DMBuffer & oPath) 74 { 75 m_szName = szName; 76 m_nOffset = offset; 77 m_wAccessType = wAccessType; 78 oPath.copyTo(m_strPath); 79 } 80 81 82 /* Node name */ 83 CPCHAR m_szName; 84 /* Offset of a node in the MDF file */ 85 UINT32 m_nOffset; 86 /* Node access type */ 87 SYNCML_DM_ACCESS_TYPE_T m_wAccessType; 88 /* Full MDF path */ 89 DMString m_strPath; 90 }; 91 92 93 class DMMetaDataNodeVector : public DMVector<DMMetaNodeLocator> 94 { 95 }; 96 97 /** 98 * DMLastMetaDataNode represents a last accessed MDF node 99 */ 100 class DMLastMetaDataNode 101 { 102 public: 103 /** 104 * Default constructor 105 */ 106 DMLastMetaDataNode () 107 { 108 m_pBuffer = NULL; 109 } 110 111 /** 112 * Initializes object 113 */ 114 void Init() 115 { 116 m_pBuffer = NULL; 117 m_oLocator.clear(); 118 } 119 120 /* MDF buffer */ 121 MDF_BUFFER_T m_pBuffer; 122 /* Meta node locator */ 123 DMMetaDataNodeVector m_oLocator; 124 }; 125 126 class DMTree; 127 128 /** 129 * DMMetaDataManager represents a Meda Data Manager for constraints and DMT schema verification 130 */ 131 class DMMetaDataManager 132 { 133 public: 134 /** 135 * Default constructor 136 */ 137 DMMetaDataManager(); 138 139 /** 140 * Destructor 141 */ 142 ~DMMetaDataManager(); 143 144 /** 145 * Initializes Meta Data manager 146 * \param env [in] - pointer on env object 147 * \param pTree[in] - pointer on DM tree object 148 * \return Return Type (SYNCML_DM_RET_STATUS_T) 149 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 150 * - All other codes indicate failure. 151 */ 152 SYNCML_DM_RET_STATUS_T Init( CEnv* env, DMTree* tree ); 153 154 /** 155 * Deinitializes Meta Data manager 156 */ 157 void DeInit(); 158 159 /** 160 * Verifyes parameters of a node to be added 161 * \param pNode [in] - pointer on DM node to be added 162 * \param oAddData [in] - data to be added 163 * \param oAutoNodes [out] - comma separated list of nodes to be auto added 164 * \param bNodeGetAccess [out] - specifies if node has "Get" permission 165 * \return Return Type (SYNCML_DM_RET_STATUS_T) 166 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 167 * - All other codes indicate failure. 168 */ 169 SYNCML_DM_RET_STATUS_T VerifyAddParameters(DMNode* pNode, 170 DMAddData & oAddData, 171 DMToken & oAutoNodes, 172 BOOLEAN & bNodeGetAccess); 173 174 /** 175 * Verifyes parameters of a node to be replaced/renamed 176 * \param pNode [in] - pointer on DM node to be replaced 177 * \param szURI [in] - path to replaced node 178 * \param oAddData [in] - data to be replaced with 179 * \param szOrigName [in] - original name of a node (in case of "Rename" operation 180 * \return Return Type (SYNCML_DM_RET_STATUS_T) 181 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 182 * - All other codes indicate failure. 183 */ 184 SYNCML_DM_RET_STATUS_T VerifyReplaceParameters(DMNode* pNode, 185 CPCHAR szURI, 186 DMAddData & oAddData, 187 CPCHAR szOrigName); 188 189 /** 190 * Verifyes if node can de deleted 191 * \param pNode [in] - pointer on DM node to be deleted 192 * \param szURI [in] - path of node to be deleted 193 * \return Return Type (SYNCML_DM_RET_STATUS_T) 194 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 195 * - All other codes indicate failure. 196 */ 197 SYNCML_DM_RET_STATUS_T VerifyDeleteParameters(DMNode* pNode, 198 CPCHAR szURI); 199 200 /** 201 * Sets auto node property 202 * \param szURI [in] - path to replaced node 203 * \param oAddData [out] - data to be set for auto node 204 * \return Return Type (SYNCML_DM_RET_STATUS_T) 205 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 206 * - All other codes indicate failure. 207 */ 208 SYNCML_DM_RET_STATUS_T SetAutoNodeProperty(CPCHAR szURI, 209 DMAddData & pAdd); 210 211 /** 212 * Verifyes access type od a node 213 * \param szURI [in] - node path 214 * \param accessType [in] - access type to be verified 215 * \param pChildDependNodes [out] - pointer on list of hard and soft dependencies of node 216 * \return TRUE if access type is found (operation is allowed) 217 */ 218 BOOLEAN VerifyAccessType(CPCHAR szURI, 219 SYNCML_DM_ACCESS_TYPE_T accessType, 220 DMMetaPCharVector* pChildDependNodes = NULL); 221 222 /** 223 * Verifies max number of children multinodes that can by created under a node 224 * \param szURI [in] - Node path 225 * \param count [in] - current number of nodes 226 * \param bOPiDataParent [in] - specifies if node is a parent of node containing plug-in data 227 * \return TRUE if max number isn't reached 228 */ 229 BOOLEAN VerifyChildrenMultiNodesCount(CPCHAR szURI, 230 UINT16 count, 231 BOOLEAN& bOPiDataParent); 232 233 /** 234 * Verifies if node is a overlay plug-in node 235 * \param szURI [in] - node path 236 * \param szID [out] - node id 237 * \param wAccessType [out] - node access type 238 * \param nNodeFormat [out] - node format 239 * \return TRUE if node ia a overlay plug-in node 240 */ 241 BOOLEAN VerifyOPINode(CPCHAR szURI, 242 CPCHAR& szID, 243 SYNCML_DM_ACCESS_TYPE_T& wAccessType, 244 SYNCML_DM_FORMAT_T& nNodeFormat ); 245 246 /** 247 * Retrieves children of node as "/" separated string 248 * \param szURI [in] - node path 249 * \param strChildrenList [out] - list of children 250 * \return count of children 251 */ 252 UINT16 UpdateChildrenList(CPCHAR szURI, 253 DMString& strChildrenList ); 254 255 /** 256 * Verifies if node is a parent of node containing plg-in data 257 * \param szURI [in] - node path 258 * \return TRUE if node is a parent of node containing plg-in data 259 */ 260 BOOLEAN IsOPiDataParent(CPCHAR szURI); 261 262 /** 263 * Checks if node has a "Local" attribute 264 * \param szURI [in] - node path 265 * \return TRUE if "Local" attribute is set 266 */ 267 BOOLEAN IsLocal(CPCHAR szURI); 268 269 /** 270 * Checks if node is a leaf 271 * \param szURI [in] - node path 272 * \return TRUE if is a leaf 273 */ 274 BOOLEAN IsLeaf(CPCHAR szURI); 275 276 /** 277 * Retrieves a MDF path for a node (could different because of multinodes and reccurance pattern 278 * \param szURI [in] - node path 279 * \param szPath [out] - MDF path 280 * \return count of children 281 */ 282 SYNCML_DM_RET_STATUS_T GetPath(CPCHAR szURI, 283 DMString & szMDF); 284 285 #ifdef LOB_SUPPORT 286 /** 287 * Verifies if node is a large object 288 * \param szURI [in] - node path 289 * \return TRUE if node is a large object 290 */ 291 BOOLEAN IsESN( CPCHAR szURI ); 292 293 /** 294 * Verifies if node is a progress bar is required for large object 295 * \param szURI [in] - node path 296 * \return TRUE if progress bar is required 297 */ 298 BOOLEAN IsProgressBarNeeded( CPCHAR szURI ); 299 #endif 300 301 private: 302 enum 303 { 304 CurrentBMDFVersion = 1, 305 BMDFHeaderSize = 6 /* file size (4) and version (2) */ 306 }; 307 308 /** 309 * Copy constructor 310 */ 311 DMMetaDataManager( const DMMetaDataManager& mdm ); 312 313 /** Assignment operator */ 314 const DMMetaDataManager& operator=( const DMMetaDataManager& mdm ); 315 316 /** 317 * Retrieves node name (from path in case of plugin node or from URI 318 * \param pNode [in] - pointer on DM node 319 * \param szURI [in] - node path 320 * \return pointer on node name 321 */ 322 CPCHAR GetNodeName(DMNode *pNode, CPCHAR szURI); 323 324 /** 325 * Verifyes parameters of a node for Add/Replace and Rename operation 326 * \param oNodeMDF [in] - Meta node 327 * \param pNode [in] - pointer on DM node to be verified 328 * \param szNodeName [in] - node name 329 * \param oAddData [in] - data to be added or replaced with 330 * \return Return Type (SYNCML_DM_RET_STATUS_T) 331 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 332 * - All other codes indicate failure. 333 */ 334 SYNCML_DM_RET_STATUS_T VerifyParameters(const DMMetaDataNode & oNodeMDF, 335 DMNode* pNode, 336 CPCHAR szNodeName, 337 DMAddData & oAddData); 338 339 /** 340 * Verifyes data field (value) 341 * \param oAddData [in] - data to be added or replaced with 342 * \return Return Type (SYNCML_DM_RET_STATUS_T) 343 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 344 * - All other codes indicate failure. 345 */ 346 SYNCML_DM_RET_STATUS_T VerifyData(DMAddData & oAddData); 347 348 /** 349 * Verifyes format of a node 350 * \param oNodeMDF [in] - Meta node 351 * \param oAddData [in] - data to be added or replaced with 352 * \return Return Type (SYNCML_DM_RET_STATUS_T) 353 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 354 * - All other codes indicate failure. 355 */ 356 SYNCML_DM_RET_STATUS_T VerifyFormat(const DMMetaDataNode & oNodeMDF, 357 DMAddData & oAddData); 358 359 /** 360 * Verifyes integer value 361 * \param oData [in] - value to be checked 362 * \return Return Type (SYNCML_DM_RET_STATUS_T) 363 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 364 * - All other codes indicate failure. 365 */ 366 SYNCML_DM_RET_STATUS_T VerifyInteger(const DMBuffer & oData); 367 368 /** 369 * Verifyes interior node constraints 370 * \param pConstraints [in] - pointer of node constraints 371 * \param szNodeName [in] - node name 372 * \return Return Type (SYNCML_DM_RET_STATUS_T) 373 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 374 * - All other codes indicate failure. 375 */ 376 SYNCML_DM_RET_STATUS_T VerifyInteriorNodeConstraints(DMConstraints *pConstraints, 377 CPCHAR szNodeName); 378 379 /** 380 * Sets default value to data structure 381 * \param oNodeMDF [in] - Meta node 382 * \param oAddData [out] - data to be added or replaced with 383 * \return Return Type (SYNCML_DM_RET_STATUS_T) 384 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 385 * - All other codes indicate failure. 386 */ 387 SYNCML_DM_RET_STATUS_T SetDefaultValue(const DMMetaDataNode & oNodeMDF, 388 DMAddData & oAddData); 389 390 /** 391 * Verifies leaf node constraints 392 * \param oNodeMDF [in] - Meta node 393 * \param oAddData [out] - data to be added or replaced with 394 * \return Return Type (SYNCML_DM_RET_STATUS_T) 395 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 396 * - All other codes indicate failure. 397 */ 398 SYNCML_DM_RET_STATUS_T VerifyLeafNodeConstraints(const DMMetaDataNode & oNodeMDF, 399 DMAddData & oAddData); 400 401 /** 402 * Verifies node constraints 403 * \param oNodeMDF [in] - Meta node 404 * \param pNode [in] - pointer on DM node to be verified 405 * \param szNodeName [in] - node name 406 * \param oAddData [out] - data to be added or replaced with 407 * \return Return Type (SYNCML_DM_RET_STATUS_T) 408 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 409 * - All other codes indicate failure. 410 */ 411 SYNCML_DM_RET_STATUS_T VerifyConstraints(const DMMetaDataNode & oNodeMDF, 412 DMNode* pNode, 413 CPCHAR szNodeName, 414 DMAddData & oAddData); 415 416 417 /** 418 * Verifyes if value is a digit 419 * \param oData [in] - value to be checked 420 * \return TRUE if value correct 421 */ 422 BOOLEAN IsDigit(const DMBuffer & oData); 423 424 /** 425 * Verifyes if value is a boolean 426 * \param oData [in] - value to be checked 427 * \return TRUE if value correct 428 */ 429 BOOLEAN IsBoolean(const DMBuffer & oData); 430 431 /** 432 * Verifyes if value is a float 433 * \param oData [in] - value to be checked 434 * \return TRUE if value correct 435 */ 436 BOOLEAN IsFloat(const DMBuffer & oData); 437 438 /** 439 * Verifyes if value is a date 440 * \param oData [in] - value to be checked 441 * \return TRUE if value correct 442 */ 443 BOOLEAN IsDate(const DMBuffer & oData); 444 445 /** 446 * Verifyes if value is a time 447 * \param oData [in] - value to be checked 448 * \return TRUE if value correct 449 */ 450 BOOLEAN IsTime(const DMBuffer & oData); 451 452 /** 453 * Verifyes node name value constraint 454 * \param pConstraints [in] - pointer of node constraints 455 * \param szNodeName [in] - node name 456 * \return TRUE if node name is correct 457 */ 458 BOOLEAN VerifynValues(DMConstraints *pConstraints, 459 const DMString & szNodeName); 460 461 /** 462 * Verifyes node value constraint 463 * \param pConstraints [in] - pointer of node constraints 464 * \param format [in] - node format 465 * \param oData [in] - node value 466 * \return TRUE if value is correct 467 */ 468 BOOLEAN VerifyValues(DMConstraints *pConstraints, 469 SYNCML_DM_FORMAT_T format, 470 const DMBuffer & oData); 471 472 /** 473 * Verifyes foreign key constraint 474 * \param pConstraints [in] - pointer of node constraints 475 * \param oData [in] - node value 476 * \return TRUE if value is correct 477 */ 478 BOOLEAN VerifyForeignKey(DMConstraints * pConstraints, 479 const DMBuffer & oData); 480 481 /** 482 * Verifyes regular expression constraint 483 * \param pConstraints [in] - pointer of node constraints 484 * \param szData [in] - value to check 485 * \return TRUE if value is correct 486 */ 487 SYNCML_DM_RET_STATUS_T VerifyRegExp(CPCHAR szPattern, 488 CPCHAR szData); 489 490 /** 491 * Searches Meta Data node name in the children list 492 * \param oBuffer [in] - Meta Data buffer (MDF file) 493 * \param szName [in] - node name 494 * \return Return Type (UINT32) 495 * returns offset on node if name is found, 0 otherwise 496 */ 497 UINT32 FindNodeInChildrenList(DMMetaDataBuffer oBuffer, 498 CPCHAR szName) const; 499 500 /** 501 * Verifies hard and soft dependency constraints 502 * \param szNodeName [in] - node name 503 * \param szURI [in] - node path 504 * \param szOrigName [in] - original node name (in case of Rename) 505 * \param callBackSoft [in] - method to call for soft dependency constraint 506 * \param callBackHard [in] - method to call for hard dependency constraint 507 * \param accessType [in] - access type 508 * \return TRUE if constraints verified with success 509 */ 510 BOOLEAN VerifyChildDependency(CPCHAR szNodeName, 511 CPCHAR szURI, 512 CPCHAR szOrigName, 513 SYNCML_DM_MDF_CBACK callBackSoft, 514 SYNCML_DM_MDF_CBACK callBackHard, 515 SYNCML_DM_ACCESS_TYPE_T accessType); 516 517 /** 518 * Verifies hard or soft dependency constraints 519 * \param szNodeName [in] - node name 520 * \param szDependencies [in] - soft or hard dependency constraint 521 * \param szOrigName [in] - original node name (in case of Rename) 522 * \param callBack [in] - method to call for constraint 523 * \param callBackSoft [in] - method to call for hard dependency constraint 524 * \return TRUE if constraints verified with success 525 */ 526 BOOLEAN VerifyDependency(CPCHAR szNodeName, 527 CPCHAR szDependecies, 528 CPCHAR szOrigName, 529 SYNCML_DM_MDF_CBACK callBack); 530 531 /** 532 * Verifies hard or soft dependency constraint for one specified path (from constraint) 533 * \param pNode [in] - pointer on DM node to be verified 534 * \param szURI [in] - node path 535 * \param szNodeName [in] - node name 536 * \param szOneURI [in] - constraint path 537 * \param szOrigName [in] - original node name (in case of Rename) 538 * \param callBack [in] - method to call for dependency constraint 539 * \param bIsMultiNode [in] - specifies if node is a multinode 540 * \return TRUE if constraints verified with success 541 */ 542 BOOLEAN VerifyOneURIDependency(DMNode* pNode, 543 char * sURI, 544 CPCHAR szNodeName, 545 CPCHAR szOneURI, 546 CPCHAR szOrigName, 547 SYNCML_DM_MDF_CBACK callBack, 548 BOOLEAN bIsMultiNode); 549 550 /** 551 * Verifies hard or soft dependency constraint for one specified path (from constraint) on plug-in node 552 * \param pNode [in] - pointer on DM node to be verified 553 * \param pPluginNode [in] - smart pointer on plug-in node 554 * \param szURI [in] - node path 555 * \param szNodeName [in] - node name 556 * \param szOneURI [in] - constraint path 557 * \param szOrigName [in] - original node name (in case of Rename) 558 * \param callBack [in] - method to call for dependency constraint 559 * \param bIsMultiNode [in] - specifies if node is a multinode 560 * \return TRUE if constraints verified with success 561 */ 562 BOOLEAN VerifyPluginURIDependency(DMNode* pNode, 563 PDmtNode pPluginNode, 564 char * sURI, 565 CPCHAR szNodeName, 566 CPCHAR szOneURI, 567 CPCHAR szOrigName, 568 SYNCML_DM_MDF_CBACK callBack, 569 BOOLEAN bIsMultiNode); 570 571 /** 572 * Builds start point of search of MDF node base on last MDF node accessed 573 * \param szURI [in] - DM node path to be found in a cache 574 * \param oBuffer [in] - Meta Data buffer (MDF file) 575 * \param accessType [out] - accessType (is set if path is found in a cache) 576 * \param oNode [out] - Meta Node (is set if path is found in a cache) 577 * \return Return Type (CPCHAR) 578 * returns tail segments of szURI from which manager continues seach, NULL if path isn't found in a cache. 579 * - All other codes indicate failure. 580 */ 581 CPCHAR BuildSearchURI(CPCHAR szURI, 582 DMMetaDataBuffer & oBuffer, 583 SYNCML_DM_ACCESS_TYPE_T & accessType, 584 DMMetaDataNode & oNode ); 585 586 /** 587 * Searches MDF node 588 * \param szURI [in] - node path to be found 589 * \param oBuffer [in] - Meta Data buffer (MDF file) 590 * \param parentAccessType [in] - access type from parent node 591 * \param bCheckMultiNode [in] - specifies if max number of multinodes should be read 592 * \param oNode [out] - found Meta Data node 593 * \param pChildDependNodes [out] - pointer on list of hard and soft dependencies of node 594 * \return Return Type (SYNCML_DM_RET_STATUS_T) 595 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 596 * - All other codes indicate failure. 597 */ 598 SYNCML_DM_RET_STATUS_T SearchNode(CPCHAR szURI, 599 DMMetaDataBuffer oBuffer, 600 SYNCML_DM_ACCESS_TYPE_T parentAccessType, 601 BOOLEAN bCheckMultiNode, 602 DMMetaDataNode & oNode, 603 DMMetaPCharVector* pChildDependNodes ); 604 605 /** 606 * Retrieves a MDF node 607 * \param szURI [in] - node path to be found 608 * \param bCheckMultiNode [in] - specifies if max number of multinodes should be read 609 * \param oNode [out] - found Meta Data node 610 * \param pChildDependNodes [out] - pointer on list of hard and soft dependencies of node 611 * \return Return Type (SYNCML_DM_RET_STATUS_T) 612 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 613 * - All other codes indicate failure. 614 */ 615 SYNCML_DM_RET_STATUS_T GetNode(CPCHAR szURI, 616 BOOLEAN bCheckMultiNode, 617 DMMetaDataNode & pNode, 618 DMMetaPCharVector* pChildDependNodes = NULL); 619 620 /** 621 * Removes reccursive segments form search path 622 * \param sTailSegments [in] - URI to remove reccursive segments 623 * \param oNode [in] - Meta Data node 624 * \return Return Type (SYNCML_DM_RET_STATUS_T) 625 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 626 * - All other codes indicate failure. 627 */ 628 SYNCML_DM_RET_STATUS_T RemoveRecursiveSegments(char* sTailSegment, 629 DMMetaDataNode & oNode); 630 631 /** 632 * Unloads MDF files from memory 633 */ 634 void UnLoad(); 635 636 #ifndef DM_STATIC_FILES 637 /** 638 * Loads MDF files located in the specified directory 639 * \param szDirectory [in] - name of directory 640 * \param bIgnoreRoot [in] - specifies if root.bmdf should be ignored 641 * \return Return Type (SYNCML_DM_RET_STATUS_T) 642 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 643 * - All other codes indicate failure. 644 */ 645 SYNCML_DM_RET_STATUS_T LoadDir(CPCHAR szDirectory, BOOLEAN bIgnoreRoot); 646 647 /** 648 * Loads MDF file 649 * \param szPath [in] - file name 650 * \return Return Type (SYNCML_DM_RET_STATUS_T) 651 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 652 * - All other codes indicate failure. 653 */ 654 SYNCML_DM_RET_STATUS_T LoadBuffer(CPCHAR szPath); 655 #else 656 /** 657 * Loads static MDF file 658 * \param szPath [in] - file index 659 * \return Return Type (SYNCML_DM_RET_STATUS_T) 660 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 661 * - All other codes indicate failure. 662 */ 663 SYNCML_DM_RET_STATUS_T LoadBuffer(UINT32 index); 664 #endif 665 666 /** 667 * Loads MDF files 668 */ 669 SYNCML_DM_RET_STATUS_T Load(); 670 671 /** 672 * Verifies if specified node name is a value of other node 673 * \param pNode [in] - pointer on DM node to be verified 674 * \param pPluginNode [in] - smart pointer on plug-in node 675 * \param szNodeName [in] - node name 676 * \param szOrigName [in] - original node name (in case of Rename) 677 * \return TRUE if name is not value of other node 678 */ 679 static BOOLEAN CheckFieldInUse(DMNode* pNode, 680 PDmtNode pPluginNode, 681 CPCHAR szNodeName, 682 CPCHAR szOrigName); 683 684 /** 685 * Clears value of node if specified node name is a value 686 * \param pNode [in] - pointer on DM node to be verified 687 * \param pPluginNode [in] - smart pointer on plug-in node 688 * \param szNodeName [in] - node name 689 * \param szOrigName [in] - original node name (in case of Rename) 690 * \return TRUE if name is not value of other node 691 */ 692 static BOOLEAN ClearNodeValue(DMNode* pNode, 693 PDmtNode pPluginNode, 694 CPCHAR szNodeName, 695 CPCHAR szOrigName); 696 697 /** 698 * Resets value of node if specified node name is a value 699 * \param pNode [in] - pointer on DM node to be verified 700 * \param pPluginNode [in] - smart pointer on plug-in node 701 * \param szNodeName [in] - node name 702 * \param szOrigName [in] - original node name (in case of Rename) 703 * \return TRUE if name is not value of other node 704 */ 705 static BOOLEAN ResetNodeValue(DMNode* pNode, 706 PDmtNode pPluginNode, 707 CPCHAR szNodeName, 708 CPCHAR szOrigName); 709 710 /** 711 * Retrieves root node from MDF file 712 * \param oNode [out] - Meta node 713 * \return Return Type (SYNCML_DM_RET_STATUS_T) 714 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 715 * - All other codes indicate failure. 716 */ 717 SYNCML_DM_RET_STATUS_T GetRootNode(DMMetaDataNode & oNode); 718 719 /** 720 * Verifies and retrieves start position of path to search (skips "./" ) 721 * \param szURI [in] - Meta node 722 * \return Return Type (CPCHAR) 723 * adjusted path, or NULL if URI isn't correct 724 */ 725 CPCHAR GetStartPos(CPCHAR szURI); 726 727 /** 728 * Finds path in the cache of last accessed node 729 * \param szURI [in] - DM node path to be found in a cache 730 * \param bCheckMultiNode [in] - specifies if max number of multinodes should be read 731 * \param oNode [out] - Meta Data node 732 * \param oBuffer [out] - Meta Data buffer 733 * \param oNode [out] - Meta Node (is set if path is found in a cache) 734 * \param pChildDependNodes [out] - pointer on list of hard and soft dependencies of node 735 * \return Return Type (SYNCML_DM_RET_STATUS_T) 736 * - SYNCML_DM_SUCCESS - indicate that operation is completed successfully. 737 * - All other codes indicate failure. 738 */ 739 SYNCML_DM_RET_STATUS_T FindCacheNode(CPCHAR szURI, 740 BOOLEAN bCheckMultiNode, 741 DMMetaDataNode & oNode, 742 DMMetaDataBuffer & oBuffer, 743 DMMetaPCharVector* pChildDependNodes); 744 745 /* Regular expression pattern for float values */ 746 static CPCHAR m_pFloatPattern[]; 747 /* Regular expression pattern for date values */ 748 static CPCHAR m_pDatePattern[]; 749 /* Regular expression pattern for time values */ 750 static CPCHAR m_pTimePattern[]; 751 752 753 /* pointer on env object */ 754 CEnv* m_pEnv; 755 /* pointer on DMTree object */ 756 DMTree* m_pTree; 757 /* Specifies if MDF file is loaded */ 758 BOOLEAN m_bIsLoad; 759 /* Vector that hold pointers on MDF buffers loaded into memory */ 760 DMMetaDataVector m_oDDFInfo; 761 /* Last accessed Meta Data node */ 762 DMLastMetaDataNode m_oLastNodeLocator; 763 }; 764 765 /*================================================================================================*/ 766 #endif 767