You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ro...@apache.org on 2006/02/21 13:10:46 UTC

svn commit: r379435 - in /incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model: CPPImplementation.cpp CPPImplementation.h ModelLoader.cpp

Author: robbinspg
Date: Tue Feb 21 04:10:43 2006
New Revision: 379435

URL: http://svn.apache.org/viewcvs?rev=379435&view=rev
Log:
Fix to Jira issue TUSCANY-34

Modified:
    incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CPPImplementation.cpp
    incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CPPImplementation.h
    incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ModelLoader.cpp

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CPPImplementation.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CPPImplementation.cpp?rev=379435&r1=379434&r2=379435&view=diff
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CPPImplementation.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CPPImplementation.cpp Tue Feb 21 04:10:43 2006
@@ -19,6 +19,7 @@
 
 #include "tuscany/sca/util/Logging.h"
 #include "tuscany/sca/model/CPPImplementation.h"
+#include "tuscany/sca/util/Utils.h"
 
 namespace tuscany
 {
@@ -32,15 +33,16 @@
             CPPImplementation::CPPImplementation(const string& dllName, const string& head, const string& classN)
                 : dll(dllName), header(head), className(classN)
             {
-                string::size_type dot = header.rfind(".h"); // this will also find .hpp
-                if (dot != string::npos)
-                {
-                    headerStub = header.substr(0, dot);
-                }
-                else
-                {
-                    headerStub = header;
-                }
+             	// Separate any path element
+            	Utils::rTokeniseString("/", head, headerPath, headerStub);
+            	if (headerPath != "")
+            	{
+            		headerPath += "/";
+            	}
+            	
+            	// Determine the header stub name
+            	string tmp;           	
+            	Utils::rTokeniseString(".h", headerStub, headerStub, tmp);
             }
 
             CPPImplementation::~CPPImplementation()

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CPPImplementation.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CPPImplementation.h?rev=379435&r1=379434&r2=379435&view=diff
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CPPImplementation.h (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/CPPImplementation.h Tue Feb 21 04:10:43 2006
@@ -79,6 +79,12 @@
                 const string& getHeaderStub() {return headerStub;}
 
                 /**
+                 * Get the header path.
+                 * @return The pathe element of the header.
+                 */
+                const string& getHeaderPath() {return headerPath;}
+
+                /**
                  * Get the name of the class.
                  * @return The class name if specified.
                  */
@@ -98,6 +104,11 @@
                  * Name of the header file without the extension.
                  */
                 string headerStub;
+
+                /**
+                 * Path element of the header.
+                 */
+                string headerPath;
 
                 /**
                  * Name of the class in the header file declaring the implementation.

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ModelLoader.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ModelLoader.cpp?rev=379435&r1=379434&r2=379435&view=diff
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ModelLoader.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ModelLoader.cpp Tue Feb 21 04:10:43 2006
@@ -323,6 +323,7 @@
                 }
                 // Determine the type
                 string componentTypeName;
+                string componentTypePath;
                 string implType = impl->getType().getName();
                 if (implType == "CPPImplementation")
                 {
@@ -330,6 +331,7 @@
                     string header = impl->getCString("header");
                     string className = impl->getCString("class");
                     CPPImplementation* cppImpl = new CPPImplementation(dll, header, className);
+                    componentTypePath = cppImpl->getHeaderPath();
                     componentTypeName = cppImpl->getHeaderStub();
                     component->setImplementation(cppImpl);
                     
@@ -341,7 +343,7 @@
                 // -----------------------
                 // Load the .componentType
                 // -----------------------
-                string typeFileName = module->getRoot() + "/" + componentTypeName + ".componentType";
+                string typeFileName = module->getRoot() + "/" + componentTypePath + componentTypeName + ".componentType";
                 try 
                 {
                     XMLDocumentPtr componentTypeFile = getXMLHelper()->loadFile(typeFileName.c_str());