Sfoglia il codice sorgente

HPCC-8614 Improved ConfigMgr

- Fixes based on comments

Signed-off-by: Gleb Aronsky <gleb.aronsky@lexisnexis.com>
Gleb Aronsky 8 anni fa
parent
commit
d84d2ad01c
92 ha cambiato i file con 1221 aggiunte e 1439 eliminazioni
  1. 7 96
      cmake_modules/commonSetup.cmake
  2. 1 1
      configuration/CMakeLists.txt
  3. 47 42
      configuration/configurator/BuildSet.cpp
  4. 6 5
      configuration/configurator/BuildSet.hpp
  5. 44 9
      configuration/configurator/CMakeLists.txt
  6. 1 3
      configuration/configurator/ConfigFileComponentUtils.cpp
  7. 3 4
      configuration/configurator/ConfigFileUtils.cpp
  8. 3 3
      configuration/configurator/ConfigNotifications.hpp
  9. 189 218
      configuration/configurator/ConfigSchemaHelper.cpp
  10. 13 14
      configuration/configurator/ConfigSchemaHelper.hpp
  11. 8 4
      configuration/configurator/ConfiguratorAPI.cpp
  12. 1 1
      configuration/configurator/ConfiguratorAPI.hpp
  13. 63 62
      configuration/configurator/ConfiguratorMain.cpp
  14. 1 1
      configuration/configurator/DocumentationMarkup.hpp
  15. 1 1
      configuration/configurator/EnvironmentConfiguration.cpp
  16. 1 1
      configuration/configurator/ExceptionStrings.cpp
  17. 2 1
      configuration/configurator/ExceptionStrings.hpp
  18. 0 7
      configuration/configurator/JSONMarkUp.cpp
  19. 1 3
      configuration/configurator/JSONMarkUp.hpp
  20. 0 0
      configuration/configurator/schemas/SchemaAll.hpp
  21. 14 14
      configuration/configurator/SchemaAnnotation.cpp
  22. 3 3
      configuration/configurator/SchemaAnnotation.hpp
  23. 2 2
      configuration/configurator/SchemaAppInfo.cpp
  24. 0 0
      configuration/configurator/schemas/SchemaAppInfo.hpp
  25. 8 8
      configuration/configurator/SchemaAttributeGroup.cpp
  26. 1 1
      configuration/configurator/SchemaAttributeGroup.hpp
  27. 60 63
      configuration/configurator/SchemaAttributes.cpp
  28. 9 9
      configuration/configurator/SchemaAttributes.hpp
  29. 3 2
      configuration/configurator/SchemaChoice.cpp
  30. 0 0
      configuration/configurator/schemas/SchemaChoice.hpp
  31. 23 22
      configuration/configurator/SchemaCommon.cpp
  32. 43 130
      configuration/configurator/SchemaCommon.hpp
  33. 2 2
      configuration/configurator/SchemaComplexContent.cpp
  34. 0 0
      configuration/configurator/schemas/SchemaComplexContent.hpp
  35. 16 15
      configuration/configurator/SchemaComplexType.cpp
  36. 1 3
      configuration/configurator/SchemaComplexType.hpp
  37. 6 6
      configuration/configurator/SchemaDocumentation.cpp
  38. 3 3
      configuration/configurator/SchemaDocumentation.hpp
  39. 125 212
      configuration/configurator/SchemaElement.cpp
  40. 6 6
      configuration/configurator/SchemaElement.hpp
  41. 23 24
      configuration/configurator/SchemaEnumeration.cpp
  42. 1 1
      configuration/configurator/SchemaEnumeration.hpp
  43. 3 3
      configuration/configurator/SchemaExtension.cpp
  44. 0 0
      configuration/configurator/schemas/SchemaExtension.hpp
  45. 26 26
      configuration/configurator/SchemaField.cpp
  46. 1 1
      configuration/configurator/SchemaField.hpp
  47. 2 2
      configuration/configurator/SchemaFractionDigits.cpp
  48. 0 0
      configuration/configurator/schemas/SchemaFractionDigits.hpp
  49. 23 20
      configuration/configurator/SchemaInclude.cpp
  50. 21 2
      configuration/configurator/SchemaInclude.hpp
  51. 37 36
      configuration/configurator/SchemaKey.cpp
  52. 1 1
      configuration/configurator/SchemaKey.hpp
  53. 35 30
      configuration/configurator/SchemaKeyRef.cpp
  54. 1 1
      configuration/configurator/SchemaKeyRef.hpp
  55. 3 3
      configuration/configurator/SchemaLength.cpp
  56. 0 0
      configuration/configurator/schemas/SchemaLength.hpp
  57. 106 115
      configuration/configurator/SchemaMapManager.cpp
  58. 0 0
      configuration/configurator/schemas/SchemaMapManager.hpp
  59. 0 0
      configuration/configurator/schemas/SchemaMaxExclusive.cpp
  60. 0 0
      configuration/configurator/schemas/SchemaMaxExclusive.hpp
  61. 0 0
      configuration/configurator/schemas/SchemaMaxInclusive.cpp
  62. 0 0
      configuration/configurator/schemas/SchemaMaxInclusive.hpp
  63. 0 0
      configuration/configurator/schemas/SchemaMaxLength.cpp
  64. 0 0
      configuration/configurator/schemas/SchemaMaxLength.hpp
  65. 0 0
      configuration/configurator/schemas/SchemaMinExclusive.cpp
  66. 0 0
      configuration/configurator/schemas/SchemaMinExclusive.hpp
  67. 0 0
      configuration/configurator/schemas/SchemaMinInclusive.cpp
  68. 0 0
      configuration/configurator/schemas/SchemaMinInclusive.hpp
  69. 0 0
      configuration/configurator/schemas/SchemaMinLength.cpp
  70. 0 0
      configuration/configurator/schemas/SchemaMinLength.hpp
  71. 0 0
      configuration/configurator/schemas/SchemaPattern.cpp
  72. 0 0
      configuration/configurator/schemas/SchemaPattern.hpp
  73. 4 4
      configuration/configurator/SchemaRestriction.cpp
  74. 0 0
      configuration/configurator/schemas/SchemaRestriction.hpp
  75. 63 71
      configuration/configurator/SchemaSchema.cpp
  76. 1 1
      configuration/configurator/SchemaSchema.hpp
  77. 20 27
      configuration/configurator/SchemaSelector.cpp
  78. 0 0
      configuration/configurator/schemas/SchemaSelector.hpp
  79. 2 2
      configuration/configurator/SchemaSequence.cpp
  80. 0 0
      configuration/configurator/schemas/SchemaSequence.hpp
  81. 17 13
      configuration/configurator/SchemaSimpleContent.cpp
  82. 0 0
      configuration/configurator/schemas/SchemaSimpleContent.hpp
  83. 29 33
      configuration/configurator/SchemaSimpleType.cpp
  84. 6 6
      configuration/configurator/SchemaSimpleType.hpp
  85. 0 0
      configuration/configurator/schemas/SchemaTotalDigits.cpp
  86. 0 0
      configuration/configurator/schemas/SchemaTotalDigits.hpp
  87. 24 24
      configuration/configurator/SchemaUnique.cpp
  88. 1 1
      configuration/configurator/SchemaUnique.hpp
  89. 2 6
      configuration/configurator/SchemaWhiteSpace.cpp
  90. 0 0
      configuration/configurator/schemas/SchemaWhiteSpace.hpp
  91. 51 8
      deployment/deploy/XMLTags.h
  92. 1 1
      plugins/cassandra/cpp-driver

+ 7 - 96
cmake_modules/commonSetup.cmake

@@ -107,6 +107,13 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
   endif()
   option(LOGGING_SERVICE "Configure use of logging service" ON)
 
+  option(MAKE_CONFIGURATOR "Build Configurator" ON)
+  option(CONFIGURATOR_LIB "Build Configurator static library (.a)" OFF)
+
+  if ( CONFIGURATOR_LIB )
+        set( MAKE_CONFIGURATOR ON )
+  endif()
+
     MACRO(SET_PLUGIN_PACKAGE plugin)
         string(TOLOWER "${plugin}" pname)
 	    if(DEFINED pluginname)
@@ -182,102 +189,6 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
       endif()
   endif()
 
-  option(MAKE_CONFIGURATOR "Build Configurator" ON)
-  option(CONFIGURATOR_LIB "Build Configurator static library (.a)" OFF)
-
-  if ( CONFIGURATOR_LIB )
-        set( MAKE_CONFIGURATOR ON )
-  endif()
-
-  if (APPLE OR WIN32)
-      option(USE_TBB "Enable Threading Building Block support" OFF)
-  else()
-      option(USE_TBB "Enable Threading Building Block support" ON)
-      option(USE_TBBMALLOC "Enable Threading Building Block scalable allocator proxy support" ON)
-  endif()
-
-  option(LOGGING_SERVICE "Configure use of logging service" ON)
-
-
-    if(REMBED)
-	if(DEFINED pluginname)
-            message(FATAL_ERROR "Cannot enable rembed, already declared ${pluginname}")
-	    else()
-            set(pluginname "rembed")
-        endif()
-    endif()
-    if(V8EMBED)
-	    if(DEFINED pluginname)
-	        message(FATAL_ERROR "Cannot enable v8embed, already declared ${pluginname}")
-        else()
-            set(pluginname "v8embed")
-        endif()
-    endif()
-    if(MEMCACHED)
-	    if(DEFINED pluginname)
-	        message(FATAL_ERROR "Cannot enable memcached, already declared ${pluginname}")
-        else()
-            set(pluginname "memcached")
-        endif()
-    endif()
-    if(PYEMBED)
-	    if(DEFINED pluginname)
-	        message(FATAL_ERROR "Cannot enable pyembed, already declared ${pluginname}")
-        else()
-            set(pluginname "pyembed")
-        endif()
-    endif()
-    if(REDIS)
-	    if(DEFINED pluginname)
-	        message(FATAL_ERROR "Cannot enable redis, already declared ${pluginname}")
-        else()
-            set(pluginname "redis")
-        endif()
-    endif()
-    if(JAVAEMBED)
-	    if(DEFINED pluginname)
-	        message(FATAL_ERROR "Cannot enable javaembed, already declared ${pluginname}")
-        else()
-            set(pluginname "javaembed")
-        endif()
-    endif()
-    if(MYSQLEMBED)
-	    if(DEFINED pluginname)
-	        message(FATAL_ERROR "Cannot enable mysqlembed, already declared ${pluginname}")
-        else()
-            set(pluginname "mysqlembed")
-        endif()
-    endif()
-    if(SQLITE3EMBED)
-	    if(DEFINED pluginname)
-	         message(FATAL_ERROR "Cannot enable sqlite3embed, already declared ${pluginname}")
-        else()
-            set(pluginname "sqlite3embed")
-        endif()
-    endif()
-    if(KAFKA)
-	    if(DEFINED pluginname)
-	        message(FATAL_ERROR "Cannot enable kafka, already declared ${pluginname}")
-        else()
-            set(pluginname "kafka")
-        endif()
-    endif()
-    if(EXAMPLEPLUGIN)
-        if(DEFINED pluginname)
-            message(FATAL_ERROR "Cannot enable exampleplugin, already declared ${pluginname}")
-        else()
-           set(pluginname "exampleplugin")
-        endif()
-    endif()
-    if(COUCHBASEEMBED)
-        if(DEFINED pluginname)
-            message(FATAL_ERROR "Cannot enable couchbaseembed, already declared ${pluginname}")
-        else()
-            set(pluginname "couchbaseembed")
-        endif()
-    endif()
-
->>>>>>> ConfigMgr 2.0 - The Configurator
   if ( USE_XALAN AND USE_LIBXSLT )
       set(USE_LIBXSLT OFF)
   endif()

+ 1 - 1
configuration/CMakeLists.txt

@@ -1,5 +1,5 @@
 ################################################################################
-#    HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems.
+#    HPCC SYSTEMS software Copyright (C) 2016 HPCC Systems.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License");
 #    you may not use this file except in compliance with the License.

+ 47 - 42
configuration/configurator/BuildSet.cpp

@@ -1,6 +1,6 @@
 /*##############################################################################
 
-    HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems®.
+    HPCC SYSTEMS software Copyright (C) 2016 HPCC Systems®.
 
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
@@ -22,38 +22,35 @@
 
 using namespace CONFIGURATOR;
 
-#define LOOP_THRU_BUILD_SET for (int idx = 0; idx < m_buildSetArray.length(); idx++)
+#define LOOP_THRU_BUILD_SET int len = m_buildSetArray.length(); for (int idx = 0; idx < len; idx++)
 
-static CBuildSetManager *s_pBuildSetManager = NULL;
+static CBuildSetManager *s_pBuildSetManager = nullptr;
 
 CBuildSetManager* CBuildSetManager::getInstance(const char* pBuildSetFile, const char* pBuildSetDirectory)
 {
-    if (s_pBuildSetManager == NULL)
+    if (s_pBuildSetManager == nullptr)
     {
         s_pBuildSetManager = new CBuildSetManager();
 
-        if (pBuildSetFile != NULL)
-            s_pBuildSetManager->m_buildSetFile.set(pBuildSetFile);
-        else
-            s_pBuildSetManager->m_buildSetFile.set(DEFAULT_BUILD_SET_XML_FILE);
-
-        if (pBuildSetDirectory != NULL)
-            s_pBuildSetManager->m_buildSetDir.set(pBuildSetDirectory);
-        else
-            s_pBuildSetManager->m_buildSetDir.set(DEFAULT_BUILD_SET_DIRECTORY);
+        s_pBuildSetManager->m_buildSetFile.set(pBuildSetFile != nullptr ? pBuildSetFile : DEFAULT_BUILD_SET_XML_FILE);
+        s_pBuildSetManager->m_buildSetDir.set(pBuildSetDirectory != nullptr ? pBuildSetDirectory : DEFAULT_BUILD_SET_DIRECTORY);
 
         pBuildSetFile = s_pBuildSetManager->m_buildSetFile;
         pBuildSetDirectory = s_pBuildSetManager->m_buildSetDir;
 
-        s_pBuildSetManager->m_buildSetPath.clear().appendf("%s%s%s", pBuildSetDirectory, pBuildSetDirectory[strlen(pBuildSetDirectory)-1] == '/' ? "" : "/", pBuildSetFile);
-        s_pBuildSetManager->populateBuildSet();
+        s_pBuildSetManager->m_buildSetPath.setf("%s%s%s", pBuildSetDirectory, pBuildSetDirectory[strlen(pBuildSetDirectory)-1] == '/' ? "" : "/", pBuildSetFile);
+        if (s_pBuildSetManager->populateBuildSet() == false)
+        {
+            delete s_pBuildSetManager;
+            s_pBuildSetManager = nullptr;
+        }
     }
     return s_pBuildSetManager;
 }
 
 CBuildSetManager::CBuildSetManager(const char* pBuildSetFile, const char* pBuildSetDir) : m_buildSetFile(pBuildSetFile), m_buildSetDir(pBuildSetDir)
 {
-    if (pBuildSetFile != NULL && pBuildSetDir != NULL)
+    if (pBuildSetFile != nullptr && pBuildSetDir != nullptr)
        m_buildSetPath.clear().appendf("%s%s%s", pBuildSetDir, pBuildSetDir[strlen(pBuildSetDir)-1] == '/' ? "" : "/", pBuildSetFile);
 }
 
@@ -88,26 +85,36 @@ void CBuildSetManager::getBuildSetServices(StringArray& buildSetArray) const
 
 const char* CBuildSetManager::getBuildSetServiceName(int index) const
 {
+    if (index >= getBuildSetServiceCount())
+        return nullptr;
     return this->getBuildSetService(index)->getName();
 }
 
 const char* CBuildSetManager::getBuildSetServiceFileName(int index) const
 {
+    if (index >= getBuildSetServiceCount())
+        return nullptr;
     return this->getBuildSetService(index)->getSchema();
 }
 
 const char* CBuildSetManager::getBuildSetComponentTypeName(int index) const
 {
+    if (index >= this->getBuildSetComponentCount())
+        return nullptr;
     return this->getBuildSetComponent(index)->getName();
 }
 
 const char* CBuildSetManager::getBuildSetComponentFileName(int index) const
 {
+    if (index >= this->getBuildSetComponentCount())
+        return nullptr;
     return this->getBuildSetComponent(index)->getSchema();
 }
 
 const char* CBuildSetManager::getBuildSetProcessName(int index) const
 {
+    if (index >= this->getBuildSetComponentCount())
+        return nullptr;
     return this->getBuildSetComponent(index)->getProcessName();
 }
 
@@ -115,7 +122,7 @@ bool CBuildSetManager::populateBuildSet()
 {
     StringBuffer xpath;
 
-    if (m_buildSetTree.get() != NULL)
+    if (m_buildSetTree.get() != nullptr)
         return false;
 
     try
@@ -127,7 +134,7 @@ bool CBuildSetManager::populateBuildSet()
         return false;
     }
 
-    xpath.appendf("./%s/%s/%s", XML_TAG_PROGRAMS, XML_TAG_BUILD, XML_TAG_BUILDSET);
+    xpath.setf("./%s/%s/%s", XML_TAG_PROGRAMS, XML_TAG_BUILD, XML_TAG_BUILDSET);
 
     Owned<IPropertyTreeIterator> iter = m_buildSetTree->getElements(xpath.str());
 
@@ -135,12 +142,12 @@ bool CBuildSetManager::populateBuildSet()
     {
         IPropertyTree* pTree = &iter->query();
 
-        if ( pTree->queryProp(XML_ATTR_PROCESS_NAME) == NULL || pTree->queryProp(XML_ATTR_OVERIDE) != NULL || ( (pTree->queryProp(XML_ATTR_DEPLOYABLE) != NULL && \
+        if ( pTree->queryProp(XML_ATTR_PROCESS_NAME) == nullptr || pTree->queryProp(XML_ATTR_OVERRIDE) != nullptr || ( (pTree->queryProp(XML_ATTR_DEPLOYABLE) != nullptr && \
                 stricmp(pTree->queryProp(XML_ATTR_DEPLOYABLE), "no") == 0 && stricmp(pTree->queryProp(XML_ATTR_PROCESS_NAME), XML_TAG_ESPSERVICE) != 0) ) )
             continue;
 
         Owned<CBuildSet> pBuildSet = new CBuildSet(pTree->queryProp(XML_ATTR_INSTALLSET), pTree->queryProp(XML_ATTR_NAME), pTree->queryProp(XML_ATTR_PROCESS_NAME),\
-                                                   pTree->queryProp(XML_ATTR_SCHEMA), pTree->queryProp(XML_ATTR_DEPLOYABLE), pTree->queryProp(XML_ATTR_OVERIDE));
+                                                   pTree->queryProp(XML_ATTR_SCHEMA), pTree->queryProp(XML_ATTR_DEPLOYABLE), pTree->queryProp(XML_ATTR_OVERRIDE));
 
         m_buildSetArray.append(*pBuildSet.getLink());
     }
@@ -153,8 +160,8 @@ void CBuildSetManager::setBuildSetArray(const StringArray &strArray)
 
     for (int idx = 0; idx < strArray.length(); idx++)
     {
-        Owned<CBuildSet> pBSet = new CBuildSet(NULL, strArray.item(idx), NULL, strArray.item(idx));
-        assert (pBSet != NULL);
+        Owned<CBuildSet> pBSet = new CBuildSet(nullptr, strArray.item(idx), nullptr, strArray.item(idx));
+        assert (pBSet != nullptr);
         m_buildSetArray.append(*pBSet.getClear());
     }
 }
@@ -165,7 +172,7 @@ const char* CBuildSetManager::getBuildSetSchema(int index) const
     if (index < m_buildSetArray.length())
         return m_buildSetArray.item(index).getSchema();
     else
-        return NULL;
+        return nullptr;
 }
 
 const int CBuildSetManager::getBuildSetSchemaCount() const
@@ -179,8 +186,8 @@ const int CBuildSetManager::getBuildSetServiceCount() const
 
     LOOP_THRU_BUILD_SET
     {
-        if (m_buildSetArray.item(idx).getProcessName() != NULL && strcmp(m_buildSetArray.item(idx).getProcessName(), XML_TAG_ESPSERVICE) == 0 && \
-                (m_buildSetArray.item(idx).getDeployable() != NULL && stricmp(m_buildSetArray.item(idx).getDeployable(), "no") == 0))
+        if (m_buildSetArray.item(idx).getProcessName() != nullptr && strcmp(m_buildSetArray.item(idx).getProcessName(), XML_TAG_ESPSERVICE) == 0 && \
+                (m_buildSetArray.item(idx).getDeployable() != nullptr && stricmp(m_buildSetArray.item(idx).getDeployable(), "no") == 0))
             nCount++;
     }
     return nCount;
@@ -192,9 +199,9 @@ const int CBuildSetManager::getBuildSetComponentCount() const
 
     LOOP_THRU_BUILD_SET
     {
-        if ( ((m_buildSetArray.item(idx).getProcessName() == NULL) || (strcmp(m_buildSetArray.item(idx).getProcessName(), XML_TAG_ESPSERVICE) != 0)) && \
-                ( (m_buildSetArray.item(idx).getDeployable() == NULL) || (stricmp(m_buildSetArray.item(idx).getDeployable(), "no") != 0) ) && \
-                ( (m_buildSetArray.item(idx).getOveride() == NULL) || (stricmp(m_buildSetArray.item(idx).getOveride(), "no")    != 0) ) )
+        if ( ((m_buildSetArray.item(idx).getProcessName() == nullptr) || (strcmp(m_buildSetArray.item(idx).getProcessName(), XML_TAG_ESPSERVICE) != 0)) && \
+                ( (m_buildSetArray.item(idx).getDeployable() == nullptr) || (stricmp(m_buildSetArray.item(idx).getDeployable(), "no") != 0) ) && \
+                ( (m_buildSetArray.item(idx).getOverride() == nullptr) || (stricmp(m_buildSetArray.item(idx).getOverride(), "no")    != 0) ) )
             nCount++;
     }
     return nCount;
@@ -202,26 +209,24 @@ const int CBuildSetManager::getBuildSetComponentCount() const
 
 const CBuildSet* CBuildSetManager::getBuildSetComponent(int index) const
 {
-    int nCount = 0;
-
     LOOP_THRU_BUILD_SET
     {
         if (index == 0)
         {
-            if ( ((m_buildSetArray.item(idx).getProcessName() == NULL) || (strcmp(m_buildSetArray.item(idx).getProcessName(), XML_TAG_ESPSERVICE) != 0)) && \
-                    ( (m_buildSetArray.item(idx).getDeployable() == NULL) || (stricmp(m_buildSetArray.item(idx).getDeployable(), "no") != 0) ) && \
-                    ( (m_buildSetArray.item(idx).getOveride() == NULL) || (stricmp(m_buildSetArray.item(idx).getOveride(), "no") != 0) ) )
+            if ( ((m_buildSetArray.item(idx).getProcessName() == nullptr) || (strcmp(m_buildSetArray.item(idx).getProcessName(), XML_TAG_ESPSERVICE) != 0)) && \
+                    ( (m_buildSetArray.item(idx).getDeployable() == nullptr) || (stricmp(m_buildSetArray.item(idx).getDeployable(), "no") != 0) ) && \
+                    ( (m_buildSetArray.item(idx).getOverride() == nullptr) || (stricmp(m_buildSetArray.item(idx).getOverride(), "no") != 0) ) )
                 return &(m_buildSetArray.item(idx));
             else
                 continue;
         }
-        if ( ((m_buildSetArray.item(idx).getProcessName() == NULL) || (strcmp(m_buildSetArray.item(idx).getProcessName(), XML_TAG_ESPSERVICE) != 0)) && \
-                ( (m_buildSetArray.item(idx).getDeployable() == NULL)|| (stricmp(m_buildSetArray.item(idx).getDeployable(), "no") != 0) ) && \
-                ( (m_buildSetArray.item(idx).getOveride() == NULL) || (stricmp(m_buildSetArray.item(idx).getOveride(), "no") != 0) ) )
+        if ( ((m_buildSetArray.item(idx).getProcessName() == nullptr) || (strcmp(m_buildSetArray.item(idx).getProcessName(), XML_TAG_ESPSERVICE) != 0)) && \
+                ( (m_buildSetArray.item(idx).getDeployable() == nullptr)|| (stricmp(m_buildSetArray.item(idx).getDeployable(), "no") != 0) ) && \
+                ( (m_buildSetArray.item(idx).getOverride() == nullptr) || (stricmp(m_buildSetArray.item(idx).getOverride(), "no") != 0) ) )
             index--;
     }
     assert(!"index invalid");
-    return NULL;
+    return nullptr;
 }
 
 const CBuildSet* CBuildSetManager::getBuildSetService(int index) const
@@ -230,17 +235,17 @@ const CBuildSet* CBuildSetManager::getBuildSetService(int index) const
     {
         if (index == 0)
         {
-            if (m_buildSetArray.item(idx).getProcessName() != NULL && strcmp(m_buildSetArray.item(idx).getProcessName(), XML_TAG_ESPSERVICE) == 0 && \
-                    (m_buildSetArray.item(idx).getDeployable() != NULL && stricmp(m_buildSetArray.item(idx).getDeployable(), "no") == 0))
+            if (m_buildSetArray.item(idx).getProcessName() != nullptr && strcmp(m_buildSetArray.item(idx).getProcessName(), XML_TAG_ESPSERVICE) == 0 && \
+                    (m_buildSetArray.item(idx).getDeployable() != nullptr && stricmp(m_buildSetArray.item(idx).getDeployable(), "no") == 0))
                 return &(m_buildSetArray.item(idx));
             else
                 continue;
         }
-        if (m_buildSetArray.item(idx).getProcessName() != NULL && strcmp(m_buildSetArray.item(idx).getProcessName(), XML_TAG_ESPSERVICE) == 0 && \
-                (m_buildSetArray.item(idx).getDeployable() != NULL && stricmp(m_buildSetArray.item(idx).getDeployable(), "no") == 0))
+        if (m_buildSetArray.item(idx).getProcessName() != nullptr && strcmp(m_buildSetArray.item(idx).getProcessName(), XML_TAG_ESPSERVICE) == 0 && \
+                (m_buildSetArray.item(idx).getDeployable() != nullptr && stricmp(m_buildSetArray.item(idx).getDeployable(), "no") == 0))
             index--;
     }
 
     assert(!"index invalid");
-    return NULL;
+    return nullptr;
 }

+ 6 - 5
configuration/configurator/BuildSet.hpp

@@ -20,12 +20,13 @@
 
 #include "jstring.hpp"
 #include "jlib.hpp"
+#include "build-config.h"
 
 namespace CONFIGURATOR
 {
 
 static const char* DEFAULT_BUILD_SET_XML_FILE("buildset.xml");
-static const char* DEFAULT_BUILD_SET_DIRECTORY("/opt/HPCCSystems/componentfiles/configxml/");
+static const char* DEFAULT_BUILD_SET_DIRECTORY(COMPONENTFILES_DIR"/configxml/");
 
 class CBuildSet;
 
@@ -70,7 +71,7 @@ public:
 
     IMPLEMENT_IINTERFACE
 
-    CBuildSet(const char* pInstallSet = NULL, const char* pName = NULL, const char* pProcessName = NULL, const char* pSchema = NULL, const char* pDeployable = NULL, const char *pOveride = NULL) : m_pInstallSet(pInstallSet), m_pName(pName), m_pProcessName(pProcessName), m_pSchema(pSchema), m_pDeployable(pDeployable), m_pOveride(pOveride)
+    CBuildSet(const char* pInstallSet = NULL, const char* pName = NULL, const char* pProcessName = NULL, const char* pSchema = NULL, const char* pDeployable = NULL, const char *pOverride = NULL) : m_pInstallSet(pInstallSet), m_pName(pName), m_pProcessName(pProcessName), m_pSchema(pSchema), m_pDeployable(pDeployable), m_pOverride(pOverride)
     {
     }
 
@@ -98,9 +99,9 @@ public:
     {
         return m_pDeployable;
     }
-    const char* getOveride() const
+    const char* getOverride() const
     {
-        return m_pOveride;
+        return m_pOverride;
     }
 
 protected:
@@ -113,7 +114,7 @@ protected:
     const char* m_pProcessName;
     const char* m_pSchema;
     const char* m_pDeployable;
-    const char* m_pOveride;
+    const char* m_pOverride;
 
 private:
 };

+ 44 - 9
configuration/configurator/CMakeLists.txt

@@ -1,14 +1,45 @@
 project ( configurator )
 
-SET(  SRCS ConfiguratorMain.cpp ConfigFileComponentUtils.cpp ConfigFileUtils.cpp
-      ConfigFileUtilsObservable.cpp EnvironmentConfiguration.cpp WizardBase.cpp ConfigSchemaHelper.cpp
-      SchemaAttributes.cpp SchemaComplexType.cpp SchemaSequence.cpp SchemaElement.cpp
-      SchemaAppInfo.cpp SchemaAnnotation.cpp SchemaComplexContent.cpp SchemaComplexType.cpp SchemaDocumentation.cpp
-      SchemaExtension.cpp SchemaChoice.cpp SchemaInclude.cpp SchemaSchema.cpp SchemaSimpleType.cpp SchemaRestriction.cpp 
-      SchemaEnumeration.cpp SchemaCommon.cpp ExceptionStrings.cpp SchemaEnumeration.cpp SchemaAttributeGroup.cpp DocumentationMarkup.hpp
-      SchemaCommon.hpp BuildSet.cpp ConfiguratorAPI.cpp SchemaMapManager.cpp EnvironmentModel.cpp SchemaFractionDigits.cpp SchemaLength.cpp SchemaMaxExclusive.cpp
-      SchemaMaxInclusive.cpp SchemaMaxLength.cpp SchemaMinInclusive.cpp SchemaMinExclusive.cpp SchemaMinLength.cpp SchemaPattern.cpp SchemaTotalDigits.cpp SchemaWhiteSpace.cpp
-      SchemaKey.cpp SchemaKeyRef.cpp SchemaSelector.cpp SchemaUnique.cpp SchemaField.cpp SchemaSimpleContent.cpp ConfigNotifications.cpp JSONMarkUp.cpp)
+SET(  SRCS ConfiguratorMain.cpp ConfigFileComponentUtils.cpp ConfigFileUtils.cpp BuildSet.cpp ConfiguratorAPI.cpp EnvironmentModel.cpp JSONMarkUp.cpp
+      ConfigFileUtilsObservable.cpp EnvironmentConfiguration.cpp WizardBase.cpp ConfigSchemaHelper.cpp ExceptionStrings.cpp DocumentationMarkup.hpp ConfigNotifications.cpp
+      ./schemas/SchemaAttributes.cpp
+      ./schemas/SchemaComplexType.cpp
+      ./schemas/SchemaSequence.cpp
+      ./schemas/SchemaElement.cpp
+      ./schemas/SchemaAppInfo.cpp
+      ./schemas/SchemaAnnotation.cpp
+      ./schemas/SchemaComplexContent.cpp
+      ./schemas/SchemaComplexType.cpp
+      ./schemas/SchemaDocumentation.cpp
+      ./schemas/SchemaExtension.cpp
+      ./schemas/SchemaChoice.cpp
+      ./schemas/SchemaInclude.cpp
+      ./schemas/SchemaSchema.cpp
+      ./schemas/SchemaSimpleType.cpp
+      ./schemas/SchemaRestriction.cpp
+      ./schemas/SchemaEnumeration.cpp
+      ./schemas/SchemaCommon.cpp
+      ./schemas/SchemaEnumeration.cpp
+      ./schemas/SchemaAttributeGroup.cpp
+      ./schemas/SchemaMapManager.cpp
+      ./schemas/SchemaFractionDigits.cpp
+      ./schemas/SchemaLength.cpp
+      ./schemas/SchemaMaxExclusive.cpp
+      ./schemas/SchemaMaxInclusive.cpp
+      ./schemas/SchemaMaxLength.cpp
+      ./schemas/SchemaMinInclusive.cpp
+      ./schemas/SchemaMinExclusive.cpp
+      ./schemas/SchemaMinLength.cpp
+      ./schemas/SchemaPattern.cpp
+      ./schemas/SchemaTotalDigits.cpp
+      ./schemas/SchemaWhiteSpace.cpp
+      ./schemas/SchemaKey.cpp
+      ./schemas/SchemaKeyRef.cpp
+      ./schemas/SchemaSelector.cpp
+      ./schemas/SchemaUnique.cpp
+      ./schemas/SchemaField.cpp
+      ./schemas/SchemaSimpleContent.cpp
+      )
 
   INCLUDE_DIRECTORIES(
         ${HPCC_SOURCE_DIR}/system/include
@@ -17,6 +48,10 @@ SET(  SRCS ConfiguratorMain.cpp ConfigFileComponentUtils.cpp ConfigFileUtils.cpp
         ${CMAKE_PREFIX_PATH}/mkspecs/linux-g++
         ${CMAKE_CURRENT_SOURCE_DIR}/configurator_ui
         ${CMAKE_CURRENT_SOURCE_DIR}/configurator_app
+        ${CMAKE_CURRENT_SOURCE_DIR}/schemas
+        ${CMAKE_CURRENT_SOURCE_DIR}
+        ${CMAKE_BINARY_DIR}
+        ${CMAKE_BINARY_DIR}/oss
 )
 
 IF( CONFIGURATOR_LIB )

+ 1 - 3
configuration/configurator/ConfigFileComponentUtils.cpp

@@ -1,6 +1,6 @@
 /*##############################################################################
 
-    HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems®.
+    HPCC SYSTEMS software Copyright (C) 2016 HPCC Systems®.
 
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
@@ -16,10 +16,8 @@
 ############################################################################## */
 
 #include "jexcept.hpp"
-
 #include "ConfigFileComponentUtils.hpp"
 
-//using namespace CONFIGURATOR;
 
 CConfigFileComponentUtils::CConfigFileComponentUtils()
 {

+ 3 - 4
configuration/configurator/ConfigFileUtils.cpp

@@ -29,10 +29,10 @@ CConfigFileUtils* CConfigFileUtils::getInstance()
 
     if (slock.lock() == true)
     {
-      if (s_configFileSingleton.get() == NULL)
-        s_configFileSingleton.setown(new CConfigFileUtils(DEFAULT_CONFIGURATION_PATH));
+        if (s_configFileSingleton.get() == NULL)
+            s_configFileSingleton.setown(new CConfigFileUtils(DEFAULT_CONFIGURATION_PATH));
 
-      slock.unlock();
+        slock.unlock();
     }
     return s_configFileSingleton.get();
 }
@@ -151,7 +151,6 @@ enum CConfigFileUtils::CF_ERROR_CODES CConfigFileUtils::writeConfigurationToFile
 
     pFileIO.setown(pFIO);
     pFileIO->write(0, length, pBuffer);
-    //notify(IConfigFileUtilsObserver::CF_FILE_WRITE_NO_CHECK);
     notify(CONFIGURATOR::IConfigFileUtilsObserver::CF_FILE_WRITE_NO_CHECK);
 
     return CF_NO_ERROR;

+ 3 - 3
configuration/configurator/ConfigNotifications.hpp

@@ -32,7 +32,7 @@ enum ENotificationType
     eWarning,
     eError,
     eCritical,
-    eUnknown // needs to be last
+    eUnknown // needs to be last, and all enumaration element indexes must be sequential
 };
 
 static const char NotificationTypeNames[eUnknown][1024] = {     "Informational",
@@ -45,7 +45,7 @@ static const char NotificationTypeNames[eUnknown][1024] = {     "Informational",
 class CNotification;
 class CNotificationManager;
 
-class CNotificationManager : public InterfaceImpl
+class CNotificationManager : public CInterface
 {
 public:
 
@@ -84,7 +84,7 @@ private:
     static CNotificationManager *s_pNotificationManager;
 };
 
-class CNotification : public InterfaceImpl
+class CNotification : public CInterfaceOf<IInterface>
 {
     friend class CNotificationManager;
 

+ 189 - 218
configuration/configurator/ConfigSchemaHelper.cpp

@@ -1,6 +1,6 @@
 /*##############################################################################
 
-    HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems®.
+    HPCC SYSTEMS software Copyright (C) 2016 HPCC Systems®.
 
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
@@ -41,19 +41,17 @@ for (int idx = 0; idx < nComponentCount; idx++)
 
 using namespace CONFIGURATOR;
 
-
-
-CConfigSchemaHelper* CConfigSchemaHelper::s_pCConfigSchemaHelper = NULL;
+CConfigSchemaHelper* CConfigSchemaHelper::s_pCConfigSchemaHelper = nullptr;
 
 CConfigSchemaHelper* CConfigSchemaHelper::getInstance(const char* pDefaultDirOverride)
 {
     // not thread safe!!!
-    if (s_pCConfigSchemaHelper == NULL)
+    if (s_pCConfigSchemaHelper == nullptr)
     {
         s_pCConfigSchemaHelper = new CConfigSchemaHelper();
         s_pCConfigSchemaHelper->m_nTables = 0;
 
-        if (pDefaultDirOverride != NULL && pDefaultDirOverride[0] != 0)
+        if (pDefaultDirOverride != nullptr && pDefaultDirOverride[0] != 0)
             s_pCConfigSchemaHelper->setBasePath(pDefaultDirOverride);
     }
     return s_pCConfigSchemaHelper;
@@ -61,10 +59,10 @@ CConfigSchemaHelper* CConfigSchemaHelper::getInstance(const char* pDefaultDirOve
 
 CConfigSchemaHelper* CConfigSchemaHelper::getInstance(const char* pBuildSetFileName, const char *pBaseDirectory, const char *pDefaultDirOverride)
 {
-    assert(pBuildSetFileName != NULL);
-    assert(pBaseDirectory != NULL);
+    assert(pBuildSetFileName != nullptr);
+    assert(pBaseDirectory != nullptr);
 
-    if (s_pCConfigSchemaHelper == NULL && pBuildSetFileName != NULL && pBaseDirectory != NULL)
+    if (s_pCConfigSchemaHelper == nullptr && pBuildSetFileName != nullptr && pBaseDirectory != nullptr)
     {
        s_pCConfigSchemaHelper = new CConfigSchemaHelper(pBuildSetFileName, pBaseDirectory, pDefaultDirOverride);
        s_pCConfigSchemaHelper->m_nTables = 0;
@@ -72,11 +70,11 @@ CConfigSchemaHelper* CConfigSchemaHelper::getInstance(const char* pBuildSetFileN
     return s_pCConfigSchemaHelper;
 }
 
-CConfigSchemaHelper::CConfigSchemaHelper(const char* pBuildSetFile, const char* pBuildSetDir, const char* pDefaultDirOverride) : m_pBasePath(NULL), m_nTables(0),\
-    m_pEnvPropertyTree(NULL), m_pSchemaMapManager(NULL)
+CConfigSchemaHelper::CConfigSchemaHelper(const char* pBuildSetFile, const char* pBuildSetDir, const char* pDefaultDirOverride) : m_pBasePath(nullptr), m_nTables(0),\
+    m_pEnvPropertyTree(nullptr), m_pSchemaMapManager(nullptr)
 {
-    assert(pBuildSetFile != NULL);
-    assert(pBuildSetDir != NULL);
+    assert(pBuildSetFile != nullptr);
+    assert(pBuildSetDir != nullptr);
 
     CBuildSetManager::getInstance(pBuildSetFile, pBuildSetDir);
     m_pSchemaMapManager = new CSchemaMapManager();
@@ -86,22 +84,22 @@ CConfigSchemaHelper::~CConfigSchemaHelper()
 {
     delete[] m_pBasePath;
     delete CConfigSchemaHelper::m_pSchemaMapManager;
-    CConfigSchemaHelper::m_pSchemaMapManager = NULL;
-    CConfigSchemaHelper::s_pCConfigSchemaHelper = NULL;
+    CConfigSchemaHelper::m_pSchemaMapManager = nullptr;
+    CConfigSchemaHelper::s_pCConfigSchemaHelper = nullptr;
 }
 
 bool CConfigSchemaHelper::populateSchema()
 {
-    assert(m_pSchemaMapManager != NULL);
+    assert(m_pSchemaMapManager != nullptr);
 
     LOOP_THRU_BUILD_SET_MANAGER_BUILD_SET
     {
         const char *pSchemaName = CBuildSetManager::getInstance()->getBuildSetComponentFileName(idx);
 
-        if (pSchemaName != NULL)
+        if (pSchemaName != nullptr)
         {
-            CXSDNodeBase *pNull = NULL;
-            CSchema *pSchema = CSchema::load(pSchemaName, pNull);
+            CXSDNodeBase *pNodeBase = nullptr;
+            CSchema *pSchema = CSchema::load(pSchemaName, pNodeBase);
 
             assert(pSchema->getLinkCount() == 1);
             m_pSchemaMapManager->setSchemaForXSD(pSchemaName, pSchema);
@@ -114,95 +112,94 @@ bool CConfigSchemaHelper::populateSchema()
 
 void CConfigSchemaHelper::printConfigSchema(StringBuffer &strXML) const
 {
-    assert(m_pSchemaMapManager != NULL);
+    assert(m_pSchemaMapManager != nullptr);
 
-    const char *pComponent = NULL;
-    CSchema* pSchema = NULL;
+    const char *pComponent = nullptr;
+    CSchema* pSchema = nullptr;
 
     LOOP_THRU_BUILD_SET_MANAGER_BUILD_SET
     {
         const char *pSchemaName = CBuildSetManager::getInstance()->getBuildSetComponentFileName(idx);
 
-        if (pComponent == NULL || strcmp(pComponent, pSchemaName) == 0)
+        if (pComponent == nullptr || strcmp(pComponent, pSchemaName) == 0)
         {
-            const char* pXSDSchema = pSchemaName;
-
-            if (pXSDSchema == NULL)
+            if (pSchemaName == nullptr)
                 continue;
 
             pSchema = m_pSchemaMapManager->getSchemaForXSD(pSchemaName);
 
-            if (pSchema != NULL)
+            if (pSchema != nullptr)
             {
-                if (strXML.length() > 0 ? strcmp(strXML.str(), pXSDSchema) == 0 : true)
+                if (strXML.length() > 0 ? strcmp(strXML.str(), pSchemaName) == 0 : true)
                     pSchema->dump(::std::cout);
             }
         }
     }
 }
 
-const char* CConfigSchemaHelper::printDocumentation(const char* comp)
+void CConfigSchemaHelper::printDocumentation(const char* comp, char **pOutput) const
 {
-    assert(comp != NULL && *comp != 0);
-    assert(m_pSchemaMapManager != NULL);
+    assert(comp != nullptr && *comp != 0);
+    assert(m_pSchemaMapManager != nullptr);
 
-    if (comp == NULL || *comp == 0)
-        return NULL;
+    if (!comp || !*comp)
+        return;
 
-    CSchema* pSchema = NULL;
+    CSchema* pSchema = nullptr;
 
     LOOP_THRU_BUILD_SET_MANAGER_BUILD_SET
     {
         const char *pSchemaName = CBuildSetManager::getInstance()->getBuildSetComponentFileName(idx);
 
-        if (pSchemaName != NULL && strcmp(comp, pSchemaName) == 0)
+        if (pSchemaName != nullptr && strcmp(comp, pSchemaName) == 0)
         {
              pSchema = m_pSchemaMapManager->getSchemaForXSD(pSchemaName);
 
-             assert(pSchema != NULL);
+             assert(pSchema != nullptr);
 
-             if (pSchema != NULL)
+             if (pSchema != nullptr)
              {
-                static StringBuffer strDoc;
-                strDoc.clear(); // needed when printing more than 1 component
+                StringBuffer strDoc;
                 pSchema->getDocumentation(strDoc);
 
-                return strDoc.str();
+                *pOutput = new char[strDoc.length()+1];
+                sprintf(*pOutput,"%s",strDoc.str());
+                return;
              }
         }
     }
-    return NULL;
+    *pOutput = nullptr;
 }
+
 void CConfigSchemaHelper::printJSON(const char* comp, char **pOutput, int nIdx, bool bCleanUp) const
 {
-    if (! (comp != NULL && *comp != 0) )
+    if (! (comp != nullptr && *comp != 0) )
     {
         DBGLOG("no component selected for JSON, index = %d", nIdx);
         return;
     }
-    assert(m_pSchemaMapManager != NULL);
+    assert(m_pSchemaMapManager != nullptr);
 
     StringBuffer strJSON;
 
     strJSON.clear();
     resetTables();
 
-    CSchema* pSchema = NULL;
+    CSchema* pSchema = nullptr;
 
     LOOP_THRU_BUILD_SET_MANAGER_BUILD_SET
     {
         const char *pSchemaName = CBuildSetManager::getInstance()->getBuildSetComponentFileName(idx);
-        //const char *pSchemaName = CBuildSetManager::getInstance()->getBuildSetComponentName(idx);
 
-        if (pSchemaName != NULL && strcmp(comp, pSchemaName) == 0)
+        if (pSchemaName != nullptr && strcmp(comp, pSchemaName) == 0)
         {
             pSchema = m_pSchemaMapManager->getSchemaForXSD(pSchemaName);
-            assert(pSchema != NULL);
+            assert(pSchema != nullptr);
 
-            if (pSchema != NULL)
+            if (pSchema != nullptr)
             {
                 pSchema->getJSON(strJSON, 0, nIdx);
-                *pOutput = (char*)malloc((sizeof(char))* (strJSON.length())+1);
+                *pOutput = new char[strJSON.length()+1];
 
                 if (bCleanUp == true)
                 {
@@ -211,26 +208,23 @@ void CConfigSchemaHelper::printJSON(const char* comp, char **pOutput, int nIdx,
                 }
 
                 sprintf(*pOutput,"%s",strJSON.str());
-
                 return;
             }
             else
-            {
-                *pOutput = NULL;
-            }
+                *pOutput = nullptr;
         }
     }
 }
 
 void CConfigSchemaHelper::printJSONByKey(const char* key, char **pOutput, bool bCleanUp) const
 {
-    if (! (key != NULL && *key != 0) )
+    if ( !key || !*key)
     {
         DBGLOG("no component key provided for to generate JSON");
         return;
     }
 
-    assert(m_pSchemaMapManager != NULL);
+    assert(m_pSchemaMapManager != nullptr);
 
     if (key[0] == '#')
         key = &(key[1]);
@@ -238,42 +232,40 @@ void CConfigSchemaHelper::printJSONByKey(const char* key, char **pOutput, bool b
     StringBuffer strKey(key);
     StringBuffer strJSON;
 
-    strJSON.clear();
     resetTables();
 
     const char *pChar = strrchr(key,'[');
-    assert(pChar != NULL && strlen(pChar) >= 3);
-
+    assert(pChar != nullptr);
     int length = strlen(pChar);
+    assert(length >= 3);
 
     StringBuffer strIdx;
 
     pChar++;
 
-    int nTemp = 0;
-
     do
     {
-        strIdx.append(*(pChar+nTemp));
-        nTemp++;
-    }while (*(pChar+nTemp) != ']');
+        strIdx.append(*pChar);
+        pChar++;
+    } while (*pChar != 0 && *pChar != ']');
+
 
     int nIndexForJSON = atoi(strIdx.str());
 
     strKey.setLength(strKey.length()-length);  // remove [N] from XPath;
 
-    CSchema* pSchema = NULL;
+    CSchema* pSchema = nullptr;
 
     LOOP_THRU_BUILD_SET_MANAGER_BUILD_SET
     {
         const char *pProcessName = CBuildSetManager::getInstance()->getBuildSetProcessName(idx);
 
-        if (pProcessName != NULL && strcmp(strKey.str(), pProcessName) == 0)
+        if (pProcessName != nullptr && strcmp(strKey.str(), pProcessName) == 0)
         {
             pSchema = m_pSchemaMapManager->getSchemaForXSD(CBuildSetManager::getInstance()->getBuildSetComponentFileName(idx));
-            assert(pSchema != NULL);
+            assert(pSchema != nullptr);
 
-            if (pSchema != NULL)
+            if (pSchema != nullptr)
             {
                 pSchema->getJSON(strJSON, 0, nIndexForJSON-1);
                 *pOutput = (char*)malloc((sizeof(char))* (strJSON.length())+1);
@@ -289,9 +281,7 @@ void CConfigSchemaHelper::printJSONByKey(const char* key, char **pOutput, bool b
                 return;
             }
             else
-            {
-                *pOutput = NULL;
-            }
+                *pOutput = nullptr;
         }
     }
 }
@@ -303,7 +293,7 @@ void CConfigSchemaHelper::printNavigatorJSON(char **pOutput, bool bCleanUp) cons
     CJSONMarkUpHelper::getNavigatorJSON(strJSON);
 
     if (strJSON.length() == 0)
-        *pOutput = NULL;
+        *pOutput = nullptr;
 
     *pOutput = (char*)malloc((sizeof(char))* (strJSON.length())+1);
 
@@ -320,24 +310,24 @@ void CConfigSchemaHelper::printNavigatorJSON(char **pOutput, bool bCleanUp) cons
 
 void CConfigSchemaHelper::printDump(const char* comp) const
 {
-    assert(comp != NULL && *comp != 0);
-    assert(m_pSchemaMapManager != NULL);
+    assert(comp != nullptr && *comp != 0);
+    assert(m_pSchemaMapManager != nullptr);
 
-    if (comp == NULL || *comp == 0)
+    if (comp == nullptr || *comp == 0)
         return;
 
-    CSchema* pSchema = NULL;
+    CSchema* pSchema = nullptr;
 
     LOOP_THRU_BUILD_SET_MANAGER_BUILD_SET
     {
         const char *pSchemaName = CBuildSetManager::getInstance()->getBuildSetComponentFileName(idx);
 
-        if (pSchemaName != NULL && strcmp(comp, pSchemaName) == 0)
+        if (pSchemaName != nullptr && strcmp(comp, pSchemaName) == 0)
         {
              pSchema = m_pSchemaMapManager->getSchemaForXSD(pSchemaName);
-             assert(pSchema != NULL);
+             assert(pSchema != nullptr);
 
-             if (pSchema != NULL)
+             if (pSchema != nullptr)
                 pSchema->dump(::std::cout);
         }
     }
@@ -346,27 +336,25 @@ void CConfigSchemaHelper::printDump(const char* comp) const
 //test purposes
 bool CConfigSchemaHelper::getXMLFromSchema(StringBuffer& strXML, const char* pComponent)
 {
-    assert (m_pSchemaMapManager != NULL);
+    assert (m_pSchemaMapManager != nullptr);
 
-    CAttributeArray *pAttributeArray = NULL;
-    CElementArray *pElementArray = NULL;
-    CSchema* pSchema = NULL;
+    CSchema* pSchema = nullptr;
 
-    strXML.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Environment>\n\t<Software>");
+    strXML.append(CONFIGURATOR_HEADER);
 
     LOOP_THRU_BUILD_SET_MANAGER_BUILD_SET
     {
         const char *pSchemaName = CBuildSetManager::getInstance()->getBuildSetComponentFileName(idx);
 
-        if (pComponent == NULL || strcmp(pComponent, pSchemaName) == 0)
+        if (pComponent == nullptr || strcmp(pComponent, pSchemaName) == 0)
         {
-            if (pSchemaName == NULL)
+            if (pSchemaName == nullptr)
                 continue;
 
             pSchema =  m_pSchemaMapManager->getSchemaForXSD(pSchemaName);
 
-            if (pSchema != NULL)
-                strXML.append(pSchema->getXML(NULL));
+            if (pSchema != nullptr)
+                strXML.append(pSchema->getXML(nullptr));
         }
     }
     strXML.append("\t</Software>\n</Environment>\n");
@@ -376,29 +364,29 @@ bool CConfigSchemaHelper::getXMLFromSchema(StringBuffer& strXML, const char* pCo
 
 void CConfigSchemaHelper::addExtensionToBeProcessed(CExtension *pExtension)
 {
-    assert(pExtension != NULL);
-    if (pExtension != NULL)
+    assert(pExtension != nullptr);
+    if (pExtension != nullptr)
         m_extensionArr.append(*pExtension);
 }
 
 void CConfigSchemaHelper::addAttributeGroupToBeProcessed(CAttributeGroup *pAttributeGroup)
 {
-    assert(pAttributeGroup != NULL);
-    if (pAttributeGroup != NULL)
+    assert(pAttributeGroup != nullptr);
+    if (pAttributeGroup != nullptr)
         m_attributeGroupArr.append(*pAttributeGroup);
 }
 
 void CConfigSchemaHelper::addNodeForTypeProcessing(CXSDNodeWithType *pNode)
 {
-    assert(pNode != NULL);
-    if (pNode != NULL)
+    assert(pNode != nullptr);
+    if (pNode != nullptr)
         m_nodeWithTypeArr.append(*pNode);
 }
 
 void CConfigSchemaHelper::addNodeForBaseProcessing(CXSDNodeWithBase *pNode)
 {
-    assert(pNode != NULL);
-    if (pNode != NULL)
+    assert(pNode != nullptr);
+    if (pNode != nullptr)
         m_nodeWithBaseArr.append(*pNode);
 }
 
@@ -408,23 +396,23 @@ void CConfigSchemaHelper::processExtensionArr()
 
     for (int idx = 0; idx < length; idx++)
     {
-        CExtension &Extension = (m_extensionArr.item(idx));
-        const char *pName = Extension.getBase();
+        CExtension &extension = (m_extensionArr.item(idx));
+        const char *pName = extension.getBase();
 
-        assert(pName != NULL);
+        assert(pName != nullptr);
 
-        if (pName != NULL)
+        if (pName != nullptr)
         {
-            CXSDNode *pNodeBase = NULL;
-            pNodeBase = m_pSchemaMapManager->getSimpleTypeWithName(pName) != NULL ? dynamic_cast<CSimpleType*>(m_pSchemaMapManager->getSimpleTypeWithName(pName)) : NULL;
+            CXSDNode *pNodeBase = nullptr;
+            pNodeBase = m_pSchemaMapManager->getSimpleTypeWithName(pName) != nullptr ? dynamic_cast<CSimpleType*>(m_pSchemaMapManager->getSimpleTypeWithName(pName)) : nullptr;
 
-            if (pNodeBase == NULL)
-                pNodeBase = m_pSchemaMapManager->getComplexTypeWithName(pName) != NULL ? dynamic_cast<CComplexType*>(m_pSchemaMapManager->getComplexTypeWithName(pName)) : NULL ;
+            if (pNodeBase == nullptr)
+                pNodeBase = m_pSchemaMapManager->getComplexTypeWithName(pName) != nullptr ? dynamic_cast<CComplexType*>(m_pSchemaMapManager->getComplexTypeWithName(pName)) : nullptr ;
 
-            assert(pNodeBase != NULL);
+            assert(pNodeBase != nullptr);
 
-            if (pNodeBase != NULL)
-                Extension.setBaseNode(pNodeBase);
+            if (pNodeBase != nullptr)
+                extension.setBaseNode(pNodeBase);
         }
     }
     m_extensionArr.popAll(false);
@@ -436,18 +424,18 @@ void CConfigSchemaHelper::processAttributeGroupArr()
 
     for (aindex_t idx = 0; idx < length; idx++)
     {
-        CAttributeGroup &AttributeGroup = (m_attributeGroupArr.item(idx));
-        const char *pRef = AttributeGroup.getRef();
+        CAttributeGroup &attributeGroup = (m_attributeGroupArr.item(idx));
+        const char *pRef = attributeGroup.getRef();
 
-        assert(pRef != NULL && pRef[0] != 0);
-        if (pRef != NULL && pRef[0] != 0)
+        assert(pRef != nullptr && pRef[0] != 0);
+        if (pRef != nullptr && pRef[0] != 0)
         {
-            assert(m_pSchemaMapManager != NULL);
+            assert(m_pSchemaMapManager != nullptr);
             CAttributeGroup *pAttributeGroup = m_pSchemaMapManager->getAttributeGroupFromXPath(pRef);
 
-            assert(pAttributeGroup != NULL);
-            if (pAttributeGroup != NULL)
-                AttributeGroup.setRefNode(pAttributeGroup);
+            assert(pAttributeGroup != nullptr);
+            if (pAttributeGroup != nullptr)
+                attributeGroup.setRefNode(pAttributeGroup);
         }
     }
     m_attributeGroupArr.popAll(true);
@@ -462,17 +450,17 @@ void CConfigSchemaHelper::processNodeWithTypeArr(CXSDNodeBase *pParentNode)
         CXSDNodeWithType *pNodeWithType = &(m_nodeWithTypeArr.item(idx));
         const char *pTypeName = pNodeWithType->getType();
 
-        assert(pTypeName != NULL);
-        if (pTypeName != NULL)
+        assert(pTypeName != nullptr);
+        if (pTypeName != nullptr)
         {
-            CXSDNode *pNode = NULL;
-            pNode = m_pSchemaMapManager->getSimpleTypeWithName(pTypeName) != NULL ? dynamic_cast<CSimpleType*>(m_pSchemaMapManager->getSimpleTypeWithName(pTypeName)) : NULL;
+            CXSDNode *pNode = nullptr;
+            pNode = m_pSchemaMapManager->getSimpleTypeWithName(pTypeName) != nullptr ? dynamic_cast<CSimpleType*>(m_pSchemaMapManager->getSimpleTypeWithName(pTypeName)) : nullptr;
 
-            if (pNode == NULL)
-                pNode = m_pSchemaMapManager->getComplexTypeWithName(pTypeName) != NULL ? dynamic_cast<CComplexType*>(m_pSchemaMapManager->getComplexTypeWithName(pTypeName)) : NULL;
-            if (pNode == NULL)
+            if (pNode == nullptr)
+                pNode = m_pSchemaMapManager->getComplexTypeWithName(pTypeName) != nullptr ? dynamic_cast<CComplexType*>(m_pSchemaMapManager->getComplexTypeWithName(pTypeName)) : nullptr;
+            if (pNode == nullptr)
                 pNode = CXSDBuiltInDataType::create(pNodeWithType, pTypeName);
-            if (pNode != NULL)
+            if (pNode != nullptr)
                 pNodeWithType->setTypeNode(pNode);
             else
                 PROGLOG("Unsupported type '%s'", pTypeName);
@@ -490,19 +478,19 @@ void CConfigSchemaHelper::processNodeWithBaseArr()
         CXSDNodeWithBase *pNodeWithBase = &(this->m_nodeWithBaseArr.item(idx));
         const char *pBaseName = pNodeWithBase->getBase();
 
-        assert(pBaseName != NULL);
-        if (pBaseName != NULL)
+        assert(pBaseName != nullptr);
+        if (pBaseName != nullptr)
         {
-            CXSDNode *pNode = NULL;
-            pNode = m_pSchemaMapManager->getSimpleTypeWithName(pBaseName) != NULL ? dynamic_cast<CSimpleType*>(m_pSchemaMapManager->getSimpleTypeWithName(pBaseName)) : NULL;
+            CXSDNode *pNode = nullptr;
+            pNode = m_pSchemaMapManager->getSimpleTypeWithName(pBaseName) != nullptr ? dynamic_cast<CSimpleType*>(m_pSchemaMapManager->getSimpleTypeWithName(pBaseName)) : nullptr;
 
-            if (pNode == NULL)
-                pNode = m_pSchemaMapManager->getComplexTypeWithName(pBaseName) != NULL ? dynamic_cast<CComplexType*>(m_pSchemaMapManager->getComplexTypeWithName(pBaseName)) : NULL;
-            if (pNode == NULL)
+            if (pNode == nullptr)
+                pNode = m_pSchemaMapManager->getComplexTypeWithName(pBaseName) != nullptr ? dynamic_cast<CComplexType*>(m_pSchemaMapManager->getComplexTypeWithName(pBaseName)) : nullptr;
+            if (pNode == nullptr)
                 pNode = CXSDBuiltInDataType::create(pNode, pBaseName);
 
-            assert(pNode != NULL);
-            if (pNode != NULL)
+            assert(pNode != nullptr);
+            if (pNode != nullptr)
                 pNodeWithBase->setBaseNode(pNode);
             else
                 PROGLOG("Unsupported type '%s'", pBaseName);
@@ -513,12 +501,12 @@ void CConfigSchemaHelper::processNodeWithBaseArr()
 
 void CConfigSchemaHelper::addElementForRefProcessing(CElement *pElement)
 {
-    assert (pElement != NULL);
-    if (pElement != NULL)
+    assert (pElement != nullptr);
+    if (pElement != nullptr)
         m_ElementArr.append(*pElement);
 }
 
-void CConfigSchemaHelper::processElementArr(CElement *pElement)
+void CConfigSchemaHelper::processElementArr()
 {
     int length = m_nodeWithBaseArr.length();
 
@@ -527,13 +515,13 @@ void CConfigSchemaHelper::processElementArr(CElement *pElement)
         CElement *pElement = &(this->m_ElementArr.item(idx));
         const char *pRef = pElement->getRef();
 
-        assert(pRef != NULL);
-        if (pRef != NULL)
+        assert(pRef != nullptr);
+        if (pRef != nullptr)
         {
-            CElement *pRefElementNode = NULL;
+            CElement *pRefElementNode = nullptr;
             pRefElementNode = m_pSchemaMapManager->getElementWithName(pRef);
 
-            if (pRefElementNode != NULL)
+            if (pRefElementNode != nullptr)
                 pElement->setRefElementNode(pRefElementNode);
             else
                 //TODO: throw exception
@@ -545,21 +533,21 @@ void CConfigSchemaHelper::processElementArr(CElement *pElement)
 
 void CConfigSchemaHelper::populateEnvXPath()
 {
-    CSchema* pSchema = NULL;
+    CSchema* pSchema = nullptr;
     StringBuffer strXPath;
 
     LOOP_THRU_BUILD_SET_MANAGER_BUILD_SET
     {
         pSchema = m_pSchemaMapManager->getSchemaForXSD(CBuildSetManager::getInstance()->getBuildSetComponentFileName(idx));
 
-        if (pSchema != NULL)
+        if (pSchema != nullptr)
             pSchema->populateEnvXPath(strXPath);
     }
 }
 
 void CConfigSchemaHelper::loadEnvFromConfig(const char *pEnvFile)
 {
-    assert(pEnvFile != NULL);
+    assert(pEnvFile != nullptr);
 
     typedef ::IPropertyTree PT;
     Linked<PT> pEnvXMLRoot;
@@ -573,7 +561,7 @@ void CConfigSchemaHelper::loadEnvFromConfig(const char *pEnvFile)
         CONFIGURATOR::MakeExceptionFromMap(EX_STR_CAN_NOT_PROCESS_ENV_XML);
     }
 
-    CSchema* pSchema = NULL;
+    CSchema* pSchema = nullptr;
 
     this->setEnvPropertyTree(pEnvXMLRoot.getLink());
     this->setEnvFilePath(pEnvFile);
@@ -582,46 +570,23 @@ void CConfigSchemaHelper::loadEnvFromConfig(const char *pEnvFile)
     {
         pSchema = m_pSchemaMapManager->getSchemaForXSD(CBuildSetManager::getInstance()->getBuildSetComponentFileName(idx));
 
-        if (pSchema != NULL)
+        if (pSchema != nullptr)
             pSchema->loadXMLFromEnvXml(pEnvXMLRoot);
     }
 }
 
-void CConfigSchemaHelper::addToolTip(const char *js)
-{
-    assert (js != NULL);
-    assert (js[0] != 0);
-
-    if (js == NULL || js[0] == 0)
-        return;
-
-    m_strToolTipsJS.append(js);
-}
-
-const char* CConfigSchemaHelper::getToolTipJS() const
-{
-    static StringBuffer strJS;
-    strJS.clear();
-
-    for (int idx = 0; idx < m_strToolTipsJS.length(); idx++)
-    {
-        strJS.append(m_strToolTipsJS.item(idx));
-    }
-    return strJS.str();
-}
-
 void CConfigSchemaHelper::setEnvTreeProp(const char *pXPath, const char* pValue)
 {
-    assert(pXPath != NULL && pXPath[0] != 0);
-    assert(m_pSchemaMapManager != NULL);
+    assert(pXPath != nullptr && pXPath[0] != 0);
+    assert(m_pSchemaMapManager != nullptr);
 
     CAttribute *pAttribute = m_pSchemaMapManager->getAttributeFromXPath(pXPath);
-    assert(pAttribute != NULL);
+    assert(pAttribute != nullptr);
 
     StringBuffer strPropName("@");
     strPropName.append(pAttribute->getName());
 
-    if (this->getEnvPropertyTree()->queryPropTree(pAttribute->getConstAncestorNode(1)->getEnvXPath())->queryProp(strPropName.str()) == NULL)
+    if (this->getEnvPropertyTree()->queryPropTree(pAttribute->getConstAncestorNode(1)->getEnvXPath())->queryProp(strPropName.str()) == nullptr)
         //should check if this attribute is optional for validation
         this->getEnvPropertyTree()->queryPropTree(pAttribute->getConstAncestorNode(1)->getEnvXPath())->setProp(strPropName.str(), pValue);
     else if (strcmp (this->getEnvPropertyTree()->queryPropTree(pAttribute->getConstAncestorNode(1)->getEnvXPath())->queryProp(strPropName.str()), pValue) == 0)
@@ -632,21 +597,21 @@ void CConfigSchemaHelper::setEnvTreeProp(const char *pXPath, const char* pValue)
 
 const char* CConfigSchemaHelper::getTableValue(const char* pXPath,  int nRow) const
 {
-    assert(pXPath != NULL);
-    assert(m_pSchemaMapManager != NULL);
+    assert(pXPath != nullptr);
+    assert(m_pSchemaMapManager != nullptr);
 
     CAttribute *pAttribute = m_pSchemaMapManager->getAttributeFromXPath(pXPath);
-    CElement *pElement = NULL;
+    CElement *pElement = nullptr;
 
-    if (pAttribute == NULL)
+    if (pAttribute == nullptr)
     {
         pElement = m_pSchemaMapManager->getElementFromXPath(pXPath);
-        assert(pElement != NULL);
+        assert(pElement != nullptr);
         return pElement->getEnvValueFromXML();
     }
     else
     {
-        assert(pAttribute != NULL);
+        assert(pAttribute != nullptr);
         if (nRow == 1)
             return pAttribute->getEnvValueFromXML();
         else
@@ -664,8 +629,8 @@ const char* CConfigSchemaHelper::getTableValue(const char* pXPath,  int nRow) co
 
             pAttribute = m_pSchemaMapManager->getAttributeFromXPath(strXPath.str());
 
-            if (pAttribute == NULL)
-                return NULL;
+            if (pAttribute == nullptr)
+                return nullptr;
 
             return pAttribute->getEnvValueFromXML();
         }
@@ -674,38 +639,36 @@ const char* CConfigSchemaHelper::getTableValue(const char* pXPath,  int nRow) co
 
 int CConfigSchemaHelper::getElementArraySize(const char *pXPath) const
 {
-    assert(pXPath != NULL);
-    assert(m_pSchemaMapManager != NULL);
+    assert(pXPath != nullptr);
+    assert(m_pSchemaMapManager != nullptr);
 
-    //CElementArray *pElementArray = m_pSchemaMapManager->getElementArrayFromXSDXPath(pXPath);
     CElementArray *pElementArray = m_pSchemaMapManager->getElementArrayFromXPath(pXPath);
 
-    if (pElementArray == NULL)
+    if (pElementArray == nullptr)
         return 0;
 
-    //return pElementArray->getCountOfSiblingElements(pXPath);
     VStringBuffer strXPath("%s[1]",pElementArray->getXSDXPath());
-    //return pElementArray->getCountOfSiblingElements(pElementArray->getXSDXPath());
+
     return pElementArray->getCountOfSiblingElements(strXPath.str());
 }
 
 const char* CConfigSchemaHelper::getAttributeXSDXPathFromEnvXPath(const char* pEnvXPath) const
 {
-    assert(pEnvXPath != NULL && *pEnvXPath != 0);
-    assert(m_pSchemaMapManager != NULL);
+    assert(pEnvXPath != nullptr && *pEnvXPath != 0);
+    assert(m_pSchemaMapManager != nullptr);
     CAttribute *pAttribute = m_pSchemaMapManager->getAttributeFromXPath(pEnvXPath);
 
-    assert(pAttribute != NULL);
+    assert(pAttribute != nullptr);
     return pAttribute->getXSDXPath();
 }
 
 const char* CConfigSchemaHelper::getElementArrayXSDXPathFromEnvXPath(const char* pXSDXPath) const
 {
-    assert(pXSDXPath != NULL);
-    assert(m_pSchemaMapManager != NULL);
+    assert(pXSDXPath != nullptr);
+    assert(m_pSchemaMapManager != nullptr);
     CElementArray *pElementArray = m_pSchemaMapManager->getElementArrayFromXSDXPath(pXSDXPath);
 
-    assert(pElementArray != NULL);
+    assert(pElementArray != nullptr);
     return pElementArray->getXSDXPath();
 }
 
@@ -719,22 +682,30 @@ void CConfigSchemaHelper::appendElementXPath(const char* pXPath)
     m_strArrayEnvXPaths.append(pXPath);
 }
 
-int CConfigSchemaHelper::stripXPathIndex(StringBuffer &strXPath)
+size_t CConfigSchemaHelper::getXPathIndexLength(const char *pXPath)
 {
-    int nLen = strXPath.length()-3;
-    int nLengthOfStringInBracket = 3;
+    if (!pXPath || !pXPath)
+        return 0;
 
-    while (nLen > 0)
+    size_t length  = strlen(pXPath);
+
+    if (length < 4) // min length must be atleast 4 : T[N]
+        return 0;
+
+    const char *pFinger = &(pXPath[length-1]);
+
+    while (pFinger != pXPath && *pFinger != '[')
     {
-        if (strXPath[nLen] == '[')
-        {
-            strXPath.reverse().remove(0,strXPath.length()-nLen).reverse();
-            return nLengthOfStringInBracket;
-        }
-        nLen--;
-        nLengthOfStringInBracket++;
+        pFinger--;
     }
-    return nLengthOfStringInBracket;
+    return (pFinger == pXPath ? 0 : &(pXPath[length]) - pFinger);
+}
+
+int CConfigSchemaHelper::stripXPathIndex(StringBuffer &strXPath)
+{
+    int nStripped = getXPathIndexLength(strXPath.str());
+    strXPath.setLength(strXPath.length()-nStripped);
+    return nStripped;
 }
 
 bool CConfigSchemaHelper::isXPathTailAttribute(const StringBuffer &strXPath)
@@ -758,7 +729,7 @@ bool CConfigSchemaHelper::isXPathTailAttribute(const StringBuffer &strXPath)
 
 void CConfigSchemaHelper::setBasePath(const char *pBasePath)
 {
-    assert(m_pBasePath == NULL);
+    assert(m_pBasePath == nullptr);
     int nLength = strlen(pBasePath);
     m_pBasePath = new char[nLength+1];
     strcpy(m_pBasePath, pBasePath);
@@ -772,7 +743,7 @@ bool CConfigSchemaHelper::saveConfigurationFile() const
     if (m_strEnvFilePath.length() == 0)
         return false;
 
-    if (this->getConstEnvPropertyTree() == NULL)
+    if (this->getConstEnvPropertyTree() == nullptr)
         return false;
 
     StringBuffer strXML;
@@ -789,10 +760,10 @@ bool CConfigSchemaHelper::saveConfigurationFileAs(const char *pFilePath)
 {
     assert(pFilePath && *pFilePath);
 
-    if (pFilePath == NULL || *pFilePath == 0)
+    if (pFilePath == nullptr || *pFilePath == 0)
         return false;
 
-    if (this->getConstEnvPropertyTree() == NULL)
+    if (this->getConstEnvPropertyTree() == nullptr)
         return false;
 
     StringBuffer strXML;
@@ -826,20 +797,20 @@ void CConfigSchemaHelper::processKeyReverseAssociation() const
 
 int CConfigSchemaHelper::getInstancesOfComponentType(const char *pCompType) const
 {
-    assert(pCompType != NULL && *pCompType != 0);
+    assert(pCompType != nullptr && *pCompType != 0);
 
     LOOP_THRU_BUILD_SET_MANAGER_BUILD_SET
     {
         const char *pCompName = CBuildSetManager::getInstance()->getBuildSetComponentTypeName(idx);//  ->getBuildSetProcessName(idx);
         const char *pProcessName = CBuildSetManager::getInstance()->getBuildSetProcessName(idx);
 
-        if (pCompName != NULL && strcmp(pCompName, pCompType) == 0)
+        if (pCompName != nullptr && strcmp(pCompName, pCompType) == 0)
         {
              CSchema *pSchema = m_pSchemaMapManager->getSchemaForXSD(CBuildSetManager::getInstance()->getBuildSetComponentFileName(idx));
 
-             assert(pSchema != NULL);
+             assert(pSchema != nullptr);
 
-             if (pSchema == NULL)
+             if (pSchema == nullptr)
                  return FAILURE;
 
              int nCount = 0;
@@ -849,10 +820,10 @@ int CConfigSchemaHelper::getInstancesOfComponentType(const char *pCompType) cons
              {
                  ::IPropertyTree *pTree = CConfigSchemaHelper::getInstance()->getEnvPropertyTree();
 
-                 if (pTree == NULL)
+                 if (pTree == nullptr)
                      return FAILURE;
 
-                 if (pTree->queryPropTree(strXPath.str()) == NULL)
+                 if (pTree->queryPropTree(strXPath.str()) == nullptr)
                      return nCount;
 
                  nCount++;
@@ -865,10 +836,10 @@ int CConfigSchemaHelper::getInstancesOfComponentType(const char *pCompType) cons
 
 const char* CConfigSchemaHelper::getInstanceNameOfComponentType(const char *pCompType, int idx)
 {
-    if (pCompType == NULL || *pCompType == 0)
-        return NULL;  // throw exception?
-    if (this->getEnvPropertyTree() == NULL)
-        return NULL;  // throw exception?
+    if (pCompType == nullptr || *pCompType == 0)
+        return nullptr;  // throw exception?
+    if (this->getEnvPropertyTree() == nullptr)
+        return nullptr;  // throw exception?
 
     ::VStringBuffer strXPath("./%s/%s[%d]", XML_TAG_SOFTWARE, pCompType, idx+1);
 
@@ -885,10 +856,10 @@ void CConfigSchemaHelper::clearLF(::StringBuffer& strToClear)
 
 CConfigSchemaHelper* CConfigSchemaHelper::getNewInstance(const char* pDefaultDirOverride)
 {
-    if (CConfigSchemaHelper::s_pCConfigSchemaHelper != NULL)
+    if (CConfigSchemaHelper::s_pCConfigSchemaHelper != nullptr)
     {
         delete CConfigSchemaHelper::s_pCConfigSchemaHelper;
-        CConfigSchemaHelper::s_pCConfigSchemaHelper = NULL;
+        CConfigSchemaHelper::s_pCConfigSchemaHelper = nullptr;
     }
 
     CConfigSchemaHelper::getInstance(pDefaultDirOverride);

+ 13 - 14
configuration/configurator/ConfigSchemaHelper.hpp

@@ -34,6 +34,7 @@
 
 namespace CONFIGURATOR
 {
+static const char* CONFIGURATOR_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Environment>\n\t<Software>";
 
 class CSchemaMapManager;
 class CSimpleType;
@@ -44,9 +45,9 @@ public:
 
     IMPLEMENT_IINTERFACE
 
-    static CConfigSchemaHelper* getInstance(const char* pDefaultDirOverride =  NULL);
-    static CConfigSchemaHelper* getInstance(const char* pBuildSetFileName, const char *pBaseDirectory, const char *pDefaultDirOverride = NULL);
-    static CConfigSchemaHelper* getNewInstance(const char* pDefaultDirOverride =  NULL);
+    static CConfigSchemaHelper* getInstance(const char* pDefaultDirOverride =  nullptr);
+    static CConfigSchemaHelper* getInstance(const char* pBuildSetFileName, const char *pBaseDirectory, const char *pDefaultDirOverride = nullptr);
+    static CConfigSchemaHelper* getNewInstance(const char* pDefaultDirOverride =  nullptr);
 
     virtual ~CConfigSchemaHelper();
 
@@ -68,10 +69,10 @@ public:
     void processNodeWithBaseArr();
 
     void addNodeForTypeProcessing(CXSDNodeWithType *pNode);
-    void processNodeWithTypeArr(CXSDNodeBase *pParentNode = NULL);
+    void processNodeWithTypeArr(CXSDNodeBase *pParentNode = nullptr);
 
     void addElementForRefProcessing(CElement *pElement);
-    void processElementArr(CElement *pElement);
+    void processElementArr();
 
     void addKeyRefForReverseAssociation(const CKeyRef *pKeyRef) const;
     void processKeyRefReverseAssociation() const;
@@ -82,14 +83,12 @@ public:
     bool getXMLFromSchema(StringBuffer& strXML, const char* pXSD); //test purposes
     void populateEnvXPath();
     void loadEnvFromConfig(const char *pEnvFile);
-    const char* printDocumentation(const char* comp);
+    void printDocumentation(const char* comp, char **pOutput) const;
     void printJSON(const char* comp, char **pOutput, int nIdx = -1, bool bCleanUp = false) const;
     void printJSONByKey(const char* key, char **pOutput, bool bCleanUp = false) const;
     void printNavigatorJSON(char **pOutput, bool bCleanUp = false) const;
     void printDump(const char* comp) const;
     void dumpStdOut() const;
-    void addToolTip(const char *js);
-    const char* getToolTipJS() const;
 
     const char* getBasePath() const
     {
@@ -141,7 +140,7 @@ public:
         m_nTables = 0;
     }
     bool saveConfigurationFile() const;
-    bool saveConfigurationFileAs(const char *pFilePath = NULL);
+    bool saveConfigurationFileAs(const char *pFilePath = nullptr);
 
     const char* getEnvFilePath() const
     {
@@ -154,7 +153,7 @@ public:
 
 protected:
 
-    CConfigSchemaHelper(const char* pBuildSetFile = DEFAULT_BUILD_SET_XML_FILE, const char* pBuildSetDir = DEFAULT_BUILD_SET_DIRECTORY, const char* pDefaultDirOverride = NULL);
+    CConfigSchemaHelper(const char* pBuildSetFile = DEFAULT_BUILD_SET_XML_FILE, const char* pBuildSetDir = DEFAULT_BUILD_SET_DIRECTORY, const char* pDefaultDirOverride = nullptr);
 
     CSchemaMapManager *m_pSchemaMapManager;
     ::CIArrayOf<CExtension> m_extensionArr;
@@ -163,7 +162,6 @@ protected:
     ::CIArrayOf<CXSDNodeWithBase> m_nodeWithBaseArr;
     ::CIArrayOf<CElement> m_ElementArr;
     ::CIArrayOf<CKeyRef> m_KeyRefArr;
-    ::StringArray m_strToolTipsJS;
     ::StringArray m_strArrayEnvXPaths;
     ::StringArray m_strArrayEnvXMLComponentInstances;
 
@@ -173,13 +171,14 @@ protected:
     }
     void setEnvFilePath(const char* pEnvFilePath)
     {
-        assert(pEnvFilePath != NULL);
+        assert(pEnvFilePath != nullptr);
         m_strEnvFilePath.set(pEnvFilePath);
     }
 
-private:
-
     static void clearLF(StringBuffer& strToClear);
+    static size_t getXPathIndexLength(const char *pXPath);
+
+private:
 
     static CConfigSchemaHelper* s_pCConfigSchemaHelper;
     mutable int m_nTables;

+ 8 - 4
configuration/configurator/ConfiguratorAPI.cpp

@@ -52,6 +52,7 @@ void deleteTableModels()
     while (nAllocatedTables > 0)
     {
         delete[] modelName[nAllocatedTables];
+        nAllocatedTables--;
     }
 }
 
@@ -95,9 +96,7 @@ int initialize()
     if (bOnce == true)
     {
         bOnce = false;
-
         InitModuleObjects();
-
     }
 
     s_pConfigSchemaHelper = CConfigSchemaHelper::getInstance();
@@ -221,6 +220,11 @@ const char* getTableValue(const char *pXPath, int nRow)
 
             strXPath.appendf("[%d]", nRow);
             strXPath.append(strXPathOriginal, offset, strXPathOriginal.length() - offset);
+
+            //confirm the next 2 lines are sufficient
+            //CConfigSchemaHelper::stripXPathIndex(strXPath);
+            //strXPath.appendf("[%d]", nRow);
+
             pAttribute =  CConfigSchemaHelper::getInstance()->getSchemaMapManager()->getAttributeFromXPath(strXPath.str());
 
             if (STRICTNESS_LEVEL >= DEFAULT_STRICTNESS)
@@ -513,10 +517,10 @@ void getJSONByComponentKey(const char *pKey, char **pOutput)
     CConfigSchemaHelper::getInstance()->printJSONByKey(pKey, pOutput, true);
 }
 
-const char* getDocBookByIndex(int idx)
+void getDocBookByIndex(int idx, char **pOutput)
 {
     const char *pFileName = CBuildSetManager::getInstance()->getBuildSetComponentFileName(idx);
-    return CConfigSchemaHelper::getInstance()->printDocumentation(pFileName);
+    CConfigSchemaHelper::getInstance()->printDocumentation(pFileName, pOutput);
 }
 
 bool saveConfigurationFile()

+ 1 - 1
configuration/configurator/ConfiguratorAPI.hpp

@@ -68,7 +68,7 @@ extern "C" void getJSON(void *pData, char **pOutput, int nIdx);
 extern "C" void getNavigatorJSON(char **pOutput);
 extern "C" void getJSONByComponentName(const char *pComponentName, char **pOutput, int nIdx);
 extern "C" void getJSONByComponentKey(const char *pKey, char **pOutput);
-extern "C" const char* getDocBookByIndex(int idx);
+extern "C" void getDocBookByIndex(int idx, char **pOutput);
 extern "C" bool saveConfigurationFile();
 extern "C" bool saveConfigurationFileAs(const char *pFilePath);
 extern "C" int getNumberOfNotificationTypes();

+ 63 - 62
configuration/configurator/ConfiguratorMain.cpp

@@ -1,6 +1,6 @@
 /*##############################################################################
 
-    HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems®.
+    HPCC SYSTEMS software Copyright (C) 2016 HPCC Systems®.
 
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
@@ -33,26 +33,26 @@ const char *pDefaultJSONExt =  ".json";
 
 void usage()
 {
-    ::std::cout << "configurator -use <xsd files>  -b <base dir path>" << ::std::endl;
-    ::std::cout << "Example Usage: ./configurator -use dali.xsd -b /opt/HPCCSystems/componentfiles/configxml -d -t /tmp " << ::std::endl;
-    ::std::cout << "-d -doc                           : generate docs" << ::std::endl;
-    ::std::cout << "-b -base <base dir path>          : base directory path to use with -use option and for xs:include references in xsd files" << ::std::endl;
-    ::std::cout << "-t -target <target directory>     : directory to which to docs will be written. If not specified, then output will go to ::std::out" << ::std::endl;
-    ::std::cout << "-u -use <schema xsd>              : use specified xsd schema instead of buildset file" << ::std::endl;
+    ::std::cout << "configurator --use <xsd files>  -b <base dir path>" << ::std::endl;
+    ::std::cout << "Example Usage: ./configurator --use dali.xsd -b /opt/HPCCSystems/componentfiles/configxml -d -t /tmp " << ::std::endl;
+    ::std::cout << "-d --doc                           : generate docs" << ::std::endl;
+    ::std::cout << "-b --base <base dir path>          : base directory path to use with --use option and for xs:include references in xsd files" << ::std::endl;
+    ::std::cout << "-t --target <target directory>     : directory to which to docs will be written. If not specified, then output will go to ::std::out" << ::std::endl;
+    ::std::cout << "-u --use <schema xsd>              : use specified xsd schema instead of buildset file" << ::std::endl;
     ::std::cout << "-h -help                          : prints out this usage" << ::std::endl;
 
     ::std::cout << ::std::endl;
 
     ::std::cout << ::std::endl << "** Experimental **" << ::std::endl;
-    ::std::cout <<"Example Usage: ./configurator -use esp.xsd -b /opt/HPCCSystems/componentfiles/configxml/ -doc" << ::std::endl;
-    ::std::cout << "-f -file <build set file>         : buildset file name (required if base directory is specfied" << ::std::endl;
-    ::std::cout << "-p -path <base dir path>          : base directory path (required if buildset file name is specified)" << ::std::endl;
-    ::std::cout << "-x -xsd  <xsd file name>          : xsd file name (can be more than one) - For use with buildset file" << ::std::endl;
-    ::std::cout << "-l -list                          : list available xsd files" << ::std::endl;
-    ::std::cout << "-m -xml                           : generate XML configuration file" << ::std::endl;
-    ::std::cout << "-j -json <component key>          : prints JSON" << ::std::endl;
-    ::std::cout << "-c -env -config <path to env xml file> : load environment config xml file (e.g. environment.xml) " << ::std::endl;
-    ::std::cout << "-dump                             : dump out xsd internal structure and values" << ::std::endl;
+    ::std::cout <<"Example Usage: ./configurator --use esp.xsd -b /opt/HPCCSystems/componentfiles/configxml/ --doc" << ::std::endl;
+    ::std::cout << "-f --file <build set file>         : buildset file name (required if base directory is specfied" << ::std::endl;
+    ::std::cout << "-p --path <base dir path>          : base directory path (required if buildset file name is specified)" << ::std::endl;
+    ::std::cout << "-x --xsd  <xsd file name>          : xsd file name (can be more than one) - For use with buildset file" << ::std::endl;
+    ::std::cout << "-l --list                          : list available xsd files" << ::std::endl;
+    ::std::cout << "-m --xml                           : generate XML configuration file" << ::std::endl;
+    ::std::cout << "-j --json <component key>          : prints JSON" << ::std::endl;
+    ::std::cout << "-c --env -config <path to env xml file> : load environment config xml file (e.g. environment.xml) " << ::std::endl;
+    ::std::cout << "--dump                             : dump out xsd internal structure and values" << ::std::endl;
 }
 
 #ifndef CONFIGURATOR_LIB
@@ -65,7 +65,7 @@ void usage()
 
     int idx = 1;
 
-    CConfigSchemaHelper *pSchemaHelper = NULL;
+    CConfigSchemaHelper *pSchemaHelper = nullptr;
 
     char pBuildSetFile[BUFF_SIZE];
     char pBuildSetFileDir[BUFF_SIZE];
@@ -88,7 +88,7 @@ void usage()
 
     bool bListXSDs      = false;
     bool bGenDocs       = false;
-	bool bGenJSON       = false;
+    bool bGenJSON       = false;
     bool bDump          = false;
     bool bLoadEnvXML    = false;
 
@@ -107,78 +107,78 @@ void usage()
             usage();
             return 0;
         }
-        if (stricmp(argv[idx], "-dump") == 0)
+        if (stricmp(argv[idx], "--dump") == 0)
             bDump = true;
-        if (stricmp(argv[idx], "-config") == 0 || stricmp(argv[idx], "-c") == 0 || stricmp(argv[idx], "-env") == 0)
+        if (stricmp(argv[idx], "-config") == 0 || stricmp(argv[idx], "-c") == 0 || stricmp(argv[idx], "--env") == 0)
         {
             idx++;
             bLoadEnvXML = true;
 
-            if (argv[idx] == NULL)
+            if (argv[idx] == nullptr)
             {
                 ::std::cout << "Missing env xml file parameter!" << ::std::endl;
                 return 0;
             }
             strncpy(pEnvXMLPath, argv[idx], BUFF_SIZE);
         }
-        else if (stricmp(argv[idx], "-file") == 0 || stricmp(argv[idx], "-f") == 0)
+        else if (stricmp(argv[idx], "--file") == 0 || stricmp(argv[idx], "-f") == 0)
         {
             idx++;
 
             assert(argv[idx]);
-            if (argv[idx] == NULL)
+            if (argv[idx] == nullptr)
             {
                 ::std::cout << "Missing file parameter!" << ::std::endl;
                 return 0;
             }
             strncpy(pBuildSetFile, argv[idx], BUFF_SIZE);
         }
-        else if (stricmp(argv[idx], "-path") == 0 || stricmp(argv[idx], "-p") == 0)
+        else if (stricmp(argv[idx], "--path") == 0 || stricmp(argv[idx], "-p") == 0)
         {
             idx++;
 
             assert(argv[idx]);
-            if (argv[idx] == NULL)
+            if (argv[idx] == nullptr)
             {
                 ::std::cout << "Missing path parameter!" << ::std::endl;
                 return 0;
             }
             strncpy(pBuildSetFileDir, argv[idx], BUFF_SIZE);
         }
-        else if (stricmp(argv[idx], "-base") == 0 || stricmp(argv[idx], "-b") == 0)
+        else if (stricmp(argv[idx], "--base") == 0 || stricmp(argv[idx], "-b") == 0)
         {
             idx++;
 
             assert(argv[idx]);
-            if (argv[idx] == NULL)
+            if (argv[idx] == nullptr)
             {
                 ::std::cout << "Missing base dir parameter!" << ::std::endl;
                 return 0;
             }
             strncpy(pBasePath, argv[idx], BUFF_SIZE);
         }
-        else if (stricmp(argv[idx], "-xsd") == 0 || stricmp(argv[idx], "-x") == 0)
+        else if (stricmp(argv[idx], "--xsd") == 0 || stricmp(argv[idx], "-x") == 0)
         {
             idx++;
 
             assert(argv[idx]);
-            if (argv[idx] == NULL)
+            if (argv[idx] == nullptr)
             {
                 ::std::cout << "Missing XSD file!" << ::std::endl;
                 return 0;
             }
             arrXSDs.append(argv[idx]);
         }
-        else if (stricmp(argv[idx], "-list") == 0 || stricmp(argv[idx], "-l") == 0)
+        else if (stricmp(argv[idx], "--list") == 0 || stricmp(argv[idx], "-l") == 0)
             bListXSDs = true;
-        else if (stricmp(argv[idx], "-doc") == 0 || stricmp(argv[idx], "-d") == 0)
+        else if (stricmp(argv[idx], "--doc") == 0 || stricmp(argv[idx], "-d") == 0)
             bGenDocs = true;
-        else if (stricmp(argv[idx], "-target") == 0 || stricmp(argv[idx], "-t") == 0)
+        else if (stricmp(argv[idx], "--target") == 0 || stricmp(argv[idx], "-t") == 0)
         {
             idx++;
 
             assert(argv[idx]);
-            if (argv[idx] == NULL)
+            if (argv[idx] == nullptr)
             {
                 ::std::cout << "Missing target!" << ::std::endl;
                 return 0;
@@ -190,7 +190,7 @@ void usage()
             idx++;
 
             assert(argv[idx]);
-            if (argv[idx] == NULL)
+            if (argv[idx] == nullptr)
             {
                 ::std::cout << "Missing extension!" << ::std::endl;
                 return 0;
@@ -205,12 +205,12 @@ void usage()
             else
                 strcpy(pTargetDocExt,argv[idx]);
         }
-        else if (stricmp(argv[idx], "-use") == 0 || stricmp(argv[idx], "-u") == 0)
+        else if (stricmp(argv[idx], "--use") == 0 || stricmp(argv[idx], "-u") == 0)
         {
             idx++;
 
             assert(argv[idx]);
-            if (argv[idx] == NULL)
+            if (argv[idx] == nullptr)
             {
                 ::std::cout << "Missing schema xsd!" << ::std::endl;
                 return 0;
@@ -221,7 +221,7 @@ void usage()
                 arrXSDs.append(argv[idx]);
             }
         }
-        else if (stricmp(argv[idx], "-json") == 0 || stricmp(argv[idx], "-j") == 0)
+        else if (stricmp(argv[idx], "--json") == 0 || stricmp(argv[idx], "-j") == 0)
         {
             bGenJSON = true;
             idx++;
@@ -232,7 +232,7 @@ void usage()
 
     if ((pBuildSetFile[0] != 0) ^ (pBuildSetFileDir[0] != 0))
     {
-        puts("-file and -path need to be both set or neither one!");
+        puts("--file and --path need to be both set or neither one!");
         return 0;
     }
     if (bGenDocs == true && arrXSDs.length() == 0)
@@ -267,35 +267,43 @@ void usage()
     {
         StringArray arrXSDs;
         CBuildSetManager::getInstance()->getBuildSetComponents(arrXSDs);
+        int length  = arrXSDs.length();
 
-        if (arrXSDs.length() > 0)
-            ::std::cout << "XSD files (" << arrXSDs.length() << ")" << ::std::endl;
+        if (length > 0)
+            ::std::cout << "XSD files (" << length << ")" << ::std::endl;
 
-        for (int idx = 0; idx < arrXSDs.length(); idx++)
+        for (int idx = 0; idx < length; idx++)
             ::std::cout << "(" << idx+1 << ") " << arrXSDs.item(idx) << ::std::endl;
     }
 
     for (int idx =  0; bGenDocs == true && idx < arrXSDs.length(); idx++)
     {
+        char *pDoc = nullptr;
         if (pTargetDocDir[0] == 0)
-            ::std::cout << pSchemaHelper->printDocumentation(arrXSDs.item(idx));
+        {
+            pSchemaHelper->printDocumentation(arrXSDs.item(idx), &pDoc);
+            ::std::cout << pDoc;
+        }
         else
         {
             Owned<IFile>   pFile;
             Owned<IFileIO> pFileIO;
             StringBuffer strTargetPath;
-            const char *pXSDFile = strrchr(arrXSDs.item(idx), '/') == NULL ? arrXSDs.item(idx) : strrchr(arrXSDs.item(idx),'/');
+            const char *pXSDFile = strrchr(arrXSDs.item(idx), '/') == nullptr ? arrXSDs.item(idx) : strrchr(arrXSDs.item(idx),'/');
 
             strTargetPath.append(pTargetDocDir).append("/").append(pXSDFile).append(pTargetDocExt);
             pFile.setown(createIFile(strTargetPath.str()));
             pFileIO.setown(pFile->open(IFOcreaterw));
 
-            const char *pDoc = pSchemaHelper->printDocumentation(arrXSDs.item(idx));
+            char *pDoc = nullptr;
+
+            pSchemaHelper->printDocumentation(arrXSDs.item(idx), &pDoc);
 
-            if (pDoc == NULL)
+            if (pDoc == nullptr)
                 continue;
 
             pFileIO->write(0, strlen(pDoc), pDoc);
+            delete[] pDoc;
         }
     }
     for (int idx =  0; bGenJSON == true && idx < arrXSDs.length(); idx++)
@@ -303,16 +311,12 @@ void usage()
         if (bLoadEnvXML == true)
             pSchemaHelper->loadEnvFromConfig(pEnvXMLPath);
 
+        char *pJSON = nullptr;
+
         if (pTargetDocDir[0] == 0)
         {
-            char *pOutput = NULL;
-
-            //pSchemaHelper->printJSONByKey(/*arrXSDs.item(idx)*/"DaliServerProcess[2]", &pOutput);
-            //pSchemaHelper->printJSONByKey(strComponentKey.str(), &pOutput);
-            pSchemaHelper->printJSON(strComponentKey.str(), &pOutput);
-            ::std::cout << pOutput;
-
-            free(pOutput);
+            pSchemaHelper->printJSON(strComponentKey.str(), &pJSON);
+            ::std::cout << pJSON;
         }
         else
         {
@@ -320,25 +324,20 @@ void usage()
             Owned<IFileIO> pFileIO;
             StringBuffer strTargetPath;
 
-            const char *pXSDFile = strrchr(arrXSDs.item(idx), '/') == NULL ? arrXSDs.item(idx) : strrchr(arrXSDs.item(idx),'/');
+            const char *pXSDFile = strrchr(arrXSDs.item(idx), '/') == nullptr ? arrXSDs.item(idx) : strrchr(arrXSDs.item(idx),'/');
 
             strTargetPath.append(pTargetDocDir).append("/").append(pXSDFile).append(pDefaultJSONExt);
             pFile.setown(createIFile(strTargetPath.str()));
             pFileIO.setown(pFile->open(IFOcreaterw));
 
-            char *pJSON = NULL;
-            //pSchemaHelper->printJSON(arrXSDs.item(idx), &pJSON);
-            //pSchemaHelper->printJSONByKey(/*arrXSDs.item(idx)*/"#DaliServerProcess[2]", &pJSON);
             pSchemaHelper->printJSONByKey(strComponentKey.str(), &pJSON);
 
-            if (pJSON == NULL)
-            {
-                free(pJSON);
+            if (pJSON == nullptr)
                 continue;
-            }
+
             pFileIO->write(0, strlen(pJSON), pJSON);
-            free(pJSON);
         }
+        delete[] pJSON;
     }
 
     for (int idx =  0; (bDump == true || bLoadEnvXML == true) && idx < arrXSDs.length(); idx++)
@@ -348,5 +347,7 @@ void usage()
         if (bDump == true)
             pSchemaHelper->printDump(arrXSDs.item(idx));
     }
+    releaseAtoms();
+
     return 0;
 }

+ 1 - 1
configuration/configurator/DocumentationMarkup.hpp

@@ -1,6 +1,6 @@
 /*##############################################################################
 
-    HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems®.
+    HPCC SYSTEMS software Copyright (C) 2016 HPCC Systems®.
 
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.

+ 1 - 1
configuration/configurator/EnvironmentConfiguration.cpp

@@ -52,7 +52,7 @@ enum CEnvironmentConfiguration::CEF_ERROR_CODES CEnvironmentConfiguration::gener
 {
     StringBuffer xpath;
 
-    xpath.clear().appendf("<%s><%s></%s>", XML_HEADER, XML_TAG_ENVIRONMENT, XML_TAG_ENVIRONMENT);
+    xpath.setf("<%s><%s></%s>", XML_HEADER, XML_TAG_ENVIRONMENT, XML_TAG_ENVIRONMENT);
 
     if (m_pEnv.get() != NULL)
         m_pEnv.clear();

+ 1 - 1
configuration/configurator/ExceptionStrings.cpp

@@ -24,7 +24,7 @@ const int nDefaultCode = 99;
 
 ::IException *CONFIGURATOR::MakeExceptionFromMap(int code, enum eExceptionCodes eCode, const char* pMsg)
 {
-    static StringBuffer strExceptionMessage;
+    StringBuffer strExceptionMessage;
     strExceptionMessage.setf("Exception: %s\nPossible Action(s): %s\n",  pExceptionStringArray[eCode-1], pExceptionStringActionArray[eCode-1]);
 
     if (pMsg != NULL)

+ 2 - 1
configuration/configurator/ExceptionStrings.hpp

@@ -49,6 +49,7 @@ catch (::IException *except) \
     StringBuffer strErrMsg;\
     except->errorMessage(strErrMsg);\
     ::std::cout << ::std::endl << strErrMsg.str() << ::std::endl << ::std::endl;\
+    except->Release();\
     exit(-1);\
 }
 
@@ -83,7 +84,7 @@ const char pExceptionStringActionArray[EX_STR_LAST_ENTRY*2][MAX_EXCEPTION_STRING
                                                                                             /* 15 */ "The XSD has a node xs:maxLength @value is not greater than or equal to 0",
                                                                                             /* 16 */ "The XSD has a node xs:pattern @value is not set",
                                                                                             /* 17 */ "The XSD has a node xs:totalDigits @value is not greater than or equal to 0",
-                                                                                            /* 17 */ "The XSD has a node xs:whitespace @value is not valid",
+                                                                                            /* 18 */ "The XSD has a node xs:whitespace @value is not valid",
                                                                                             /*** ADD CORRESPONDING ENTRY TO pExceptionStringActionArray ***/
                                                                                         };
 

+ 0 - 7
configuration/configurator/JSONMarkUp.cpp

@@ -6,13 +6,6 @@
 
 using namespace CONFIGURATOR;
 
-void CJSONMarkUpHelper::markUpString(::StringBuffer &str)
-{
-    //str.replaceString("\"","\\\"");
-    //str.replace("[","\\[");
-    //str.replace("]","/]");
-}
-
 void CJSONMarkUpHelper::createUIContent(::StringBuffer &strJSON, unsigned int &offset, const char *pUIType, const char* pLabel, const char* pKey, \
                                         const char *pToolTip, const char *pDefaultValue, const char *pValues, const char *pValue)
 {

+ 1 - 3
configuration/configurator/JSONMarkUp.hpp

@@ -59,7 +59,7 @@ static const char* JSON_NAVIGATOR_SELECTABLE("\"selectable\":");
 static const char* JSON_NAVIGATOR_NODES("\"nodes\":");
 
 
-#define CONTENT_INNER_CONTENT_BEGIN strJSON.append(JSON_CONTENT_BEGIN);offset += STANDARD_OFFSET_1;QuickOutPad(strJSON, offset);strJSON.append(JSON_INNER_CONTENT_BEGIN_1);
+#define CONTENT_INNER_CONTENT_BEGIN strJSON.append(JSON_CONTENT_BEGIN);offset += STANDARD_OFFSET_1;quickOutPad(strJSON, offset);strJSON.append(JSON_INNER_CONTENT_BEGIN_1);
 #define INNER_CONTENT_END offset -= STANDARD_OFFSET_1;strJSON.append(JSON_INNER_CONTENT_END);
 #define CONTENT_CONTENT_END offset -= STANDARD_OFFSET_1;strJSON.append(JSON_CONTENT_END);
 
@@ -70,8 +70,6 @@ public:
     static void createUIContent(::StringBuffer &strJSON, unsigned int &offset, const char *pUIType, const char* pLabel, const char* pKey, const char *pToolTip = "", const char *pDefaultValue = "", const char* pValues = "", const char*  pValue = "");
     //static void createUIContent(::StringBuffer &strJSON, unsigned int &offset, ::StringBuffer strUIType, ::StringBuffer strLabel, ::StringBuffer strKey, ::StringBuffer strToolTip = "", ::StringBuffer strDefaultValue = "", ::StringBuffer strValues = "", ::StringBuffer strValue = "");
     static void getNavigatorJSON(::StringBuffer &strJSON);
-private:
-    static void markUpString(::StringBuffer &str);
 };
 }
 #endif // _JSONMARKUP_HPP_

configuration/configurator/SchemaAll.hpp → configuration/configurator/schemas/SchemaAll.hpp


+ 14 - 14
configuration/configurator/SchemaAnnotation.cpp

@@ -30,18 +30,18 @@ using namespace CONFIGURATOR;
 
 CAnnotation* CAnnotation::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(pSchemaRoot != NULL);
+    assert(pSchemaRoot != nullptr);
 
-    if (pSchemaRoot == NULL)
-        return NULL;
+    if (pSchemaRoot == nullptr)
+        return nullptr;
 
     StringBuffer strXPathExt(xpath);
 
     strXPathExt.append("/").append(XSD_TAG_DOCUMENTATION);
-    CDocumentation *pDocumentation = CDocumentation::load(NULL, pSchemaRoot, strXPathExt.str());
+    CDocumentation *pDocumentation = CDocumentation::load(nullptr, pSchemaRoot, strXPathExt.str());
 
-    strXPathExt.clear().append(xpath).append("/").append(XSD_TAG_APP_INFO);
-    CAppInfo *pAnnInfo = CAppInfo::load(NULL, pSchemaRoot, strXPathExt.str());
+    strXPathExt.setf("%s/%s", xpath, XSD_TAG_APP_INFO);
+    CAppInfo *pAnnInfo = CAppInfo::load(nullptr, pSchemaRoot, strXPathExt.str());
 
     CAnnotation *pAnnotation = new CAnnotation(pParentNode, pDocumentation, pAnnInfo);
     pAnnotation->setXSDXPath(xpath);
@@ -55,32 +55,32 @@ CAnnotation* CAnnotation::load(CXSDNodeBase* pParentNode, const IPropertyTree *p
 void CAnnotation::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
-    QuickOutHeader(cout, XSD_ANNOTATION_STR, offset);
+    quickOutHeader(cout, XSD_ANNOTATION_STR, offset);
 
     QUICK_OUT(cout, XSDXPath, offset);
 
-    if (m_pAppInfo != NULL)
+    if (m_pAppInfo != nullptr)
         m_pAppInfo->dump(cout, offset);
 
-    if (m_pDocumentation != NULL)
+    if (m_pDocumentation != nullptr)
         m_pDocumentation->dump(cout, offset);
 
-    QuickOutFooter(cout, XSD_ANNOTATION_STR, offset);
+    quickOutFooter(cout, XSD_ANNOTATION_STR, offset);
 }
 
 void CAnnotation::getDocumentation(StringBuffer &strDoc) const
 {
-    if (m_pAppInfo != NULL)
+    if (m_pAppInfo != nullptr)
         m_pAppInfo->getDocumentation(strDoc);
-    if (m_pDocumentation != NULL)
+    if (m_pDocumentation != nullptr)
         m_pDocumentation->getDocumentation(strDoc);
 }
 
 void CAnnotation::loadXMLFromEnvXml(const IPropertyTree *pEnvTree)
 {
-    if (m_pAppInfo != NULL)
+    if (m_pAppInfo != nullptr)
         m_pAppInfo->loadXMLFromEnvXml(pEnvTree);
 
-    if (m_pDocumentation != NULL)
+    if (m_pDocumentation != nullptr)
         m_pDocumentation->loadXMLFromEnvXml(pEnvTree);
 }

+ 3 - 3
configuration/configurator/SchemaAnnotation.hpp

@@ -48,11 +48,11 @@ public:
     {
         return m_pAppInfo;
     }
-    static CAnnotation* load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSchemaRoot, const char* xpath = NULL);
+    static CAnnotation* load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSchemaRoot, const char* xpath = nullptr);
 
 protected:
 
-    CAnnotation(CXSDNodeBase* pParentNode, CDocumentation *pDocumenation = NULL, CAppInfo *pAppInfp = NULL) : CXSDNode::CXSDNode(pParentNode, XSD_ANNOTATION), m_pDocumentation(pDocumenation), m_pAppInfo(pAppInfp)
+    CAnnotation(CXSDNodeBase* pParentNode, CDocumentation *pDocumenation = nullptr, CAppInfo *pAppInfp = nullptr) : CXSDNode::CXSDNode(pParentNode, XSD_ANNOTATION), m_pDocumentation(pDocumenation), m_pAppInfo(pAppInfp)
     {
     }
 
@@ -61,7 +61,7 @@ protected:
 
 private:
 
-    CAnnotation() : CXSDNode::CXSDNode(NULL, XSD_ANNOTATION)
+    CAnnotation() : CXSDNode::CXSDNode(nullptr, XSD_ANNOTATION)
     {
     }
 };

+ 2 - 2
configuration/configurator/SchemaAppInfo.cpp

@@ -105,7 +105,7 @@ void CAppInfo::dump(::std::ostream &cout, unsigned int offset) const
 {
     offset += STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_APP_INFO_STR, offset);
+    quickOutHeader(cout, XSD_APP_INFO_STR, offset);
 
     QUICK_OUT(cout, Title, offset);
     QUICK_OUT(cout, ViewType, offset);
@@ -119,7 +119,7 @@ void CAppInfo::dump(::std::ostream &cout, unsigned int offset) const
     QUICK_OUT(cout, XPath, offset);
     QUICK_OUT(cout, XSDXPath, offset);
 
-    QuickOutFooter(cout, XSD_APP_INFO_STR, offset);
+    quickOutFooter(cout, XSD_APP_INFO_STR, offset);
 }
 
 void CAppInfo::getDocumentation(StringBuffer &strDoc) const

configuration/configurator/SchemaAppInfo.hpp → configuration/configurator/schemas/SchemaAppInfo.hpp


+ 8 - 8
configuration/configurator/SchemaAttributeGroup.cpp

@@ -67,7 +67,7 @@ void CAttributeGroup::dump(::std::ostream &cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_ATTRIBUTE_GROUP_STR, offset);
+    quickOutHeader(cout, XSD_ATTRIBUTE_GROUP_STR, offset);
 
     QUICK_OUT(cout, Name,       offset);
     QUICK_OUT(cout, Ref,        offset);
@@ -78,7 +78,7 @@ void CAttributeGroup::dump(::std::ostream &cout, unsigned int offset) const
     if (m_pAttributeArray != NULL)
         m_pAttributeArray->dump(cout, offset);
 
-    QuickOutFooter(cout, XSD_ATTRIBUTE_GROUP_STR, offset);
+    quickOutFooter(cout, XSD_ATTRIBUTE_GROUP_STR, offset);
 }
 
 void CAttributeGroup::getDocumentation(StringBuffer &strDoc) const
@@ -211,7 +211,7 @@ void CAttributeGroup::getJSON(StringBuffer &strJSON, unsigned int offset, int id
     {
         if (m_pRefAttributeGroup->getConstAttributeArray() != NULL && m_pRefAttributeGroup->getConstAttributeArray()->length() > 0)
         {
-            QuickOutPad(strJSON, offset);
+            quickOutPad(strJSON, offset);
             CONTENT_INNER_CONTENT_BEGIN
             m_pRefAttributeGroup->getConstAttributeArray()->getJSON(strJSON, offset);
         }
@@ -278,13 +278,13 @@ void CAttributeGroupArray::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout,XSD_ATTRIBUTE_GROUP_ARRAY_STR, offset);
+    quickOutHeader(cout,XSD_ATTRIBUTE_GROUP_ARRAY_STR, offset);
 
     QUICK_OUT(cout, XSDXPath, offset);
     QUICK_OUT(cout, EnvXPath,  offset);
     QUICK_OUT_ARRAY(cout, offset);
 
-    QuickOutFooter(cout,XSD_ATTRIBUTE_GROUP_ARRAY_STR, offset);
+    quickOutFooter(cout,XSD_ATTRIBUTE_GROUP_ARRAY_STR, offset);
 }
 
 void CAttributeGroupArray::getDocumentation(StringBuffer &strDoc) const
@@ -325,7 +325,7 @@ void CAttributeGroupArray::getJSON(StringBuffer &strJSON, unsigned int offset, i
     int nLength = this->length();
 
     offset += STANDARD_OFFSET_1;
-    QuickOutPad(strJSON, offset);
+    quickOutPad(strJSON, offset);
 
     for (int lidx = 0; lidx < nLength; lidx++)
     {
@@ -333,7 +333,7 @@ void CAttributeGroupArray::getJSON(StringBuffer &strJSON, unsigned int offset, i
         {
             if (lidx != 0)
             {
-                QuickOutPad(strJSON, offset);
+                quickOutPad(strJSON, offset);
                 strJSON.append(",");
             }
         }
@@ -351,7 +351,7 @@ void CAttributeGroupArray::getJSON(StringBuffer &strJSON, unsigned int offset, i
 
         if (lidx+1 < nLength)
         {
-            QuickOutPad(strJSON, offset);
+            quickOutPad(strJSON, offset);
         }
     }
 }

+ 1 - 1
configuration/configurator/SchemaAttributeGroup.hpp

@@ -94,7 +94,7 @@ protected:
 private:
 };
 
-class CAttributeGroupArray : public ::CIArrayOf<CAttributeGroup>, public InterfaceImpl, public CXSDNodeBase
+class CAttributeGroupArray : public ::CIArrayOf<CAttributeGroup>, public CInterface, public CXSDNodeBase
 {
 public:
 

+ 60 - 63
configuration/configurator/SchemaAttributes.cpp

@@ -46,7 +46,7 @@ CAttribute::~CAttribute()
 
 bool CAttribute::isHidden()
 {
-    if(this->getAnnotation()->getAppInfo() != NULL && !stricmp(this->getAnnotation()->getAppInfo()->getViewType(),"hidden"))
+    if(this->getAnnotation()->getAppInfo() != nullptr && !stricmp(this->getAnnotation()->getAppInfo()->getViewType(),"hidden"))
         return true;
 
     return false;
@@ -54,7 +54,7 @@ bool CAttribute::isHidden()
 
 const char* CAttribute::getTitle() const
 {
-    if (this->m_pAnnotation != NULL && this->m_pAnnotation->getAppInfo() != NULL && this->m_pAnnotation->getAppInfo()->getTitle() != NULL && this->m_pAnnotation->getAppInfo()->getTitle()[0] != 0)
+    if (this->m_pAnnotation != nullptr && this->m_pAnnotation->getAppInfo() != nullptr && this->m_pAnnotation->getAppInfo()->getTitle() != nullptr && this->m_pAnnotation->getAppInfo()->getTitle()[0] != 0)
         return this->m_pAnnotation->getAppInfo()->getTitle();
     else
         return this->getName();
@@ -71,7 +71,7 @@ void CAttribute::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout,XSD_ATTRIBUTE_STR, offset);
+    quickOutHeader(cout,XSD_ATTRIBUTE_STR, offset);
 
     QUICK_OUT(cout, Name,   offset);
     QUICK_OUT(cout, Type,   offset);
@@ -81,27 +81,27 @@ void CAttribute::dump(::std::ostream& cout, unsigned int offset) const
     QUICK_OUT(cout, EnvXPath,  offset);
     QUICK_OUT(cout, EnvValueFromXML,  offset);
 
-    if (m_pAnnotation != NULL)
+    if (m_pAnnotation != nullptr)
         m_pAnnotation->dump(cout, offset);
-    if (m_pSimpleTypeArray != NULL)
+    if (m_pSimpleTypeArray != nullptr)
         m_pSimpleTypeArray->dump(cout, offset);
 
-    QuickOutFooter(cout,XSD_ATTRIBUTE_STR, offset);
+    quickOutFooter(cout,XSD_ATTRIBUTE_STR, offset);
 }
 
 void CAttribute::getDocumentation(StringBuffer &strDoc) const
 {
     const char *pName = this->getTitle();
-    const char *pToolTip = NULL;
+    const char *pToolTip = nullptr;
     const char *pDefaultValue = this->getDefault();
     const char *pRequired = this->getUse();
 
-    if (m_pAnnotation != NULL && m_pAnnotation->getAppInfo() != NULL)
+    if (m_pAnnotation != nullptr && m_pAnnotation->getAppInfo() != nullptr)
     {
         const CAppInfo *pAppInfo = m_pAnnotation->getAppInfo();
         const char* pViewType = pAppInfo->getViewType();
 
-        if (pViewType != NULL && stricmp("hidden", pViewType) == 0)
+        if (pViewType != nullptr && stricmp("hidden", pViewType) == 0)
             return; // HIDDEN
         else
             pToolTip = pAppInfo->getToolTip();
@@ -111,7 +111,7 @@ void CAttribute::getDocumentation(StringBuffer &strDoc) const
     strDoc.appendf("<%s>%s</%s>\n", DM_TABLE_ENTRY, pName, DM_TABLE_ENTRY);
     strDoc.appendf("<%s>%s</%s>\n", DM_TABLE_ENTRY, pToolTip, DM_TABLE_ENTRY);
 
-    if (m_pSimpleTypeArray == NULL)
+    if (m_pSimpleTypeArray == nullptr)
         strDoc.appendf("<%s>%s</%s>\n", DM_TABLE_ENTRY, pDefaultValue, DM_TABLE_ENTRY);
     else
     {
@@ -121,7 +121,7 @@ void CAttribute::getDocumentation(StringBuffer &strDoc) const
         strDoc.appendf("<%s>%s</%s>\n", DM_TABLE_ENTRY, strDocTemp.str(), DM_TABLE_ENTRY);
     }
 
-    if (m_pAnnotation != NULL && m_pAnnotation->getAppInfo() != NULL && m_pAnnotation->getAppInfo()->getDocLineBreak() == true)
+    if (m_pAnnotation != nullptr && m_pAnnotation->getAppInfo() != nullptr && m_pAnnotation->getAppInfo()->getDocLineBreak() == true)
         strDoc.appendf("<%s>%s%s</%s>\n", DM_TABLE_ENTRY, DM_LINE_BREAK2, pRequired, DM_TABLE_ENTRY);
     else
         strDoc.appendf("<%s>%s</%s>\n", DM_TABLE_ENTRY, pRequired, DM_TABLE_ENTRY);
@@ -157,7 +157,7 @@ void CAttribute::getJSON(StringBuffer &strJSON, unsigned int offset, int idx) co
     StringBuffer strKeys;
     const CElementArray *pElementArray = dynamic_cast<const CElementArray*>(this->getParentNodeByType(XSD_ELEMENT_ARRAY));
 
-    if (pElementArray != NULL && pElementArray->getParentNodeByType(XSD_ELEMENT_ARRAY) != NULL &&  pElementArray->getParentNodeByType(XSD_ELEMENT_ARRAY)->getNodeType() != XSD_SCHEMA)
+    if (pElementArray != nullptr && pElementArray->getParentNodeByType(XSD_ELEMENT_ARRAY) != nullptr &&  pElementArray->getParentNodeByType(XSD_ELEMENT_ARRAY)->getNodeType() != XSD_SCHEMA)
     {
         for (int i = 0; i < pElementArray->ordinality(); i++)
         {
@@ -173,7 +173,7 @@ void CAttribute::getJSON(StringBuffer &strJSON, unsigned int offset, int idx) co
             }
 
             const CAttribute *pAttribute = const_cast<const CAttribute*>(&(pElementArray->item(i).getComplexTypeArray()->item(0).getAttributeArray()->item(idx)));
-            assert(pAttribute != NULL);
+            assert(pAttribute != nullptr);
 
             strInstanceValues.appendf("\"%s\"",pAttribute->getInstanceValue());
             strKeys.appendf("\"%s\"",pAttribute->getEnvXPath());
@@ -193,10 +193,10 @@ void CAttribute::getJSON(StringBuffer &strJSON, unsigned int offset, int idx) co
 
 void CAttribute::populateEnvXPath(StringBuffer strXPath, unsigned int index)
 {
-    assert(this->getName() != NULL);
+    assert(this->getName() != nullptr);
 
     const char *pChar = strrchr(strXPath.str(),'[');
-    assert(pChar != NULL && strlen(pChar) >= 3);
+    assert(pChar != nullptr && strlen(pChar) >= 3);
 
     /*strXPath.setLength(strXPath.length()-strlen(pChar));  // remove [N] from XPath;
     strXPath.appendf("[%d]", index);*/
@@ -208,14 +208,14 @@ void CAttribute::populateEnvXPath(StringBuffer strXPath, unsigned int index)
     CConfigSchemaHelper::getInstance()->getSchemaMapManager()->addMapOfXPathToAttribute(this->getEnvXPath(), this);
     CConfigSchemaHelper::getInstance()->appendAttributeXPath(this->getEnvXPath());
 
-    if (this->m_pSimpleTypeArray != NULL)
+    if (this->m_pSimpleTypeArray != nullptr)
         m_pSimpleTypeArray->populateEnvXPath(strXPath);
 }
 
 void CAttribute::loadXMLFromEnvXml(const IPropertyTree *pEnvTree)
 {
-    assert(this->getEnvXPath() != NULL);
-    assert(this->getConstParentNode()->getEnvXPath() != NULL);
+    assert(this->getEnvXPath() != nullptr);
+    assert(this->getConstParentNode()->getEnvXPath() != nullptr);
 
     StringBuffer strXPath(this->getConstParentNode()->getEnvXPath());
 
@@ -227,7 +227,7 @@ void CAttribute::loadXMLFromEnvXml(const IPropertyTree *pEnvTree)
         this->setEnvValueFromXML(pEnvTree->queryPropTree(strXPath.str())->queryProp(strAttribName.str()));
         setInstanceAsValid();
 
-        if (this->m_pSimpleTypeArray != NULL)
+        if (this->m_pSimpleTypeArray != nullptr)
             m_pSimpleTypeArray->loadXMLFromEnvXml(pEnvTree);
     }
     else if (stricmp(this->getUse(), XML_ENV_VALUE_REQUIRED) == 0) // check if this a required attribute
@@ -239,16 +239,16 @@ void CAttribute::loadXMLFromEnvXml(const IPropertyTree *pEnvTree)
 
 bool CAttribute::setEnvValueFromXML(const char *p)
 {
-    if (p == NULL)
+    if (p == nullptr)
     {
-        if (this->getDefault() != NULL && *(this->getDefault()) != 0)
+        if (this->getDefault() != nullptr && *(this->getDefault()) != 0)
         {
             this->setInstanceValue(this->getDefault());
             this->setInstanceAsValid(true);
             return true;
         }
 
-        if (this->getUse() != NULL && stricmp(this->getUse(), TAG_REQUIRED) != 0)
+        if (this->getUse() != nullptr && stricmp(this->getUse(), TAG_REQUIRED) != 0)
             return true;
         else
         {
@@ -259,11 +259,11 @@ bool CAttribute::setEnvValueFromXML(const char *p)
         }
     }
 
-    if (this->getTypeNode() != NULL)
+    if (this->getTypeNode() != nullptr)
     {
         const CXSDBuiltInDataType *pNodeBuiltInType = dynamic_cast<const CXSDBuiltInDataType*>(this->getTypeNode());
 
-        if (pNodeBuiltInType != NULL && pNodeBuiltInType->checkConstraint(p) == false)
+        if (pNodeBuiltInType != nullptr && pNodeBuiltInType->checkConstraint(p) == false)
         {
             this->setInstanceAsValid(false);
             //assert (!"Invalid value for data type");
@@ -279,7 +279,7 @@ bool CAttribute::setEnvValueFromXML(const char *p)
         for (int idx = 0; this->m_ReverseKeyRefArray.length(); idx++)
         {
            CKeyRef *pKeyRef = static_cast<CKeyRef*>((this->m_ReverseKeyRefArray.item(idx)));
-            assert(pKeyRef != NULL);
+            assert(pKeyRef != nullptr);
 
             if (pKeyRef->checkConstraint(p) == false)
             {
@@ -298,26 +298,26 @@ bool CAttribute::setEnvValueFromXML(const char *p)
 
 void CAttribute::appendReverseKeyRef(const CKeyRef *pKeyRef)
 {
-    assert(pKeyRef != NULL);
+    assert(pKeyRef != nullptr);
 
-    if (pKeyRef != NULL)
+    if (pKeyRef != nullptr)
         this->m_ReverseKeyRefArray.append(static_cast<void*>(const_cast<CKeyRef*>(pKeyRef)));
 }
 
 void CAttribute::appendReverseKey(const CKey *pKey)
 {
-    assert(pKey != NULL);
+    assert(pKey != nullptr);
 
-    if (pKey != NULL)
+    if (pKey != nullptr)
         this->m_ReverseKeyArray.append(static_cast<void*>(const_cast<CKey*>(pKey)));
 }
 
 CAttribute* CAttribute::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(pSchemaRoot != NULL);
+    assert(pSchemaRoot != nullptr);
 
-    if (pSchemaRoot == NULL)
-        return NULL;
+    if (pSchemaRoot == nullptr)
+        return nullptr;
 
     CAttribute *pAttribute = new CAttribute(pParentNode);
 
@@ -336,9 +336,9 @@ CAttribute* CAttribute::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSc
         else if (strcmp(iterAttrib->queryName(), XML_ATTR_TYPE) == 0)
         {
             const char *pType = iterAttrib->queryValue();
-            assert(pType != NULL && *pType != 0);
+            assert(pType != nullptr && *pType != 0);
 
-            if (pType != NULL && *pType != 0)
+            if (pType != nullptr && *pType != 0)
             {
                 pAttribute->setType(pType);
                 CConfigSchemaHelper::getInstance()->addNodeForTypeProcessing(pAttribute);
@@ -351,14 +351,13 @@ CAttribute* CAttribute::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSc
     strXPathExt.append("/").append(XSD_TAG_ANNOTATION);
 
     CAnnotation *pAnnotation = CAnnotation::load(pAttribute, pSchemaRoot, strXPathExt.str());
-    if (pAnnotation != NULL)
+    if (pAnnotation != nullptr)
         pAttribute->setAnnotation(pAnnotation);
 
-    strXPathExt.clear().append(xpath);
-    strXPathExt.append("/").append(XSD_TAG_SIMPLE_TYPE);
+    strXPathExt.setf("%s/%s",xpath, XSD_TAG_SIMPLE_TYPE);
 
     CSimpleTypeArray *pSimpleTypeArray = CSimpleTypeArray::load(pAttribute, pSchemaRoot, strXPathExt.str());
-    if (pSimpleTypeArray != NULL)
+    if (pSimpleTypeArray != nullptr)
         pAttribute->setSimpleTypeArray(pSimpleTypeArray);
 
     return pAttribute;
@@ -373,7 +372,7 @@ const char* CAttributeArray::getXML(const char* /*pComponent*/)
         for (int idx = 0; idx < length; idx++)
         {
             CAttribute &Attribute = this->item(idx);
-            m_strXML.append(" ").append(Attribute.getXML(NULL));
+            m_strXML.append(" ").append(Attribute.getXML(nullptr));
 
             if (idx+1 < length)
                 m_strXML.append("\n");
@@ -384,10 +383,10 @@ const char* CAttributeArray::getXML(const char* /*pComponent*/)
 
 CAttributeArray* CAttributeArray::load(const char* pSchemaFile)
 {
-    assert(pSchemaFile != NULL);
+    assert(pSchemaFile != nullptr);
 
-    if (pSchemaFile == NULL)
-        return NULL;
+    if (pSchemaFile == nullptr)
+        return nullptr;
 
     Linked<IPropertyTree> pSchemaRoot;
 
@@ -398,15 +397,15 @@ CAttributeArray* CAttributeArray::load(const char* pSchemaFile)
     StringBuffer strXPathExt("./");
     strXPathExt.append(XSD_TAG_ATTRIBUTE);
 
-    return CAttributeArray::load(NULL, pSchemaRoot, strXPathExt.str());
+    return CAttributeArray::load(nullptr, pSchemaRoot, strXPathExt.str());
 }
 
 CAttributeArray* CAttributeArray::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(pSchemaRoot != NULL);
+    assert(pSchemaRoot != nullptr);
 
-    if (pSchemaRoot == NULL || xpath == NULL)
-        return NULL;
+    if (pSchemaRoot == nullptr || xpath == nullptr)
+        return nullptr;
 
     StringBuffer strXPathExt(xpath);
     CAttributeArray *pAttribArray = new CAttributeArray(pParentNode);
@@ -417,11 +416,11 @@ CAttributeArray* CAttributeArray::load(CXSDNodeBase* pParentNode, const IPropert
     int count = 1;
     ForEach(*attributeIter)
     {
-        strXPathExt.clear().append(xpath).appendf("[%d]",count);
+        strXPathExt.setf("%s[%d]", xpath, count);
 
         CAttribute *pAttrib = CAttribute::load(pAttribArray, pSchemaRoot, strXPathExt.str());
 
-        if (pAttrib != NULL)
+        if (pAttrib != nullptr)
             pAttribArray->append(*pAttrib);
         count++;
     }
@@ -429,7 +428,7 @@ CAttributeArray* CAttributeArray::load(CXSDNodeBase* pParentNode, const IPropert
     if (pAttribArray->length() == 0)
     {
         delete pAttribArray;
-        return NULL;
+        return nullptr;
     }
     return pAttribArray;
 }
@@ -438,19 +437,19 @@ void CAttributeArray::dump(::std::ostream &cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_ATTRIBUTE_ARRAY_STR, offset);
+    quickOutHeader(cout, XSD_ATTRIBUTE_ARRAY_STR, offset);
 
     QUICK_OUT(cout, XSDXPath,  offset);
     QUICK_OUT(cout, EnvXPath,  offset);
     QUICK_OUT_ARRAY(cout, offset);
 
-    QuickOutFooter(cout, XSD_ATTRIBUTE_ARRAY_STR, offset);
+    quickOutFooter(cout, XSD_ATTRIBUTE_ARRAY_STR, offset);
 }
 
 
 void CAttributeArray::getDocumentation(StringBuffer &strDoc) const
 {
-    assert(this->getConstParentNode() != NULL);
+    assert(this->getConstParentNode() != nullptr);
 
     strDoc.append(DM_SECT4_BEGIN);
 
@@ -473,12 +472,12 @@ void CAttributeArray::getDocumentation(StringBuffer &strDoc) const
     strDoc.append(DM_TABLE_ID_BEGIN);
     DEBUG_MARK_STRDOC;
 
-    if (pParentComplexType != NULL && pParentComplexType->getAnnotation() != NULL && pParentComplexType->getAnnotation()->getAppInfo() != NULL && pParentComplexType->getAnnotation()->getAppInfo()->getDocTableID() != NULL)
+    if (pParentComplexType != nullptr && pParentComplexType->getAnnotation() != nullptr && pParentComplexType->getAnnotation()->getAppInfo() != nullptr && pParentComplexType->getAnnotation()->getAppInfo()->getDocTableID() != nullptr)
     {
         strDoc.append(pParentComplexType->getAnnotation()->getAppInfo()->getDocTableID());
         DEBUG_MARK_STRDOC;
     }
-    else if  (pParentAttributeGroup != NULL && pParentAttributeGroup->getAnnotation() != NULL && pParentAttributeGroup->getAnnotation()->getAppInfo() != NULL && pParentAttributeGroup->getAnnotation()->getAppInfo()->getDocTableID() != NULL)
+    else if  (pParentAttributeGroup != nullptr && pParentAttributeGroup->getAnnotation() != nullptr && pParentAttributeGroup->getAnnotation()->getAppInfo() != nullptr && pParentAttributeGroup->getAnnotation()->getAppInfo()->getDocTableID() != nullptr)
     {
         strDoc.append(pParentAttributeGroup->getAnnotation()->getAppInfo()->getDocTableID());
         DEBUG_MARK_STRDOC;
@@ -512,11 +511,9 @@ void CAttributeArray::getJSON(StringBuffer &strJSON, unsigned int offset, int id
 {
     offset += STANDARD_OFFSET_2;
 
-    int lidx=0;
-
-    for (lidx=0; lidx < this->length(); lidx++)
+    for (int lidx=0; lidx < this->length(); lidx++)
     {
-        QuickOutPad(strJSON, offset);
+        quickOutPad(strJSON, offset);
         strJSON.append("{");
         (this->item(lidx)).getJSON(strJSON, offset, lidx);
 
@@ -537,7 +534,7 @@ void CAttributeArray::populateEnvXPath(StringBuffer strXPath, unsigned int index
 
 void CAttributeArray::loadXMLFromEnvXml(const IPropertyTree *pEnvTree)
 {
-    assert(pEnvTree != NULL);
+    assert(pEnvTree != nullptr);
 
     if (pEnvTree->hasProp(this->getEnvXPath()) == false)
         throw MakeExceptionFromMap(EX_STR_XPATH_DOES_NOT_EXIST_IN_TREE);
@@ -557,9 +554,9 @@ void CAttributeArray::loadXMLFromEnvXml(const IPropertyTree *pEnvTree)
 
 const CAttribute* CAttributeArray::findAttributeWithName(const char *pName, bool bCaseInsensitive) const
 {
-    assert (pName != NULL && pName[0] != 0);
-    if (pName == NULL || pName[0] == 0 || this->length() == 0)
-        return NULL;
+    assert (pName != nullptr && pName[0] != 0);
+    if (pName == nullptr || pName[0] == 0 || this->length() == 0)
+        return nullptr;
 
     for (int idx = 0; idx < this->length(); idx++)
     {
@@ -574,7 +571,7 @@ const CAttribute* CAttributeArray::findAttributeWithName(const char *pName, bool
                 return &(this->item(idx));
         }
     }
-    return NULL;
+    return nullptr;
 }
 const void CAttributeArray::getAttributeNames(StringArray &names, StringArray &titles) const
 {

+ 9 - 9
configuration/configurator/SchemaAttributes.hpp

@@ -38,13 +38,13 @@ class CAttribute : public CXSDNodeWithType
 {
 public:
 
-    CAttribute(CXSDNodeBase* pParentNode, const char* pName = NULL) : CXSDNodeWithType::CXSDNodeWithType(pParentNode, XSD_ATTRIBUTE), m_strName(pName),
-            m_strDefault(""), m_strUse(""), m_pAnnotation(NULL), m_pSimpleTypeArray(NULL), m_bInstanceValueValid(false)
+    CAttribute(CXSDNodeBase* pParentNode, const char* pName = nullptr) : CXSDNodeWithType::CXSDNodeWithType(pParentNode, XSD_ATTRIBUTE), m_strName(pName),
+            m_strDefault(""), m_strUse(""), m_pAnnotation(nullptr), m_pSimpleTypeArray(nullptr), m_bInstanceValueValid(false)
     {
     }
 
-    CAttribute(CXSDNodeBase* pParentNode, const char* pName, const char* pType, const char* pDefault, const char* pUse) : CXSDNodeWithType::CXSDNodeWithType(pParentNode, XSD_ATTRIBUTE), m_strName(pName), m_pAnnotation(NULL),
-            m_strDefault(pDefault), m_strUse(pUse), m_pSimpleTypeArray(NULL), m_bInstanceValueValid(false)
+    CAttribute(CXSDNodeBase* pParentNode, const char* pName, const char* pType, const char* pDefault, const char* pUse) : CXSDNodeWithType::CXSDNodeWithType(pParentNode, XSD_ATTRIBUTE), m_strName(pName), m_pAnnotation(nullptr),
+            m_strDefault(pDefault), m_strUse(pUse), m_pSimpleTypeArray(nullptr), m_bInstanceValueValid(false)
     {
     }
 
@@ -73,7 +73,7 @@ public:
         return m_pSimpleTypeArray;
     }
 
-    static CAttribute* load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSchemaRoot, const char* xpath = NULL);
+    static CAttribute* load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSchemaRoot, const char* xpath = nullptr);
 
     bool isInstanceValueValid()
     {
@@ -94,13 +94,13 @@ protected:
 
     void setAnnotation(CAnnotation *pAnnotation)
     {
-        assert(pAnnotation != NULL);  // why would this ever be NULL?
+        assert(pAnnotation != nullptr);  // why would this ever be nullptr?
         m_pAnnotation = pAnnotation;
     }
 
     void setSimpleTypeArray(CSimpleTypeArray *pSimpleTypeArray)
     {
-        assert(pSimpleTypeArray != NULL);  // why would this ever be NULL?
+        assert(pSimpleTypeArray != nullptr);  // why would this ever be nullptr?
         m_pSimpleTypeArray = pSimpleTypeArray;
     }
 
@@ -114,11 +114,11 @@ private:
 
 };
 
-class CAttributeArray : public ::CIArrayOf<CAttribute>, public InterfaceImpl, public CXSDNodeBase
+class CAttributeArray : public ::CIArrayOf<CAttribute>, public CInterface, public CXSDNodeBase
 {
 public:
 
-    CAttributeArray(CXSDNodeBase* pParentNode = NULL) : CXSDNodeBase::CXSDNodeBase(pParentNode, XSD_ATTRIBUTE_ARRAY)
+    CAttributeArray(CXSDNodeBase* pParentNode = nullptr) : CXSDNodeBase::CXSDNodeBase(pParentNode, XSD_ATTRIBUTE_ARRAY)
     {
     }
 

+ 3 - 2
configuration/configurator/SchemaChoice.cpp

@@ -71,7 +71,7 @@ void CChoice::dump(::std::ostream &cout, unsigned int offset) const
 {
     offset += STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_CHOICE_STR, offset);
+    quickOutHeader(cout, XSD_CHOICE_STR, offset);
 
     QUICK_OUT(cout, ID,         offset);
     QUICK_OUT(cout ,MinOccurs,  offset);
@@ -81,7 +81,7 @@ void CChoice::dump(::std::ostream &cout, unsigned int offset) const
     if (m_pArrayOfElementArrays != NULL)
         m_pArrayOfElementArrays->dump(cout, offset);
 
-    QuickOutFooter(cout, XSD_CHOICE_STR, offset);
+    quickOutFooter(cout, XSD_CHOICE_STR, offset);
 }
 
 void CChoice::getDocumentation(StringBuffer &strDoc) const
@@ -129,6 +129,7 @@ void CChoice::loadXMLFromEnvXml(const IPropertyTree *pEnvTree)
         }
         catch (...)
         {
+            UNIMPLEMENTED;
         }
     }
 }

configuration/configurator/SchemaChoice.hpp → configuration/configurator/schemas/SchemaChoice.hpp


+ 23 - 22
configuration/configurator/SchemaCommon.cpp

@@ -229,7 +229,7 @@ const CXSDNodeBase* CXSDNodeBase::getConstAncestorNode(unsigned iLevel) const
    {
        pAncestorNode = const_cast<CXSDNodeBase*>(pAncestorNode->getConstParentNode());
        iLevel--;
-   } while (iLevel > 0 && pAncestorNode != NULL);
+   } while (iLevel > 0 && pAncestorNode != nullptr);
 
    return pAncestorNode;
 }
@@ -238,13 +238,13 @@ const CXSDNodeBase* CXSDNodeBase::getParentNodeByType(NODE_TYPES eNodeType[], co
 {
    for (int i = 0; i < length; i++)
    {
-       if (this->m_eNodeType == eNodeType[i] && pParent != NULL)
+       if (this->m_eNodeType == eNodeType[i] && pParent != nullptr)
            return this;
    }
-   if (this->getConstParentNode() != NULL)
+   if (this->getConstParentNode() != nullptr)
        return this->getConstParentNode()->getParentNodeByType(eNodeType, this, length);
 
-   return NULL;
+   return nullptr;
 }
 
 CXSDNode::CXSDNode(CXSDNodeBase *pParentNode, NODE_TYPES pNodeType) : CXSDNodeBase::CXSDNodeBase(pParentNode, pNodeType)
@@ -253,21 +253,21 @@ CXSDNode::CXSDNode(CXSDNodeBase *pParentNode, NODE_TYPES pNodeType) : CXSDNodeBa
 
 bool CXSDNode::checkSelf(NODE_TYPES eNodeType, const char *pName, const char* pCompName) const
 {
-  if (eNodeType & this->getNodeType() && (pName != NULL ? !strcmp(pName, this->getNodeTypeStr()) : true))
+  if (eNodeType & this->getNodeType() && (pName != nullptr ? !strcmp(pName, this->getNodeTypeStr()) : true))
   {
-      assert(pName != NULL); // for now pName should always be populated
-      return this;
+      assert(pName != nullptr); // for now pName should always be populated
+      return true;
   }
-  return NULL;
+  return false;
 }
 
 const CXSDNodeBase* CXSDNode::getParentNodeByType(NODE_TYPES eNodeType) const
 {
   if (this->m_eNodeType == eNodeType)
       return this;
-  if (this->getConstParentNode() != NULL)
+  if (this->getConstParentNode() != nullptr)
       return this->getConstParentNode()->getParentNodeByType(eNodeType);
-  return NULL;
+  return nullptr;
 }
 
 const CXSDNodeBase* CXSDNodeBase::getNodeByTypeAndNameAscending(NODE_TYPES eNodeType[], const char *pName, int length) const
@@ -276,22 +276,23 @@ const CXSDNodeBase* CXSDNodeBase::getNodeByTypeAndNameAscending(NODE_TYPES eNode
   {
     assert(this->m_eNodeType != eNodeType[i]);
 
-    if (this->getConstParentNode() != NULL)
+    if (this->getConstParentNode() != nullptr)
         return this->getConstParentNode()->getNodeByTypeAndNameAscending(eNodeType[i], pName);
   }
-  return NULL;
+  return nullptr;
 }
 
 const CXSDNodeBase* CXSDNodeBase::getNodeByTypeAndNameDescending(NODE_TYPES eNodeType[], const char *pName, int length) const
 {
     assert(false);  // Derived classes need to hande this
-    return NULL;
+    UNIMPLEMENTED;
+    return nullptr;
 }
 
 const CXSDNodeBase* CXSDNodeBase::getParentNodeByType(NODE_TYPES eNodeType, const CXSDNodeBase *pParent) const
 {
-    if (this->getConstParentNode() == NULL)
-        return NULL;
+    if (this->getConstParentNode() == nullptr)
+        return nullptr;
     else if (this->getConstParentNode()->getNodeType() == eNodeType)
         return this->getConstParentNode();
     else
@@ -300,14 +301,14 @@ const CXSDNodeBase* CXSDNodeBase::getParentNodeByType(NODE_TYPES eNodeType, cons
 
 CXSDBuiltInDataType* CXSDBuiltInDataType::create(CXSDNodeBase* pParentNode, const char* pNodeType)
 {
-    assert(pParentNode != NULL);
+    assert(pParentNode != nullptr);
 
     enum NODE_TYPES eNodeType = CConfigSchemaHelper::getInstance()->getSchemaMapManager()->getEnumFromTypeName(pNodeType);
 
     if (eNodeType != XSD_ERROR)
         return new CXSDBuiltInDataType(pParentNode, eNodeType);
     else
-        return NULL;
+        return nullptr;
 }
 
 CXSDBuiltInDataType::CXSDBuiltInDataType(CXSDNodeBase* pParentNode, enum NODE_TYPES eNodeType) : CXSDNode::CXSDNode(pParentNode, eNodeType)
@@ -333,8 +334,8 @@ void CXSDBuiltInDataType::dump(::std::ostream& cout, unsigned int offset) const
 
     const char *pTypeNameString = CConfigSchemaHelper::getInstance()->getSchemaMapManager()->getTypeNameFromEnum(this->getNodeType(), true);
 
-    QuickOutHeader(cout, pTypeNameString, offset);
-    QuickOutFooter(cout, pTypeNameString, offset);
+    quickOutHeader(cout, pTypeNameString, offset);
+    quickOutFooter(cout, pTypeNameString, offset);
 }
 
 void CXSDBuiltInDataType::getDocumentation(StringBuffer &strDoc) const
@@ -344,7 +345,7 @@ void CXSDBuiltInDataType::getDocumentation(StringBuffer &strDoc) const
 
 bool CXSDBuiltInDataType::checkConstraint(const char *pValue) const
 {
-    if (pValue == NULL || *pValue == 0)
+    if (pValue == nullptr || *pValue == 0)
         return true;
 
     enum NODE_TYPES eNodeType = this->getNodeType();
@@ -354,7 +355,7 @@ bool CXSDBuiltInDataType::checkConstraint(const char *pValue) const
         if (XSD_DT_NORMALIZED_STRING == eNodeType)
         {
             const char key[] = "\n\r\t";
-            if (strpbrk(pValue, key) != NULL)
+            if (strpbrk(pValue, key) != nullptr)
                 return false;
         }
         else if (XSD_DT_STRING == eNodeType)
@@ -364,7 +365,7 @@ bool CXSDBuiltInDataType::checkConstraint(const char *pValue) const
         else if(XSD_DT_TOKEN == eNodeType)
         {
             const char key[] = "\n\r\t";
-            if (strpbrk(pValue, key) != NULL)
+            if (strpbrk(pValue, key) != nullptr)
                 return false;
             if (pValue[0] == ' ' || pValue[strlen(pValue)-1] == ' ' || strstr(pValue, "  ")); // leading/trailing space multiple spaces
                 return false;

+ 43 - 130
configuration/configurator/SchemaCommon.hpp

@@ -26,6 +26,7 @@
 #include "jarray.hpp"
 #include "XMLTags.h"
 #include "ExceptionStrings.hpp"
+#include "build-config.h"
 
 namespace CONFIGURATOR
 {
@@ -35,12 +36,12 @@ namespace CONFIGURATOR
 #define MAXIMUM_STRICTNESS  10
 #define STRICTNESS_LEVEL MINIMUM_STRICTNESS
 
-#define QUICK_OUT(X,Y,Z) QuickOut(X,#Y,get##Y(),Z);
-#define QUICK_OUT_2(Y) QuickOut(cout, #Y, get##Y(), offset);
-#define QUICK_OUT_3(X) if (m_p##X != NULL) m_p##X->dump(cout, offset);
+#define QUICK_OUT(X,Y,Z) quickOut(X,#Y,get##Y(),Z);
+#define QUICK_OUT_2(Y) quickOut(cout, #Y, get##Y(), offset);
+#define QUICK_OUT_3(X) if (m_p##X != nullptr) m_p##X->dump(cout, offset);
 #define QUICK_OUT_ARRAY(X,Z) for (int idx=0; idx < this->length(); idx++)               \
                              {                                                          \
-                                QuickOutPad(X,Z+STANDARD_OFFSET_1);                     \
+                                quickOutPad(X,Z+STANDARD_OFFSET_1);                     \
                                 X << idx+1 << "]" << ::std::endl;                         \
                                 (this->item(idx)).dump(cout,Z);                         \
                              }
@@ -61,7 +62,7 @@ namespace CONFIGURATOR
                                  (this->item(idx)).populateEnvXPath(X.str(), Y);        \
                             }
 
-#define QUICK_LOAD_ENV_XML(X)   assert(X != NULL);                                      \
+#define QUICK_LOAD_ENV_XML(X)   assert(X != nullptr);                                      \
                                 for (int idx=0; idx < this->length(); idx++)            \
                                 {                                                       \
                                      (this->item(idx)).loadXMLFromEnvXml(X);            \
@@ -76,22 +77,22 @@ namespace CONFIGURATOR
 //#define GETTERSETTER2(X) protected: StringBuffer m_str##X; public: GETTER(X) SETTER2(X) public:
 
 #define GETTERINT(X) virtual const long get##X() const { return m_n##X; }
-#define SETTERINT(X) virtual void set##X(long p) { m_n##X = p; } virtual void set##X(const char *p) { assert(p != NULL); if (p != 0 && *p != 0) m_n##X = atol(p); }
+#define SETTERINT(X) virtual void set##X(long p) { m_n##X = p; } virtual void set##X(const char *p) { assert(p != nullptr); if (p != 0 && *p != 0) m_n##X = atol(p); }
 #define GETTERSETTERINT(X) protected: long m_n##X; public: GETTERINT(X) SETTERINT(X) private:
 
-#define SETPARENTNODE(X, Y) if (X!= NULL && Y != NULL) X->setParentNode(Y);
+#define SETPARENTNODE(X, Y) if (X!= nullptr && Y != nullptr) X->setParentNode(Y);
 //#define DEBUG_MARK_STRDOC strDoc.append(__FILE__).append(":").append(__LINE__).append("\n");
 #define DEBUG_MARK_STRDOC
 #define DEBUG_MARK_COMMENT(X) X.append("//  ").append(__FILE__).append(":").append(__LINE__).append("\n");
 #define DEBUG_MARK_COMMENT2(X,Y) X.append("//  UIType=").append(Y->getUIType()).append("  ").append(__FILE__).append(":").append(__LINE__).append("\n");
-#define DEBUG_MARK_COMMENT_3 QuickOutPad(strJSON, offset); strJSON.append("{ \"").append(__FILE__).append("\" : \"").append(__LINE__).append("\"},\n"); QuickOutPad(strJSON, offset);
-#define DEBUG_MARK_COMMENT_4 QuickOutPad(strJSON, offset); strJSON.append(",{ \"").append(__FILE__).append("\" : \"").append(__LINE__).append("\"},\n"); QuickOutPad(strJSON, offset);
+#define DEBUG_MARK_COMMENT_3 quickOutPad(strJSON, offset); strJSON.append("{ \"").append(__FILE__).append("\" : \"").append(__LINE__).append("\"},\n"); QuickOutPad(strJSON, offset);
+#define DEBUG_MARK_COMMENT_4 quickOutPad(strJSON, offset); strJSON.append(",{ \"").append(__FILE__).append("\" : \"").append(__LINE__).append("\"},\n"); QuickOutPad(strJSON, offset);
 #define DEBUG_MARK_STRJS DEBUG_MARK_COMMENT(strJS)
 #define DEBUG_MARK_JSON_1 //DEBUG_MARK_COMMENT_4// DEBUG_MARK_COMMENT(strJSON)
 #define DEBUG_MARK_JSON_2 //DEBUG_MARK_COMMENT_3// DEBUG_MARK_COMMENT(strJSON)
 
 #define GETTERTYPE(X) C##X* get##X() const { return m_p##X; }
-#define SETTERTYPE(X) void set##X( C##X *p ) { assert(p != NULL); if (p != NULL) m_p##X = p; }
+#define SETTERTYPE(X) void set##X( C##X *p ) { assert(p != nullptr); if (p != nullptr) m_p##X = p; }
 #define GETTERSETTERTYPE(X) public: C##X *m_p##X; GETTERTYPE(X) SETTERTYPE(X) private:
 
 #define CHECK_EXCLUSION(X)  if(CConfigSchemaHelper::getInstance()->getSchemaMapManager()->isNodeExcluded(X)) return nullptr;
@@ -162,60 +163,7 @@ enum NODE_TYPES
     XSD_ERROR
 };
 
-static const char* DEFAULT_SCHEMA_DIRECTORY("/opt/HPCCSystems/componentfiles/configxml/");
-
-#define NAME_SPACE_FOR_XSD_SCHEMA   "xs:"
-
-static const char* XSD_TAG_ANNOTATION(NAME_SPACE_FOR_XSD_SCHEMA"annotation");
-static const char* XSD_TAG_APP_INFO(NAME_SPACE_FOR_XSD_SCHEMA"appinfo");
-//static const char* XSD_TAG_ATTRIBUTE(NAME_SPACE_FOR_XSD_SCHEMA"attribute");
-//static const char* XSD_TAG_ATTRIBUTE_GROUP(NAME_SPACE_FOR_XSD_SCHEMA"attributeGroup");
-//static const char* XSD_TAG_CHOICE(NAME_SPACE_FOR_XSD_SCHEMA"choice");
-//static const char* XSD_TAG_COMPLEX_CONTENT(NAME_SPACE_FOR_XSD_SCHEMA"complexContent");
-//static const char* XSD_TAG_COMPLEX_TYPE(NAME_SPACE_FOR_XSD_SCHEMA"complexType");
-static const char* XSD_TAG_DOCUMENTATION(NAME_SPACE_FOR_XSD_SCHEMA"documentation");
-//static const char* XSD_TAG_ELEMENT(NAME_SPACE_FOR_XSD_SCHEMA"element");
-static const char* XSD_TAG_EXTENSION(NAME_SPACE_FOR_XSD_SCHEMA"extension");
-static const char* XSD_TAG_KEY(NAME_SPACE_FOR_XSD_SCHEMA"key");
-static const char* XSD_TAG_KEYREF(NAME_SPACE_FOR_XSD_SCHEMA"keyref");
-static const char* XSD_TAG_SELECTOR(NAME_SPACE_FOR_XSD_SCHEMA"selector");
-static const char* XSD_TAG_FIELD(NAME_SPACE_FOR_XSD_SCHEMA"field");
-static const char* XSD_TAG_INCLUDE(NAME_SPACE_FOR_XSD_SCHEMA"include");
-static const char* XSD_TAG_RESTRICTION(NAME_SPACE_FOR_XSD_SCHEMA"restriction");
-static const char* XSD_TAG_SCHEMA("");
-static const char* XSD_TAG_SIMPLE_CONTENT(NAME_SPACE_FOR_XSD_SCHEMA"simpleContent");
-//static const char* XSD_TAG_SEQUENCE(NAME_SPACE_FOR_XSD_SCHEMA"sequence");
-static const char* XSD_TAG_SIMPLE_TYPE(NAME_SPACE_FOR_XSD_SCHEMA"simpleType");
-static const char* XSD_TAG_ENUMERATION(NAME_SPACE_FOR_XSD_SCHEMA"enumeration");
-static const char* XSD_TAG_FRACTION_DIGITS(NAME_SPACE_FOR_XSD_SCHEMA"fractionDigits");
-static const char* XSD_TAG_LENGTH(NAME_SPACE_FOR_XSD_SCHEMA"length");
-static const char* XSD_TAG_MAX_EXCLUSIVE(NAME_SPACE_FOR_XSD_SCHEMA"maxExclusive");
-static const char* XSD_TAG_MAX_INCLUSIVE(NAME_SPACE_FOR_XSD_SCHEMA"maxInclusive");
-static const char* XSD_TAG_MIN_EXCLUSIVE(NAME_SPACE_FOR_XSD_SCHEMA"minExlusive");
-static const char* XSD_TAG_MIN_INCLUSIVE(NAME_SPACE_FOR_XSD_SCHEMA"minExclusive");
-static const char* XSD_TAG_MAX_LENGTH(NAME_SPACE_FOR_XSD_SCHEMA"maxLength");
-static const char* XSD_TAG_MIN_LENGTH(NAME_SPACE_FOR_XSD_SCHEMA"minLength");
-static const char* XSD_TAG_PATTERN(NAME_SPACE_FOR_XSD_SCHEMA"pattern");
-static const char* XSD_TAG_TOTAL_DIGITS(NAME_SPACE_FOR_XSD_SCHEMA"totalDigits");
-static const char* XSD_TAG_UNQIUE(NAME_SPACE_FOR_XSD_SCHEMA"unique");
-static const char* XSD_TAG_WHITE_SPACE(NAME_SPACE_FOR_XSD_SCHEMA"whiteSpace");
-
-static const char* XSD_DATA_TYPE_NORMALIZED_STRING(NAME_SPACE_FOR_XSD_SCHEMA"normalizedString");
-static const char* XSD_DATA_TYPE_STRING(NAME_SPACE_FOR_XSD_SCHEMA"string");
-static const char* XSD_DATA_TYPE_TOKEN(NAME_SPACE_FOR_XSD_SCHEMA"token");
-static const char* XSD_DATA_TYPE_DATE(NAME_SPACE_FOR_XSD_SCHEMA"date");
-static const char* XSD_DATA_TYPE_TIME(NAME_SPACE_FOR_XSD_SCHEMA"time");
-static const char* XSD_DATA_TYPE_DATE_TIME(NAME_SPACE_FOR_XSD_SCHEMA"dateTime");
-static const char* XSD_DATA_TYPE_DECIMAL(NAME_SPACE_FOR_XSD_SCHEMA"decimal"); // A decimal value
-static const char* XSD_DATA_TYPE_INTEGER(NAME_SPACE_FOR_XSD_SCHEMA"integer"); // An integer value
-static const char* XSD_DATA_TYPE_INT(NAME_SPACE_FOR_XSD_SCHEMA"int"); // A signed 32-bit integer
-static const char* XSD_DATA_TYPE_LONG(NAME_SPACE_FOR_XSD_SCHEMA"long"); // A signed 64-bit integer
-static const char* XSD_DATA_TYPE_NON_NEGATIVE_INTEGER(NAME_SPACE_FOR_XSD_SCHEMA"nonNegativeInteger");
-static const char* XSD_DATA_TYPE_NON_POSITIVE_INTEGER(NAME_SPACE_FOR_XSD_SCHEMA"nonPositiveInteger");
-static const char* XSD_DATA_TYPE_NEGATIVE_INTEGER(NAME_SPACE_FOR_XSD_SCHEMA"negativeInteger");
-static const char* XSD_DATA_TYPE_POSITIVE_INTEGER(NAME_SPACE_FOR_XSD_SCHEMA"positiveInteger");
-static const char* XSD_DATA_TYPE_BOOLEAN(NAME_SPACE_FOR_XSD_SCHEMA"boolean");
-
+static const char* DEFAULT_SCHEMA_DIRECTORY(COMPONENTFILES_DIR "/configxml/");
 static const char* XSD_ANNOTATION_STR("Annotation");
 static const char* XSD_APP_INFO_STR("AppInfo");
 static const char* XSD_ATTRIBUTE_STR("Attribute");
@@ -311,14 +259,14 @@ static const char* TAG_UNBOUNDED("unbounded");
 #define XML_ATTR_XMLNS_XS              "@xmlns:xs"
 #define XML_ATTR_SCHEMA_LOCATION       "@schemaLocation"
 #define XML_ATTR_VALUE                 "@value"
-#define XML_ATTR_OVERIDE               "@overide"
+#define XML_ATTR_OVERRIDE              "@overide"  // intentionally misspelled
 #define XML_ATTR_DEPLOYABLE            "@deployable"
 
 static unsigned int STANDARD_OFFSET_1 = 3;
 static unsigned int STANDARD_OFFSET_2 = 6;
 static unsigned int STANDARD_OFFSET_3 = 9;
 
-static void QuickOutPad(::std::ostream& cout, unsigned int offset)
+static void quickOutPad(::std::ostream& cout, unsigned int offset)
 {
     while(offset > 0)
     {
@@ -327,7 +275,7 @@ static void QuickOutPad(::std::ostream& cout, unsigned int offset)
     }
 }
 
-static void QuickOutPad(::StringBuffer &str, unsigned int offset)
+static void quickOutPad(::StringBuffer &str, unsigned int offset)
 {
     while(offset > 0)
     {
@@ -336,31 +284,31 @@ static void QuickOutPad(::StringBuffer &str, unsigned int offset)
     }
 }
 
-static void QuickOutHeader(::std::ostream &cout, const char* pLabel, unsigned int offset = 0)
+static void quickOutHeader(::std::ostream &cout, const char* pLabel, unsigned int offset = 0)
 {
-    QuickOutPad(cout,offset);
+    quickOutPad(cout,offset);
     cout << "\033[32m-- " << pLabel << " START" << " --" << "\033[0m" << ::std::endl;
 }
 
-static void QuickOutFooter(::std::ostream &cout, const char* pLabel, unsigned int offset = 0)
+static void quickOutFooter(::std::ostream &cout, const char* pLabel, unsigned int offset = 0)
 {
-    QuickOutPad(cout,offset);
+    quickOutPad(cout,offset);
     //cout << "<--- FINISH " << pLabel << ::std::endl;
     cout << "\033[31m" << "-- " << pLabel << " FINISH" << " --" << "\033[0m" << ::std::endl;
 }
 
-static void QuickOut(::std::ostream &cout, const char* pLabel, const char* pValue, unsigned int offset = 0)
+static void quickOut(::std::ostream &cout, const char* pLabel, const char* pValue, unsigned int offset = 0)
 {
     if (pLabel && strlen(pValue) > 0)
     {
-        QuickOutPad(cout,offset+STANDARD_OFFSET_2);
+        quickOutPad(cout,offset+STANDARD_OFFSET_2);
         cout << "\033[34m" << pLabel << ":\t\033[0m" << "\033[34m'\033[0m" << pValue << "\033[34m'" << "\033[0m" << ::std::endl;
     }
 }
 
-static void QuickOut(::std::ostream &cout, const char* pLabel, int value, unsigned int offset = 0)
+static void quickOut(::std::ostream &cout, const char* pLabel, int value, unsigned int offset = 0)
 {
-    QuickOutPad(cout,offset);
+    quickOutPad(cout,offset);
     cout << pLabel << ": " << value << ::std::endl;
 }
 
@@ -382,46 +330,11 @@ static const char* stripTrailingIndex(StringBuffer& strXPath)  // should this re
     return strXPath.str();
 }
 
-class InterfaceImpl : public IInterface
-{
-public:
-
-    InterfaceImpl()
-    {
-        atomic_set(&xxcount, 1);
-    }
-
-    virtual void Link() const
-    {
-        atomic_inc(&xxcount);
-    }
-
-    virtual bool Release() const
-    {
-        if (atomic_dec_and_test(&xxcount))
-        {
-           delete this;
-           return true;
-        }
-
-        return false;
-    }
-
-    int getLinkCount() const
-    {
-        return xxcount.counter;
-    }
-
-private:
-
-    mutable atomic_t xxcount;
-};
-
 class CXSDNodeBase
 {
 public:
 
-    CXSDNodeBase(CXSDNodeBase* pParentNode = NULL, NODE_TYPES eNodeType = XSD_ERROR);
+    CXSDNodeBase(CXSDNodeBase* pParentNode = nullptr, NODE_TYPES eNodeType = XSD_ERROR);
 
     virtual ~CXSDNodeBase();
 
@@ -435,7 +348,7 @@ public:
 
     virtual bool setEnvValueFromXML(const char* p)
     {
-        if (p != NULL)
+        if (p != nullptr)
         {
             m_strEnvValueFromXML.set(p);
             return true;
@@ -456,8 +369,8 @@ public:
         return m_pParentNode;
     }
 
-    virtual const CXSDNodeBase* getParentNodeByType(NODE_TYPES eNodeType[], const CXSDNodeBase *pParent = NULL, int length = 1) const;
-    virtual const CXSDNodeBase* getParentNodeByType(NODE_TYPES eNodeType, const CXSDNodeBase *pParent = NULL) const;
+    virtual const CXSDNodeBase* getParentNodeByType(NODE_TYPES eNodeType[], const CXSDNodeBase *pParent = nullptr, int length = 1) const;
+    virtual const CXSDNodeBase* getParentNodeByType(NODE_TYPES eNodeType, const CXSDNodeBase *pParent = nullptr) const;
     virtual const CXSDNodeBase* getNodeByTypeAndNameAscending(NODE_TYPES eNodeType[], const char *pName, int length = 1) const;
     virtual const CXSDNodeBase* getNodeByTypeAndNameAscending(NODE_TYPES eNodeType, const char *pName) const
     {
@@ -473,7 +386,7 @@ public:
     }
     void setParentNode(CXSDNodeBase *pParentNode)
     {
-        if (m_pParentNode == NULL)  // Should only be set once, otherwise it's an external schema and should have parent set
+        if (m_pParentNode == nullptr)  // Should only be set once, otherwise it's an external schema and should have parent set
         {
             m_pParentNode = pParentNode;
         }
@@ -490,7 +403,7 @@ public:
 
     virtual const char* getXML(const char* /*pComponent*/)
     {
-        return NULL;
+        return nullptr;
     }
 
     virtual void getDocumentation(::StringBuffer &strDoc) const = 0;
@@ -541,25 +454,25 @@ public:
 
     static T* load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSchemaRoot, const char* xpath)
     {
-        assert(pSchemaRoot != NULL);
+        assert(pSchemaRoot != nullptr);
 
-        if (pSchemaRoot == NULL)
-            return NULL;
+        if (pSchemaRoot == nullptr)
+            return nullptr;
 
-        T *pT = NULL;
+        T *pT = nullptr;
 
-        if (xpath != NULL && *xpath != 0)
+        if (xpath != nullptr && *xpath != 0)
         {
             ::IPropertyTree* pTree = pSchemaRoot->queryPropTree(xpath);
 
-            if (pTree == NULL)
-                return NULL;
+            if (pTree == nullptr)
+                return nullptr;
 
             pT = new T(pParentNode);
 
             const char* pValue = pTree->queryProp(XML_ATTR_VALUE);
 
-            if (pValue != NULL && *pValue != 0)
+            if (pValue != nullptr && *pValue != 0)
                 pT->setValue(pValue);
             else
             {
@@ -575,9 +488,9 @@ public:
     {
         offset += STANDARD_OFFSET_1;
 
-        QuickOutHeader(cout, XSD_MIN_INCLUSIVE_STR, offset);
+        quickOutHeader(cout, XSD_MIN_INCLUSIVE_STR, offset);
         QUICK_OUT(cout, Value, offset);
-        QuickOutFooter(cout, XSD_MIN_INCLUSIVE_STR, offset);
+        quickOutFooter(cout, XSD_MIN_INCLUSIVE_STR, offset);
     }
 
     virtual void getDocumentation(::StringBuffer &strDoc) const
@@ -588,7 +501,7 @@ public:
     virtual const char* getXML(const char* /*pComponent*/)
     {
         UNIMPLEMENTED;
-        return NULL;
+        return nullptr;
     }
 
     virtual void populateEnvXPath(::StringBuffer strXPath, unsigned int index = 1)
@@ -610,7 +523,7 @@ class CXSDNodeWithType : public CXSDNode
 
 public:
 
-    CXSDNodeWithType(CXSDNodeBase* pParentNode, enum NODE_TYPES eNodeType) : CXSDNode::CXSDNode(pParentNode, eNodeType), m_pXSDNode(NULL)
+    CXSDNodeWithType(CXSDNodeBase* pParentNode, enum NODE_TYPES eNodeType) : CXSDNode::CXSDNode(pParentNode, eNodeType), m_pXSDNode(nullptr)
     {
     }
 
@@ -640,7 +553,7 @@ class CXSDNodeWithBase : public CXSDNode
 
 public:
 
-    CXSDNodeWithBase(CXSDNodeBase* pParentNode, enum NODE_TYPES eNodeType) : CXSDNode::CXSDNode(pParentNode, eNodeType), m_pXSDNode(NULL)
+    CXSDNodeWithBase(CXSDNodeBase* pParentNode, enum NODE_TYPES eNodeType) : CXSDNode::CXSDNode(pParentNode, eNodeType), m_pXSDNode(nullptr)
     {
     }
 
@@ -673,7 +586,7 @@ public:
 
 private:
 
-    CXSDBuiltInDataType(CXSDNodeBase* pParentNode = NULL, NODE_TYPES eNodeType = XSD_ERROR);
+    CXSDBuiltInDataType(CXSDNodeBase* pParentNode = nullptr, NODE_TYPES eNodeType = XSD_ERROR);
     CXSDBuiltInDataType(CXSDNodeBase* pParentNode, const char* pNodeType);
 };
 

+ 2 - 2
configuration/configurator/SchemaComplexContent.cpp

@@ -58,13 +58,13 @@ void CComplexContent::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_COMPLEX_CONTENT_STR, offset);
+    quickOutHeader(cout, XSD_COMPLEX_CONTENT_STR, offset);
     QUICK_OUT(cout, XSDXPath,  offset);
 
     if (m_pExtension != nullptr)
         m_pExtension->dump(cout, offset);
 
-    QuickOutFooter(cout, XSD_COMPLEX_CONTENT_STR, offset);
+    quickOutFooter(cout, XSD_COMPLEX_CONTENT_STR, offset);
 }
 
 

configuration/configurator/SchemaComplexContent.hpp → configuration/configurator/schemas/SchemaComplexContent.hpp


+ 16 - 15
configuration/configurator/SchemaComplexType.cpp

@@ -72,7 +72,7 @@ const CXSDNodeBase* CComplexType::getNodeByTypeAndNameDescending(NODE_TYPES eNod
 void CComplexType::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
-    QuickOutHeader(cout, XSD_COMPLEX_TYPE_STR, offset);
+    quickOutHeader(cout, XSD_COMPLEX_TYPE_STR, offset);
 
     QUICK_OUT_2(Name)
     QUICK_OUT(cout, XSDXPath,   offset);
@@ -90,7 +90,7 @@ void CComplexType::dump(::std::ostream& cout, unsigned int offset) const
     if (m_pAnnotation != NULL)
         m_pAnnotation->dump(cout, offset);
 
-    QuickOutFooter(cout, XSD_COMPLEX_TYPE_STR, offset);
+    quickOutFooter(cout, XSD_COMPLEX_TYPE_STR, offset);
 }
 
 void CComplexType::getDocumentation(StringBuffer &strDoc) const
@@ -131,7 +131,7 @@ void CComplexType::getJSON(StringBuffer &strJSON, unsigned int offset, int idx)
 	{
         strJSON.append("\n");
         offset += STANDARD_OFFSET_2;
-        QuickOutPad(strJSON, offset);
+        quickOutPad(strJSON, offset);
         CONTENT_INNER_CONTENT_BEGIN
 
         //bAddComma = true;
@@ -139,7 +139,7 @@ void CComplexType::getJSON(StringBuffer &strJSON, unsigned int offset, int idx)
 
     if (m_pAttributeArray != NULL && m_pAttributeArray->length() > 0)
     {
-        QuickOutPad(strJSON, offset);
+        quickOutPad(strJSON, offset);
         //if (bAddComma)
         {
            strJSON.append("{");
@@ -275,24 +275,24 @@ CComplexType* CComplexType::load(CXSDNodeBase* pParentNode, const IPropertyTree
 
     IPropertyTree *pTree = pSchemaRoot->queryPropTree(xpath);
     const char* pName = pTree->queryProp(XML_ATTR_NAME);
-    StringBuffer strXPathExt(xpath);
+    StringBuffer strXPathExt;
 
-    strXPathExt.clear().append(xpath).append("/").append(XSD_TAG_SEQUENCE);
+    strXPathExt.setf("%s/%s", xpath, XSD_TAG_SEQUENCE);
     pSequence = CSequence::load(NULL, pSchemaRoot, strXPathExt.str());
 
-    strXPathExt.clear().append(xpath).append("/").append(XSD_TAG_ANNOTATION);
+    strXPathExt.setf("%s/%s", xpath, XSD_TAG_ANNOTATION);
     pAnnotation = CAnnotation::load(NULL, pSchemaRoot, strXPathExt.str());
 
-    strXPathExt.clear().append(xpath).append("/").append(XSD_TAG_COMPLEX_CONTENT);
+    strXPathExt.setf("%s/%s", xpath, XSD_TAG_COMPLEX_CONTENT);
     pComplexContent = CComplexContent::load(NULL, pSchemaRoot, strXPathExt.str());
 
-    strXPathExt.clear().append(xpath).append("/").append(XSD_TAG_ATTRIBUTE);
+    strXPathExt.setf("%s/%s", xpath, XSD_TAG_ATTRIBUTE);
     pAttributeArray = CAttributeArray::load(NULL, pSchemaRoot, strXPathExt.str());
 
-    strXPathExt.clear().append(xpath).append("/").append(XSD_TAG_CHOICE);
+    strXPathExt.setf("%s/%s", xpath, XSD_TAG_CHOICE);
     pChoice = CChoice::load(NULL, pSchemaRoot, strXPathExt.str());
 
-    strXPathExt.clear().append(xpath).append("/").append(XSD_TAG_ATTRIBUTE_GROUP);
+    strXPathExt.setf("%s/%s", xpath, XSD_TAG_ATTRIBUTE_GROUP);
     pAttributeGroupArray = CAttributeGroupArray::load(NULL, pSchemaRoot, strXPathExt.str());
 
     CComplexType *pComplexType = new CComplexType(pParentNode, pName, pSequence, pComplexContent, pAttributeArray, pChoice, pAttributeGroupArray, pAnnotation);
@@ -319,12 +319,12 @@ void CComplexTypeArray::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_COMPLEX_TYPE_ARRAY_STR, offset);
+    quickOutHeader(cout, XSD_COMPLEX_TYPE_ARRAY_STR, offset);
 
     QUICK_OUT(cout, XSDXPath,   offset);
     QUICK_OUT_ARRAY(cout, offset);
 
-    QuickOutFooter(cout, XSD_COMPLEX_TYPE_ARRAY_STR, offset);
+    quickOutFooter(cout, XSD_COMPLEX_TYPE_ARRAY_STR, offset);
 }
 
 void CComplexTypeArray::getDocumentation(StringBuffer &strDoc) const
@@ -389,10 +389,11 @@ CComplexTypeArray* CComplexTypeArray::load(CXSDNodeBase* pParentNode, const IPro
 
     int count = 1;
 
+    StringBuffer strXPathExt;
+
     ForEach(*complexTypeIter)
     {
-        StringBuffer strXPathExt(xpath);
-        strXPathExt.appendf("[%d]", count);
+        strXPathExt.setf("%s[%d]", xpath, count);
 
         CComplexType *pComplexType = CComplexType::load(pComplexTypeArray, pSchemaRoot, strXPathExt.str());
 

+ 1 - 3
configuration/configurator/SchemaComplexType.hpp

@@ -100,7 +100,7 @@ private:
 
 };
 
-class CComplexTypeArray : public ::CIArrayOf<CComplexType>, public InterfaceImpl, public CXSDNodeBase
+class CComplexTypeArray : public ::CIArrayOf<CComplexType>, public CInterface, public CXSDNodeBase
 {
 public:
 
@@ -112,8 +112,6 @@ public:
     {
     }
 
-//    virtual const CXSDNodeBase* getNodeByTypeAndNameDescending(NODE_TYPES eNodeType, const char *pName) const;
-//    virtual const CXSDNodeBase* getNodeByTypeAndNameAscending(NODE_TYPES eNodeType, const char *pName) const;
     virtual void dump(::std::ostream& cout, unsigned int offset = 0) const;
     virtual void getDocumentation(::StringBuffer &strDoc) const;
     virtual void getJSON(::StringBuffer &strJSON, unsigned int offset = 0, int idx = -1) const;

+ 6 - 6
configuration/configurator/SchemaDocumentation.cpp

@@ -26,18 +26,18 @@ void CDocumentation::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_DOCUMENTATION_STR, offset);
+    quickOutHeader(cout, XSD_DOCUMENTATION_STR, offset);
     QUICK_OUT(cout, XSDXPath,  offset);
     QUICK_OUT(cout,Documentation, offset);
-    QuickOutFooter(cout, XSD_DOCUMENTATION_STR, offset);
+    quickOutFooter(cout, XSD_DOCUMENTATION_STR, offset);
 }
 
 CDocumentation* CDocumentation::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    if (pSchemaRoot == NULL)
-        return NULL;
-    if (pSchemaRoot->queryPropTree(xpath) == NULL)
-        return NULL; // no documentation node
+    if (pSchemaRoot == nullptr)
+        return nullptr;
+    if (!xpath || !*xpath || pSchemaRoot->queryPropTree(xpath) == nullptr)
+        return nullptr; // no documentation node
 
     StringBuffer strDoc;
 

+ 3 - 3
configuration/configurator/SchemaDocumentation.hpp

@@ -43,17 +43,17 @@ public:
     virtual void dump(::std::ostream& cout, unsigned int offset = 0) const;
     virtual void getDocumentation(StringBuffer &strDoc) const;
 
-    static CDocumentation* load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath = NULL);
+    static CDocumentation* load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath = nullptr);
 
 protected:
 
-    CDocumentation(CXSDNodeBase* pParentNode, const char *pDocs = NULL) : CXSDNode::CXSDNode(pParentNode, XSD_DOCUMENTATION), m_strDocString(pDocs)
+    CDocumentation(CXSDNodeBase* pParentNode, const char *pDocs = nullptr) : CXSDNode::CXSDNode(pParentNode, XSD_DOCUMENTATION), m_strDocString(pDocs)
     {
     }
 
 private:
 
-    CDocumentation() : CXSDNode::CXSDNode(NULL, XSD_DOCUMENTATION)
+    CDocumentation() : CXSDNode::CXSDNode(nullptr, XSD_DOCUMENTATION)
     {
     }
 };

+ 125 - 212
configuration/configurator/SchemaElement.cpp

@@ -1,6 +1,6 @@
 /*##############################################################################
 
-    HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems®.
+    HPCC SYSTEMS software Copyright (C) 2016 HPCC Systems®.
 
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
@@ -21,11 +21,6 @@
 #include "jarray.hpp"
 #include "jhash.hpp"
 #include "XMLTags.h"
-
-
-//#define ::StringBuffer ::::StringBuffer
-//#define ::IPropertyTree ::::IPropertyTree
-
 #include "SchemaAnnotation.hpp"
 #include "SchemaCommon.hpp"
 #include "SchemaElement.hpp"
@@ -45,14 +40,14 @@ using namespace CONFIGURATOR;
 
 const CXSDNodeBase* CElement::getNodeByTypeAndNameAscending(NODE_TYPES eNodeType, const char *pName) const
 {
-    const CXSDNodeBase* pMatchingNode = NULL;
+    const CXSDNodeBase* pMatchingNode = nullptr;
 
-    if (eNodeType == this->getNodeType() && (pName != NULL ? !strcmp(pName, this->getNodeTypeStr()) : true))
+    if (eNodeType == this->getNodeType() && (pName != nullptr ? !strcmp(pName, this->getNodeTypeStr()) : true))
         return this;
 
     if (eNodeType == XSD_ELEMENT)
         pMatchingNode = (dynamic_cast<CElement*>(this->getParentNode()))->getNodeByTypeAndNameAscending(XSD_ELEMENT, pName);
-    if (pMatchingNode == NULL)
+    if (pMatchingNode == nullptr)
         pMatchingNode = (dynamic_cast<CElementArray*>(this->getParentNode()))->getNodeByTypeAndNameAscending(eNodeType, pName);
 
     return pMatchingNode;
@@ -60,11 +55,11 @@ const CXSDNodeBase* CElement::getNodeByTypeAndNameAscending(NODE_TYPES eNodeType
 
 const CXSDNodeBase* CElement::getNodeByTypeAndNameDescending(NODE_TYPES eNodeType, const char *pName) const
 {
-    const CXSDNodeBase* pMatchingNode = NULL;
+    const CXSDNodeBase* pMatchingNode = nullptr;
 
-    if (eNodeType == this->getNodeType() && (pName != NULL ? !strcmp(pName, this->getNodeTypeStr()) : true))
+    if (eNodeType == this->getNodeType() && (pName != nullptr ? !strcmp(pName, this->getNodeTypeStr()) : true))
         return this;
-    if (m_pComplexTypeArray != NULL)
+    if (m_pComplexTypeArray != nullptr)
         pMatchingNode = m_pComplexTypeArray->getNodeByTypeAndNameDescending(eNodeType, pName);
 
     return pMatchingNode;
@@ -72,11 +67,11 @@ const CXSDNodeBase* CElement::getNodeByTypeAndNameDescending(NODE_TYPES eNodeTyp
 
 CElement* CElement::load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSchemaRoot, const char* xpath, bool bIsInXSD)
 {
-    assert(pSchemaRoot != NULL);
-    assert(pParentNode != NULL);
+    assert(pSchemaRoot != nullptr);
+    assert(pParentNode != nullptr);
 
-    if (pSchemaRoot == NULL || pParentNode == NULL)
-        return NULL;
+    if (pSchemaRoot == nullptr || pParentNode == nullptr)
+        return nullptr;
 
     CElement *pElement = new CElement(pParentNode);
 
@@ -85,7 +80,7 @@ CElement* CElement::load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSche
 
     ::IPropertyTree *pTree = pSchemaRoot->queryPropTree(xpath);
 
-    if (pElement != NULL && pTree != NULL)
+    if (pTree != nullptr)
         pElement->setName(pTree->queryProp(XML_ATTR_NAME));
 
     Owned<IAttributeIterator> iterAttrib = pTree->getAttributes(true);
@@ -96,7 +91,7 @@ CElement* CElement::load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSche
         {
             const char *pName = iterAttrib->queryValue();
 
-            if (pName != NULL && *pName != 0)
+            if (pName != nullptr && *pName != 0)
                 pElement->setName(pName);
         }
         else if (strcmp(iterAttrib->queryName(), XML_ATTR_MAXOCCURS) == 0)
@@ -107,9 +102,9 @@ CElement* CElement::load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSche
         {
             const char *pType = iterAttrib->queryValue();
 
-            assert(pType != NULL && *pType != 0);
+            assert(pType != nullptr && *pType != 0);
 
-            if (pType != NULL && *pType != 0)
+            if (pType != nullptr && *pType != 0)
             {
                 pElement->setType(pType);
                 CConfigSchemaHelper::getInstance()->addNodeForTypeProcessing(pElement);
@@ -119,9 +114,9 @@ CElement* CElement::load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSche
         {
             const char *pRef = iterAttrib->queryValue();
 
-            assert (pRef != NULL && *pRef != 0 && pElement->getConstAncestorNode(3)->getNodeType() != XSD_SCHEMA);
+            assert (pRef != nullptr && *pRef != 0 && pElement->getConstAncestorNode(3)->getNodeType() != XSD_SCHEMA);
 
-            if (pRef != NULL && *pRef != 0 && pElement->getConstAncestorNode(3)->getNodeType() != XSD_SCHEMA)
+            if (pRef != nullptr && *pRef != 0 && pElement->getConstAncestorNode(3)->getNodeType() != XSD_SCHEMA)
             {
                 pElement->setRef(pRef);
                 CConfigSchemaHelper::getInstance()->addElementForRefProcessing(pElement);
@@ -135,34 +130,32 @@ CElement* CElement::load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSche
         {
             const char *pDefault = iterAttrib->queryValue();
 
-            assert(pDefault != NULL);
+            assert(pDefault != nullptr);
             assert(strlen(pElement->getDefault()) == 0);
             pElement->setDefault(pDefault);
         }
-        assert(iterAttrib->queryValue() != NULL);
+        assert(iterAttrib->queryValue() != nullptr);
     }
     assert(strlen(pElement->getName()) > 0);
 
     if (strlen(pElement->getRef()) != 0)
     {
         assert(pElement->getComplexTypeArray()->length() == 0);
-        assert(pElement->getSimpleType() == NULL);
+        assert(pElement->getSimpleType() == nullptr);
         assert(strlen(pElement->getDefault()) == 0);
         assert(strlen(pElement->getType()) == 0);
-        /*assert(pElement->getKey() == NULL);
-        assert(pElement->getKeyRef() == NULL);
-        assert(pElement->getUnique() == NULL);*/
+        /*assert(pElement->getKey() == nullptr);
+        assert(pElement->getKeyRef() == nullptr);
+        assert(pElement->getUnique() == nullptr);*/
     }
 
-    ::StringBuffer strXPathExt(xpath);
-
-    strXPathExt.append("/").append(XSD_TAG_ANNOTATION);
+    ::VStringBuffer strXPathExt("%s/%s", xpath, XSD_TAG_ANNOTATION);
     pElement->m_pAnnotation = CAnnotation::load(pElement, pSchemaRoot, strXPathExt.str());
 
-    strXPathExt.clear().append(xpath).append("/").append(XSD_TAG_COMPLEX_TYPE);
+    strXPathExt.setf("%s/%s", xpath, XSD_TAG_COMPLEX_TYPE);
     pElement->m_pComplexTypeArray = CComplexTypeArray::load(pElement, pSchemaRoot, strXPathExt.str());
 
-    if (pElement->m_pAnnotation != NULL && pElement->m_pAnnotation->getAppInfo() != NULL && strlen(pElement->m_pAnnotation->getAppInfo()->getTitle()) > 0)
+    if (pElement->m_pAnnotation != nullptr && pElement->m_pAnnotation->getAppInfo() != nullptr && strlen(pElement->m_pAnnotation->getAppInfo()->getTitle()) > 0)
     {
         /****  MUST FIX TO HAVE CORRECT UI TAB LABELS (but getName is expected to return the XPATH name *****/
         //pElement->setName(pElement->m_pAnnotation->getAppInfo()->getTitle());
@@ -171,13 +164,13 @@ CElement* CElement::load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSche
     else
         pElement->setTitle(pElement->getName());
 
-/*    strXPathExt.clear().append(xpath).append("/").append(XSD_TAG_KEY);
+/*  strXPathExt.setf("%s/%s", xpath, XSD_TAG_KEY);
     pElement->m_pKeyArray = CKeyArray::load(pElement, pSchemaRoot, strXPathExt.str());
 
-    strXPathExt.clear().append(xpath).append("/").append(XSD_TAG_KEYREF);
+    strXPathExt.setf("%s/%s", xpath, XSD_TAG_KEYREF);
     pElement->m_pKeyRefArray = CKeyRefArray::load(pElement, pSchemaRoot, strXPathExt.str());
 */
-    strXPathExt.clear().append(xpath).append("/").append(XSD_TAG_SIMPLE_TYPE);
+    strXPathExt.setf("%s/%s", xpath, XSD_TAG_SIMPLE_TYPE);
     pElement->m_pSimpleType = CSimpleType::load(pElement, pSchemaRoot, strXPathExt.str());
 
     SETPARENTNODE(pElement, pParentNode);
@@ -187,15 +180,12 @@ CElement* CElement::load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSche
 
 const CElement* CElement::getTopMostElement(const CXSDNodeBase *pNode)
 {
-    if (pNode == NULL)
-        return NULL;
-    else if (pNode->getNodeType() == XSD_ELEMENT)
+    if (pNode == nullptr)
+        return nullptr;
+    else if (pNode->getNodeType() == XSD_ELEMENT && pNode->getParentNodeByType(XSD_ELEMENT) == nullptr)
     {
-        if (pNode->getParentNodeByType(XSD_ELEMENT) == NULL)
-        {
-            assert(dynamic_cast<const CElement*>(pNode) != NULL);
-            return dynamic_cast<const CElement*>(pNode);
-        }
+        assert(dynamic_cast<const CElement*>(pNode) != nullptr);
+        return dynamic_cast<const CElement*>(pNode);
     }
     return getTopMostElement(pNode->getParentNodeByType(XSD_ELEMENT));
 }
@@ -212,14 +202,14 @@ const char* CElement::getXML(const char* /*pComponent*/)
     {
         m_strXML.append("\n<").append(getName()).append(" ");
 
-        if (m_pAnnotation != NULL)
-            m_strXML.append(m_pAnnotation->getXML(NULL));
-        if (m_pComplexTypeArray != NULL)
-            m_strXML.append(m_pComplexTypeArray->getXML(NULL));
-        if (m_pKeyArray != NULL)
-            m_strXML.append(m_pKeyArray->getXML(NULL));
-        if (m_pKeyRefArray != NULL)
-            m_strXML.append(m_pKeyRefArray->getXML(NULL));
+        if (m_pAnnotation != nullptr)
+            m_strXML.append(m_pAnnotation->getXML(nullptr));
+        if (m_pComplexTypeArray != nullptr)
+            m_strXML.append(m_pComplexTypeArray->getXML(nullptr));
+        if (m_pKeyArray != nullptr)
+            m_strXML.append(m_pKeyArray->getXML(nullptr));
+        if (m_pKeyRefArray != nullptr)
+            m_strXML.append(m_pKeyRefArray->getXML(nullptr));
     }
     return m_strXML.str();
 }
@@ -228,7 +218,7 @@ void CElement::dump(::std::ostream &cout, unsigned int offset) const
 {
     offset += STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_ELEMENT_STR, offset);
+    quickOutHeader(cout, XSD_ELEMENT_STR, offset);
     QUICK_OUT(cout, Name, offset);
     QUICK_OUT(cout, Type, offset);
     QUICK_OUT(cout, MinOccurs, offset);
@@ -239,42 +229,42 @@ void CElement::dump(::std::ostream &cout, unsigned int offset) const
     QUICK_OUT(cout, EnvValueFromXML,  offset);
     QUICK_OUT(cout, Ref, offset);
 
-    if (this->getTypeNode() != NULL)
+    if (this->getTypeNode() != nullptr)
         this->getTypeNode()->dump(cout, offset);
-    if (m_pAnnotation != NULL)
+    if (m_pAnnotation != nullptr)
         m_pAnnotation->dump(cout, offset);
-    if (m_pComplexTypeArray != NULL)
+    if (m_pComplexTypeArray != nullptr)
         m_pComplexTypeArray->dump(cout, offset);
-    if (m_pKeyArray != NULL)
+    if (m_pKeyArray != nullptr)
         m_pKeyArray->dump(cout, offset);
-    if (m_pKeyRefArray != NULL)
+    if (m_pKeyRefArray != nullptr)
         m_pKeyRefArray->dump(cout, offset);
-    if (m_pSimpleType != NULL)
+    if (m_pSimpleType != nullptr)
         m_pSimpleType->dump(cout, offset);
 
-    if (this->getRef() != NULL)
+    if (this->getRef() != nullptr)
     {
         CElement *pElement = CConfigSchemaHelper::getInstance()->getSchemaMapManager()->getElementWithName(this->getRef());
 
-        assert(pElement != NULL);
-        if (pElement != NULL)
+        assert(pElement != nullptr);
+        if (pElement != nullptr)
             pElement->dump(cout, offset);
     }
-    QuickOutFooter(cout, XSD_ELEMENT_STR, offset);
+    quickOutFooter(cout, XSD_ELEMENT_STR, offset);
 }
 
 void CElement::getDocumentation(::StringBuffer &strDoc) const
 {
     const CXSDNodeBase *pGrandParentNode = this->getConstParentNode()->getConstParentNode();
 
-    assert(pGrandParentNode != NULL);
-    if (pGrandParentNode == NULL)
+    assert(pGrandParentNode != nullptr);
+    if (pGrandParentNode == nullptr)
         return;
 
-    if (m_pAnnotation != NULL && m_pAnnotation->getAppInfo() != NULL && m_pAnnotation->getAppInfo()->getViewType() != NULL && stricmp(m_pAnnotation->getAppInfo()->getViewType(), "none") == 0)
+    if (m_pAnnotation != nullptr && m_pAnnotation->getAppInfo() != nullptr && m_pAnnotation->getAppInfo()->getViewType() != nullptr && stricmp(m_pAnnotation->getAppInfo()->getViewType(), "none") == 0)
         return;
 
-    if (this->getName() != NULL && (stricmp(this->getName(), "Instance") == 0 || stricmp(this->getName(), "Note") == 0 || stricmp(this->getName(), "Notes") == 0 ||  stricmp(this->getName(), "Topology") == 0 ))
+    if (this->getName() != nullptr && (stricmp(this->getName(), "Instance") == 0 || stricmp(this->getName(), "Note") == 0 || stricmp(this->getName(), "Notes") == 0 ||  stricmp(this->getName(), "Topology") == 0 ))
         return; // don't document instance
 
     assert(strlen(this->getName()) > 0);
@@ -290,7 +280,7 @@ void CElement::getDocumentation(::StringBuffer &strDoc) const
         strDoc.appendf("<%s %s=\"%s%s\">\n", DM_SECT2, DM_ID, strName.str(),"_mod");
         strDoc.appendf("<%s>%s</%s>\n", DM_TITLE_LITERAL, this->getName(), DM_TITLE_LITERAL);
 
-        if (m_pAnnotation!= NULL)
+        if (m_pAnnotation!= nullptr)
         {
             m_pAnnotation->getDocumentation(strDoc);
             DEBUG_MARK_STRDOC;
@@ -300,15 +290,15 @@ void CElement::getDocumentation(::StringBuffer &strDoc) const
         DEBUG_MARK_STRDOC;
         strDoc.append(DM_TITLE_BEGIN).append(DM_TITLE_END);
 
-        if (m_pComplexTypeArray != NULL)
+        if (m_pComplexTypeArray != nullptr)
             m_pComplexTypeArray->getDocumentation(strDoc);
 
         strDoc.append(DM_SECT3_END);
         return;
     }
-    else if (m_pComplexTypeArray != NULL)
+    else if (m_pComplexTypeArray != nullptr)
     {
-        if (m_pAnnotation!= NULL)
+        if (m_pAnnotation!= nullptr)
         {
             m_pAnnotation->getDocumentation(strDoc);
             DEBUG_MARK_STRDOC;
@@ -322,9 +312,9 @@ void CElement::getDocumentation(::StringBuffer &strDoc) const
         DEBUG_MARK_STRDOC;
         m_pComplexTypeArray->getDocumentation(strDoc);
     }
-    else if (m_pComplexTypeArray == NULL)
+    else if (m_pComplexTypeArray == nullptr)
     {
-        if (m_pAnnotation!= NULL)
+        if (m_pAnnotation!= nullptr)
         {
             m_pAnnotation->getDocumentation(strDoc);
             DEBUG_MARK_STRDOC;
@@ -333,7 +323,7 @@ void CElement::getDocumentation(::StringBuffer &strDoc) const
         strDoc.appendf("%s%s%s", DM_PARA_BEGIN, this->getName(), DM_PARA_END);
         DEBUG_MARK_STRDOC;
 
-        if (m_pAnnotation != NULL && m_pAnnotation->getDocumentation() != NULL)
+        if (m_pAnnotation != nullptr && m_pAnnotation->getDocumentation() != nullptr)
         {
             m_pAnnotation->getDocumentation(strDoc);
             DEBUG_MARK_STRDOC;
@@ -343,46 +333,32 @@ void CElement::getDocumentation(::StringBuffer &strDoc) const
 
 void CElement::getJSON(::StringBuffer &strJSON, unsigned int offset, int idx) const
 {
-    assert(this->getConstAncestorNode(3) != NULL);
-
-//    if (m_pAnnotation != NULL && m_pAnnotation->getAppInfo() != NULL && m_pAnnotation->getAppInfo()->getViewType() != NULL && stricmp(m_pAnnotation->getAppInfo()->getViewType(), "none") == 0)
-//        return;
-
     assert(strlen(this->getName()) > 0);
 
     StringBuffer strXPath(this->getEnvXPath());
-
     stripTrailingIndex(strXPath);
 
-    if (m_pComplexTypeArray != NULL  && m_pComplexTypeArray->length() > 0)
+    if (m_pComplexTypeArray != nullptr  && m_pComplexTypeArray->length() > 0)
     {
-        //CJSONMarkUpHelper::createUIContent(strJSON, offset, (this->getMaxOccursInt() > 1 || strlen(this->getMinOccurs()) > 0) ? JSON_TYPE_TABLE : JSON_TYPE_TAB, this->getTitle(), this->getEnvXPath());
 
-        //CJSONMarkUpHelper::createUIContent(strJSON, offset, (this->getMaxOccursInt() > 1 || strlen(this->getMinOccurs()) > 0) ? JSON_TYPE_TABLE : JSON_TYPE_TAB, this->getTitle(), strXPath.str());
         CJSONMarkUpHelper::createUIContent(strJSON, offset, JSON_TYPE_TAB, this->getTitle(), strXPath.str());
-
         m_pComplexTypeArray->getJSON(strJSON, offset);
     }
     else
-    {
-        //CJSONMarkUpHelper::createUIContent(strJSON, offset, JSON_TYPE_TABLE, this->getTitle(), this->getEnvXPath());
         CJSONMarkUpHelper::createUIContent(strJSON, offset, JSON_TYPE_TABLE, this->getTitle(), strXPath.str());
-        // add values
-        //CJSONMarkUpHelper::createUIContent(strJSON, offset, JSON_TYPE_INPUT, this->getTitle(),  strXPath.str());
-    }
 }
 
 
 bool CElement::isATab() const
 {
     const CComplexTypeArray *pComplexTypArray = this->getComplexTypeArray();
-    const CAttributeGroupArray *pAttributeGroupArray = (pComplexTypArray != NULL && pComplexTypArray->length() > 0) ? pComplexTypArray->item(0).getAttributeGroupArray() : NULL;
-    const CAttributeArray *pAttributeArray = (pComplexTypArray != NULL && pComplexTypArray->length() > 0) ? pComplexTypArray->item(0).getAttributeArray() : NULL;
+    const CAttributeGroupArray *pAttributeGroupArray = (pComplexTypArray != nullptr && pComplexTypArray->length() > 0) ? pComplexTypArray->item(0).getAttributeGroupArray() : nullptr;
+    const CAttributeArray *pAttributeArray = (pComplexTypArray != nullptr && pComplexTypArray->length() > 0) ? pComplexTypArray->item(0).getAttributeArray() : nullptr;
 
     if (this->getConstAncestorNode(3)->getNodeType() != XSD_SCHEMA && \
             (this->hasChildElements() == true || \
              (this->hasChildElements() == false && (static_cast<const CElementArray*>(this->getConstParentNode()))->anyElementsHaveMaxOccursGreaterThanOne() == false)/* || \
-             (this->isTopLevelElement() == true && (pAttributeGroupArray != NULL || pAttributeArray != NULL))*/))
+             (this->isTopLevelElement() == true && (pAttributeGroupArray != nullptr || pAttributeArray != nullptr))*/))
 
     {
         return true;
@@ -391,21 +367,17 @@ bool CElement::isATab() const
     {
         return false;
     }
-/*    if (stricmp(this->getMaxOccurs(), TAG_UNBOUNDED) == 0)
-    {
-        return false;
-    }
     // Any element that is in sequence of complex type will be a tab
-    else*/ if (this->getConstAncestorNode(3)->getNodeType() == XSD_SEQUENCE && this->getConstAncestorNode(3)->getNodeType() == XSD_COMPLEX_TYPE)
+    if (this->getConstAncestorNode(3)->getNodeType() == XSD_SEQUENCE && this->getConstAncestorNode(3)->getNodeType() == XSD_COMPLEX_TYPE)
     {
         return true;
     }
-    else if (/*this->getConstAncestorNode(3)->getNodeType == XSD_COMPLEX_TYPE &&*/ this->getConstAncestorNode(3)->getNodeType() == XSD_ELEMENT)
+    else if (this->getConstAncestorNode(3)->getNodeType() == XSD_ELEMENT)
     {
         const CElement *pElement = dynamic_cast<const CElement*>(this->getConstAncestorNode(3));
 
-        assert(pElement != NULL);
-        if (pElement != NULL)
+        assert(pElement != nullptr);
+        if (pElement != nullptr)
             return pElement->isATab();
     }
     return false;
@@ -417,7 +389,7 @@ bool CElement::isLastTab(const int idx) const
 
     const CElementArray *pElementArray = dynamic_cast<const CElementArray*>(this->getConstParentNode());
 
-    if (pElementArray == NULL)
+    if (pElementArray == nullptr)
     {
         assert(!"Corrupt XSD??");
         return false;
@@ -428,24 +400,20 @@ bool CElement::isLastTab(const int idx) const
     return false;
 }
 
-
 void CElement::populateEnvXPath(::StringBuffer strXPath, unsigned int index)
 {
     assert(strXPath.length() > 0);
 
-    //strXPath.append("/").append(this->getName()).append("[").append(index).append("]");
     strXPath.append("[").append(index).append("]");
-
-    //PROGLOG("Setting element to envpath of %s, previous path: %s", strXPath.str(), this->getEnvXPath());
     this->setEnvXPath(strXPath);
 
     CConfigSchemaHelper::getInstance()->getSchemaMapManager()->addMapOfXPathToElement(this->getEnvXPath(), this);
 
-    if (m_pComplexTypeArray != NULL)
+    if (m_pComplexTypeArray != nullptr)
         m_pComplexTypeArray->populateEnvXPath(strXPath, index);
-    if (m_pSimpleType != NULL)
+    if (m_pSimpleType != nullptr)
         m_pSimpleType->populateEnvXPath(strXPath, index);
-    if (m_pKeyArray != NULL)
+    if (m_pKeyArray != nullptr)
         m_pKeyArray->populateEnvXPath(strXPath, index);
 }
 
@@ -454,7 +422,7 @@ void CElement::loadXMLFromEnvXml(const ::IPropertyTree *pEnvTree)
     //PROGLOG("Mapping element with XPATH of %s to %p", this->getEnvXPath(), this);
     //CConfigSchemaHelper::getInstance()->getSchemaMapManager()->addMapOfXPathToElement(this->getEnvXPath(), this);
 
-    if (m_pComplexTypeArray != NULL)
+    if (m_pComplexTypeArray != nullptr)
     {
         try
         {
@@ -466,7 +434,7 @@ void CElement::loadXMLFromEnvXml(const ::IPropertyTree *pEnvTree)
             // time to do validation?
         }
     }
-    if (m_pSimpleType != NULL)
+    if (m_pSimpleType != nullptr)
     {
         try
         {
@@ -477,11 +445,11 @@ void CElement::loadXMLFromEnvXml(const ::IPropertyTree *pEnvTree)
         }
     }
 
-    if (m_pComplexTypeArray == NULL)
+    if (m_pComplexTypeArray == nullptr)
     {
         const char* pValue =  pEnvTree->queryPropTree(this->getEnvXPath())->queryProp("");
 
-        if (pValue != NULL)
+        if (pValue != nullptr)
         {
             this->setEnvValueFromXML(pValue);
             CConfigSchemaHelper::getInstance()->appendElementXPath(this->getEnvXPath());
@@ -490,7 +458,7 @@ void CElement::loadXMLFromEnvXml(const ::IPropertyTree *pEnvTree)
 
     const char* pInstanceName =  pEnvTree->queryPropTree(this->getEnvXPath())->queryProp(XML_ATTR_NAME);
 
-    if (pInstanceName != NULL && *pInstanceName != 0)
+    if (pInstanceName != nullptr && *pInstanceName != 0)
         this->setInstanceName(pInstanceName);
 }
 
@@ -501,20 +469,20 @@ bool CElement::isTopLevelElement() const
 
 const char * CElement::getViewType() const
 {
-    if(m_pAnnotation != NULL && m_pAnnotation->getAppInfo() != NULL)
+    if(m_pAnnotation != nullptr && m_pAnnotation->getAppInfo() != nullptr)
         return m_pAnnotation->getAppInfo()->getViewType();
-    return NULL;
+    return nullptr;
 }
 
 void CElementArray::dump(::std::ostream &cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_ELEMENT_ARRAY_STR, offset);
+    quickOutHeader(cout, XSD_ELEMENT_ARRAY_STR, offset);
     QUICK_OUT(cout, XSDXPath,  offset);
     QUICK_OUT(cout, EnvXPath,  offset);
     QUICK_OUT_ARRAY(cout, offset);
-    QuickOutFooter(cout, XSD_ELEMENT_ARRAY_STR, offset);
+    quickOutFooter(cout, XSD_ELEMENT_ARRAY_STR, offset);
 }
 
 void CElementArray::getDocumentation(::StringBuffer &strDoc) const
@@ -525,7 +493,7 @@ void CElementArray::getDocumentation(::StringBuffer &strDoc) const
 void CElementArray::getJSON(::StringBuffer &strJSON, unsigned int offset, int idx) const
 {
     offset += STANDARD_OFFSET_2;
-    QuickOutPad(strJSON, offset);
+    quickOutPad(strJSON, offset);
 
     int lidx = (idx == -1 ? 0 : idx);
 
@@ -534,7 +502,7 @@ void CElementArray::getJSON(::StringBuffer &strJSON, unsigned int offset, int id
     (this->item(lidx)).getJSON(strJSON, offset+STANDARD_OFFSET_2, lidx);
 
     offset += STANDARD_OFFSET_2;
-    QuickOutPad(strJSON, offset);
+    quickOutPad(strJSON, offset);
     strJSON.append("}");
 }
 
@@ -542,10 +510,9 @@ void CElementArray::populateEnvXPath(::StringBuffer strXPath, unsigned int index
 {
     strXPath.appendf("/%s", this->item(0).getName());
     this->setEnvXPath(strXPath);
-
-    for (int idx=0; idx < this->length(); idx++)
+    int len = this->length();
+    for (int idx=0; idx < len; idx++)
     {
-        //strXPath.appendf("[%d]", idx+1);
         this->item(idx).populateEnvXPath(strXPath.str(), idx+1);
         CConfigSchemaHelper::stripXPathIndex(strXPath);
     }
@@ -560,7 +527,7 @@ const char* CElementArray::getXML(const char* /*pComponent*/)
         for (int idx = 0; idx < length; idx++)
         {
             CElement &Element = this->item(idx);
-            m_strXML.append(Element.getXML(NULL));
+            m_strXML.append(Element.getXML(nullptr));
 
             if (idx+1 < length)
                 m_strXML.append("\n");
@@ -576,28 +543,22 @@ void CElementArray::loadXMLFromEnvXml(const ::IPropertyTree *pEnvTree)
 
     do
     {
-        CElement *pElement = NULL;
+        CElement *pElement = nullptr;
 
         strEnvXPath.appendf("[%d]", subIndex);
         if (pEnvTree->hasProp(strEnvXPath.str()) == false)
              return;
 
         if (subIndex == 1)
-        {
             pElement =  CConfigSchemaHelper::getInstance()->getSchemaMapManager()->getElementFromXPath(strEnvXPath.str());
-        }
         else
         {
             pElement = CElement::load(this, this->getSchemaRoot(), this->getXSDXPath(), false);
             this->append(*pElement);
         }
 
-        assert(pElement);
-
         if (subIndex > 1)
-        {
             pElement->populateEnvXPath(this->getEnvXPath(), subIndex);
-        }
 
         pElement->setTopLevelElement(false);
         pElement->loadXMLFromEnvXml(pEnvTree);
@@ -610,9 +571,9 @@ void CElementArray::loadXMLFromEnvXml(const ::IPropertyTree *pEnvTree)
 
 CElementArray* CElementArray::load(const char* pSchemaFile)
 {
-    assert(pSchemaFile != NULL);
-    if (pSchemaFile == NULL)
-        return NULL;
+    assert(pSchemaFile != nullptr);
+    if (pSchemaFile == nullptr)
+        return nullptr;
 
     typedef ::IPropertyTree jlibIPropertyTree;
     ::Linked<jlibIPropertyTree> pSchemaRoot;
@@ -621,22 +582,17 @@ CElementArray* CElementArray::load(const char* pSchemaFile)
     schemaPath.appendf("%s%s", DEFAULT_SCHEMA_DIRECTORY, pSchemaFile);
     pSchemaRoot.setown(createPTreeFromXMLFile(schemaPath.str()));
 
-    CElementArray *pElemArray = CElementArray::load(NULL, pSchemaRoot, XSD_TAG_ELEMENT);
-
-    //PROGLOG("Function: %s() at %s:%d", __func__, __FILE__, __LINE__);
-    //PROGLOG("pElemArray = %p", pElemArray);
-
+    CElementArray *pElemArray = CElementArray::load(nullptr, pSchemaRoot, XSD_TAG_ELEMENT);
     return pElemArray;
 }
 
 CElementArray* CElementArray::load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(pSchemaRoot != NULL);
-    if (pSchemaRoot == NULL)
-        return NULL;
+    assert(pSchemaRoot != nullptr);
+    if (pSchemaRoot == nullptr)
+        return nullptr;
 
     CElementArray *pElemArray = new CElementArray(pParentNode);
-    assert(pElemArray != NULL);
 
     pSchemaRoot->Link();
     pElemArray->setSchemaRoot(pSchemaRoot);
@@ -652,49 +608,11 @@ CElementArray* CElementArray::load(CXSDNodeBase* pParentNode, const ::IPropertyT
     SETPARENTNODE(pElemArray, pParentNode);
 
     return pElemArray;
-
-
-/*    typedef ::IPropertyTreeIterator jlibIPropertyTreeIterator;
-    Owned<jlibIPropertyTreeIterator> elemIter = pSchemaRoot->getElements(xpath);
-
-    CElement *pElem = CElement::load(pElemArray, pSchemaRoot, strXPathExt.str());
-
-    assert(pElem);
-    pElemArray->append(*pElem);
-
-    SETPARENTNODE(pElemArray, pParentNode);
-
-    return pElemArray;
-
-    int count = 1;
-
-    ForEach(*elemIter)
-    {
-        strXPathExt.set(xpath);
-        strXPathExt.appendf("[%d]", count);
-
-        CElement *pElem = CElement::load(pElemArray, pSchemaRoot, strXPathExt.str());
-
-        assert(pElem);
-        pElemArray->append(*pElem);
-
-        count++;
-    }
-
-    if (pElemArray->length() == 0)
-    {
-        delete pElemArray;
-        return NULL;
-    }
-
-    SETPARENTNODE(pElemArray, pParentNode);
-
-    return pElemArray;*/
 }
 
 int CElementArray::getCountOfSiblingElements(const char *pXPath) const
 {
-    assert(pXPath != NULL && *pXPath != 0);
+    assert(pXPath != nullptr && *pXPath != 0);
 
     int count = 0;
 
@@ -708,9 +626,12 @@ int CElementArray::getCountOfSiblingElements(const char *pXPath) const
 
 const CXSDNodeBase* CElementArray::getNodeByTypeAndNameAscending(NODE_TYPES eNodeType, const char *pName) const
 {
-    assert(pName != NULL);
+    assert(pName != nullptr);
+    if (!pName || !*pName)
+        return nullptr;
 
-    for (int idx = 1; idx < this->length() && eNodeType == XSD_ELEMENT; idx++)
+    int len = this->length();
+    for (int idx = 1; idx < len && eNodeType == XSD_ELEMENT; idx++)
     {
         if (strcmp ((static_cast<CElement>(this->item(idx))).getName(), pName) == 0)
             return &(this->item(idx));
@@ -720,7 +641,7 @@ const CXSDNodeBase* CElementArray::getNodeByTypeAndNameAscending(NODE_TYPES eNod
 
 const CXSDNodeBase* CElementArray::getNodeByTypeAndNameDescending(NODE_TYPES eNodeType, const char *pName) const
 {
-    assert(pName != NULL);
+    assert(pName != nullptr);
 
     if (eNodeType == this->getNodeType())
         return this;
@@ -730,33 +651,25 @@ const CXSDNodeBase* CElementArray::getNodeByTypeAndNameDescending(NODE_TYPES eNo
 
 const CElement* CElementArray::getElementByNameAscending(const char *pName) const
 {
-    for (int idx = 1; idx < this->length() ;idx++)
+    int len = this->length();
+    for (int idx = 1; idx < len; idx++)
     {
         if (strcmp ((static_cast<CElement>(this->item(idx))).getName(), pName) == 0)
             return &(this->item(idx));
     }
 
     assert(!("Control should not reach here, unknown pName?"));
-    return NULL;
-}
-
-const CElement* CElementArray::getElementByNameDescending(const char *pName) const
-{
-    for (int idx = 1; idx < this->length(); idx++)
-    {
-        if (strcmp ((static_cast<CElement>(this->item(idx))).getName(), pName) == 0)
-            return &(this->item(idx));
-    }
-    return NULL;
+    return nullptr;
 }
 
 int CElementArray::getSiblingIndex(const char* pXSDXPath, const CElement* pElement)
 {
-    assert(pXSDXPath != NULL && *pXSDXPath != 0 && pElement != NULL);
+    assert(pXSDXPath != nullptr && *pXSDXPath != 0 && pElement != nullptr);
 
     int nSiblingIndex = 0;
+    int len =this->length();
 
-    for (int idx=0; idx < this->length(); idx++)
+    for (int idx=0; idx < len; idx++)
     {
         if (strcmp(this->item(idx).getXSDXPath(), pXSDXPath) == 0)
         {
@@ -787,9 +700,9 @@ void CElement::setIsInXSD(bool b)
     if (m_bIsInXSD == true)
     {
         CElementArray *pElemArray = dynamic_cast<CElementArray*>(this->getParentNode());
-        assert(pElemArray != NULL);
+        assert(pElemArray != nullptr);
 
-        if (pElemArray != NULL)
+        if (pElemArray != nullptr)
             pElemArray->incCountOfElementsInXSD();
     }
 }
@@ -798,7 +711,7 @@ bool CElement::hasChildElements() const
 {
     const CComplexTypeArray* pComplexTypeArray = this->getComplexTypeArray();
 
-    if (pComplexTypeArray != NULL && pComplexTypeArray->length() != 0)
+    if (pComplexTypeArray != nullptr && pComplexTypeArray->length() != 0)
     {
         int nLen = pComplexTypeArray->length();
 
@@ -814,15 +727,12 @@ bool CElement::hasChildElements() const
 
 CArrayOfElementArrays* CArrayOfElementArrays::load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(pSchemaRoot != NULL);
-    if (pSchemaRoot == NULL)
-        return NULL;
+    assert(pSchemaRoot != nullptr);
+    if (pSchemaRoot == nullptr)
+        return nullptr;
 
     CArrayOfElementArrays *pArrayOfElementArrays = new CArrayOfElementArrays(pParentNode);
 
-    /*pSchemaRoot->Link();
-    pArrayOfElementArrays->setSchemaRoot(pSchemaRoot);*/
-
     ::StringBuffer strXPathExt(xpath);
     pArrayOfElementArrays->setXSDXPath(xpath);
 
@@ -838,7 +748,6 @@ CArrayOfElementArrays* CArrayOfElementArrays::load(CXSDNodeBase* pParentNode, co
 
         CElementArray *pElemArray = CElementArray::load(pArrayOfElementArrays, pSchemaRoot, strXPathExt.str());
 
-        assert(pElemArray);
         pArrayOfElementArrays->append(*pElemArray);
 
         count++;
@@ -849,7 +758,8 @@ CArrayOfElementArrays* CArrayOfElementArrays::load(CXSDNodeBase* pParentNode, co
 
 void CArrayOfElementArrays::getDocumentation(::StringBuffer &strDoc) const
 {
-    for (int i = 0; i < this->length(); i++)
+    int len = this->length();
+    for (int i = 0; i < len; i++)
     {
         this->item(i).getDocumentation(strDoc);
     }
@@ -861,7 +771,8 @@ void CArrayOfElementArrays::populateEnvXPath(::StringBuffer strXPath, unsigned i
     CConfigSchemaHelper::stripXPathIndex(strCopy);
     this->setEnvXPath(strCopy);
 
-    for (int i = 0; i < this->length(); i++)
+    int len = this->length();
+    for (int i = 0; i < len; i++)
     {
         this->item(i).populateEnvXPath(strXPath.str());
         CConfigSchemaHelper::getInstance()->getSchemaMapManager()->addMapOfXSDXPathToElementArray(this->item(i).getXSDXPath(), &(this->item(i)));
@@ -870,7 +781,8 @@ void CArrayOfElementArrays::populateEnvXPath(::StringBuffer strXPath, unsigned i
 
 void CArrayOfElementArrays::loadXMLFromEnvXml(const ::IPropertyTree *pEnvTree)
 {
-    for (int i = 0; i < this->ordinality(); i++)
+    int len = this->ordinality();
+    for (int i = 0; i < len; i++)
     {
         this->item(i).loadXMLFromEnvXml(pEnvTree);
     }
@@ -878,7 +790,8 @@ void CArrayOfElementArrays::loadXMLFromEnvXml(const ::IPropertyTree *pEnvTree)
 
 void CArrayOfElementArrays::getJSON(::StringBuffer &strJSON, unsigned int offset, int idx) const
 {
-    for (int i = 0; i < this->ordinality(); i++)
+    int len = this->ordinality();
+    for (int i = 0; i < len; i++)
     {
         if (i != 0)
             strJSON.append(",\n");

+ 6 - 6
configuration/configurator/SchemaElement.hpp

@@ -117,10 +117,10 @@ public:
     {
         if (m_strMaxOccurs.length() == 0)  // not set
             return SHRT_MIN;
-        else if (strcmp(m_strMaxOccurs.str(), TAG_UNBOUNDED) == 0)
+        if (strcmp(m_strMaxOccurs.str(), TAG_UNBOUNDED) == 0)
             return SHRT_MAX;
-        else
-            return atoi(m_strMaxOccurs.str());
+
+        return atoi(m_strMaxOccurs.str());
     }
 
     int getMinOccursInt() const
@@ -185,7 +185,6 @@ public:
     virtual const CXSDNodeBase* getNodeByTypeAndNameDescending(NODE_TYPES eNodeType, const char *pName) const;
 
     const CElement* getElementByNameAscending(const char *pName) const;
-    const CElement* getElementByNameDescending(const char *pName) const;
     virtual void dump(::std::ostream &cout, unsigned int offset = 0) const;
     virtual void getDocumentation(::StringBuffer &strDoc) const;
     virtual void getJSON(::StringBuffer &strJSON, unsigned int offset = 0, int idx = -1) const;
@@ -231,7 +230,7 @@ private:
     }
 };
 
-class CArrayOfElementArrays : public ::CIArrayOf<CElementArray>, public InterfaceImpl, public CXSDNodeBase
+class CArrayOfElementArrays : public ::CIArrayOf<CElementArray>, public CInterface, public CXSDNodeBase
 {
     friend class CElementArray;
 
@@ -247,7 +246,8 @@ public:
 
     virtual void dump(::std::ostream &cout, unsigned int offset = 0) const
     {
-        for(int idx = 0; idx < this->length(); idx++)
+        int len = this->length();
+        for(int idx = 0; idx < len; idx++)
         {
             this->item(idx).dump(cout);
         }

+ 23 - 24
configuration/configurator/SchemaEnumeration.cpp

@@ -30,9 +30,9 @@ using namespace CONFIGURATOR;
 
 CEnumeration* CEnumeration::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(pSchemaRoot != NULL);
-    if (pSchemaRoot == NULL)
-        return NULL;
+    assert(pSchemaRoot != nullptr);
+    if (pSchemaRoot == nullptr)
+        return nullptr;
 
     CEnumeration *pEnumeration = new CEnumeration(pParentNode);
     pEnumeration->setXSDXPath(xpath);
@@ -41,12 +41,12 @@ CEnumeration* CEnumeration::load(CXSDNodeBase* pParentNode, const IPropertyTree
     {
         IPropertyTree* pTree = pSchemaRoot->queryPropTree(xpath);
 
-        if (pTree == NULL)
+        if (pTree == nullptr)
             return pEnumeration;
 
         const char* pValue = pTree->queryProp(XML_ATTR_VALUE);
 
-        if (pValue != NULL)
+        if (pValue != nullptr)
             pEnumeration->setValue(pValue);
     }
     return pEnumeration;
@@ -56,12 +56,12 @@ void CEnumeration::dump(::std::ostream &cout, unsigned int offset) const
 {
     offset += STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_ENUMERATION_STR, offset);
+    quickOutHeader(cout, XSD_ENUMERATION_STR, offset);
     QUICK_OUT(cout, Value, offset);
     QUICK_OUT(cout, XSDXPath,  offset);
     QUICK_OUT(cout, EnvXPath,  offset);
     QUICK_OUT(cout, EnvValueFromXML,  offset);
-    QuickOutFooter(cout, XSD_ENUMERATION_STR, offset);
+    quickOutFooter(cout, XSD_ENUMERATION_STR, offset);
 }
 
 void CEnumeration::getDocumentation(StringBuffer &strDoc) const
@@ -72,42 +72,39 @@ void CEnumeration::getDocumentation(StringBuffer &strDoc) const
 const char* CEnumeration::getXML(const char* /*pComponent*/)
 {
     UNIMPLEMENTED;
-    return NULL;
+    return nullptr;
 }
 
 void CEnumeration::populateEnvXPath(StringBuffer strXPath, unsigned int index)
 {
-    assert(this->getValue() != NULL);
+    assert(this->getValue() != nullptr);
     const CAttribute *pAttribute = dynamic_cast<const CAttribute*>(this->getParentNodeByType(XSD_ATTRIBUTE));
 
-    assert(pAttribute != NULL);
+    assert(pAttribute != nullptr);
     this->setEnvXPath(strXPath.str());
 }
 
 void CEnumeration::loadXMLFromEnvXml(const IPropertyTree *pEnvTree)
 {
-    assert(this->getEnvXPath() != NULL);
+    assert(this->getEnvXPath() != nullptr);
     const CAttribute *pAttribute = dynamic_cast<const CAttribute*>(this->getParentNodeByType(XSD_ATTRIBUTE) );
-    assert(pAttribute != NULL);
+    assert(pAttribute != nullptr);
 
     StringBuffer strXPath(this->getEnvXPath());
     strXPath.append("[@").append(pAttribute->getName()).append("=\"").append(this->getValue()).append("\"]");
 
-    if (pEnvTree->hasProp(strXPath.str()) == true)
-        this->setInstanceValueValid(true);
-    else
-        this->setInstanceValueValid(false);
+    this->setInstanceValueValid(pEnvTree->hasProp(strXPath.str()));
 }
 
 void CEnumerationArray::dump(::std::ostream &cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_ENUMERATION_ARRAY_STR, offset);
+    quickOutHeader(cout, XSD_ENUMERATION_ARRAY_STR, offset);
     QUICK_OUT_ARRAY(cout, offset);
     QUICK_OUT(cout, XSDXPath,  offset);
     QUICK_OUT(cout, EnvXPath,  offset);
-    QuickOutFooter(cout, XSD_ENUMERATION_ARRAY_STR, offset);
+    quickOutFooter(cout, XSD_ENUMERATION_ARRAY_STR, offset);
 }
 
 void CEnumerationArray::getDocumentation(StringBuffer &strDoc) const
@@ -119,7 +116,7 @@ void CEnumerationArray::getDocumentation(StringBuffer &strDoc) const
 const char* CEnumerationArray::getXML(const char* /*pComponent*/)
 {
     UNIMPLEMENTED;
-    return NULL;
+    return nullptr;
 }
 
 void CEnumerationArray::populateEnvXPath(StringBuffer strXPath, unsigned int index)
@@ -131,7 +128,9 @@ void CEnumerationArray::populateEnvXPath(StringBuffer strXPath, unsigned int ind
 
 void CEnumerationArray::loadXMLFromEnvXml(const IPropertyTree *pEnvTree)
 {
-    assert(pEnvTree != NULL);
+    assert(pEnvTree != nullptr);
+    if (!pEnvTree)
+        return;
     if (pEnvTree->hasProp(this->getEnvXPath()) == false)
         throw MakeExceptionFromMap(EX_STR_XPATH_DOES_NOT_EXIST_IN_TREE);
     else
@@ -165,9 +164,9 @@ void CEnumerationArray::setEnvValueNodeIndex(int index)
 
 CEnumerationArray* CEnumerationArray::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(pSchemaRoot != NULL);
-    if (pSchemaRoot == NULL)
-        return NULL;
+    assert(pSchemaRoot != nullptr);
+    if (pSchemaRoot == nullptr)
+        return nullptr;
 
     CEnumerationArray *pEnumerationArray = new CEnumerationArray(pParentNode);
     pEnumerationArray->setXSDXPath(xpath);
@@ -190,7 +189,7 @@ CEnumerationArray* CEnumerationArray::load(CXSDNodeBase* pParentNode, const IPro
     if (pEnumerationArray->length() == 0)
     {
         delete pEnumerationArray;
-        return NULL;
+        return nullptr;
     }
 
     SETPARENTNODE(pEnumerationArray, pParentNode);

+ 1 - 1
configuration/configurator/SchemaEnumeration.hpp

@@ -64,7 +64,7 @@ private:
     }
 };
 
-class CEnumerationArray : public CIArrayOf<CEnumeration>, public InterfaceImpl, public CXSDNodeBase
+class CEnumerationArray : public CIArrayOf<CEnumeration>, public CInterface, public CXSDNodeBase
 {
 public:
 

+ 3 - 3
configuration/configurator/SchemaExtension.cpp

@@ -32,14 +32,14 @@ void CExtension::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_EXTENSION_STR, offset);
+    quickOutHeader(cout, XSD_EXTENSION_STR, offset);
     QUICK_OUT(cout, Base, offset);
     QUICK_OUT(cout, XSDXPath,  offset);
 
     if (this->getBaseNode() != NULL)
         this->getBaseNode()->dump(cout, offset);
 
-    QuickOutFooter(cout, XSD_EXTENSION_STR, offset);
+    quickOutFooter(cout, XSD_EXTENSION_STR, offset);
 }
 
 const char* CExtension::getXML(const char* /*pComponent*/)
@@ -80,7 +80,7 @@ CExtension* CExtension::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSc
         if (pTree == NULL)
             return NULL; // no xs:extension node
 
-        const char* pBase = pSchemaRoot->getPropTree(xpath)->queryProp(XML_ATTR_BASE);
+        const char* pBase = pTree->queryProp(XML_ATTR_BASE);
 
         if (pBase != NULL)
         {

configuration/configurator/SchemaExtension.hpp → configuration/configurator/schemas/SchemaExtension.hpp


+ 26 - 26
configuration/configurator/SchemaField.cpp

@@ -23,35 +23,35 @@ using namespace CONFIGURATOR;
 
 CField* CField::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(pSchemaRoot != NULL);
-    assert(pParentNode != NULL);
+    assert(pSchemaRoot != nullptr);
+    assert(pParentNode != nullptr);
     assert(pParentNode->getNodeType() == XSD_FIELD_ARRAY);
 
-    if (pSchemaRoot == NULL || pParentNode == NULL)
+    if (pSchemaRoot == nullptr || pParentNode == nullptr)
     {
         // TODO: Throw Exception
-        return NULL;
+        return nullptr;
     }
 
-    CField *pField = NULL;
+    CField *pField = nullptr;
 
-    if (xpath != NULL && *xpath != 0)
+    if (xpath != nullptr && *xpath != 0)
     {
         IPropertyTree* pTree = pSchemaRoot->queryPropTree(xpath);
 
-        if (pTree == NULL)
-            return NULL;
+        if (pTree == nullptr)
+            return nullptr;
 
-        const char* pXPath = pSchemaRoot->getPropTree(xpath)->queryProp(XML_ATTR_XPATH);
-        assert(pXPath != NULL && *pXPath != 0);
+        const char* pXPath = pTree->queryProp(XML_ATTR_XPATH);
+        assert(pXPath != nullptr && *pXPath != 0);
 
-        if (pXPath == NULL || *pXPath == 0)
+        if (pXPath == nullptr || *pXPath == 0)
         {
             assert(!"Throw Exception");
             // TODO: throw exception
         }
 
-        if (pXPath != NULL)
+        if (pXPath != nullptr)
         {
             pField = new CField(pParentNode);
             pField->setXSDXPath(xpath);
@@ -63,9 +63,9 @@ CField* CField::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot
             // TODO: throw MakeExceptionFromMap(EX_STR_MISSING_XPATH_IN_FIELD);
         }
 
-        const char *pID = pSchemaRoot->getPropTree(xpath)->queryProp(XML_ATTR_ID);
+        const char *pID = pTree->queryProp(XML_ATTR_ID);
 
-        if (pID != NULL)
+        if (pID != nullptr)
             pField->setID(pID);
    }
    return pField;
@@ -75,25 +75,25 @@ void CField::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset += STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_FIELD_STR, offset);
+    quickOutHeader(cout, XSD_FIELD_STR, offset);
     QUICK_OUT(cout, XPath, offset);
     QUICK_OUT(cout, ID, offset);
     QUICK_OUT(cout, XSDXPath,  offset);
-    QuickOutFooter(cout, XSD_FIELD_STR, offset);
+    quickOutFooter(cout, XSD_FIELD_STR, offset);
 }
 
 CFieldArray* CFieldArray::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(xpath != NULL);
-    assert(pParentNode != NULL);
-    assert(pSchemaRoot != NULL);
+    assert(xpath != nullptr);
+    assert(pParentNode != nullptr);
+    assert(pSchemaRoot != nullptr);
     assert(pParentNode->getNodeType() == XSD_KEY || pParentNode->getNodeType() == XSD_KEYREF || pParentNode->getNodeType() == XSD_UNIQUE);
 
-    if (pSchemaRoot == NULL || xpath == NULL || pParentNode == NULL)
+    if (pSchemaRoot == nullptr || xpath == nullptr || pParentNode == nullptr)
     {
         // TODO: exceptions
         //throw
-        return NULL;
+        return nullptr;
     }
 
     StringBuffer strXPathExt(xpath);
@@ -105,11 +105,11 @@ CFieldArray* CFieldArray::load(CXSDNodeBase* pParentNode, const IPropertyTree *p
     int count = 1;
     ForEach(*attributeIter)
     {
-        strXPathExt.clear().append(xpath).appendf("[%d]",count);
+        strXPathExt.setf("%s[%d]", xpath, count);
 
         CField *pField = CField::load(pFieldArray, pSchemaRoot, strXPathExt.str());
 
-        if (pField != NULL)
+        if (pField != nullptr)
                 pFieldArray->append(*pField);
 
         count++;
@@ -118,7 +118,7 @@ CFieldArray* CFieldArray::load(CXSDNodeBase* pParentNode, const IPropertyTree *p
     if (pFieldArray->length() == 0)
     {
         delete pFieldArray;
-        pFieldArray = NULL;
+        pFieldArray = nullptr;
     }
     return pFieldArray;
 }
@@ -127,11 +127,11 @@ void CFieldArray::dump(::std::ostream &cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_FIELD_ARRAY_STR, offset);
+    quickOutHeader(cout, XSD_FIELD_ARRAY_STR, offset);
     QUICK_OUT(cout, XSDXPath,  offset);
     QUICK_OUT(cout, EnvXPath,  offset);
     QUICK_OUT_ARRAY(cout, offset);
-    QuickOutFooter(cout, XSD_FIELD_ARRAY_STR, offset);
+    quickOutFooter(cout, XSD_FIELD_ARRAY_STR, offset);
 }
 
 

+ 1 - 1
configuration/configurator/SchemaField.hpp

@@ -76,7 +76,7 @@ protected:
     ::StringBuffer m_strXPath;
 };
 
-class CFieldArray : public ::CIArrayOf<CField>, public InterfaceImpl, public CXSDNodeBase
+class CFieldArray : public ::CIArrayOf<CField>, public CInterface, public CXSDNodeBase
 {
 public:
     virtual ~CFieldArray()

+ 2 - 2
configuration/configurator/SchemaFractionDigits.cpp

@@ -65,10 +65,10 @@ void CFractionDigits::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_FRACTION_DIGITS_STR, offset);
+    quickOutHeader(cout, XSD_FRACTION_DIGITS_STR, offset);
     QUICK_OUT(cout, XSDXPath,  offset);
     QUICK_OUT(cout, EnvXPath,  offset);
     QUICK_OUT(cout, Value, offset);
     QUICK_OUT(cout, FractionDigits, offset);
-    QuickOutFooter(cout, XSD_FRACTION_DIGITS_STR, offset);
+    quickOutFooter(cout, XSD_FRACTION_DIGITS_STR, offset);
 }

configuration/configurator/SchemaFractionDigits.hpp → configuration/configurator/schemas/SchemaFractionDigits.hpp


+ 23 - 20
configuration/configurator/SchemaInclude.cpp

@@ -29,14 +29,14 @@ void CInclude::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_INCLUDE_STR, offset);
+    quickOutHeader(cout, XSD_INCLUDE_STR, offset);
     QUICK_OUT(cout, SchemaLocation, offset);
     QUICK_OUT(cout, XSDXPath,  offset);
 
-    if (this->getIncludeSchema() != NULL)
+    if (this->getIncludeSchema() != nullptr)
         this->getIncludeSchema()->dump(cout, offset);
 
-    QuickOutFooter(cout, XSD_INCLUDE_STR, offset);
+    quickOutFooter(cout, XSD_INCLUDE_STR, offset);
 }
 
 void CInclude::getDocumentation(StringBuffer &strDoc) const
@@ -50,23 +50,23 @@ const char* CInclude::getXML(const char* /*pComponent*/)
 
 CInclude* CInclude::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    //return NULL; // TODO: Fix this to properly work with includes... temporary for testing
+    //return nullptr; // TODO: Fix this to properly work with includes... temporary for testing
 
-    if (pParentNode == NULL || pSchemaRoot == NULL || xpath == NULL)
-        return NULL;
+    if (pParentNode == nullptr || pSchemaRoot == nullptr || xpath == nullptr)
+        return nullptr;
 
-    CInclude *pInclude = NULL;
+    CInclude *pInclude = nullptr;
     IPropertyTree *pTree = pSchemaRoot->queryPropTree(xpath);
 
-    if (pTree != NULL)
+    if (pTree != nullptr)
     {
-        const char *pSchemaLocation = pSchemaRoot->queryPropTree(xpath)->queryProp(XML_ATTR_SCHEMA_LOCATION);
+        const char *pSchemaLocation = pTree->queryProp(XML_ATTR_SCHEMA_LOCATION);
 
-        if (pSchemaLocation != NULL)
+        if (pSchemaLocation != nullptr)
         {
-            CSchema* pSchema = CSchema::load(pSchemaLocation, NULL); // no parent across XSD files
+            CSchema* pSchema = CSchema::load(pSchemaLocation, nullptr); // no parent across XSD files
 
-            pInclude = new CInclude(NULL, pSchemaLocation);
+            pInclude = new CInclude(nullptr, pSchemaLocation);
             pInclude->setXSDXPath(xpath);
             pInclude->setIncludedSchema(pSchema);
         }
@@ -76,7 +76,7 @@ CInclude* CInclude::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchema
 
 void CInclude::populateEnvXPath(StringBuffer strXPath, unsigned int index)
 {
-    assert(this->m_pIncludedSchema != NULL);
+    assert(this->m_pIncludedSchema != nullptr);
     this->m_pIncludedSchema->populateEnvXPath(strXPath.str());
 }
 
@@ -90,8 +90,8 @@ void CIncludeArray::populateEnvXPath(StringBuffer strXPath, unsigned int index)
 
 CIncludeArray* CIncludeArray::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char *xpath)
 {
-    if (pSchemaRoot == NULL)
-        return NULL;
+    if (pSchemaRoot == nullptr)
+        return nullptr;
 
     CIncludeArray *pIncludeArray = new CIncludeArray(pParentNode);
     pIncludeArray->setXSDXPath(xpath);
@@ -107,14 +107,17 @@ CIncludeArray* CIncludeArray::load(CXSDNodeBase* pParentNode, const IPropertyTre
 
         CInclude *pInclude = CInclude::load(pIncludeArray, pSchemaRoot, strXPathExt.str());
 
-        if (pInclude != NULL)
+        if (pInclude != nullptr)
             pIncludeArray->append(*pInclude);
 
         count++;
     }
 
     if (pIncludeArray->length() == 0)
-        return NULL;
+    {
+        delete pIncludeArray;
+        return nullptr;
+    }
 
     return pIncludeArray;
 }
@@ -128,7 +131,7 @@ const char* CIncludeArray::getXML(const char* /*pComponent*/)
         for (int idx = 0; idx < length; idx++)
         {
             CInclude &Include = this->item(idx);
-            m_strXML.append(Include.getXML(NULL));
+            m_strXML.append(Include.getXML(nullptr));
 
             if (idx+1 < length)
                 m_strXML.append("\n");
@@ -141,9 +144,9 @@ void CIncludeArray::dump(::std::ostream &cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_INCLUDE_ARRAY_STR, offset);
+    quickOutHeader(cout, XSD_INCLUDE_ARRAY_STR, offset);
     QUICK_OUT_ARRAY(cout, offset);
-    QuickOutFooter(cout, XSD_INCLUDE_ARRAY_STR, offset);
+    quickOutFooter(cout, XSD_INCLUDE_ARRAY_STR, offset);
 }
 
 void CIncludeArray::getDocumentation(StringBuffer &strDoc) const

+ 21 - 2
configuration/configurator/SchemaInclude.hpp

@@ -70,7 +70,26 @@ private:
 
 };
 
-class CIncludeArray : public CIArrayOf<CInclude>, public InterfaceImpl, public CXSDNodeBase
+
+class CKevinArray
+{
+public:
+
+    CKevinArray()
+    {
+    }
+
+    virtual ~CKevinArray()
+    {
+    }
+    char* load(/*CXSDNodeBase* pParentNode*/const ::IPropertyTree *pSchemaRoot, const char * p )
+    {
+        return nullptr;
+
+    }
+};
+
+class CIncludeArray : public CIArrayOf<CInclude>, public CInterface, public CXSDNodeBase
 {
 public:
 
@@ -87,7 +106,7 @@ public:
     virtual void populateEnvXPath(StringBuffer strXPath, unsigned int index = 1);
     virtual const char* getXML(const char* /*pComponent*/);
 
-    static CIncludeArray* load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath);
+    static CIncludeArray* load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSchemaRoot, const char* xpath);
 
 protected:
 

+ 37 - 36
configuration/configurator/SchemaKey.cpp

@@ -32,41 +32,41 @@ using namespace CONFIGURATOR;
 
 CKey* CKey::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(pSchemaRoot != NULL);
-    assert(pParentNode != NULL);
+    assert(pSchemaRoot != nullptr);
+    assert(pParentNode != nullptr);
     assert(pParentNode->getNodeType() == XSD_KEY_ARRAY);
 
-    if (pSchemaRoot == NULL || pParentNode == NULL)
+    if (pSchemaRoot == nullptr || pParentNode == nullptr)
     {
         // TODO: Throw Exception
-        return NULL;
+        return nullptr;
     }
 
     CKey *pKey = new CKey(pParentNode);
 
-    if (xpath != NULL && *xpath != 0)
+    if (xpath != nullptr && *xpath != 0)
     {
         IPropertyTree* pTree = pSchemaRoot->queryPropTree(xpath);
 
-        if (pTree == NULL)
-            return NULL; // no xs:key
+        if (pTree == nullptr)
+            return nullptr; // no xs:key
 
-        const char* pName = pSchemaRoot->getPropTree(xpath)->queryProp(XML_ATTR_NAME);
-        if (pName != NULL)
+        const char* pName = pTree->queryProp(XML_ATTR_NAME);
+        if (pName != nullptr)
          {
-             pKey = new CKey(pParentNode);
              pKey->setXSDXPath(xpath);
              pKey->setName(pName);
          }
          else
          {
              assert(!"value attribute can be empty!");
+             delete pKey;
              // TODO: throw MakeExceptionFromMap(EX_STR_MISSING_VALUE_ATTRIBUTE_IN_LENGTH);
-             return NULL;
+             return nullptr;
          }
 
-         const char *pID = pSchemaRoot->getPropTree(xpath)->queryProp(XML_ATTR_ID);
-         if (pID != NULL)
+         const char *pID = pTree->queryProp(XML_ATTR_ID);
+         if (pID != nullptr)
              pKey->setID(pID);
 
          StringBuffer strXPathExt(xpath);
@@ -77,14 +77,14 @@ CKey* CKey::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, co
 
          pKey->m_pFieldArray = CFieldArray::load(pKey, pSchemaRoot, strXPathExt.str());
 
-         strXPathExt.clear().set(xpath);
+         strXPathExt.set(xpath);
          strXPathExt.append("/").append(XSD_TAG_SELECTOR);
 
          if (strXPathExt.charAt(0) == '.')
              strXPathExt.remove(0,2); // remove leading ./
 
          pKey->m_pSelector = CSelector::load(pKey, pSchemaRoot, strXPathExt.str());
-         assert(pKey->m_pFieldArray != NULL && pKey->m_pSelector != NULL);
+         assert(pKey->m_pFieldArray != nullptr && pKey->m_pSelector != nullptr);
 
          strXPathExt.append("/").append(XSD_TAG_ANNOTATION);
          pKey->m_pAnnotation = CAnnotation::load(pKey, pSchemaRoot, strXPathExt.str());
@@ -94,11 +94,11 @@ CKey* CKey::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, co
 
 void CKey::populateEnvXPath(StringBuffer strXPath, unsigned int index)
 {
-    assert(this->m_pSelector != NULL);
+    assert(this->m_pSelector != nullptr);
 
     this->setEnvXPath(strXPath.str());
 
-    if (this->m_pSelector != NULL)
+    if (this->m_pSelector != nullptr)
     {
         this->m_pSelector->populateEnvXPath(strXPath.str());
         CConfigSchemaHelper::getInstance()->addKeyForReverseAssociation(this);
@@ -108,27 +108,28 @@ void CKey::populateEnvXPath(StringBuffer strXPath, unsigned int index)
 bool CKey::checkConstraint(const char *pValue) const
 {
     bool bRetVal = true;
+    auto fieldArraylength = m_pFieldArray->length();
 
-    if (m_pSelector != NULL && m_pFieldArray->length() != 0)
+    if (m_pSelector != nullptr && fieldArraylength != 0)
     {
-        for (int idx = 0; idx < m_pFieldArray->length(); idx++)
+        for (int idx = 0; idx < fieldArraylength; idx++)
         {
             assert(!"Multiple fields not implemented");
             CField *m_pField = &(m_pFieldArray->item(idx));
 
-            assert(m_pField != NULL);
-            if (m_pField == NULL)
+            assert(m_pField != nullptr);
+            if (m_pField == nullptr)
                 return false;
 
             StringBuffer strXPathForConstraintCheck(this->getEnvXPath());
             strXPathForConstraintCheck.appendf("/%s", this->m_pSelector->getXPath());
 
             const CElement *pElement = CConfigSchemaHelper::getInstance()->getSchemaMapManager()->getElementFromXPath(strXPathForConstraintCheck.str());
-            if (pElement == NULL)
+            if (pElement == nullptr)
                 return false;
 
             const CAttribute *pAttribute = dynamic_cast<const CAttribute*>(pElement->getNodeByTypeAndNameDescending(XSD_ATTRIBUTE, m_pField->getXPath()));  // needs to be first possible descendent
-            if (pAttribute != NULL && pAttribute->getParentNodeByType(XSD_ELEMENT) != pElement)
+            if (pAttribute != nullptr && pAttribute->getParentNodeByType(XSD_ELEMENT) != pElement)
             {
                 assert(!"Could not find match for key");
             }
@@ -141,26 +142,26 @@ void CKey::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset += STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_KEY_STR, offset);
+    quickOutHeader(cout, XSD_KEY_STR, offset);
     QUICK_OUT(cout, Name, offset);
     QUICK_OUT(cout, ID, offset);
     QUICK_OUT(cout, XSDXPath,  offset);
 
-    if (m_pFieldArray != NULL)
+    if (m_pFieldArray != nullptr)
         m_pFieldArray->dump(cout, offset);
-    if (m_pSelector != NULL)
+    if (m_pSelector != nullptr)
         m_pSelector->dump(cout, offset);
 
-    QuickOutFooter(cout, XSD_KEY_STR, offset);
+    quickOutFooter(cout, XSD_KEY_STR, offset);
 }
 
 CKeyArray* CKeyArray::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(pSchemaRoot != NULL);
+    assert(pSchemaRoot != nullptr);
     assert(pParentNode->getNodeType() == XSD_ELEMENT);
 
-    if (pSchemaRoot == NULL || xpath == NULL)
-        return NULL;
+    if (pSchemaRoot == nullptr || xpath == nullptr)
+        return nullptr;
 
     StringBuffer strXPathExt(xpath);
 
@@ -175,7 +176,7 @@ CKeyArray* CKeyArray::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSche
         strXPathExt.clear().append(xpath).appendf("[%d]",count);
 
         CKey *pKey = CKey::load(pKeyArray, pSchemaRoot, strXPathExt.str());
-        if (pKey != NULL)
+        if (pKey != nullptr)
             pKeyArray->append(*pKey);
 
         count++;
@@ -184,16 +185,16 @@ CKeyArray* CKeyArray::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSche
     if (pKeyArray->length() == 0)
     {
         delete pKeyArray;
-        pKeyArray = NULL;
+        pKeyArray = nullptr;
     }
     return pKeyArray;
 }
 
 bool CKeyArray::checkConstraint(const char *pValue) const
 {
-    assert(pValue != NULL);
+    assert(pValue != nullptr);
 
-    if (pValue == NULL)
+    if (pValue == nullptr)
         return false;
 
     for (int idx = 0; idx < this->length(); idx++)
@@ -208,11 +209,11 @@ void CKeyArray::dump(::std::ostream &cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_KEY_ARRAY_STR, offset);
+    quickOutHeader(cout, XSD_KEY_ARRAY_STR, offset);
     QUICK_OUT(cout, XSDXPath,  offset);
     QUICK_OUT(cout, EnvXPath,  offset);
     QUICK_OUT_ARRAY(cout, offset);
-    QuickOutFooter(cout, XSD_KEY_ARRAY_STR, offset);
+    quickOutFooter(cout, XSD_KEY_ARRAY_STR, offset);
 }
 
 void CKeyArray::populateEnvXPath(StringBuffer strXPath, unsigned int index)

+ 1 - 1
configuration/configurator/SchemaKey.hpp

@@ -68,7 +68,7 @@ protected:
     CAnnotation *m_pAnnotation;
 };
 
-class CKeyArray : public CIArrayOf<CKey>, public InterfaceImpl, public CXSDNodeBase
+class CKeyArray : public CIArrayOf<CKey>, public CInterface, public CXSDNodeBase
 {
 public:
 

+ 35 - 30
configuration/configurator/SchemaKeyRef.cpp

@@ -28,48 +28,49 @@ using namespace CONFIGURATOR;
 
 CKeyRef* CKeyRef::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(pSchemaRoot != NULL);
-    assert(pParentNode != NULL);
+    assert(pSchemaRoot != nullptr);
+    assert(pParentNode != nullptr);
     assert(pParentNode->getNodeType() == XSD_KEYREF_ARRAY);
 
-    if (pSchemaRoot == NULL || pParentNode == NULL)
+    if (pSchemaRoot == nullptr || pParentNode == nullptr)
     {
         // TODO: Throw Exception
-        return NULL;
+        return nullptr;
     }
 
     CKeyRef *pKeyRef = new CKeyRef(pParentNode);
 
-    if (xpath != NULL && *xpath != 0)
+    if (xpath != nullptr && *xpath != 0)
     {
         IPropertyTree* pTree = pSchemaRoot->queryPropTree(xpath);
-        if (pTree == NULL)
-            return NULL; // no xs:KeyRef
+        if (pTree == nullptr)
+            return nullptr; // no xs:KeyRef
 
-        const char* pName = pSchemaRoot->getPropTree(xpath)->queryProp(XML_ATTR_NAME);
-        const char* pRefer = pSchemaRoot->getPropTree(xpath)->queryProp(XML_ATTR_REFER);
+        const char* pName = pTree->queryProp(XML_ATTR_NAME);
+        const char* pRefer = pTree->queryProp(XML_ATTR_REFER);
 
-        if (pName != NULL && pRefer != NULL)
+        if (pName != nullptr && pRefer != nullptr)
         {
-            pKeyRef = new CKeyRef(pParentNode);
             pKeyRef->setXSDXPath(xpath);
             pKeyRef->setName(pName);
         }
         else
         {
+            delete pKeyRef;
+            pKeyRef = nullptr;
             assert(!"value attribute can be empty!");
             // TODO: throw MakeExceptionFromMap(EX_STR_MISSING_VALUE_ATTRIBUTE_IN_LENGTH);
         }
 
-        const char *pID = pSchemaRoot->getPropTree(xpath)->queryProp(XML_ATTR_ID);
-        if (pID != NULL)
+        const char *pID = pTree->queryProp(XML_ATTR_ID);
+        if (pID != nullptr)
             pKeyRef->setID(pID);
 
         StringBuffer strXPathExt(xpath);
         strXPathExt.append("/").append(XSD_TAG_FIELD);
         pKeyRef->m_pFieldArray = CFieldArray::load(pKeyRef, pSchemaRoot, strXPathExt.str());
 
-        strXPathExt.clear().set(xpath);
+        strXPathExt.set(xpath);
         strXPathExt.append("/").append(XSD_TAG_SELECTOR);
         pKeyRef->m_pSelector = CSelector::load(pKeyRef, pSchemaRoot, strXPathExt.str());
     }
@@ -80,26 +81,26 @@ void CKeyRef::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset += STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_KEYREF_STR, offset);
+    quickOutHeader(cout, XSD_KEYREF_STR, offset);
     QUICK_OUT(cout, Name, offset);
     QUICK_OUT(cout, ID, offset);
     QUICK_OUT(cout, Refer, offset);
     QUICK_OUT(cout, XSDXPath,  offset);
 
-    if (m_pFieldArray != NULL)
+    if (m_pFieldArray != nullptr)
         m_pFieldArray->dump(cout, offset);
 
-    if (m_pSelector != NULL)
+    if (m_pSelector != nullptr)
         m_pSelector->dump(cout, offset);
 
-    QuickOutFooter(cout, XSD_KEYREF_STR, offset);
+    quickOutFooter(cout, XSD_KEYREF_STR, offset);
 }
 
 bool CKeyRef::checkConstraint(const char *pValue) const
 {
-    assert (pValue != NULL);
+    assert (pValue != nullptr);
 
-    if (pValue == NULL)
+    if (pValue == nullptr)
         return true;
     else
     {
@@ -107,17 +108,21 @@ bool CKeyRef::checkConstraint(const char *pValue) const
         strQName.append("/").append(this->getRefer());
 
         CKey *pKey = CConfigSchemaHelper::getInstance()->getSchemaMapManager()->getKeyFromXSDXPath(strQName.str());
+
+        assert(pKey);
+        if (pKey == nullptr)
+            return true;
         return pKey->checkConstraint(pValue);
     }
 }
 
 void CKeyRef::populateEnvXPath(StringBuffer strXPath, unsigned int index)
 {
-    assert(this->m_pSelector != NULL);
+    assert(this->m_pSelector != nullptr);
 
     this->setEnvXPath(strXPath.str());
 
-    if (this->m_pSelector != NULL)
+    if (this->m_pSelector != nullptr)
     {
         this->m_pSelector->populateEnvXPath(strXPath.str());
         CConfigSchemaHelper::getInstance()->addKeyRefForReverseAssociation(this);
@@ -126,11 +131,11 @@ void CKeyRef::populateEnvXPath(StringBuffer strXPath, unsigned int index)
 
 CKeyRefArray* CKeyRefArray::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(pSchemaRoot != NULL);
+    assert(pSchemaRoot != nullptr);
     assert(pParentNode->getNodeType() == XSD_ELEMENT);
 
-    if (pSchemaRoot == NULL || xpath == NULL)
-        return NULL;
+    if (pSchemaRoot == nullptr || xpath == nullptr)
+        return nullptr;
 
     StringBuffer strXPathExt(xpath);
 
@@ -142,11 +147,11 @@ CKeyRefArray* CKeyRefArray::load(CXSDNodeBase* pParentNode, const IPropertyTree
     int count = 1;
     ForEach(*attributeIter)
     {
-        strXPathExt.clear().append(xpath).appendf("[%d]",count);
+        strXPathExt.setf("%s[%d]", xpath, count);
 
         CKeyRef *pKeyRef = CKeyRef::load(pKeyRefArray, pSchemaRoot, strXPathExt.str());
 
-        if (pKeyRef != NULL)
+        if (pKeyRef != nullptr)
             pKeyRefArray->append(*pKeyRef);
 
         count++;
@@ -155,7 +160,7 @@ CKeyRefArray* CKeyRefArray::load(CXSDNodeBase* pParentNode, const IPropertyTree
     if (pKeyRefArray->length() == 0)
     {
         delete pKeyRefArray;
-        pKeyRefArray = NULL;
+        pKeyRefArray = nullptr;
     }
     return pKeyRefArray;
 }
@@ -164,11 +169,11 @@ void CKeyRefArray::dump(::std::ostream &cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_KEYREF_ARRAY_STR, offset);
+    quickOutHeader(cout, XSD_KEYREF_ARRAY_STR, offset);
     QUICK_OUT(cout, XSDXPath,  offset);
     QUICK_OUT(cout, EnvXPath,  offset);
     QUICK_OUT_ARRAY(cout, offset);
-    QuickOutFooter(cout, XSD_KEYREF_ARRAY_STR, offset);
+    quickOutFooter(cout, XSD_KEYREF_ARRAY_STR, offset);
 }
 
 void CKeyRefArray::populateEnvXPath(StringBuffer strXPath, unsigned int index)

+ 1 - 1
configuration/configurator/SchemaKeyRef.hpp

@@ -60,7 +60,7 @@ protected:
     CSelector *m_pSelector;
 };
 
-class CKeyRefArray : public ::CIArrayOf<CKeyRef>, public InterfaceImpl, public CXSDNodeBase
+class CKeyRefArray : public ::CIArrayOf<CKeyRef>, public CInterface, public CXSDNodeBase
 {
 public:
     virtual ~CKeyRefArray()

+ 3 - 3
configuration/configurator/SchemaLength.cpp

@@ -37,7 +37,7 @@ CLength* CLength::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRo
         if (pTree == NULL)
             return NULL; // no xs:length node
 
-        const char* pValue = pSchemaRoot->getPropTree(xpath)->queryProp(XML_ATTR_VALUE);
+        const char* pValue = pTree->queryProp(XML_ATTR_VALUE);
         if (pValue != NULL)
         {
             if (atoi(pValue) < 0)
@@ -60,8 +60,8 @@ void CLength::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset += STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_LENGTH_STR, offset);
+    quickOutHeader(cout, XSD_LENGTH_STR, offset);
     QUICK_OUT(cout, Value, offset);
-    QuickOutFooter(cout, XSD_LENGTH_STR, offset);
+    quickOutFooter(cout, XSD_LENGTH_STR, offset);
 }
 

configuration/configurator/SchemaLength.hpp → configuration/configurator/schemas/SchemaLength.hpp


+ 106 - 115
configuration/configurator/SchemaMapManager.cpp

@@ -109,51 +109,42 @@ CSchema* CSchemaMapManager::getSchemaForXSD(const char* pComponent)
 {
     CSchema **pSchema = m_pSchemaPtrMap->getValue(pComponent);
 
-    if (pSchema != NULL )
-    {
-        assert ((*pSchema)->getLinkCount() == 1);
+    if (pSchema != nullptr )
         return *pSchema;
-    }
     else
-        return NULL;
+        return nullptr;
 }
 
 void CSchemaMapManager::setSchemaForXSD(const char* pComponent, CSchema *pSchema)
 {
-    assert(pSchema != NULL);
-    assert(pComponent != NULL);
-    assert(*pComponent != 0);
-
-    assert(pSchema->getLinkCount() == 1);
-
-    if (pSchema != NULL && pComponent != NULL && *pComponent != 0)
+    if (pSchema != nullptr && pComponent != nullptr && *pComponent != 0)
     {
-        if (m_pSchemaPtrMap->getValue(pComponent) == NULL)
+        if (m_pSchemaPtrMap->getValue(pComponent) == nullptr)
             m_pSchemaPtrMap->setValue(pComponent, (pSchema));
     }
 }
 
 CSimpleType* CSchemaMapManager::getSimpleTypeWithName(const char* pName)
 {
-    assert(pName != NULL);
-    if (pName == NULL)
-        return NULL;
+    assert(pName != nullptr);
+    if (pName == nullptr)
+        return nullptr;
 
-    CSimpleType **ppSimpleType = NULL;
+    CSimpleType **ppSimpleType = nullptr;
     ppSimpleType = m_pSimpleTypePtrMap->getValue(pName);
 
-    if (ppSimpleType != NULL)
+    if (ppSimpleType != nullptr)
         return *ppSimpleType;
     else
-        return NULL;
+        return nullptr;
 }
 
 void CSchemaMapManager::setSimpleTypeWithName(const char* pName, CSimpleType *pSimpleType)
 {
-    assert (pSimpleType != NULL);
-    if (pName == NULL || pSimpleType == NULL)
+    assert (pSimpleType != nullptr);
+    if (pName == nullptr || pSimpleType == nullptr)
         return;
-    if (m_pSimpleTypePtrMap->getValue(pName) != NULL)
+    if (m_pSimpleTypePtrMap->getValue(pName) != nullptr)
         throw MakeExceptionFromMap(EX_STR_SIMPLE_TYPE_ALREADY_DEFINED);
 
     assert(pSimpleType->getLinkCount() == 1);
@@ -162,23 +153,23 @@ void CSchemaMapManager::setSimpleTypeWithName(const char* pName, CSimpleType *pS
 
 CComplexType* CSchemaMapManager::getComplexTypeWithName(const char* pName)
 {
-    assert(pName != NULL);
-    if (pName == NULL)
-        return NULL;
+    assert(pName != nullptr);
+    if (pName == nullptr)
+        return nullptr;
 
-    CComplexType **ppComplexType = NULL;
+    CComplexType **ppComplexType = nullptr;
     ppComplexType = (m_pComplexTypePtrsMap->getValue(pName));
 
-    return (ppComplexType != NULL ? *ppComplexType : NULL);
+    return (ppComplexType != nullptr ? *ppComplexType : nullptr);
 }
 
 void CSchemaMapManager::setComplexTypeWithName(const char* pName, CComplexType *pComplexType)
 {
-    assert (pComplexType != NULL);
-    if (pName == NULL || pComplexType == NULL)
+    assert (pComplexType != nullptr);
+    if (pName == nullptr || pComplexType == nullptr)
         return;
 
-    if (m_pComplexTypePtrsMap->getValue(pName) != NULL)
+    if (m_pComplexTypePtrsMap->getValue(pName) != nullptr)
         throw MakeExceptionFromMap(EX_STR_COMPLEX_TYPE_ALREADY_DEFINED);
 
     assert(pComplexType->getLinkCount() == 1);
@@ -187,35 +178,35 @@ void CSchemaMapManager::setComplexTypeWithName(const char* pName, CComplexType *
 
 CComplexType* CSchemaMapManager::getComplexTypeFromXPath(const char *pXPath)
 {
-    assert(pXPath != NULL && *pXPath != 0);
+    assert(pXPath != nullptr && *pXPath != 0);
 
     CComplexType** ppComplexType =  m_pComplexTypePtrsMap->getValue(pXPath);
-    if (ppComplexType != NULL)
+    if (ppComplexType != nullptr)
         return *ppComplexType;
     else
-        return NULL;
+        return nullptr;
 }
 
 CAttributeGroup* CSchemaMapManager::getAttributeGroup(const char* pName)
 {
-    assert(pName != NULL);
-    if (pName == NULL)
-        return NULL;
+    assert(pName != nullptr);
+    if (pName == nullptr)
+        return nullptr;
 
-    CAttributeGroup *pAttributeGroup = NULL;
+    CAttributeGroup *pAttributeGroup = nullptr;
     pAttributeGroup = *(m_pAttributeGroupTypePtrsMap->getValue(pName));
 
-    assert(pAttributeGroup != NULL);
+    assert(pAttributeGroup != nullptr);
     return pAttributeGroup;
 }
 
 void CSchemaMapManager::setAttributeGroupTypeWithName(const char* pName, CAttributeGroup *pAttributeGroup)
 {
-    assert (pAttributeGroup != NULL);
-    if (pName == NULL || pAttributeGroup == NULL)
+    assert (pAttributeGroup != nullptr);
+    if (pName == nullptr || pAttributeGroup == nullptr)
         return;
 
-    if (m_pAttributeGroupTypePtrsMap->getValue(pName) != NULL)
+    if (m_pAttributeGroupTypePtrsMap->getValue(pName) != nullptr)
     {
         m_pAttributeGroupTypePtrsMap->remove(pName);
         //throw MakeExceptionFromMap(EX_STR_ATTRIBUTE_GROUP_ALREADY_DEFINED);
@@ -227,46 +218,46 @@ void CSchemaMapManager::setAttributeGroupTypeWithName(const char* pName, CAttrib
 
 CAttributeGroup* CSchemaMapManager::getAttributeGroupFromXPath(const char *pXPath)
 {
-    assert(pXPath != NULL && *pXPath != 0);
-    if (pXPath == NULL || *pXPath == 0)
-        return NULL;
+    assert(pXPath != nullptr && *pXPath != 0);
+    if (pXPath == nullptr || *pXPath == 0)
+        return nullptr;
 
     CAttributeGroup **ppAttributeGroup = m_pAttributeGroupTypePtrsMap->getValue(pXPath);
-    assert(ppAttributeGroup != NULL);
+    assert(ppAttributeGroup != nullptr);
 
-    if (ppAttributeGroup != NULL)
+    if (ppAttributeGroup != nullptr)
         return *ppAttributeGroup;
     else
-        return NULL;
+        return nullptr;
 }
 
 CElement* CSchemaMapManager::getElementWithName(const char* pName)
 {
-    assert (pName != NULL && *pName != 0);
-    if (pName != NULL && *pName != 0)
+    assert (pName != nullptr && *pName != 0);
+    if (pName != nullptr && *pName != 0)
     {
         CElement **ppElement = m_pElementNamePtrsMap->getValue(pName);
-        assert(ppElement != NULL);
+        assert(ppElement != nullptr);
 
-        if (ppElement != NULL)
+        if (ppElement != nullptr)
             return *ppElement;
         else
-            return NULL;
+            return nullptr;
     }
     else
-        return NULL;
+        return nullptr;
 }
 
 void CSchemaMapManager::setElementWithName(const char* pName, CElement *pElement)
 {
-    assert (pName != NULL && *pName != 0 && pElement != NULL);
+    assert (pName != nullptr && *pName != 0 && pElement != nullptr);
 
-    if (pName != NULL && *pName != 0 && pElement != NULL)
+    if (pName != nullptr && *pName != 0 && pElement != nullptr)
     {
-        assert (pElement != NULL);
-        if (pName == NULL || *pName == 0 || pElement == NULL)
+        assert (pElement != nullptr);
+        if (pName == nullptr || *pName == 0 || pElement == nullptr)
             return;
-        if (m_pElementNamePtrsMap->getValue(pName) != NULL)
+        if (m_pElementNamePtrsMap->getValue(pName) != nullptr)
         {
             if (STRICTNESS_LEVEL >= DEFAULT_STRICTNESS)
                 assert(!"Redefintion");
@@ -280,13 +271,13 @@ void CSchemaMapManager::setElementWithName(const char* pName, CElement *pElement
 
 void CSchemaMapManager::addMapOfXPathToAttribute(const char*pXPath, CAttribute *pAttribute)
 {
-    assert (pAttribute != NULL);
-    assert(pXPath != NULL && *pXPath != 0);
+    assert (pAttribute != nullptr);
+    assert(pXPath != nullptr && *pXPath != 0);
 
     // TODO:: throw exception if problems here
     CAttribute **ppAttribute = m_pAttributePtrsMap->getValue(pXPath);
 
-    if (ppAttribute != NULL && *ppAttribute != pAttribute)
+    if (ppAttribute != nullptr && *ppAttribute != pAttribute)
         assert(!"Assigning different node with same xpath! delete it first!");
 
     // should I remove automatically?
@@ -300,7 +291,7 @@ void CSchemaMapManager::addMapOfXPathToAttribute(const char*pXPath, CAttribute *
 
 void CSchemaMapManager::removeMapOfXPathToAttribute(const char*pXPath)
 {
-    assert (m_pAttributePtrsMap->find(pXPath) != NULL);
+    assert (m_pAttributePtrsMap->find(pXPath) != nullptr);
 
     StringBuffer strXPath(pXPath);
     strXPath.replace('/','_');
@@ -311,10 +302,10 @@ void CSchemaMapManager::removeMapOfXPathToAttribute(const char*pXPath)
 
 CAttribute* CSchemaMapManager::getAttributeFromXPath(const char* pXPath)
 {
-    assert(pXPath != NULL && *pXPath != 0);
+    assert(pXPath != nullptr && *pXPath != 0);
     CAttribute **pAttribute = m_pAttributePtrsMap->getValue(pXPath);
 
-    if (pAttribute == NULL)
+    if (pAttribute == nullptr)
     {
         StringBuffer strXPath(pXPath);
         strXPath.replace('/','_');
@@ -322,20 +313,20 @@ CAttribute* CSchemaMapManager::getAttributeFromXPath(const char* pXPath)
     }
 
     if (STRICTNESS_LEVEL >= DEFAULT_STRICTNESS)
-        assert(pAttribute != NULL);
-    if (pAttribute == NULL)
-        return NULL;
+        assert(pAttribute != nullptr);
+    if (pAttribute == nullptr)
+        return nullptr;
 
     return *pAttribute;
 }
 
 void CSchemaMapManager::addMapOfXSDXPathToElementArray(const char*pXPath, CElementArray *pElementArray)
 {
-    assert (pElementArray != NULL);
-    assert(pXPath != NULL && *pXPath != 0);
+    assert (pElementArray != nullptr);
+    assert(pXPath != nullptr && *pXPath != 0);
     assert(pElementArray->getLinkCount() == 1);
 
-    if (m_pElementArrayPtrsMap->find(pXPath) != NULL)
+    if (m_pElementArrayPtrsMap->find(pXPath) != nullptr)
         return;  // already mapped, we must be dealing with live data
 
     PROGLOG("Mapping XSD XPath %s to %p elementarray", pXPath, pElementArray);
@@ -344,58 +335,58 @@ void CSchemaMapManager::addMapOfXSDXPathToElementArray(const char*pXPath, CEleme
 
 void CSchemaMapManager::removeMapOfXSDXPathToElementArray(const char*pXPath)
 {
-    assert (m_pElementArrayPtrsMap->find(pXPath) != NULL);
+    assert (m_pElementArrayPtrsMap->find(pXPath) != nullptr);
     m_pElementArrayPtrsMap->remove(pXPath);
 }
 
 CElementArray* CSchemaMapManager::getElementArrayFromXSDXPath(const char* pXPath)
 {
-    assert(pXPath != NULL && *pXPath != 0);
-    if (pXPath == NULL)
-        return NULL;
+    assert(pXPath != nullptr && *pXPath != 0);
+    if (pXPath == nullptr)
+        return nullptr;
 
     CElementArray** ppElementArray = m_pElementArrayPtrsMap->getValue(pXPath);
-    if (ppElementArray != NULL)
+    if (ppElementArray != nullptr)
         return *ppElementArray;
     else
-        return NULL;
+        return nullptr;
 }
 
 void CSchemaMapManager::addMapOfXPathToElement(const char* pXPath, CElement *pElement,  bool bIsTopLevelElement)
 {
-    assert (pElement != NULL);
-    assert(pXPath != NULL && *pXPath != 0);
+    assert (pElement != nullptr);
+    assert(pXPath != nullptr && *pXPath != 0);
     PROGLOG("Mapping XPath %s to %p element", pXPath, pElement);
     assert(pElement->getLinkCount() == 1);
 
-    assert(m_pElementPtrsMap->getValue(pXPath) == NULL);
+    assert(m_pElementPtrsMap->getValue(pXPath) == nullptr);
     m_pElementPtrsMap->setValue(pXPath, pElement);
 }
 
 void CSchemaMapManager::removeMapOfXPathToElement(const char*pXPath)
 {
-    assert (m_pElementPtrsMap->find(pXPath) != NULL);
+    assert (m_pElementPtrsMap->find(pXPath) != nullptr);
     m_pElementPtrsMap->remove(pXPath);
 }
 
 CElement* CSchemaMapManager::getElementFromXPath(const char *pXPath)
 {
-    assert(pXPath != NULL && *pXPath != 0);
+    assert(pXPath != nullptr && *pXPath != 0);
     CElement **ppElement = m_pElementPtrsMap->getValue(pXPath);
 
-    assert(ppElement != NULL);
-    if (ppElement != NULL)
+    assert(ppElement != nullptr);
+    if (ppElement != nullptr)
         return *ppElement;
     else
-        return NULL;
+        return nullptr;
 }
 
 void CSchemaMapManager::addMapOfXSDXPathToElement(const char* pXPath, CElement *pElement)
 {
-    assert (pElement != NULL);
-    assert(pXPath != NULL && *pXPath != 0);
+    assert (pElement != nullptr);
+    assert(pXPath != nullptr && *pXPath != 0);
 
-    if (pElement != NULL && pXPath != NULL && *pXPath != 0)
+    if (pElement != nullptr && pXPath != nullptr && *pXPath != 0)
     {
         StringBuffer strFullXPath;
         strFullXPath.appendf("%s-%s",pElement->getConstSchemaNode()->getXSDXPath(), pXPath);
@@ -405,12 +396,12 @@ void CSchemaMapManager::addMapOfXSDXPathToElement(const char* pXPath, CElement *
 
 void CSchemaMapManager::addMapOfXPathToElementArray(const char* pXPath, CElementArray *pElementArray)
 {
-    assert(pXPath != NULL && *pXPath != 0);
+    assert(pXPath != nullptr && *pXPath != 0);
     assert(pElementArray);
 
     PROGLOG("Mapping Env XML XPath %s to %p elementarray", pXPath, pElementArray);
 
-    if (pElementArray != NULL && pXPath != NULL && *pXPath != 0)
+    if (pElementArray != nullptr && pXPath != nullptr && *pXPath != 0)
     {
         StringBuffer strXPath(pXPath);
         stripTrailingIndex(strXPath);
@@ -421,16 +412,16 @@ void CSchemaMapManager::addMapOfXPathToElementArray(const char* pXPath, CElement
 
 void CSchemaMapManager::removeMapOfXPathToElementArray(const char* pXPath)
 {
-    assert(pXPath != NULL && *pXPath != 0);
-    assert(m_pElementArrayPtrsMap->find(pXPath) != NULL);
+    assert(pXPath != nullptr && *pXPath != 0);
+    assert(m_pElementArrayPtrsMap->find(pXPath) != nullptr);
 
     this-m_pElementArrayPtrsMap->remove(pXPath);
 }
 
 CElementArray* CSchemaMapManager::getElementArrayFromXPath(const char *pXPath)
 {
-    assert(pXPath != NULL && *pXPath != 0);
-    assert(m_pElementArrayPtrsMap->getValue(pXPath) != NULL);
+    assert(pXPath != nullptr && *pXPath != 0);
+    assert(m_pElementArrayPtrsMap->getValue(pXPath) != nullptr);
 
     return *(this->m_pElementArrayPtrsMap->getValue(pXPath));
 }
@@ -438,40 +429,40 @@ CElementArray* CSchemaMapManager::getElementArrayFromXPath(const char *pXPath)
 CElement* CSchemaMapManager::getElementFromXSDXPath(const char *pXPath) const
 {
     UNIMPLEMENTED;
-    //return NULL;
+    //return nullptr;
 }
 
 void CSchemaMapManager::addMapOfXSDXPathToKey(const char* pXPath, CKey *pKey)
 {
-    assert (pKey != NULL);
-    assert (pXPath != NULL && *pXPath != 0);
+    assert (pKey != nullptr);
+    assert (pXPath != nullptr && *pXPath != 0);
 
-    if (pKey != NULL && pXPath != NULL && *pXPath != 0)
+    if (pKey != nullptr && pXPath != nullptr && *pXPath != 0)
         m_pStringToKeyPtrsMap->setValue(pXPath, pKey);
 }
 
 CKey* CSchemaMapManager::getKeyFromXSDXPath(const char *pXPath) const
 {
-    assert(pXPath != NULL && *pXPath != 0);
-    if (pXPath != NULL && *pXPath != 0)
+    assert(pXPath != nullptr && *pXPath != 0);
+    if (pXPath != nullptr && *pXPath != 0)
     {
         CKey **ppKey = m_pStringToKeyPtrsMap->getValue(pXPath);
-        assert(ppKey != NULL);
+        assert(ppKey != nullptr);
 
-        if (ppKey != NULL)
+        if (ppKey != nullptr)
             return *ppKey;
         else
-            return NULL;
+            return nullptr;
     }
     assert(!"Control should reach here.  xpath invalid?");
-    return NULL;
+    return nullptr;
 }
 
 void CSchemaMapManager::addMapOfXPathToRestriction(const char*pXPath, CRestriction *pRestriction)
 {
-    assert (pRestriction != NULL);
-    assert(pXPath != NULL && *pXPath != 0);
-    assert(m_pRestrictionPtrsMap->find(pXPath) == NULL);
+    assert (pRestriction != nullptr);
+    assert(pXPath != nullptr && *pXPath != 0);
+    assert(m_pRestrictionPtrsMap->find(pXPath) == nullptr);
     assert(pRestriction->getLinkCount() == 1);
 
     m_pRestrictionPtrsMap->setValue(pXPath, pRestriction);
@@ -479,21 +470,21 @@ void CSchemaMapManager::addMapOfXPathToRestriction(const char*pXPath, CRestricti
 
 void CSchemaMapManager::removeMapOfXPathToRestriction(const char*pXPath)
 {
-    assert(pXPath != NULL && *pXPath != 0);
+    assert(pXPath != nullptr && *pXPath != 0);
     m_pRestrictionPtrsMap->remove(pXPath);
 }
 
 CRestriction* CSchemaMapManager::getRestrictionFromXPath(const char* pXPath)
 {
-    assert(pXPath != NULL && *pXPath != 0);
+    assert(pXPath != nullptr && *pXPath != 0);
 
     CRestriction **ppRestriction = m_pRestrictionPtrsMap->getValue(pXPath);
-    assert(ppRestriction != NULL);
+    assert(ppRestriction != nullptr);
 
-    if (ppRestriction != NULL)
+    if (ppRestriction != nullptr)
         return *ppRestriction;
     else
-        return NULL;
+        return nullptr;
 }
 
 int CSchemaMapManager::getNumberOfComponents() const
@@ -527,7 +518,7 @@ CElement* CSchemaMapManager::getComponent(int index)
             nCount++;
         }        
     }
-    return NULL;
+    return nullptr;
 }
 
 int CSchemaMapManager::getIndexOfElement(const CElement *pElem)
@@ -550,12 +541,12 @@ int CSchemaMapManager::getIndexOfElement(const CElement *pElem)
 
 enum NODE_TYPES CSchemaMapManager::getEnumFromTypeName(const char *pTypeName) const
 {
-    if (pTypeName == NULL || *pTypeName == 0)
+    if (pTypeName == nullptr || *pTypeName == 0)
         return XSD_ERROR;
 
     enum NODE_TYPES *eRet = (m_pStringToEnumMap->getValue(pTypeName));
 
-    if (eRet == NULL || *eRet == XSD_ERROR)
+    if (eRet == nullptr || *eRet == XSD_ERROR)
     {
         if (STRICTNESS_LEVEL >= MAXIMUM_STRICTNESS)
             assert(!"Unknown XSD built in data type");
@@ -573,7 +564,7 @@ const char* CSchemaMapManager::getTypeNameFromEnum(enum NODE_TYPES eType, bool b
 
     assert(!"Unknown XSD built-in type");
     PROGLOG("Unknown XSD built-in type");
-    return NULL;
+    return nullptr;
 }
 
 

configuration/configurator/SchemaMapManager.hpp → configuration/configurator/schemas/SchemaMapManager.hpp


configuration/configurator/SchemaMaxExclusive.cpp → configuration/configurator/schemas/SchemaMaxExclusive.cpp


configuration/configurator/SchemaMaxExclusive.hpp → configuration/configurator/schemas/SchemaMaxExclusive.hpp


configuration/configurator/SchemaMaxInclusive.cpp → configuration/configurator/schemas/SchemaMaxInclusive.cpp


configuration/configurator/SchemaMaxInclusive.hpp → configuration/configurator/schemas/SchemaMaxInclusive.hpp


configuration/configurator/SchemaMaxLength.cpp → configuration/configurator/schemas/SchemaMaxLength.cpp


configuration/configurator/SchemaMaxLength.hpp → configuration/configurator/schemas/SchemaMaxLength.hpp


configuration/configurator/SchemaMinExclusive.cpp → configuration/configurator/schemas/SchemaMinExclusive.cpp


configuration/configurator/SchemaMinExclusive.hpp → configuration/configurator/schemas/SchemaMinExclusive.hpp


configuration/configurator/SchemaMinInclusive.cpp → configuration/configurator/schemas/SchemaMinInclusive.cpp


configuration/configurator/SchemaMinInclusive.hpp → configuration/configurator/schemas/SchemaMinInclusive.hpp


configuration/configurator/SchemaMinLength.cpp → configuration/configurator/schemas/SchemaMinLength.cpp


configuration/configurator/SchemaMinLength.hpp → configuration/configurator/schemas/SchemaMinLength.hpp


configuration/configurator/SchemaPattern.cpp → configuration/configurator/schemas/SchemaPattern.cpp


configuration/configurator/SchemaPattern.hpp → configuration/configurator/schemas/SchemaPattern.hpp


+ 4 - 4
configuration/configurator/SchemaRestriction.cpp

@@ -49,7 +49,7 @@ void CRestriction::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_RESTRICTION_STR, offset);
+    quickOutHeader(cout, XSD_RESTRICTION_STR, offset);
     QUICK_OUT_2(Base);
     QUICK_OUT_2(ID);
     QUICK_OUT(cout, XSDXPath,  offset);
@@ -67,7 +67,7 @@ void CRestriction::dump(::std::ostream& cout, unsigned int offset) const
     QUICK_OUT_3(Pattern)
     QUICK_OUT_3(TotalDigits)
     QUICK_OUT_3(WhiteSpace)
-    QuickOutFooter(cout, XSD_RESTRICTION_STR, offset);
+    quickOutFooter(cout, XSD_RESTRICTION_STR, offset);
 }
 
 void CRestriction::getDocumentation(StringBuffer &strDoc) const
@@ -169,8 +169,8 @@ bool CRestriction::checkConstraint(const char *pValue) const
             if (pNodeSimpleContent != NULL && pNodeSimpleContent->checkConstraint(pValue) == false)
                 return false;
         }
-         assert(!"Unknown base node in restriction");
-         return false;
+        assert(!"Unknown base node in restriction");
+        return false;
     }
     return true;
 }

configuration/configurator/SchemaRestriction.hpp → configuration/configurator/schemas/SchemaRestriction.hpp


+ 63 - 71
configuration/configurator/SchemaSchema.cpp

@@ -31,17 +31,16 @@ using namespace CONFIGURATOR;
 
 CSchema::~CSchema()
 {
-    assert(this->getLinkCount() == 1);
 }
 
 CSchema* CSchema::load(const char* pSchemaLocation, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(pSchemaRoot != NULL);
-    if (pSchemaRoot == NULL)
-        return NULL;
+    assert(pSchemaRoot != nullptr);
+    if (pSchemaRoot == nullptr)
+        return nullptr;
 
     CConfigSchemaHelper *pSchemaHelper = (CConfigSchemaHelper::getInstance());
-    if (pSchemaHelper->getSchemaMapManager()->getSchemaForXSD(pSchemaLocation) != NULL)  // check to see if the this schema has already been processed
+    if (pSchemaHelper->getSchemaMapManager()->getSchemaForXSD(pSchemaLocation) != nullptr)  // check to see if the this schema has already been processed
         return pSchemaHelper->getSchemaMapManager()->getSchemaForXSD(pSchemaLocation);
 
 
@@ -49,40 +48,38 @@ CSchema* CSchema::load(const char* pSchemaLocation, const IPropertyTree *pSchema
     pSchema->setXSDXPath(xpath);
 
     IPropertyTree *pTree = pSchemaRoot->queryPropTree(xpath);
-    if (pTree == NULL)
-        return NULL;
+    if (pTree == nullptr)
+        return nullptr;
 
     pSchema->setXMLNS_XS(pTree->queryProp(XML_ATTR_XMLNS_XS));
     pSchema->setElementFormDefault(pTree->queryProp(XML_ATTR_ELEMENTFORMDEFAULT));
     pSchema->setAttributeFormDefault(pTree->queryProp(XML_ATTR_ATTRIBUTEFORMDEFAULT));
 
     StringBuffer strXPathExt(xpath);
-    strXPathExt.clear().append(xpath).append(XSD_TAG_INCLUDE);
 
-    CIncludeArray* pIncludeArray = NULL;//CIncludeArray::load(pSchema, pSchemaRoot, strXPathExt); // change this back to be uncommented
-
-    strXPathExt.clear().append(xpath).append(XSD_TAG_SIMPLE_TYPE);
+    strXPathExt.append(XSD_TAG_INCLUDE);
+    CIncludeArray* pIncludeArray = CIncludeArray::load(pSchema, pSchemaRoot, strXPathExt);
 
+    strXPathExt.setf("%s%s",xpath, XSD_TAG_SIMPLE_TYPE);
     CSimpleTypeArray* pSimpleTypeArray = CSimpleTypeArray::load(pSchema, pSchemaRoot, strXPathExt);
 
-    strXPathExt.clear().append(xpath).append(XSD_TAG_COMPLEX_TYPE);
+    strXPathExt.setf("%s%s",xpath, XSD_TAG_COMPLEX_TYPE);
     CComplexTypeArray* pComplexTypeArray = CComplexTypeArray::load(pSchema, pSchemaRoot, strXPathExt);
 
-    strXPathExt.clear().append(xpath).append(XSD_TAG_ELEMENT);
-    //CElementArray* pElemArray = CElementArray::load(pSchema, pSchemaRoot, strXPathExt.str());
+    strXPathExt.setf("%s%s",xpath, XSD_TAG_ELEMENT);
     CArrayOfElementArrays* pArrayOfElemArray = CArrayOfElementArrays::load(pSchema, pSchemaRoot, strXPathExt.str());
 
-    strXPathExt.clear().append(xpath).append(XSD_TAG_ATTRIBUTE_GROUP);
+    strXPathExt.setf("%s%s",xpath, XSD_TAG_ATTRIBUTE_GROUP);
     CAttributeGroupArray* pAttributeGroupArray = CAttributeGroupArray::load(pSchema, pSchemaRoot, strXPathExt);
 
-    strXPathExt.clear().append(xpath).append(XSD_TAG_ANNOTATION);
+    strXPathExt.setf("%s%s",xpath, XSD_TAG_ANNOTATION);
     CAnnotation* pAnnotation = CAnnotation::load(pSchema, pSchemaRoot, strXPathExt);
     pSchema->m_pAnnotation = pAnnotation;
 
     pSchema->m_pArrayElementOfArrays = pArrayOfElemArray;
     pSchema->m_pComplexTypeArray = pComplexTypeArray;
 
-    if (pSchema->m_pAttributeGroupArray == NULL)
+    if (pSchema->m_pAttributeGroupArray == nullptr)
         pSchema->m_pAttributeGroupArray = pAttributeGroupArray;
     else
         // copy contents from from pAttributeGroupArray to pSchema->m_pAttributeGroupArray
@@ -101,13 +98,13 @@ CSchema* CSchema::load(const char* pSchemaLocation, const IPropertyTree *pSchema
 
 CSchema* CSchema::load(const char* pSchemaLocation, CXSDNodeBase* pParentNode)
 {
-    if (pSchemaLocation == NULL)
-        return NULL;
+    if (pSchemaLocation == nullptr)
+        return nullptr;
 
     Linked<IPropertyTree> pSchemaRoot;
     StringBuffer schemaPath;
 
-    if (CConfigSchemaHelper::getInstance()->getBasePath() == NULL)
+    if (CConfigSchemaHelper::getInstance()->getBasePath() == nullptr)
         schemaPath.appendf("%s%s", DEFAULT_SCHEMA_DIRECTORY, pSchemaLocation);
     else
         schemaPath.appendf("%s/%s", CConfigSchemaHelper::getInstance()->getBasePath(), pSchemaLocation);
@@ -133,40 +130,40 @@ void CSchema::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_SCHEMA_STR, offset);
+    quickOutHeader(cout, XSD_SCHEMA_STR, offset);
     QUICK_OUT_2(XMLNS_XS);
     QUICK_OUT_2(ElementFormDefault);
     QUICK_OUT_2(AttributeFormDefault);
     QUICK_OUT(cout, XSDXPath,  offset);
     QUICK_OUT(cout, EnvXPath,  offset);
 
-    if (m_pArrayElementOfArrays != NULL)
+    if (m_pArrayElementOfArrays != nullptr)
         m_pArrayElementOfArrays->dump(cout, offset);
-    if (m_pComplexTypeArray != NULL)
+    if (m_pComplexTypeArray != nullptr)
         m_pComplexTypeArray->dump(cout, offset);
-    if (m_pSimpleTypeArray != NULL)
+    if (m_pSimpleTypeArray != nullptr)
         m_pSimpleTypeArray->dump(cout, offset);
-    if (m_pIncludeArray != NULL)
+    if (m_pIncludeArray != nullptr)
         m_pIncludeArray->dump(cout, offset);
-    if (m_pAnnotation != NULL)
+    if (m_pAnnotation != nullptr)
         m_pAnnotation->dump(cout, offset);
-    if (m_pAttributeGroupArray != NULL)
+    if (m_pAttributeGroupArray != nullptr)
         m_pAttributeGroupArray->dump(cout, offset);
 
-    QuickOutFooter(cout, XSD_SCHEMA_STR, offset);
+    quickOutFooter(cout, XSD_SCHEMA_STR, offset);
 }
 
 void CSchema::getDocumentation(StringBuffer &strDoc) const
 {
-    if (m_pArrayElementOfArrays != NULL)
+    if (m_pArrayElementOfArrays != nullptr)
         m_pArrayElementOfArrays->getDocumentation(strDoc);
-    if (m_pComplexTypeArray != NULL)
+    if (m_pComplexTypeArray != nullptr)
         m_pComplexTypeArray->getDocumentation(strDoc);
-    if (m_pAttributeGroupArray != NULL)
+    if (m_pAttributeGroupArray != nullptr)
         m_pAttributeGroupArray->getDocumentation(strDoc);
-    if (m_pSimpleTypeArray != NULL)
+    if (m_pSimpleTypeArray != nullptr)
         m_pSimpleTypeArray->getDocumentation(strDoc);
-    if (m_pIncludeArray != NULL)
+    if (m_pIncludeArray != nullptr)
         m_pIncludeArray->getDocumentation(strDoc);
 
     strDoc.append(DM_SECT2_END);
@@ -176,10 +173,10 @@ void CSchema::getJSON(StringBuffer &strJSON, unsigned int offset, int idx) const
 {
     strJSON.append(JSON_BEGIN);
     offset += STANDARD_OFFSET_1;
-    QuickOutPad(strJSON, offset);
+    quickOutPad(strJSON, offset);
 
     //offset -= STANDARD_OFFSET_1;
-    if (m_pArrayElementOfArrays != NULL)
+    if (m_pArrayElementOfArrays != nullptr)
     {
         //strJSON.append("{");
         m_pArrayElementOfArrays->item(0).getJSON(strJSON, offset, idx);
@@ -187,7 +184,7 @@ void CSchema::getJSON(StringBuffer &strJSON, unsigned int offset, int idx) const
         //m_pArrayElementOfArrays->getJSON(strJSON, offset, idx);
         //DEBUG_MARK_JSON;
     }
-    if (m_pComplexTypeArray != NULL)
+    if (m_pComplexTypeArray != nullptr)
     {
         //m_pComplexTypeArray->getJSON(strJSON, offset);
         //DEBUG_MARK_JSON;
@@ -201,40 +198,34 @@ void  CSchema::populateEnvXPath(StringBuffer strXPath, unsigned int index)
 {
     strXPath.append("./").append(XML_TAG_SOFTWARE);
 
-    if (m_pArrayElementOfArrays != NULL)
-    {
+    if (m_pArrayElementOfArrays != nullptr)
         m_pArrayElementOfArrays->populateEnvXPath(strXPath);
-        //CConfigSchemaHelper::getInstance()->getSchemaMapManager()->addMapOfXSDXPathToElementArray(m_pArrayElementOfArrays->getXSDXPath(), m_pArrayElementOfArrays);
-    }
-    if (m_pAttributeGroupArray != NULL)
+    if (m_pAttributeGroupArray != nullptr)
         m_pAttributeGroupArray->populateEnvXPath(strXPath);
-    if (m_pSimpleTypeArray != NULL)
+    if (m_pSimpleTypeArray != nullptr)
         m_pSimpleTypeArray->populateEnvXPath(strXPath);
-    if (m_pIncludeArray != NULL)
+    if (m_pIncludeArray != nullptr)
         m_pIncludeArray->populateEnvXPath(strXPath);
-    if (m_pComplexTypeArray != NULL)
-    {
-        assert(m_pComplexTypeArray != 0);
+    if (m_pComplexTypeArray != nullptr)
         m_pComplexTypeArray->populateEnvXPath(strXPath);
-    }
     this->setEnvXPath(strXPath);
 }
 
 void CSchema::loadXMLFromEnvXml(const IPropertyTree *pEnvTree)
 {
-    assert(pEnvTree != NULL);
+    assert(pEnvTree != nullptr);
 
-    if (m_pArrayElementOfArrays != NULL)
+    if (m_pArrayElementOfArrays != nullptr)
         m_pArrayElementOfArrays->loadXMLFromEnvXml(pEnvTree);
-    if (m_pComplexTypeArray != NULL)
+    if (m_pComplexTypeArray != nullptr)
         m_pComplexTypeArray->loadXMLFromEnvXml(pEnvTree);
-    if (m_pAttributeGroupArray != NULL)
+    if (m_pAttributeGroupArray != nullptr)
         m_pAttributeGroupArray->loadXMLFromEnvXml(pEnvTree);
-    if (m_pSimpleTypeArray != NULL)
+    if (m_pSimpleTypeArray != nullptr)
         m_pSimpleTypeArray->loadXMLFromEnvXml(pEnvTree);
-    if (m_pIncludeArray != NULL)
+    if (m_pIncludeArray != nullptr)
         m_pIncludeArray->loadXMLFromEnvXml(pEnvTree);
-    if (m_pAttributeGroupArray != NULL)
+    if (m_pAttributeGroupArray != nullptr)
         m_pAttributeGroupArray->loadXMLFromEnvXml(pEnvTree);
 
     CConfigSchemaHelper::getInstance()->processAttributeGroupArr();
@@ -242,12 +233,13 @@ void CSchema::loadXMLFromEnvXml(const IPropertyTree *pEnvTree)
 
 const char* CSchema::getXML(const char* /*pComponent*/)
 {
+    int length;
+
     if (m_strXML.length() == 0)
     {
-        int length =  m_pArrayElementOfArrays->length();
-
-        if (m_pArrayElementOfArrays != NULL)
+        if (m_pArrayElementOfArrays != nullptr)
         {
+            length =  m_pArrayElementOfArrays->length();
             for (int idx = 0; idx < length; idx++)
             {
                 CElementArray &ElementArray = m_pArrayElementOfArrays->item(idx);
@@ -256,20 +248,20 @@ const char* CSchema::getXML(const char* /*pComponent*/)
                 {
                     CElement &Element = ElementArray.item(idx2);
 
-                    m_strXML.append(Element.getXML(NULL));
+                    m_strXML.append(Element.getXML(nullptr));
 
                     if (idx+2 < length)
                         m_strXML.append("\n");
                 }
             }
         }
-        if (m_pAttributeGroupArray != NULL)
+        if (m_pAttributeGroupArray != nullptr)
         {
             length = m_pAttributeGroupArray->length();
             for (int idx = 0; idx < length; idx++)
             {
                 CAttributeGroup &AttributeGroup  = m_pAttributeGroupArray->item(idx);
-                m_strXML.append(AttributeGroup.getXML(NULL));
+                m_strXML.append(AttributeGroup.getXML(nullptr));
 
                 if (idx+1 < length)
                     m_strXML.append("\n");
@@ -278,38 +270,38 @@ const char* CSchema::getXML(const char* /*pComponent*/)
 
         m_strXML.append("/>\n");
 
-        if (m_pComplexTypeArray != NULL)
+        if (m_pComplexTypeArray != nullptr)
         {
             length = m_pComplexTypeArray->length();
             for (int idx = 0; idx < length; idx++)
             {
                 CComplexType &ComplexType = m_pComplexTypeArray->item(idx);
-                m_strXML.append(ComplexType.getXML(NULL));
+                m_strXML.append(ComplexType.getXML(nullptr));
 
                 if (idx+1 < length)
                      m_strXML.append("\n");
             }
         }
-        if (m_pSimpleTypeArray != NULL)
+        if (m_pSimpleTypeArray != nullptr)
         {
             length = m_pSimpleTypeArray->length();
             for (int idx = 0; idx < length; idx++)
             {
                 CSimpleType &SimpleType = m_pSimpleTypeArray->item(idx);
 
-                m_strXML.append(SimpleType.getXML(NULL));
+                m_strXML.append(SimpleType.getXML(nullptr));
 
                 if (idx+1 < length)
                     m_strXML.append("\n");
             }
         }
-        if (m_pIncludeArray != NULL)
+        if (m_pIncludeArray != nullptr)
         {
             length = m_pIncludeArray->length();
             for (int idx = 0; idx < length; idx++)
             {
                 CInclude &Include = m_pIncludeArray->item(idx);
-                m_strXML.append(Include.getXML(NULL));
+                m_strXML.append(Include.getXML(nullptr));
 
                 if (idx+1 < length)
                     m_strXML.append("\n");
@@ -321,10 +313,10 @@ const char* CSchema::getXML(const char* /*pComponent*/)
 
 CXSDNode* CSchema::getExtensionType(const char* pExtensionTypeName) const
 {
-    if (pExtensionTypeName == NULL)
-        return NULL;
+    if (pExtensionTypeName == nullptr)
+        return nullptr;
 
-    if (m_pSimpleTypeArray != NULL)
+    if (m_pSimpleTypeArray != nullptr)
     {
         int length = m_pSimpleTypeArray->length();
 
@@ -336,7 +328,7 @@ CXSDNode* CSchema::getExtensionType(const char* pExtensionTypeName) const
                 return &SimpleType;
         }
     }
-    if (m_pComplexTypeArray != NULL)
+    if (m_pComplexTypeArray != nullptr)
     {
         int length = m_pComplexTypeArray->length();
 
@@ -348,7 +340,7 @@ CXSDNode* CSchema::getExtensionType(const char* pExtensionTypeName) const
                 return &ComplexType;
         }
     }
-    return NULL;
+    return nullptr;
 }
 
 const char* CSchema::getSchemaFileName() const

+ 1 - 1
configuration/configurator/SchemaSchema.hpp

@@ -26,7 +26,7 @@
 namespace CONFIGURATOR
 {
 
-class CSchema : public InterfaceImpl, public CXSDNodeBase
+class CSchema : public CInterface, public CXSDNodeBase
 {
 public:
 

+ 20 - 27
configuration/configurator/SchemaSelector.cpp

@@ -25,52 +25,45 @@ using namespace CONFIGURATOR;
 
 CSelector* CSelector::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(pSchemaRoot != NULL);
-    assert(pParentNode != NULL);
+    assert(pSchemaRoot != nullptr);
+    assert(pParentNode != nullptr);
     assert(pParentNode->getNodeType() == XSD_KEY || pParentNode->getNodeType() == XSD_KEYREF || pParentNode->getNodeType() == XSD_UNIQUE);
 
-    if (pSchemaRoot == NULL || pParentNode == NULL)
+    if (pSchemaRoot == nullptr || pParentNode == nullptr)
     {
         // TODO: Throw Exception
         assert(false);
-        return NULL;
+        return nullptr;
     }
 
-    CSelector *pSelector = NULL;
+    CSelector *pSelector = nullptr;
 
-    if (xpath != NULL && *xpath != 0)
+    if (xpath != nullptr && *xpath != 0)
     {
         IPropertyTree* pTree = pSchemaRoot->queryPropTree(xpath);
 
-        if (pTree == NULL)
+        if (pTree == nullptr)
         {
             assert(!"Selector required");
             // TODO: throw MakeExceptionFromMap("EX_STR_MISSING_SELECTOR_MISSING");
         }
-        const char* pXPath = pSchemaRoot->getPropTree(xpath)->queryProp(XML_ATTR_XPATH);
-        assert(pXPath != NULL && *pXPath != 0);
+        const char* pXPath = pTree->queryProp(XML_ATTR_XPATH);
+        assert(pXPath != nullptr && *pXPath != 0);
 
-        if (pXPath == NULL || *pXPath == 0)
+        if (pXPath == nullptr || *pXPath == 0)
         {
             assert(!"Throw Exception");
-            return NULL;
+            return nullptr;
              // TODO: throw exception
         }
-        if (pXPath != NULL)
-        {
-            pSelector = new CSelector(pParentNode);
-            pSelector->setXSDXPath(xpath);
-            pSelector->setXPath(pXPath);
-        }
-        else
-        {
-            assert(!"selector can not be be empty!");
-            // TODO: throw MakeExceptionFromMap(EX_STR_MISSING_VALUE_ATTRIBUTE_IN_LENGTH);
-        }
 
-        const char *pID = pSchemaRoot->getPropTree(xpath)->queryProp(XML_ATTR_ID);
-        if (pID != NULL)
-         pSelector->setID(pID);
+        pSelector = new CSelector(pParentNode);
+        pSelector->setXSDXPath(xpath);
+        pSelector->setXPath(pXPath);
+
+        const char *pID = pTree->queryProp(XML_ATTR_ID);
+        if (pID != nullptr)
+            pSelector->setID(pID);
     }
     return pSelector;
 }
@@ -79,11 +72,11 @@ void CSelector::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset += STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_SELECTOR_STR, offset);
+    quickOutHeader(cout, XSD_SELECTOR_STR, offset);
     QUICK_OUT(cout, XPath, offset);
     QUICK_OUT(cout, ID, offset);
     QUICK_OUT(cout, XSDXPath,  offset);
-    QuickOutFooter(cout, XSD_SELECTOR_STR, offset);
+    quickOutFooter(cout, XSD_SELECTOR_STR, offset);
 }
 
 void CSelector::populateEnvXPath(StringBuffer strXPath, unsigned int index)

configuration/configurator/SchemaSelector.hpp → configuration/configurator/schemas/SchemaSelector.hpp


+ 2 - 2
configuration/configurator/SchemaSequence.cpp

@@ -68,13 +68,13 @@ void CSequence::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_SEQUENCE_STR, offset);
+    quickOutHeader(cout, XSD_SEQUENCE_STR, offset);
     QUICK_OUT(cout, XSDXPath,  offset);
 
     if (m_pArrayOfElementArrays != NULL)
         m_pArrayOfElementArrays->dump(cout, offset);
 
-    QuickOutFooter(cout, XSD_SEQUENCE_STR, offset);
+    quickOutFooter(cout, XSD_SEQUENCE_STR, offset);
 }
 
 void CSequence::getDocumentation(StringBuffer &strDoc) const

configuration/configurator/SchemaSequence.hpp → configuration/configurator/schemas/SchemaSequence.hpp


+ 17 - 13
configuration/configurator/SchemaSimpleContent.cpp

@@ -26,37 +26,41 @@ using namespace CONFIGURATOR;
 
 CSimpleContent* CSimpleContent::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    if (pParentNode == NULL || pSchemaRoot == NULL)
-        return NULL;
+    if (pParentNode == nullptr || pSchemaRoot == nullptr)
+        return nullptr;
 
-    CExtension *pExtension = NULL;
-    CAnnotation *pAnnotation = NULL;
-    CRestriction *pRestriction = NULL;
+    CExtension *pExtension = nullptr;
+    CAnnotation *pAnnotation = nullptr;
+    CRestriction *pRestriction = nullptr;
     IPropertyTree *pTree = pSchemaRoot->queryPropTree(xpath);
+
+    if(pTree == nullptr)
+        return nullptr;
+
     StringBuffer strXPathExt(xpath);
     strXPathExt.append("/").append(XSD_TAG_EXTENSION);
 
-    if (pSchemaRoot->queryPropTree(strXPathExt.str()) != NULL)
+    if (pSchemaRoot->queryPropTree(strXPathExt.str()) != nullptr)
     {
-        pExtension = CExtension::load(NULL, pSchemaRoot, strXPathExt.str());
+        pExtension = CExtension::load(nullptr, pSchemaRoot, strXPathExt.str());
 
-        if (pExtension != NULL)
+        if (pExtension != nullptr)
             pExtension->initExtension();
     }
 
     strXPathExt.set(xpath);
     strXPathExt.append("/").append(XSD_TAG_ANNOTATION);
 
-    if (pSchemaRoot->queryPropTree(strXPathExt.str()) != NULL)
-        pAnnotation = CAnnotation::load(NULL, pSchemaRoot, strXPathExt.str());
+    if (pSchemaRoot->queryPropTree(strXPathExt.str()) != nullptr)
+        pAnnotation = CAnnotation::load(nullptr, pSchemaRoot, strXPathExt.str());
 
     strXPathExt.set(xpath);
     strXPathExt.append("/").append(XSD_TAG_RESTRICTION);
 
-    if (pSchemaRoot->queryPropTree(strXPathExt.str()) != NULL)
-        pRestriction = CRestriction::load(NULL, pSchemaRoot, strXPathExt.str());
+    if (pSchemaRoot->queryPropTree(strXPathExt.str()) != nullptr)
+        pRestriction = CRestriction::load(nullptr, pSchemaRoot, strXPathExt.str());
 
-    const char* pID =  NULL;
+    const char* pID =  nullptr;
     pID = pTree->queryProp(XML_ATTR_ID);
 
     CSimpleContent *pSimpleContent = new CSimpleContent(pParentNode, pID);

configuration/configurator/SchemaSimpleContent.hpp → configuration/configurator/schemas/SchemaSimpleContent.hpp


+ 29 - 33
configuration/configurator/SchemaSimpleType.cpp

@@ -30,34 +30,34 @@ using namespace CONFIGURATOR;
 
 CXSDNodeBase* CSimpleType::getNodeByTypeAndNameAscending(NODE_TYPES eNodeType, const char *pName)
 {
-    return (this->checkSelf(eNodeType, pName, this->getName()) ? this : NULL);
+    return (this->checkSelf(eNodeType, pName, this->getName()) ? this : nullptr);
 }
 
 CXSDNodeBase* CSimpleType::getNodeByTypeAndNameDescending(NODE_TYPES eNodeType, const char *pName)
 {
-    return (this->checkSelf(eNodeType, pName, this->getName()) ? this : NULL);
+    return (this->checkSelf(eNodeType, pName, this->getName()) ? this : nullptr);
 }
 
 void CSimpleType::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_SIMPLE_TYPE_STR, offset);
+    quickOutHeader(cout, XSD_SIMPLE_TYPE_STR, offset);
     QUICK_OUT_2(Name);
     QUICK_OUT_2(ID);
     QUICK_OUT(cout, XSDXPath,   offset);
     QUICK_OUT(cout, EnvXPath,  offset);
     QUICK_OUT(cout, EnvValueFromXML,  offset);
 
-    if (m_pRestriction != NULL)
+    if (m_pRestriction != nullptr)
         m_pRestriction->dump(cout, offset);
 
-    QuickOutFooter(cout, XSD_SIMPLE_TYPE_STR, offset);
+    quickOutFooter(cout, XSD_SIMPLE_TYPE_STR, offset);
 }
 
 void CSimpleType::getDocumentation(StringBuffer &strDoc) const
 {
-    if (m_pRestriction != NULL)
+    if (m_pRestriction != nullptr)
         m_pRestriction->getDocumentation(strDoc);
 }
 
@@ -65,51 +65,47 @@ void CSimpleType::populateEnvXPath(StringBuffer strXPath, unsigned int index)
 {
     this->setEnvXPath(strXPath);
 
-    if (this->m_pRestriction != NULL)
+    if (this->m_pRestriction != nullptr)
         this->m_pRestriction->populateEnvXPath(strXPath);
 }
 
 void CSimpleType::loadXMLFromEnvXml(const IPropertyTree *pEnvTree)
 {
-    assert(pEnvTree != NULL);
+    assert(pEnvTree != nullptr);
 
-    if (this->m_pRestriction != NULL)
+    if (this->m_pRestriction != nullptr)
         this->m_pRestriction->loadXMLFromEnvXml(pEnvTree);
 }
 
 CSimpleType* CSimpleType::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(pSchemaRoot != NULL);
+    assert(pSchemaRoot != nullptr);
 
-    if (pSchemaRoot == NULL || pParentNode == NULL)
-        return NULL;
+    if (pSchemaRoot == nullptr || pParentNode == nullptr)
+        return nullptr;
 
     IPropertyTree *pTree = pSchemaRoot->queryPropTree(xpath);
 
-    if (pTree == NULL)
-        return NULL;
+    if (pTree == nullptr)
+        return nullptr;
 
-    const char* pName =  NULL;
-    const char* pID =  NULL;
+    const char* pName =  nullptr;
+    const char* pID =  nullptr;
 
     pName = pTree->queryProp(XML_ATTR_NAME);
     pID = pTree->queryProp(XML_ATTR_ID);
 
     CSimpleType* pSimpleType = new CSimpleType(pParentNode, pName,pID);
     pSimpleType->setXSDXPath(xpath);
-    assert(pSimpleType != NULL);
-
-    if (pSimpleType == NULL)
-        return NULL;
 
     StringBuffer strXPathExt(xpath);
     strXPathExt.append("/").append(XSD_TAG_RESTRICTION);
 
     CRestriction *pRestriction = CRestriction::load(pSimpleType, pSchemaRoot, strXPathExt.str());
 
-    if (pRestriction != NULL)
+    if (pRestriction != nullptr)
         pSimpleType->setRestriciton(pRestriction);
-    if (pName != NULL)
+    if (pName != nullptr)
         CConfigSchemaHelper::getInstance()->getSchemaMapManager()->setSimpleTypeWithName(pName, pSimpleType);
 
     return pSimpleType;
@@ -122,8 +118,8 @@ const char* CSimpleType::getXML(const char* /*pComponent*/)
         m_strXML.append("<").append(getName()).append("\n");
         m_strXML.append("<").append(getID()).append("\n");
 
-        if (m_pRestriction != NULL)
-            m_strXML.append(m_pRestriction->getXML(NULL));
+        if (m_pRestriction != nullptr)
+            m_strXML.append(m_pRestriction->getXML(nullptr));
 
         m_strXML.append("/>\n");
     }
@@ -132,7 +128,7 @@ const char* CSimpleType::getXML(const char* /*pComponent*/)
 
 bool CSimpleType::checkConstraint(const char *pValue) const
 {
-    if (this->getRestriction() == NULL)
+    if (this->getRestriction() == nullptr)
         return true;
     else
         return this->getRestriction()->checkConstraint(pValue);
@@ -142,20 +138,20 @@ void CSimpleTypeArray::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_SIMPLE_TYPE_ARRAY_STR, offset);
+    quickOutHeader(cout, XSD_SIMPLE_TYPE_ARRAY_STR, offset);
     QUICK_OUT(cout, XSDXPath, offset);
     QUICK_OUT(cout, EnvXPath,  offset);
     QUICK_OUT(cout, EnvValueFromXML,  offset);
     QUICK_OUT_ARRAY(cout, offset);
-    QuickOutFooter(cout, XSD_SIMPLE_TYPE_ARRAY_STR, offset);
+    quickOutFooter(cout, XSD_SIMPLE_TYPE_ARRAY_STR, offset);
 }
 
 CSimpleTypeArray* CSimpleTypeArray::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(pParentNode != NULL);
-    assert(pSchemaRoot != NULL);
-    if (pSchemaRoot == NULL)
-        return NULL;
+    assert(pParentNode != nullptr);
+    assert(pSchemaRoot != nullptr);
+    if (pSchemaRoot == nullptr)
+        return nullptr;
 
     CSimpleTypeArray *pSimpleTypeArray = new CSimpleTypeArray(pParentNode);
     pSimpleTypeArray->setXSDXPath(xpath);
@@ -170,7 +166,7 @@ CSimpleTypeArray* CSimpleTypeArray::load(CXSDNodeBase* pParentNode, const IPrope
 
         CSimpleType *pSimpleType = CSimpleType::load(pSimpleTypeArray, pSchemaRoot, strXPathExt.str());
 
-        assert(pSimpleType != NULL);
+        assert(pSimpleType != nullptr);
         pSimpleTypeArray->append(*pSimpleType);
 
         count++;
@@ -193,6 +189,6 @@ void CSimpleTypeArray::populateEnvXPath(StringBuffer strXPath, unsigned int inde
 
 void CSimpleTypeArray::loadXMLFromEnvXml(const IPropertyTree *pEnvTree)
 {
-    assert(pEnvTree != NULL);
+    assert(pEnvTree != nullptr);
     QUICK_LOAD_ENV_XML(pEnvTree)
 }

+ 6 - 6
configuration/configurator/SchemaSimpleType.hpp

@@ -56,10 +56,10 @@ public:
 
     void setRestriciton(CRestriction *pRestriction)
     {
-        if (m_pRestriction != NULL)
+        if (m_pRestriction != nullptr)
         {
             m_pRestriction->Release();
-            m_pRestriction = NULL;
+            m_pRestriction = nullptr;
         }
         m_pRestriction = pRestriction;
     }
@@ -68,7 +68,7 @@ public:
 
 protected:
 
-    CSimpleType(CXSDNodeBase* pRootNode, const char* pName = NULL, const char* pID = NULL, CRestriction* pRestriction = NULL) : CXSDNode::CXSDNode(pRootNode, XSD_SIMPLE_TYPE),m_strName(pName), m_strID(pID), m_pRestriction(pRestriction)
+    CSimpleType(CXSDNodeBase* pRootNode, const char* pName = nullptr, const char* pID = nullptr, CRestriction* pRestriction = nullptr) : CXSDNode::CXSDNode(pRootNode, XSD_SIMPLE_TYPE),m_strName(pName), m_strID(pID), m_pRestriction(pRestriction)
     {
     }
 
@@ -76,12 +76,12 @@ protected:
 
 private:
 
-    CSimpleType() : CXSDNode::CXSDNode(NULL)
+    CSimpleType() : CXSDNode::CXSDNode(nullptr)
     {
     }
 };
 
-class CSimpleTypeArray : public CIArrayOf<CSimpleType>, public InterfaceImpl, public CXSDNodeBase
+class CSimpleTypeArray : public CIArrayOf<CSimpleType>, public CInterface, public CXSDNodeBase
 {
 public:
 
@@ -104,7 +104,7 @@ protected:
 
 private:
 
-    CSimpleTypeArray() : CXSDNodeBase::CXSDNodeBase(NULL)
+    CSimpleTypeArray() : CXSDNodeBase::CXSDNodeBase(nullptr)
     {
     }
 };

configuration/configurator/SchemaTotalDigits.cpp → configuration/configurator/schemas/SchemaTotalDigits.cpp


configuration/configurator/SchemaTotalDigits.hpp → configuration/configurator/schemas/SchemaTotalDigits.hpp


+ 24 - 24
configuration/configurator/SchemaUnique.cpp

@@ -21,26 +21,26 @@ using namespace CONFIGURATOR;
 
 CUnique* CUnique::load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(pSchemaRoot != NULL);
-    assert(pParentNode != NULL);
+    assert(pSchemaRoot != nullptr);
+    assert(pParentNode != nullptr);
     assert(pParentNode->getNodeType() == XSD_UNIQUE_ARRAY);
 
-    if (pSchemaRoot == NULL || pParentNode == NULL) 
-        return NULL;    // TODO: Throw Exception
+    if (pSchemaRoot == nullptr || pParentNode == nullptr)
+        return nullptr;    // TODO: Throw Exception
 
-    CUnique *pUnique = NULL;
+    CUnique *pUnique = nullptr;
 
-    if (xpath != NULL && *xpath != 0)
+    if (xpath != nullptr && *xpath != 0)
     {
         IPropertyTree* pTree = pSchemaRoot->queryPropTree(xpath);
 
-        if (pTree == NULL)
-            return NULL;
+        if (pTree == nullptr)
+            return nullptr;
 
-        const char* pName = pSchemaRoot->getPropTree(xpath)->queryProp(XML_ATTR_NAME);
-        assert(pName != NULL && *pName != 0);
+        const char* pName = pTree->queryProp(XML_ATTR_NAME);
+        assert(pName != nullptr && *pName != 0);
 
-        if (pName == NULL || *pName == 0)
+        if (pName == nullptr || *pName == 0)
             assert(!"Throw Exception name can not be empty");     // TODO: throw exception
         else
         {
@@ -48,8 +48,8 @@ CUnique* CUnique::load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSchema
             pUnique->setXSDXPath(xpath);
         }
 
-        const char *pID = pSchemaRoot->getPropTree(xpath)->queryProp(XML_ATTR_ID);
-        if (pID != NULL)
+        const char *pID = pTree->queryProp(XML_ATTR_ID);
+        if (pID != nullptr)
             pUnique->setID(pID);
     }
     return pUnique;
@@ -59,21 +59,21 @@ void CUnique::dump(::std::ostream& cout, unsigned int offset) const
 {
     offset += STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_UNIQUE_STR, offset);
+    quickOutHeader(cout, XSD_UNIQUE_STR, offset);
     QUICK_OUT(cout, ID, offset);
     QUICK_OUT(cout, Name, offset);
     QUICK_OUT(cout, XSDXPath,  offset);
-    QuickOutFooter(cout, XSD_UNIQUE_STR, offset);
+    quickOutFooter(cout, XSD_UNIQUE_STR, offset);
 }
 
 CUniqueArray* CUniqueArray::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    assert(pSchemaRoot != NULL);
-    if (pSchemaRoot == NULL || xpath == NULL)
-        return NULL;
+    assert(pSchemaRoot != nullptr);
+    if (pSchemaRoot == nullptr || xpath == nullptr)
+        return nullptr;
 
     Owned<IPropertyTreeIterator> attributeIter = pSchemaRoot->getElements(xpath, ipt_ordered);
-    StringBuffer strXPathExt(xpath);
+    StringBuffer strXPathExt;
 
     CUniqueArray *pUniqueArray = new CUniqueArray(pParentNode);
     pUniqueArray->setXSDXPath(xpath);
@@ -81,11 +81,11 @@ CUniqueArray* CUniqueArray::load(CXSDNodeBase* pParentNode, const IPropertyTree
     int count = 1;
     ForEach(*attributeIter)
     {
-        strXPathExt.clear().append(xpath).appendf("[%d]",count);
+        strXPathExt.setf("%s[%d]", xpath, count);
 
         CUnique *pUnique = CUnique::load(pUniqueArray, pSchemaRoot, strXPathExt.str());
 
-        if (pUnique != NULL)
+        if (pUnique != nullptr)
             pUniqueArray->append(*pUnique);
 
         count++;
@@ -94,7 +94,7 @@ CUniqueArray* CUniqueArray::load(CXSDNodeBase* pParentNode, const IPropertyTree
     if (pUniqueArray->length() == 0)
     {
         delete pUniqueArray;
-        pUniqueArray = NULL;
+        pUniqueArray = nullptr;
     }
     return pUniqueArray;
 }
@@ -103,11 +103,11 @@ void CUniqueArray::dump(::std::ostream &cout, unsigned int offset) const
 {
     offset+= STANDARD_OFFSET_1;
 
-    QuickOutHeader(cout, XSD_UNIQUE_ARRAY_STR, offset);
+    quickOutHeader(cout, XSD_UNIQUE_ARRAY_STR, offset);
     QUICK_OUT(cout, XSDXPath,  offset);
     QUICK_OUT(cout, EnvXPath,  offset);
     QUICK_OUT_ARRAY(cout, offset);
-    QuickOutFooter(cout, XSD_UNIQUE_ARRAY_STR, offset);
+    quickOutFooter(cout, XSD_UNIQUE_ARRAY_STR, offset);
 }
 
 

+ 1 - 1
configuration/configurator/SchemaUnique.hpp

@@ -58,7 +58,7 @@ protected:
 
 };
 
-class CUniqueArray : public CIArrayOf<CUnique>, public InterfaceImpl, public CXSDNodeBase
+class CUniqueArray : public CIArrayOf<CUnique>, public CInterface, public CXSDNodeBase
 {
 public:
 

+ 2 - 6
configuration/configurator/SchemaWhiteSpace.cpp

@@ -1,6 +1,6 @@
 /*##############################################################################
 
-    HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems®.
+    HPCC SYSTEMS software Copyright (C) 2016 HPCC Systems®.
 
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
@@ -21,9 +21,5 @@ using namespace CONFIGURATOR;
 
 CWhiteSpace* CWhiteSpace::load(CXSDNodeBase* pParentNode, const ::IPropertyTree *pSchemaRoot, const char* xpath)
 {
-    CWhiteSpace *pWhiteSpace = CXSDNodeWithRestrictions<CWhiteSpace>::load(pParentNode, pSchemaRoot, xpath);
-    if (pWhiteSpace == NULL)
-        return NULL;
-
-    return pWhiteSpace;
+    return CXSDNodeWithRestrictions<CWhiteSpace>::load(pParentNode, pSchemaRoot, xpath);
 }

configuration/configurator/SchemaWhiteSpace.hpp → configuration/configurator/schemas/SchemaWhiteSpace.hpp


+ 51 - 8
deployment/deploy/XMLTags.h

@@ -233,14 +233,57 @@
 #define XML_ATTR_WATCHDOGENABLED       "@watchdogEnabled"
 #define XML_ATTR_WATCHDOGPROGRESSENABLED  "@watchdogProgressEnabled"
 #define XML_ATTR_WATCHDOGPROGRESSINTERVAL "@watchdogProgressInterval"
+#define NAME_SPACE_FOR_XSD_SCHEMA      "xs:"
 
-#define XSD_TAG_ELEMENT                "xs:element"
-#define XSD_TAG_SEQUENCE               "xs:sequence"
-#define XSD_TAG_CHOICE                 "xs:choice"
-#define XSD_TAG_COMPLEX_TYPE           "xs:complexType"
-#define XSD_TAG_COMPLEX_CONTENT        "xs:complexContent"
-#define XSD_TAG_ATTRIBUTE              "xs:attribute"
-#define XSD_TAG_ATTRIBUTE_GROUP        "xs:attributeGroup"
+static const char* XSD_TAG_ANNOTATION(NAME_SPACE_FOR_XSD_SCHEMA "annotation");
+static const char* XSD_TAG_APP_INFO(NAME_SPACE_FOR_XSD_SCHEMA "appinfo");
+static const char* XSD_TAG_ATTRIBUTE(NAME_SPACE_FOR_XSD_SCHEMA "attribute");
+static const char* XSD_TAG_ATTRIBUTE_GROUP(NAME_SPACE_FOR_XSD_SCHEMA "attributeGroup");
+static const char* XSD_TAG_CHOICE(NAME_SPACE_FOR_XSD_SCHEMA "choice");
+static const char* XSD_TAG_COMPLEX_CONTENT(NAME_SPACE_FOR_XSD_SCHEMA "complexContent");
+static const char* XSD_TAG_COMPLEX_TYPE(NAME_SPACE_FOR_XSD_SCHEMA "complexType");
+static const char* XSD_TAG_DOCUMENTATION(NAME_SPACE_FOR_XSD_SCHEMA "documentation");
+static const char* XSD_TAG_ELEMENT(NAME_SPACE_FOR_XSD_SCHEMA "element");
+static const char* XSD_TAG_EXTENSION(NAME_SPACE_FOR_XSD_SCHEMA "extension");
+static const char* XSD_TAG_KEY(NAME_SPACE_FOR_XSD_SCHEMA "key");
+static const char* XSD_TAG_KEYREF(NAME_SPACE_FOR_XSD_SCHEMA "keyref");
+static const char* XSD_TAG_SELECTOR(NAME_SPACE_FOR_XSD_SCHEMA "selector");
+static const char* XSD_TAG_FIELD(NAME_SPACE_FOR_XSD_SCHEMA "field");
+static const char* XSD_TAG_INCLUDE(NAME_SPACE_FOR_XSD_SCHEMA "include");
+static const char* XSD_TAG_RESTRICTION(NAME_SPACE_FOR_XSD_SCHEMA "restriction");
+static const char* XSD_TAG_SCHEMA("");
+static const char* XSD_TAG_SIMPLE_CONTENT(NAME_SPACE_FOR_XSD_SCHEMA "simpleContent");
+static const char* XSD_TAG_SEQUENCE(NAME_SPACE_FOR_XSD_SCHEMA "sequence");
+static const char* XSD_TAG_SIMPLE_TYPE(NAME_SPACE_FOR_XSD_SCHEMA "simpleType");
+static const char* XSD_TAG_ENUMERATION(NAME_SPACE_FOR_XSD_SCHEMA "enumeration");
+static const char* XSD_TAG_FRACTION_DIGITS(NAME_SPACE_FOR_XSD_SCHEMA "fractionDigits");
+static const char* XSD_TAG_LENGTH(NAME_SPACE_FOR_XSD_SCHEMA "length");
+static const char* XSD_TAG_MAX_EXCLUSIVE(NAME_SPACE_FOR_XSD_SCHEMA "maxExclusive");
+static const char* XSD_TAG_MAX_INCLUSIVE(NAME_SPACE_FOR_XSD_SCHEMA "maxInclusive");
+static const char* XSD_TAG_MIN_EXCLUSIVE(NAME_SPACE_FOR_XSD_SCHEMA "minExlusive");
+static const char* XSD_TAG_MIN_INCLUSIVE(NAME_SPACE_FOR_XSD_SCHEMA "minExclusive");
+static const char* XSD_TAG_MAX_LENGTH(NAME_SPACE_FOR_XSD_SCHEMA "maxLength");
+static const char* XSD_TAG_MIN_LENGTH(NAME_SPACE_FOR_XSD_SCHEMA "minLength");
+static const char* XSD_TAG_PATTERN(NAME_SPACE_FOR_XSD_SCHEMA "pattern");
+static const char* XSD_TAG_TOTAL_DIGITS(NAME_SPACE_FOR_XSD_SCHEMA "totalDigits");
+static const char* XSD_TAG_UNQIUE(NAME_SPACE_FOR_XSD_SCHEMA "unique");
+static const char* XSD_TAG_WHITE_SPACE(NAME_SPACE_FOR_XSD_SCHEMA "whiteSpace");
+
+static const char* XSD_DATA_TYPE_NORMALIZED_STRING(NAME_SPACE_FOR_XSD_SCHEMA "normalizedString");
+static const char* XSD_DATA_TYPE_STRING(NAME_SPACE_FOR_XSD_SCHEMA "string");
+static const char* XSD_DATA_TYPE_TOKEN(NAME_SPACE_FOR_XSD_SCHEMA "token");
+static const char* XSD_DATA_TYPE_DATE(NAME_SPACE_FOR_XSD_SCHEMA "date");
+static const char* XSD_DATA_TYPE_TIME(NAME_SPACE_FOR_XSD_SCHEMA "time");
+static const char* XSD_DATA_TYPE_DATE_TIME(NAME_SPACE_FOR_XSD_SCHEMA "dateTime");
+static const char* XSD_DATA_TYPE_DECIMAL(NAME_SPACE_FOR_XSD_SCHEMA "decimal"); // A decimal value
+static const char* XSD_DATA_TYPE_INTEGER(NAME_SPACE_FOR_XSD_SCHEMA "integer"); // An integer value
+static const char* XSD_DATA_TYPE_INT(NAME_SPACE_FOR_XSD_SCHEMA "int"); // A signed 32-bit integer
+static const char* XSD_DATA_TYPE_LONG(NAME_SPACE_FOR_XSD_SCHEMA "long"); // A signed 64-bit integer
+static const char* XSD_DATA_TYPE_NON_NEGATIVE_INTEGER(NAME_SPACE_FOR_XSD_SCHEMA "nonNegativeInteger");
+static const char* XSD_DATA_TYPE_NON_POSITIVE_INTEGER(NAME_SPACE_FOR_XSD_SCHEMA "nonPositiveInteger");
+static const char* XSD_DATA_TYPE_NEGATIVE_INTEGER(NAME_SPACE_FOR_XSD_SCHEMA "negativeInteger");
+static const char* XSD_DATA_TYPE_POSITIVE_INTEGER(NAME_SPACE_FOR_XSD_SCHEMA "positiveInteger");
+static const char* XSD_DATA_TYPE_BOOLEAN(NAME_SPACE_FOR_XSD_SCHEMA "boolean");
 
 #define UI_FIELD_ATTR_NAME              "@Name"
 #define UI_FIELD_ATTR_VALUE             "@Value"
@@ -286,7 +329,7 @@
 #define TAG_URL                         "url"
 #define TAG_INSTALLSET                  "installSet"
 #define TAG_PROCESSNAME                 "processName"
-#define TAG_SCHEMA                      "schema"
+#define TAG_SCHEMA                      "SCHEMA "
 #define TAG_DEPLOYABLE                  "deployable"
 #define TAG_VALUE                       "value"
 #define TAG_ATTRIBUTE                   "Attribute"

+ 1 - 1
plugins/cassandra/cpp-driver

@@ -1 +1 @@
-Subproject commit d7bbad34db39a51f209c6fadd07c9ec3a0bb86b7
+Subproject commit 468db35af8875930d424395808ddc9523c57c6f2