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/10/02 12:04:48 UTC
svn commit: r451941 - in /incubator/tuscany/cpp/sdo: projects/tuscany_sdo/
projects/tuscany_sdo/sdo_runtime/ projects/tuscany_sdo/sdo_test/
runtime/core/src/commonj/sdo/
Author: robbinspg
Date: Mon Oct 2 03:04:46 2006
New Revision: 451941
URL: http://svn.apache.org/viewvc?view=rev&rev=451941
Log:
TUSCANY-764 change SDOString to typedef of std::string
Removed:
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOString.cpp
Modified:
incubator/tuscany/cpp/sdo/projects/tuscany_sdo/sdo_runtime/sdo_runtime.dsp
incubator/tuscany/cpp/sdo/projects/tuscany_sdo/sdo_test/sdo_test.dsp
incubator/tuscany/cpp/sdo/projects/tuscany_sdo/tuscany_sdo.dsw
incubator/tuscany/cpp/sdo/projects/tuscany_sdo/tuscany_sdo.ncb
incubator/tuscany/cpp/sdo/projects/tuscany_sdo/tuscany_sdo.opt
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryBuilder.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSAX2Parser.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOString.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLString.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLString.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SchemaInfo.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelper.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XpathHelper.cpp
Modified: incubator/tuscany/cpp/sdo/projects/tuscany_sdo/sdo_runtime/sdo_runtime.dsp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/projects/tuscany_sdo/sdo_runtime/sdo_runtime.dsp?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/projects/tuscany_sdo/sdo_runtime/sdo_runtime.dsp (original)
+++ incubator/tuscany/cpp/sdo/projects/tuscany_sdo/sdo_runtime/sdo_runtime.dsp Mon Oct 2 03:04:46 2006
@@ -284,10 +284,6 @@
# End Source File
# Begin Source File
-SOURCE=..\..\..\runtime\core\src\commonj\sdo\SDOString.cpp
-# End Source File
-# Begin Source File
-
SOURCE=..\..\..\runtime\core\src\commonj\sdo\SDOUtils.cpp
# End Source File
# Begin Source File
Modified: incubator/tuscany/cpp/sdo/projects/tuscany_sdo/sdo_test/sdo_test.dsp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/projects/tuscany_sdo/sdo_test/sdo_test.dsp?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/projects/tuscany_sdo/sdo_test/sdo_test.dsp (original)
+++ incubator/tuscany/cpp/sdo/projects/tuscany_sdo/sdo_test/sdo_test.dsp Mon Oct 2 03:04:46 2006
@@ -71,7 +71,7 @@
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\deploy\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /Zm200 /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\deploy\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /Zm200 /c
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
Modified: incubator/tuscany/cpp/sdo/projects/tuscany_sdo/tuscany_sdo.dsw
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/projects/tuscany_sdo/tuscany_sdo.dsw?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/projects/tuscany_sdo/tuscany_sdo.dsw (original)
+++ incubator/tuscany/cpp/sdo/projects/tuscany_sdo/tuscany_sdo.dsw Mon Oct 2 03:04:46 2006
@@ -32,9 +32,6 @@
Begin Project Dependency
Project_Dep_Name sdo_runtime
End Project Dependency
- Begin Project Dependency
- Project_Dep_Name sdo_test
- End Project Dependency
}}}
###############################################################################
Modified: incubator/tuscany/cpp/sdo/projects/tuscany_sdo/tuscany_sdo.ncb
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/projects/tuscany_sdo/tuscany_sdo.ncb?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
Binary files - no diff available.
Modified: incubator/tuscany/cpp/sdo/projects/tuscany_sdo/tuscany_sdo.opt
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/projects/tuscany_sdo/tuscany_sdo.opt?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
Binary files - no diff available.
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryBuilder.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryBuilder.cpp?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryBuilder.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryBuilder.cpp Mon Oct 2 03:04:46 2006
@@ -105,7 +105,7 @@
// dob may have been set by the line above.
if (deletions[i].dob != 0)
{
- DataObjectList& dli = dob->getList(prop);
+ DataObjectList& dli = dob->getList((const char*)prop);
dli.insert(0,deletions[i].dob);
}
break;
@@ -114,7 +114,7 @@
}
else
{
- DataObjectList& dli = dob->getList(prop);
+ DataObjectList& dli = dob->getList((const char*)prop);
dli.append((const char*)value);
}
}
@@ -147,7 +147,7 @@
return;
}
- const Property& p = cont->getProperty(prop);
+ const Property& p = cont->getProperty((const char*)prop);
DataObjectPtr dob = dataFactory->create(
p.getType());
populateDeletion(csi,dob,currentIndex);
@@ -214,7 +214,7 @@
else
{
try {
- cont = rootDataObject->getDataObject(contpath);
+ cont = rootDataObject->getDataObject((const char*)contpath);
LOGINFO_2(INFO,"Handling deletion from %s of %s",
(const char*)contpath,(const char*)prop);
}
@@ -374,7 +374,7 @@
}
else
{
- dob = rootDataObject->getDataObject(thispath);
+ dob = rootDataObject->getDataObject((const char*)thispath);
}
if (dob != 0) {
@@ -428,7 +428,7 @@
}
else
{
- dob = rootDataObject->getDataObject(changes[i].reference);
+ dob = rootDataObject->getDataObject((const char*)changes[i].reference);
}
if (dob != 0)
{
@@ -491,7 +491,7 @@
(const char*)((*e).path),
(const char*)((*e).value));
- DataObjectPtr pdob = rootDataObject->getDataObject((*e).value);
+ DataObjectPtr pdob = rootDataObject->getDataObject((const char*)(*e).value);
if (pdob != 0)
{
csi->appendToChanges(p,dob,pdob,(*e).index);
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp Mon Oct 2 03:04:46 2006
@@ -107,25 +107,6 @@
return rootElementName;
}
-// ===================================================================
-// set the root element name
-// ===================================================================
-void DataFactoryImpl::setRootElementName(const char* ren)
-{
-
- // If the incoming string is meaningful then use it to reset the stored
- // value. Otherwise, just erase what we have.
-
- if (ren != 0 && (strlen(ren) != 0))
- {
- rootElementName = ren;
- }
- else
- {
- rootElementName.erase();
- }
-
-}
void DataFactoryImpl::setRootElementName(const SDOString& ren)
{
@@ -169,7 +150,7 @@
TYPES_MAP::const_iterator typeIter;
TYPES_MAP::iterator typeIter2;
- char* fullTypeName;
+ SDOString fullTypeName;
for (typeIter = inmdg.types.begin() ; typeIter != inmdg.types.end() ; ++typeIter)
{
@@ -181,7 +162,6 @@
(typeIter->second)->getURI(),
(typeIter->second)->getName());
typeIter2 = types.find(fullTypeName);
- if (fullTypeName)delete fullTypeName;
// copy the aliases , if there are any.
@@ -275,13 +255,14 @@
SDOIllegalArgumentException, " Type has empty name");
}
+ SDOString typeUri;
- if (findType(uri, inTypeName) == 0)
+ if (uri)
+ typeUri = uri;
+ if (findType(typeUri, inTypeName) == 0)
{
- char* fullTypeName = getFullTypeName(uri, inTypeName);
+ SDOString fullTypeName = getFullTypeName(uri, inTypeName);
types[fullTypeName] = new TypeImpl(uri, inTypeName, isSeq, isOp, isAbs, isData, isFromList);
- if (fullTypeName)delete fullTypeName;
-
}
}
@@ -356,10 +337,9 @@
const char* propTypeName,
bool many)
{
- char* fullPropTypeName = getFullTypeName(propTypeUri, propTypeName);
+ SDOString fullPropTypeName = getFullTypeName(propTypeUri, propTypeName);
TYPES_MAP::iterator typeIter;
typeIter = types.find(fullPropTypeName);
- if (fullPropTypeName)delete fullPropTypeName;
if (typeIter != types.end())
{
addPropertyToType(uri,inTypeName,
@@ -405,9 +385,8 @@
// << ") to type " << uri << "#" << inTypeName << endl;
- char* fullTypeName = getFullTypeName(uri, inTypeName);
+ SDOString fullTypeName = getFullTypeName(uri, inTypeName);
typeIter = types.find(fullTypeName);
- if (fullTypeName)delete fullTypeName;
if(typeIter == types.end())
{
@@ -438,7 +417,6 @@
fullTypeName = getFullTypeName(propTypeUri, propTypeName);
typeIter2 = types.find(fullTypeName);
- if (fullTypeName)delete fullTypeName;
if (typeIter2 == types.end())
{
@@ -714,57 +692,17 @@
// ===================================================================
// getFullTypeName - return the name used as a key in the types map
// ===================================================================
-char* DataFactoryImpl::getFullTypeName(const char* uri, const char* inTypeName) const
+SDOString DataFactoryImpl::getFullTypeName(const SDOString& uri, const SDOString& inTypeName) const
{
- char* c;
- if (uri != 0 && inTypeName != 0)
- {
- c = new char[strlen(uri) + strlen(inTypeName) + 2];
- sprintf(c,"%s#%s",uri,inTypeName);
- return c;
- }
- if (uri != 0)
- {
- c = new char[strlen(uri) + 2];
- sprintf(c,"%s#",uri);
- return c;
- }
- c = new char[strlen(inTypeName) + 2];
- sprintf(c,"#%s",inTypeName);
- return c;
-}
-
-char* DataFactoryImpl::getFullTypeName(const SDOString& uri, const SDOString& inTypeName) const
-{
- return getFullTypeName(uri.c_str(), inTypeName.c_str());
+ return uri + "#" + inTypeName;
}
// ===================================================================
-// getFullTypeName - return the name used as a key in the types map
+// getAliasTypeName - return the name used as a key in the types map
// ===================================================================
-char* DataFactoryImpl::getAliasTypeName(const char* uri, const char* inTypeName) const
+SDOString DataFactoryImpl::getAliasTypeName(const SDOString& uri, const SDOString& inTypeName) const
{
- char* c;
- if (uri != 0 && inTypeName != 0)
- {
- c = new char[strlen(uri) + strlen(inTypeName) + 9];
- sprintf(c,"ALIAS::%s#%s",uri,inTypeName);
- return c;
- }
- if (uri != 0)
- {
- c = new char[strlen(uri) + 9];
- sprintf(c,"ALIAS::%s#",uri);
- return c;
- }
- c = new char[strlen(inTypeName) + 9];
- sprintf(c,"ALIAS::#%s",inTypeName);
- return c;
-}
-
-char* DataFactoryImpl::getAliasTypeName(const SDOString& uri, const SDOString& inTypeName) const
-{
- return getAliasTypeName(uri.c_str(), inTypeName.c_str());
+ return "ALIAS::" + getFullTypeName(uri, inTypeName);
}
// ===================================================================
@@ -827,9 +765,8 @@
TYPES_MAP::const_iterator typeIter;
- char* fullTypeName = getFullTypeName(typeuri, typenam);
+ SDOString fullTypeName = getFullTypeName(typeuri, typenam);
typeIter = types.find(fullTypeName);
- if (fullTypeName)delete fullTypeName;
if(typeIter == types.end())
{
@@ -1295,40 +1232,27 @@
// ===================================================================
// getTypeImpl - return a pointer to the required TypeImpl
// ===================================================================
-const TypeImpl& DataFactoryImpl::getTypeImpl(const char* uri, const char* inTypeName) const
+const TypeImpl& DataFactoryImpl::getTypeImpl(const SDOString& uri, const SDOString& inTypeName) const
{
const TypeImpl* type = findTypeImpl(uri, inTypeName);
if (type == 0)
{
string msg("Type not found :");
- if (uri != 0)msg += uri;
- msg += " ";
- if (inTypeName != 0)msg += inTypeName;
+ msg += uri + " " + inTypeName;
SDO_THROW_EXCEPTION("getTypeImpl" ,
SDOTypeNotFoundException, msg.c_str());
}
- return *type;
-}
-
-const TypeImpl& DataFactoryImpl::getTypeImpl(const SDOString& uri, const SDOString& inTypeName) const
-{
- return getTypeImpl(uri.c_str(), inTypeName.c_str());
+ return *type;;
}
// ===================================================================
// findType
// ===================================================================
-
-const Type* DataFactoryImpl::findType(const char* uri, const char* inTypeName) const
-{
- return (Type*)findTypeImpl(uri,inTypeName);
-}
-
const Type* DataFactoryImpl::findType(const SDOString uri, const SDOString inTypeName) const
{
- return (Type*) findTypeImpl(uri.c_str(), inTypeName.c_str());
+ return (Type*) findTypeImpl(uri, inTypeName);
}
// ===================================================================
@@ -1337,15 +1261,9 @@
const TypeImpl* DataFactoryImpl::findTypeImpl(const SDOString& uri, const SDOString& inTypeName) const
{
- return findTypeImpl(uri.c_str(), inTypeName.c_str());
-}
-
-const TypeImpl* DataFactoryImpl::findTypeImpl(const char* uri, const char* inTypeName) const
-{
- char* fullTypeName = getFullTypeName(uri, inTypeName);
+ SDOString fullTypeName = getFullTypeName(uri, inTypeName);
TYPES_MAP::const_iterator typeIter;
typeIter = types.find(fullTypeName);
- if (fullTypeName)delete fullTypeName;
if(typeIter != types.end())
{
return typeIter->second;
@@ -1355,7 +1273,6 @@
// try alias names
fullTypeName = getAliasTypeName(uri, inTypeName);
typeIter = types.find(fullTypeName);
- if (fullTypeName)delete fullTypeName;
if(typeIter != types.end())
{
return typeIter->second;
@@ -1373,10 +1290,9 @@
const char* alias)
{
- char* fullTypeName = getFullTypeName(typeuri, typenam);
+ SDOString fullTypeName = getFullTypeName(typeuri, typenam);
TYPES_MAP::iterator typeIter;
typeIter = types.find(fullTypeName);
- if (fullTypeName)delete fullTypeName;
if(typeIter != types.end())
{
(typeIter->second)->setAlias(alias);
@@ -1544,12 +1460,8 @@
void DataFactoryImpl::removeOpenProperty(const SDOString& name)
{
- removeOpenProperty(name.c_str());
- }
- void DataFactoryImpl::removeOpenProperty(const char* name)
- {
propertyMap::iterator i =
- openProperties.find(name);
+ openProperties.find(name.c_str());
if (i != openProperties.end())
{
openProperties.erase(i);
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.h?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.h Mon Oct 2 03:04:46 2006
@@ -651,33 +651,22 @@
virtual void resolve();
-// TODO: Remove char* form of method since it is not exposed to users
- const Type* findType (const char* uri, const char* inTypeName) const;
const Type* findType(const SDOString uri, const SDOString inTypeName) const;
-// TODO: Remove char* form of method since it is not exposed to users
- const TypeImpl* findTypeImpl (const char* uri, const char* inTypeName) const;
const TypeImpl* findTypeImpl(const SDOString& uri, const SDOString& inTypeName) const;
void addOpenProperty(const PropertyImpl& prop);
-// TODO: Remove char* form of method since it is not exposed to users
- void removeOpenProperty(const char* name);
void removeOpenProperty(const SDOString& name);
const propertyMap& getOpenProperties();
-// TODO: Remove char* form of method since it is not exposed to users
- virtual const TypeImpl& getTypeImpl(const char* uri, const char* inTypeName) const;
virtual const TypeImpl& getTypeImpl(const SDOString& uri, const SDOString& inTypeName) const;
virtual const SDOString& getRootElementName() const;
-// TODO: Remove char* form of method since it is not exposed to users
- virtual void setRootElementName(const char* ren);
virtual void setRootElementName(const SDOString& ren);
virtual bool checkType(const Type& t);
virtual bool isCompatible(DataFactory* df, DataObject* d);
virtual bool compareTypes(const TypeImpl* t1, const Type& t2);
- virtual bool generateInterface(const char* fileroot, const char* factoryname);
-
- virtual bool generateInterface(const SDOString& fileroot, const SDOString& factoryname);
+ virtual bool generateInterface(const char* fileroot, const char* factoryname);
+ virtual bool generateInterface(const SDOString& fileroot, const SDOString& factoryname);
virtual std::ostream& printSelf(std::ostream &os);
@@ -702,12 +691,8 @@
typedef std::vector<TypeImpl*> TYPES_VECTOR;
TYPES_VECTOR cstypes;
-// TODO: Remove char* form of method since it is not exposed to users
- char* getFullTypeName(const char* uri, const char* inTypeName) const;
- char* getFullTypeName(const SDOString& uri, const SDOString& inTypeName) const;
-// TODO: Remove char* form of method since it is not exposed to users
- char* getAliasTypeName(const char* uri, const char* inTypeName) const;
- char* getAliasTypeName(const SDOString& uri, const SDOString& inTypeName) const;
+ SDOString getFullTypeName(const SDOString& uri, const SDOString& inTypeName) const;
+ SDOString getAliasTypeName(const SDOString& uri, const SDOString& inTypeName) const;
void copyTypes(const DataFactoryImpl& inmdg);
};
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.cpp?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.cpp Mon Oct 2 03:04:46 2006
@@ -919,12 +919,6 @@
// open type support
- const PropertyImpl* DataObjectImpl::defineProperty(const char* propname,
- const Type& t)
- {
- return defineProperty(SDOString(propname), t);
- }
-
const PropertyImpl* DataObjectImpl::defineProperty(const SDOString& propname,
const Type& t)
{
@@ -995,126 +989,84 @@
return getPropertyImpl(propname);
}
- const PropertyImpl* DataObjectImpl::defineBoolean(const char* propname)
- {
- return defineBoolean(SDOString(propname));
- }
-
const PropertyImpl* DataObjectImpl::defineBoolean(const SDOString& propname)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Boolean");
return defineProperty(propname,t);
}
-
- const PropertyImpl* DataObjectImpl::defineByte(const char* propname)
- {
- return defineByte(SDOString(propname));
- }
+
const PropertyImpl* DataObjectImpl::defineByte(const SDOString& propname)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Byte");
return defineProperty(propname,t);
}
- const PropertyImpl* DataObjectImpl::defineCharacter(const char* propname)
- {
- return defineCharacter(SDOString(propname));
- }
+
const PropertyImpl* DataObjectImpl::defineCharacter(const SDOString& propname)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Character");
return defineProperty(propname,t);
}
- const PropertyImpl* DataObjectImpl::defineString(const char* propname)
- {
- return defineString(SDOString(propname));
- }
+
const PropertyImpl* DataObjectImpl::defineString(const SDOString& propname)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "String");
return defineProperty(propname,t);
}
- const PropertyImpl* DataObjectImpl::defineBytes(const char* propname)
- {
- return defineBytes(SDOString(propname));
- }
+
const PropertyImpl* DataObjectImpl::defineBytes(const SDOString& propname)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Bytes");
return defineProperty(propname,t);
}
- const PropertyImpl* DataObjectImpl::defineShort(const char* propname)
- {
- return defineShort(SDOString(propname));
- }
+
const PropertyImpl* DataObjectImpl::defineShort(const SDOString& propname)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Short");
return defineProperty(propname,t);
}
- const PropertyImpl* DataObjectImpl::defineInteger(const char* propname)
- {
- return defineInteger(SDOString(propname));
- }
+
const PropertyImpl* DataObjectImpl::defineInteger(const SDOString& propname)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Integer");
return defineProperty(propname,t);
}
- const PropertyImpl* DataObjectImpl::defineLong(const char* propname)
- {
- return defineLong(SDOString(propname));
- }
+
const PropertyImpl* DataObjectImpl::defineLong(const SDOString& propname)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Long");
return defineProperty(propname,t);
}
- const PropertyImpl* DataObjectImpl::defineFloat(const char* propname)
- {
- return defineFloat(SDOString(propname));
- }
+
const PropertyImpl* DataObjectImpl::defineFloat(const SDOString& propname)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Float");
return defineProperty(propname,t);
}
- const PropertyImpl* DataObjectImpl::defineDouble(const char* propname)
- {
- return defineDouble(SDOString(propname));
- }
+
const PropertyImpl* DataObjectImpl::defineDouble(const SDOString& propname)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Double");
return defineProperty(propname,t);
}
- const PropertyImpl* DataObjectImpl::defineDate(const char* propname)
- {
- return defineDate(SDOString(propname));
- }
+
const PropertyImpl* DataObjectImpl::defineDate(const SDOString& propname)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Date");
return defineProperty(propname,t);
}
- const PropertyImpl* DataObjectImpl::defineCString(const char* propname)
- {
- return defineCString(SDOString(propname));
- }
+
const PropertyImpl* DataObjectImpl::defineCString(const SDOString& propname)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Bytes");
return defineProperty(propname,t);
}
- const PropertyImpl* DataObjectImpl::defineDataObject(const char* propname,
- const Type& t)
- {
- return defineDataObject(SDOString(propname), t);
- }
+
const PropertyImpl* DataObjectImpl::defineDataObject(const SDOString& propname,
const Type& t)
{
return defineProperty(propname,t);
}
+
const PropertyImpl* DataObjectImpl::defineDataObject(const char* propname,
const char* typeURI, const char* typeName)
{
@@ -2006,7 +1958,7 @@
{
root = root->getContainerImpl();
}
- return root->findPropertyContainer(SDOString(path, 2), din);
+ return root->findPropertyContainer(SDOString(path, 2, string::npos), din);
}
DataObjectImpl* d;
@@ -3291,11 +3243,6 @@
}
return (Property&)*pi;
- }
-
- PropertyImpl* DataObjectImpl::getPropertyImpl(const char* prop)
- {
- return getPropertyImpl(SDOString(prop));
}
PropertyImpl* DataObjectImpl::getPropertyImpl(const SDOString& prop)
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.h?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.h Mon Oct 2 03:04:46 2006
@@ -142,7 +142,6 @@
virtual const Property& getProperty(const char* prop);
virtual const Property& getProperty(const SDOString& prop);
- virtual PropertyImpl* getPropertyImpl(const char* prop);
virtual PropertyImpl* getPropertyImpl(const SDOString& prop);
virtual PropertyImpl* getPropertyImpl(unsigned int index);
@@ -568,38 +567,21 @@
* This method and its siblings define a new property on an
* open type when a setting is requested.
*/
-
- virtual const PropertyImpl* defineProperty(const char* propname,
- const Type& t);
virtual const PropertyImpl* defineProperty(const SDOString& propname,
const Type& t);
- virtual const PropertyImpl* defineBoolean(const char* propname);
- virtual const PropertyImpl* defineBoolean(const SDOString& propname);
- virtual const PropertyImpl* defineByte(const char* propname);
+ virtual const PropertyImpl* defineBoolean(const SDOString& propname);
virtual const PropertyImpl* defineByte(const SDOString& propname);
- virtual const PropertyImpl* defineCharacter(const char* propname);
virtual const PropertyImpl* defineCharacter(const SDOString& propname);
- virtual const PropertyImpl* defineString(const char* propname);
virtual const PropertyImpl* defineString(const SDOString& propname);
- virtual const PropertyImpl* defineBytes(const char* propname);
virtual const PropertyImpl* defineBytes(const SDOString& propname);
- virtual const PropertyImpl* defineShort(const char* propname);
virtual const PropertyImpl* defineShort(const SDOString& propname);
- virtual const PropertyImpl* defineInteger(const char* propname);
virtual const PropertyImpl* defineInteger(const SDOString& propname);
- virtual const PropertyImpl* defineLong(const char* propname);
virtual const PropertyImpl* defineLong(const SDOString& propname);
- virtual const PropertyImpl* defineFloat(const char* propname);
virtual const PropertyImpl* defineFloat(const SDOString& propname);
- virtual const PropertyImpl* defineDouble(const char* propname);
virtual const PropertyImpl* defineDouble(const SDOString& propname);
- virtual const PropertyImpl* defineDate(const char* propname);
virtual const PropertyImpl* defineDate(const SDOString& propname);
- virtual const PropertyImpl* defineCString(const char* propname);
virtual const PropertyImpl* defineCString(const SDOString& propname);
- virtual const PropertyImpl* defineDataObject(const char* propname,
- const Type&t );
virtual const PropertyImpl* defineDataObject(const SDOString& propname,
const Type&t );
virtual const PropertyImpl* defineDataObject(const char* propname,
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp Mon Oct 2 03:04:46 2006
@@ -99,7 +99,7 @@
try
{
const Type& type = refsIter->dataObject->getType();
- const Property& prop = refsIter->dataObject->getProperty(refsIter->property);
+ const Property& prop = refsIter->dataObject->getProperty((const char*)refsIter->property);
const Type& propType = ((TypeImpl&)type).getRealPropertyType(refsIter->property);
// Allowing referenes to DataObjects only
@@ -123,7 +123,7 @@
//if (xpath.firstIndexOf('/') == 0)
// xpath = xpath.substring(1);
- reffedDO = rootDataObject->getDataObject(refsIter->value);
+ reffedDO = rootDataObject->getDataObject((const char*)refsIter->value);
}
if (!reffedDO)
@@ -174,7 +174,7 @@
const Type& type = currentDataObject->getType();
// go lower level so we can find open properties w/o exception
DataObject* dob = currentDataObject;
- const PropertyImpl* pprop = ((DataObjectImpl*)dob)->getPropertyImpl(propertyName);
+ const PropertyImpl* pprop = ((DataObjectImpl*)dob)->getPropertyImpl((const char*)propertyName);
if (pprop == 0)
{
@@ -193,11 +193,11 @@
{
if (!property.isMany())
{
- currentDataObject->setDataObject(propertyName, newDO);
+ currentDataObject->setDataObject((const char*)propertyName, newDO);
}
else
{
- DataObjectList& dol = currentDataObject->getList(propertyName);
+ DataObjectList& dol = currentDataObject->getList((const char*)propertyName);
dol.append(newDO);
}
}
@@ -211,9 +211,9 @@
void SDOSAX2Parser::handleOpenAttribute(
SDOXMLString& tns,
- const char* propuri,
- const char* propname,
- const char* value)
+ const SDOXMLString& propuri,
+ const SDOXMLString& propname,
+ const SDOXMLString& value)
{
// first, see if there is a global element or attribute corresponding...
try
@@ -247,7 +247,7 @@
}
else
{
- currentDataObject->setCString(propname,value);
+ currentDataObject->setCString((const char*)propname,value);
}
return;
}
@@ -302,7 +302,7 @@
}
else
{
- currentDataObject->setCString(propname,value);
+ currentDataObject->setCString((const char*)propname,value);
}
}
catch (SDORuntimeException)
@@ -340,9 +340,9 @@
{
// if its an open type, then attributes will be allowed to have
// an invalid name, and setCString will create them all as bytes
- handleOpenAttribute(tns, (const char*)attributes[i].getUri(),
- (const char*)attributes[i].getName(),
- (const char*)attributes[i].getValue());
+ handleOpenAttribute(tns, attributes[i].getUri(),
+ attributes[i].getName(),
+ attributes[i].getValue());
}
else
@@ -391,7 +391,7 @@
IDMap[propValue] = currentDataObject;
}
// Always set the property as a String. SDO will do the conversion
- currentDataObject->setCString(attributes[i].getName(), propValue);
+ currentDataObject->setCString((const char*)attributes[i].getName(), propValue);
}
}
}
@@ -448,7 +448,7 @@
// the type of the list needs to be set, as chars sets a CString
try
{
- DataObjectList& dl = ((DataObjectImpl*)dob)->getList(propertyName);
+ DataObjectList& dl = ((DataObjectImpl*)dob)->getList((const char*)propertyName);
((DataObjectListImpl*)&dl)->setType(prop->getType().getURI(),
prop->getType().getName());
}
@@ -475,7 +475,7 @@
}
else
{
- DataObjectList& dol = dob->getList(propertyName);
+ DataObjectList& dol = dob->getList((const char*)propertyName);
dol.append(newDO);
}
setCurrentDataObject(newDO);
@@ -488,12 +488,12 @@
switch (prop->getTypeEnum())
{
case Type::BooleanType:
- pprop = ((DataObjectImpl*)dob)->defineBoolean(propertyName);
+ pprop = ((DataObjectImpl*)dob)->defineBoolean((const char*)propertyName);
currentPropertySetting = PropertySetting(currentDataObject, propertyName,
bToBeNull);
break;
case Type::ByteType:
- pprop = ((DataObjectImpl*)dob)->defineByte(propertyName);
+ pprop = ((DataObjectImpl*)dob)->defineByte((const char*)propertyName);
currentPropertySetting = PropertySetting(currentDataObject, propertyName,
bToBeNull);
break;
@@ -556,7 +556,7 @@
}
else
{
- dob->setDataObject(propertyName, newDO);
+ dob->setDataObject((const char*)propertyName, newDO);
}
setCurrentDataObject(newDO);
setAttributes(tns,namespaces,attributes);
@@ -578,7 +578,7 @@
if (!xsitypeName.isNull())
{
// it has a type from xsi:type
- newDO = dataFactory->create(xsitypeURI, xsitypeName);
+ newDO = dataFactory->create((const char*)xsitypeURI, (const char*)xsitypeName);
}
else
{
@@ -593,7 +593,7 @@
}
else
{
- DataObjectList& dol = dob->getList(propertyName);
+ DataObjectList& dol = dob->getList((const char*)propertyName);
dol.append(newDO);
}
setCurrentDataObject(newDO);
@@ -787,6 +787,9 @@
SDOXMLString tns = URI;
+ if (tns.isNull())
+ tns = "";
+
try
{
if (currentDataObject == 0)
@@ -830,12 +833,12 @@
else
{
DataFactory* df = dataFactory;
- ((DataFactoryImpl*)df)->setRootElementName(localname);
+ ((DataFactoryImpl*)df)->setRootElementName((const char*)localname);
}
// NOTE: always creating DO doesn't cater for DataType as top element
- const Type& tp = dataFactory->getType(typeURI,typeName);
+ const Type& tp = dataFactory->getType((const char*)typeURI,typeName);
if (tp.isDataType())
{
newDO = dataFactory->create(tns, "RootType");
@@ -867,7 +870,7 @@
else
{
- newDO = dataFactory->create(typeURI, typeName);
+ newDO = dataFactory->create((const char*)typeURI, (const char*)typeName);
// get the type definition, and see if its an extended primitive.
@@ -977,7 +980,7 @@
}
else
{
- newDO = dataFactory->create(typeURI, typeName);
+ newDO = dataFactory->create((const char*)typeURI, (const char*)typeName);
}
XSDTypeInfo* typeInfo = (XSDTypeInfo*)
@@ -1230,7 +1233,7 @@
// may throw SDOPropertyNotFoundException
else {
const Property& p = currentPropertySetting.dataObject->getProperty(
- currentPropertySetting.name);
+ (const char*)currentPropertySetting.name);
if (p.isMany())
{
DataObjectList& dl = currentPropertySetting.dataObject->
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSAX2Parser.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSAX2Parser.h?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSAX2Parser.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSAX2Parser.h Mon Oct 2 03:04:46 2006
@@ -73,9 +73,9 @@
virtual void handleOpenAttribute(
SDOXMLString& tns,
- const char* propuri,
- const char* propname,
- const char* value);
+ const SDOXMLString& propuri,
+ const SDOXMLString& propname,
+ const SDOXMLString& value);
virtual const PropertyImpl* handleOpenType(
SDOXMLString& tns,
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOString.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOString.h?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOString.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOString.h Mon Oct 2 03:04:46 2006
@@ -23,58 +23,7 @@
#define _SDOString_H_
#include "commonj/sdo/export.h"
-#include <iostream>
-using std::string;
-
-namespace commonj
-{
- namespace sdo
- {
- /**
- * SDOString - utility class for string handling.
- * Keeps the string handling local to one place, so we can
- * replace it with a more NLS friendly version later.
- */
-
- class SDOString : public string
- {
- public:
- SDO_API SDOString substr(size_t i = 0, size_t n = std::string::npos) const
- {
- return SDOString(string::substr(i, n));
- }
-
- SDO_API SDOString toLower(unsigned int start = 0,
- unsigned int length = 0);
- SDO_API SDOString(const string& str) : string(str) {}
- // SDO_SPI SDOString(const std::string& str, size_t pos);
- SDO_API SDOString(const std::string& str, size_t pos, size_t n = std::string::npos)
- : string(str, pos, n) {}
- SDO_API SDOString(const char* str) : string(str) {}
- SDO_API SDOString() : string() {}
- SDO_API virtual ~SDOString() {}
-
- static SDO_API const SDOString SDONullString;
-
- // User defined conversion so that the compiler will automatically convert SDOString to const char *
-
- // This is currently omitted because it can lead to confusion over
- // which method should be called. For example, suppose we have two
- // (overloaded) methods
- // 1. void fn(const char* first, const char* second)
- // 2. void fn(const SDOString& first, const SDOString& second)
- // and we make a call passing a C style string as the first parameter and an SDOString
- // as the second parameter. Currently, the first parameter is
- // converted to an SDOString and the second method is called. If the
- // conversion below is uncommented, then the compiler also has the
- // option to convert the second parameter to a C style string and then
- // call the first method - and it is ambiguous which of these to choose,
- // leading to a compile time error.
-
- // operator const char*() const { return c_str(); }
-
- };
- } // End - namespace sdo
-} // End - namespace commonj
+#include <string>
+typedef std::string SDOString;
#endif // _SDOString_H_
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLString.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLString.cpp?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLString.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLString.cpp Mon Oct 2 03:04:46 2006
@@ -62,6 +62,15 @@
}
return *this;
}
+
+ SDOXMLString::operator std::string() const
+ {
+ if (xmlForm)
+ {
+ return (const char *)xmlForm;
+ }
+ return "";
+ }
SDOXMLString SDOXMLString::operator+(const SDOXMLString& str) const
{
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLString.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLString.h?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLString.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLString.h Mon Oct 2 03:04:46 2006
@@ -63,6 +63,7 @@
SDO_SPI bool operator< (const SDOXMLString& str) const;
+ SDO_SPI operator std::string() const;
SDO_SPI operator const char*() const {return (const char*) xmlForm;}
SDO_SPI operator const xmlChar*() const {return xmlForm;}
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp Mon Oct 2 03:04:46 2006
@@ -140,7 +140,7 @@
// Locate the RootType
const Type& rootTy = dataFactory->getType(elementURI, "RootType");
// Does a property exist with the given element name?
- const Property& rootProp = rootTy.getProperty(elementName);
+ const Property& rootProp = rootTy.getProperty((const char*)elementName);
// Is this property of the correct Type?
const Type& rootPropType = rootProp.getType();
if (rootTypeURI == (SDOXMLString)rootPropType.getURI()
@@ -1198,7 +1198,7 @@
TypeDefinitionImpl typeDef = ti->getTypeDefinition();
if (!typeDef.IDPropertyName.isNull())
{
- refValue = reffedObject->getCString(typeDef.IDPropertyName);
+ refValue = reffedObject->getCString((const char*)typeDef.IDPropertyName);
}
}
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SchemaInfo.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SchemaInfo.cpp?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SchemaInfo.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SchemaInfo.cpp Mon Oct 2 03:04:46 2006
@@ -24,6 +24,7 @@
{
SchemaInfo::SchemaInfo()
+ : targetNamespaceURI("")
{
}
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.cpp?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.cpp Mon Oct 2 03:04:46 2006
@@ -488,7 +488,7 @@
// Substitute Support - get the real underlying type
///////////////////////////////////////////////////////////////////////////
- const Type& TypeImpl::getRealPropertyType(const char* propertyName) const
+ const Type& TypeImpl::getRealPropertyType(const std::string& propertyName) const
{
const TypeImpl* ti = getRealPropertyTypeImpl(propertyName);
if (ti != 0)return (Type&)*ti;
@@ -501,26 +501,26 @@
}
- const TypeImpl* TypeImpl::getRealPropertyTypeImpl(const char* propertyName) const
+ const TypeImpl* TypeImpl::getRealPropertyTypeImpl(const std::string& propertyName) const
{
std::list<PropertyImpl*>::const_iterator i;
for (i = props.begin(); i != props.end(); ++i)
{
- if (!strcmp(propertyName,(*i)->getName()))
+ if (propertyName == (*i)->getName())
{
return ((*i)->getTypeImpl());
}
for (unsigned int k=0;k < (*i)->getAliasCount(); k++)
{
- if (!strcmp(propertyName,(*i)->getAlias(k)))
+ if (propertyName == (*i)->getAlias(k))
{
return ((*i)->getTypeImpl());
}
}
for (unsigned int j=0;j < (*i)->getSubstitutionCount(); j++)
{
- if (!strcmp(propertyName,(*i)->getSubstitutionName(j)))
+ if (propertyName == (*i)->getSubstitutionName(j))
{
return (TypeImpl*)(*i)->getSubstitutionType(j);
}
@@ -528,62 +528,57 @@
}
return 0;
}
-
+
///////////////////////////////////////////////////////////////////////////
// Returns the property with the specified name.
///////////////////////////////////////////////////////////////////////////
- PropertyImpl* TypeImpl::getPropertyImpl(const char* propertyName) const
+
+ PropertyImpl* TypeImpl::getPropertyImpl(const SDOString& propertyName) const
{
-
+
// Extension - find the property from an xpath
- // not very elegant, but it will do.
- // you should not be able to have "." and "[" before a "/" - this is assumed.
-
- if (propertyName == 0 || strlen(propertyName) == 0) return 0;
-
- char* tokenend = (char*) strchr(propertyName,'/');
- char * bracket = (char*) strchr(propertyName,'[');
- char* dot = (char*) strchr(propertyName,'.');
- char* copy;
+ // you should not be able to have both "." and "[" before a "/" - this is assumed.
-
- int len = strlen(propertyName);
- if (tokenend != 0)
- {
- len = tokenend - propertyName;
- if (bracket != 0 && bracket < tokenend) len = bracket - propertyName;
- if (dot != 0 && dot < tokenend) len = dot - propertyName;
- }
- else
+ if (propertyName.length() == 0) return 0;
+
+ // strchr returns NULL if target not found
+ // find_first_of returns string::npos in that case
+ // find_first_of returns the subscript of the character found eg 0 if it is the first
+ size_t tokenend = propertyName.find_first_of('/');
+ size_t bracket = propertyName.find_first_of('[');
+ size_t dot = propertyName.find_first_of('.');
+ size_t dotOrBracketOrSlash = propertyName.find_first_of(".[/");
+ SDOString copy;
+ // char* copy;
+
+ int len = propertyName.length();
+ if (dotOrBracketOrSlash != string::npos)
{
- if (bracket != 0) len = bracket - propertyName;
- if (dot != 0) len = dot - propertyName;
+ len = dotOrBracketOrSlash;
}
+
if (len != 0)
{
- copy = new char[len+1];
- strncpy(copy, propertyName,len);
- copy[len] = 0;
+ copy.assign(propertyName, 0, len);
}
else
{
- copy = new char[strlen(propertyName)+1];
- strcpy(copy,propertyName);
+ copy = propertyName;
}
-
+
std::list<PropertyImpl*>::const_iterator i;
for (i = props.begin(); i != props.end(); ++i)
{
- if (!strcmp(copy,(*i)->getName()))
+ if (!strcmp(copy.c_str(),(*i)->getName())) // ie the two strings are the same
{
- delete copy;
- if (tokenend && strlen(tokenend) > 1)
- {
+ // delete copy;
+ if ((tokenend != string::npos) && (propertyName.length() - tokenend) > 1)
+ {
+ // There is someting to the right of the "/"
const TypeImpl* ti = (*i)->getTypeImpl();
if (ti != 0)
{
- PropertyImpl* p = ti->
- getPropertyImpl((const char *)(tokenend+1));
+ PropertyImpl* p = ti->getPropertyImpl(SDOString(propertyName, tokenend + 1, string::npos));
return p;
}
else
@@ -595,18 +590,20 @@
return (PropertyImpl*)(*i);
}
}
- for (unsigned int j=0;j < (*i)->getSubstitutionCount(); j++)
+
+ for (unsigned int j = 0; j < (*i)->getSubstitutionCount(); j++)
{
- if (!strcmp(copy,(*i)->getSubstitutionName(j)))
+ if (!strcmp(copy.c_str(), (*i)->getSubstitutionName(j))) // ie the two strings are the same
{
- delete copy;
- if (tokenend && strlen(tokenend) > 1)
- {
+ // delete copy;
+ if ((tokenend != string::npos) && (propertyName.length() - tokenend) > 1)
+ {
+ // There is someting to the right of the "/"
const TypeImpl* ti = (*i)->getTypeImpl();
if (ti != 0)
{
- PropertyImpl* p = ti->
- getPropertyImpl((const char *)(tokenend+1));
+ // PropertyImpl* p = ti->getPropertyImpl((const char *)(tokenend+1));
+ PropertyImpl* p = ti->getPropertyImpl(SDOString(propertyName, tokenend + 1, string::npos));
return p;
}
else
@@ -619,18 +616,18 @@
}
}
}
- for (unsigned int k=0;k < (*i)->getAliasCount(); k++)
+ for (unsigned int k = 0; k < (*i)->getAliasCount(); k++)
{
- if (!strcmp(copy,(*i)->getAlias(k)))
+ if (!strcmp(copy.c_str(), (*i)->getAlias(k))) // ie the two strings are the same
{
- delete copy;
- if (tokenend && strlen(tokenend) > 1)
- {
+ // delete copy;
+ if ((tokenend != string::npos) && (propertyName.length() - tokenend) > 1)
+ {
const TypeImpl* ti = (*i)->getTypeImpl();
if (ti != 0)
{
- PropertyImpl* p = ti->
- getPropertyImpl((const char *)(tokenend+1));
+ // PropertyImpl* p = ti->getPropertyImpl((const char *)(tokenend+1));
+ PropertyImpl* p = ti->getPropertyImpl(SDOString(propertyName, tokenend + 1, string::npos));
return p;
}
else
@@ -645,120 +642,7 @@
}
}
return 0;
- }
- // +++
- PropertyImpl* TypeImpl::getPropertyImpl(const SDOString& propertyName) const
- {
-
- // Extension - find the property from an xpath
- // you should not be able to have both "." and "[" before a "/" - this is assumed.
-
- if (propertyName.length() == 0) return 0;
-
- // strchr returns NULL if target not found
- // find_first_of returns string::npos in that case
- // find_first_of returns the subscript of the character found eg 0 if it is the first
- size_t tokenend = propertyName.find_first_of('/');
- size_t bracket = propertyName.find_first_of('[');
- size_t dot = propertyName.find_first_of('.');
- size_t dotOrBracketOrSlash = propertyName.find_first_of(".[/");
- SDOString copy;
- // char* copy;
-
- int len = propertyName.length();
- if (dotOrBracketOrSlash != string::npos)
- {
- len = dotOrBracketOrSlash;
- }
-
- if (len != 0)
- {
- copy.assign(propertyName, 0, len);
- }
- else
- {
- copy = propertyName;
- }
-
- std::list<PropertyImpl*>::const_iterator i;
- for (i = props.begin(); i != props.end(); ++i)
- {
- if (!strcmp(copy.c_str(),(*i)->getName())) // ie the two strings are the same
- {
- // delete copy;
- if ((tokenend != string::npos) && (propertyName.length() - tokenend) > 1)
- {
- // There is someting to the right of the "/"
- const TypeImpl* ti = (*i)->getTypeImpl();
- if (ti != 0)
- {
- PropertyImpl* p = ti->getPropertyImpl(SDOString(propertyName, tokenend + 1));
- return p;
- }
- else
- {
- return (PropertyImpl*)(*i);
- }
- }
- else {
- return (PropertyImpl*)(*i);
- }
- }
-
- for (unsigned int j = 0; j < (*i)->getSubstitutionCount(); j++)
- {
- if (!strcmp(copy.c_str(), (*i)->getSubstitutionName(j))) // ie the two strings are the same
- {
- // delete copy;
- if ((tokenend != string::npos) && (propertyName.length() - tokenend) > 1)
- {
- // There is someting to the right of the "/"
- const TypeImpl* ti = (*i)->getTypeImpl();
- if (ti != 0)
- {
- // PropertyImpl* p = ti->getPropertyImpl((const char *)(tokenend+1));
- PropertyImpl* p = ti->getPropertyImpl(SDOString(propertyName, tokenend + 1));
- return p;
- }
- else
- {
- return (PropertyImpl*)(*i);
- }
- }
- else {
- return (PropertyImpl*)(*i);
- }
- }
- }
- for (unsigned int k = 0; k < (*i)->getAliasCount(); k++)
- {
- if (!strcmp(copy.c_str(), (*i)->getAlias(k))) // ie the two strings are the same
- {
- // delete copy;
- if ((tokenend != string::npos) && (propertyName.length() - tokenend) > 1)
- {
- const TypeImpl* ti = (*i)->getTypeImpl();
- if (ti != 0)
- {
- // PropertyImpl* p = ti->getPropertyImpl((const char *)(tokenend+1));
- PropertyImpl* p = ti->getPropertyImpl(SDOString(propertyName, tokenend + 1));
- return p;
- }
- else
- {
- return (PropertyImpl*)(*i);
- }
- }
- else {
- return (PropertyImpl*)(*i);
- }
- }
- }
- }
- return 0;
- }
-
- // ---
+ }
///////////////////////////////////////////////////////////////////////////
// Returns the property with the specified name.
@@ -791,11 +675,15 @@
///////////////////////////////////////////////////////////////////////////
unsigned int TypeImpl::getPropertyIndex(const char* propertyName) const
{
+ return getPropertyIndex(SDOString(propertyName));
+ }
+ unsigned int TypeImpl::getPropertyIndex(const SDOString& propertyName) const
+ {
std::list<PropertyImpl*>::const_iterator i;
int j = 0;
for (i = props.begin(); i != props.end(); ++i)
{
- if (!strcmp(propertyName,(*i)->getName()))
+ if (!strcmp(propertyName.c_str(), (*i)->getName()))
{
return j;
}
@@ -806,23 +694,7 @@
SDO_THROW_EXCEPTION("getPropertyIndex",
SDOPropertyNotFoundException, msg.c_str());
}
- unsigned int TypeImpl::getPropertyIndex(const SDOString& propertyName) const
- {
- std::list<PropertyImpl*>::const_iterator i;
- int j = 0;
- for (i = props.begin(); i != props.end(); ++i)
- {
- if (!strcmp(propertyName.c_str(), (*i)->getName()))
- {
- return j;
- }
- j++;
- }
- string msg("Property not found:");
- msg += propertyName;
- SDO_THROW_EXCEPTION("getPropertyIndex",
- SDOPropertyNotFoundException, msg.c_str());
- }
+
///////////////////////////////////////////////////////////////////////////
// Returns the property with the specified name.
///////////////////////////////////////////////////////////////////////////
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.h?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.h Mon Oct 2 03:04:46 2006
@@ -157,7 +157,6 @@
const Property& getProperty(const SDOString& propertyName) const ;
const Property& getProperty(unsigned int index) const ;
- PropertyImpl* getPropertyImpl(const char* propertyName) const ;
PropertyImpl* getPropertyImpl(const SDOString& propertyName) const ;
PropertyImpl* getPropertyImpl(unsigned int index) const ;
@@ -169,8 +168,8 @@
PropertyImpl* getPropertyImplPure(const char* propertyName) const ;
// get the type of the property even if its a substitute
- const Type& getRealPropertyType(const char* propertyName) const ;
- const TypeImpl* getRealPropertyTypeImpl(const char* propertyName) const ;
+ const Type& getRealPropertyType(const std::string& propertyName) const ;
+ const TypeImpl* getRealPropertyTypeImpl(const std::string& propertyName) const ;
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelper.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelper.h?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelper.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelper.h Mon Oct 2 03:04:46 2006
@@ -57,21 +57,21 @@
const char* targetNamespaceURI=0) = 0;
SDO_API virtual XMLDocumentPtr loadFile(
const SDOString& xmlFile,
- const SDOString& targetNamespaceURI = SDOString::SDONullString) = 0;
+ const SDOString& targetNamespaceURI = "") = 0;
SDO_API virtual XMLDocumentPtr load(
std::istream& inXml,
const char* targetNamespaceURI=0) = 0;
SDO_API virtual XMLDocumentPtr load(
std::istream& inXml,
- const SDOString& targetNamespaceURI = SDOString::SDONullString) = 0;
+ const SDOString& targetNamespaceURI = "") = 0;
SDO_API virtual XMLDocumentPtr load(
const char* inXml,
const char* targetNamespaceURI=0) = 0;
SDO_API virtual XMLDocumentPtr load(
const SDOString& inXml,
- const SDOString& targetNamespaceURI = SDOString::SDONullString) = 0;
+ const SDOString& targetNamespaceURI = "") = 0;
/** save saves the graph to XML
*
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp Mon Oct 2 03:04:46 2006
@@ -149,18 +149,18 @@
{
if (elementname == 0)
{
- return createDocument(SDOString::SDONullString, SDOString::SDONullString);
+ return createDocument(SDOString(""), SDOString(""));
}
else
{
- return createDocument(SDOString(elementname), SDOString::SDONullString);
+ return createDocument(SDOString(elementname), SDOString(""));
}
}
else
{
if (elementname == 0)
{
- return createDocument(SDOString::SDONullString, SDOString(rootElementURI));
+ return createDocument(SDOString(""), SDOString(rootElementURI));
}
else
{
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h Mon Oct 2 03:04:46 2006
@@ -76,21 +76,21 @@
const char* targetNamespaceURI = 0);
virtual XMLDocumentPtr loadFile(
const SDOString& xmlFile,
- const SDOString& targetNamespaceURI = SDOString::SDONullString);
+ const SDOString& targetNamespaceURI = "");
virtual XMLDocumentPtr load(
std::istream& inXml,
const char* targetNamespaceURI = 0);
virtual XMLDocumentPtr load(
std::istream& inXml,
- const SDOString& targetNamespaceURI = SDOString::SDONullString);
+ const SDOString& targetNamespaceURI = "");
virtual XMLDocumentPtr load(
const char* inXml,
const char* targetNamespaceURI = 0);
virtual XMLDocumentPtr load(
const SDOString& inXml,
- const SDOString& targetNamespaceURI = SDOString::SDONullString);
+ const SDOString& targetNamespaceURI = "");
virtual XMLDocumentPtr createDocument(
DataObjectPtr dataObject,
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h Mon Oct 2 03:04:46 2006
@@ -71,7 +71,7 @@
int indent = -1) = 0;
SDO_API virtual char* generate(
const TypeList& types,
- const SDOString& targetNamespaceURI = SDOString::SDONullString,
+ const SDOString& targetNamespaceURI = "",
int indent = -1) = 0;
SDO_API virtual void generate(
const TypeList& types,
@@ -81,7 +81,7 @@
SDO_API virtual void generate(
const TypeList& types,
std::ostream& outXsd,
- const SDOString& targetNamespaceURI = SDOString::SDONullString,
+ const SDOString& targetNamespaceURI = "",
int indent = -1) = 0;
SDO_API virtual void generateFile(
const TypeList& types,
@@ -91,7 +91,7 @@
SDO_API virtual void generateFile(
const TypeList& types,
const SDOString& fileName,
- const SDOString& targetNamespaceURI = SDOString::SDONullString,
+ const SDOString& targetNamespaceURI = "",
int indent = -1) = 0;
/***********************************/
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp Mon Oct 2 03:04:46 2006
@@ -267,10 +267,10 @@
cout << addTypeCode.c_str() <<endl;
*/
- df->addType(ty.uri, ty.name, ty.isSequenced,
+ df->addType((const char*)ty.uri, (const char*)ty.name, ty.isSequenced,
ty.isOpen, ty.isAbstract, ty.dataType, ty.isFromList);
df->setDASValue(
- ty.uri, ty.name,
+ (const char*)ty.uri, (const char*)ty.name,
"XMLDAS::TypeInfo",
new XSDTypeInfo(ty));
@@ -336,11 +336,11 @@
*/
df->setBaseType(
- ty.uri,
- ty.name,
- ty.parentTypeUri,
- ty.parentTypeName,
- ty.isRestriction);
+ (const char*)ty.uri,
+ (const char*)ty.name,
+ (const char*)ty.parentTypeUri,
+ (const char*)ty.parentTypeName,
+ (const char*)ty.isRestriction);
}
catch (SDORuntimeException& e)
{
@@ -438,13 +438,13 @@
try
{
- df->addPropertyToType(ty.uri, ty.name,
- prop.name,
- prop.typeUri,
- prop.typeName,
- prop.isMany,
- prop.isReadOnly,
- prop.isContainment);
+ df->addPropertyToType((const char*)ty.uri, (const char*)ty.name,
+ (const char*)prop.name,
+ (const char*)prop.typeUri,
+ (const char*)prop.typeName,
+ (const char*)prop.isMany,
+ (const char*)prop.isReadOnly,
+ (const char*)prop.isContainment);
LOGINFO_1(INFO,"XSDHelper adds property %s",(const char*)(prop.name));
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h Mon Oct 2 03:04:46 2006
@@ -101,7 +101,7 @@
);
virtual char* generate(
const TypeList& types,
- const SDOString& targetNamespaceURI = SDOString::SDONullString,
+ const SDOString& targetNamespaceURI = "",
int indent = -1
);
void generate(
@@ -113,7 +113,7 @@
void generate(
const TypeList& types,
std::ostream& outXsd,
- const SDOString& targetNamespaceURI = SDOString::SDONullString,
+ const SDOString& targetNamespaceURI = "",
int indent = -1
);
virtual void generateFile(
@@ -124,7 +124,7 @@
virtual void generateFile(
const TypeList& types,
const SDOString& fileName,
- const SDOString& targetNamespaceURI = SDOString::SDONullString,
+ const SDOString& targetNamespaceURI = "",
int indent = -1);
virtual DataFactoryPtr getDataFactory();
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XpathHelper.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XpathHelper.cpp?view=diff&rev=451941&r1=451940&r2=451941
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XpathHelper.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XpathHelper.cpp Mon Oct 2 03:04:46 2006
@@ -20,6 +20,7 @@
#include "commonj/sdo/XpathHelper.h"
#include <string.h>
+using std::string;
namespace commonj{
namespace sdo{
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org