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/08/25 13:20:52 UTC
svn commit: r436758 -
/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/
Author: robbinspg
Date: Fri Aug 25 04:20:50 2006
New Revision: 436758
URL: http://svn.apache.org/viewvc?rev=436758&view=rev
Log:
TUSCANY-539 - Apply Geoff Winn's patch
Modified:
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DASValue.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DASValue.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObject.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/DataObjectList.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Logger.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XpathHelper.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XpathHelper.h
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DASValue.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DASValue.cpp?rev=436758&r1=436757&r2=436758&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DASValue.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DASValue.cpp Fri Aug 25 04:20:50 2006
@@ -34,6 +34,11 @@
{
}
+ DASValue::DASValue(const SDOString& val)
+ : value(val)
+ {
+ }
+
DASValue::~DASValue()
{
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DASValue.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DASValue.h?rev=436758&r1=436757&r2=436758&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DASValue.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DASValue.h Fri Aug 25 04:20:50 2006
@@ -22,6 +22,7 @@
#include "commonj/sdo/export.h"
+#include "commonj/sdo/SDOString.h"
#include "string"
@@ -39,11 +40,12 @@
public:
SDO_API DASValue();
SDO_API DASValue(const char* value);
+ SDO_API DASValue(const SDOString& value);
SDO_API virtual ~DASValue();
SDO_API const char* getValue() const;
private:
- std::string value;
+ SDOString value;
};
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObject.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObject.h?rev=436758&r1=436757&r2=436758&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObject.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObject.h Fri Aug 25 04:20:50 2006
@@ -202,8 +202,9 @@
virtual SDO_API bool getBoolean(const SDOString& path) = 0;
virtual SDO_API bool getBoolean(unsigned int propindex) = 0;
virtual SDO_API bool getBoolean(const Property& p) = 0;
-
+
virtual SDO_API void setBoolean(const char* path, bool b) = 0;
+ virtual SDO_API void setBoolean(const SDOString& path, bool b) = 0;
virtual SDO_API void setBoolean(unsigned int propindex, bool b) = 0;
virtual SDO_API void setBoolean(const Property& p, bool b) = 0;
@@ -214,10 +215,12 @@
*/
virtual SDO_API char getByte(const char* path) = 0;
+ virtual SDO_API char getByte(const SDOString& path) = 0;
virtual SDO_API char getByte(unsigned int propindex) = 0;
virtual SDO_API char getByte(const Property& p) = 0;
virtual SDO_API void setByte(const char* path, char c) = 0;
+ virtual SDO_API void setByte(const SDOString& path, char c) = 0;
virtual SDO_API void setByte(unsigned int propindex, char c) = 0;
virtual SDO_API void setByte(const Property& p, char c) = 0;
@@ -228,10 +231,12 @@
*/
virtual SDO_API wchar_t getCharacter(const char* path) = 0;
+ virtual SDO_API wchar_t getCharacter(const SDOString& path) = 0;
virtual SDO_API wchar_t getCharacter(unsigned int propindex) = 0;
virtual SDO_API wchar_t getCharacter(const Property& p) = 0;
-
+
virtual SDO_API void setCharacter(const char* path, wchar_t c) = 0;
+ virtual SDO_API void setCharacter(const SDOString& path, wchar_t c) = 0;
virtual SDO_API void setCharacter(unsigned int propindex, wchar_t c) = 0;
virtual SDO_API void setCharacter(const Property& p, wchar_t c) = 0;
@@ -245,6 +250,7 @@
* reallen = do->getBytes("name",buf,len);
*/
virtual SDO_API unsigned int getLength(const char* path) = 0;
+ virtual SDO_API unsigned int getLength(const SDOString& path) = 0;
virtual SDO_API unsigned int getLength(unsigned int propindex) = 0;
virtual SDO_API unsigned int getLength(const Property& p) = 0;
virtual SDO_API unsigned int getLength() = 0;
@@ -266,10 +272,12 @@
virtual SDO_API unsigned int getBytes(const char* path, char* buf, unsigned int max) = 0;
+ virtual SDO_API unsigned int getBytes(const SDOString& path, char* buf, unsigned int max) = 0;
virtual SDO_API unsigned int getBytes(unsigned int propindex, char* buf, unsigned int max) = 0;
virtual SDO_API unsigned int getBytes(const Property& p, char* buf, unsigned int max) = 0;
-
+
virtual SDO_API void setBytes(const char* path, const char* c, unsigned int length) = 0;
+ virtual SDO_API void setBytes(const SDOString& path, const char* c, unsigned int length) = 0;
virtual SDO_API void setBytes(unsigned int propindex, const char* c, unsigned int length) = 0;
virtual SDO_API void setBytes(const Property& p, const char* c, unsigned int length) = 0;
@@ -285,11 +293,13 @@
* length of the array, then only a portion of the array is returned.
*/
+ virtual SDO_API unsigned int getString(const SDOString& path , wchar_t* c, unsigned int max) = 0;
virtual SDO_API unsigned int getString(const char* path , wchar_t* c, unsigned int max) = 0;
virtual SDO_API unsigned int getString(unsigned int propindex, wchar_t* c, unsigned int max) = 0;
virtual SDO_API unsigned int getString(const Property& p, wchar_t* c, unsigned int max) = 0;
virtual SDO_API void setString(const char* path, const wchar_t* c, unsigned int length) = 0;
+ virtual SDO_API void setString(const SDOString& path, const wchar_t* c, unsigned int length) = 0;
virtual SDO_API void setString(unsigned int propindex, const wchar_t* c, unsigned int length) = 0;
virtual SDO_API void setString(const Property& p, const wchar_t* c, unsigned int length) = 0;
@@ -299,10 +309,12 @@
* reachable from it, as identified by the specified path.
*/
virtual SDO_API const SDODate getDate(const char* path) = 0;
+ virtual SDO_API const SDODate getDate(const SDOString& path) = 0;
virtual SDO_API const SDODate getDate(unsigned int propindex) = 0;
virtual SDO_API const SDODate getDate(const Property& p) = 0;
virtual SDO_API void setDate(const char* path, const SDODate d) = 0;
+ virtual SDO_API void setDate(const SDOString& path, const SDODate d) = 0;
virtual SDO_API void setDate(unsigned int propindex, const SDODate d) = 0;
virtual SDO_API void setDate(const Property& p, const SDODate d) = 0;
@@ -312,10 +324,12 @@
* reachable from it, as identified by the specified path.
*/
+ virtual SDO_API long double getDouble(const SDOString& path) = 0;
virtual SDO_API long double getDouble(const char* path) = 0;
virtual SDO_API long double getDouble(unsigned int propindex) = 0;
virtual SDO_API long double getDouble(const Property& p) = 0;
+ virtual SDO_API void setDouble(const SDOString& path, long double d) = 0;
virtual SDO_API void setDouble(const char* path, long double d) = 0;
virtual SDO_API void setDouble(unsigned int propindex, long double d) = 0;
virtual SDO_API void setDouble(const Property& p, long double d) = 0;
@@ -326,10 +340,12 @@
* reachable from it, as identified by the specified path.
*/
+ virtual SDO_API float getFloat(const SDOString& path) = 0;
virtual SDO_API float getFloat(const char* path) = 0;
virtual SDO_API float getFloat(unsigned int propindex) = 0;
virtual SDO_API float getFloat(const Property& p) = 0;
+ virtual SDO_API void setFloat(const SDOString& path, float f) = 0;
virtual SDO_API void setFloat(const char* path, float f) = 0;
virtual SDO_API void setFloat(unsigned int propindex, float f) = 0;
virtual SDO_API void setFloat(const Property& p, float f) = 0;
@@ -340,10 +356,12 @@
* reachable from it, as identified by the specified path.
*/
+ virtual SDO_API long getInteger(const SDOString& path) = 0;
virtual SDO_API long getInteger(const char* path) = 0;
virtual SDO_API long getInteger(unsigned int propindex) = 0;
virtual SDO_API long getInteger(const Property& p) = 0;
+ virtual SDO_API void setInteger(const SDOString& path, long i) = 0;
virtual SDO_API void setInteger(const char* path, long i) = 0;
virtual SDO_API void setInteger(unsigned int propindex, long i) = 0;
virtual SDO_API void setInteger(const Property& p, long i) = 0;
@@ -354,10 +372,12 @@
* reachable from it, as identified by the specified path.
*/
+ virtual SDO_API int64_t getLong(const SDOString& path) = 0;
virtual SDO_API int64_t getLong(const char* path) = 0;
virtual SDO_API int64_t getLong(unsigned int propindex) = 0;
virtual SDO_API int64_t getLong(const Property& p) = 0;
-
+
+ virtual SDO_API void setLong(const SDOString& path, int64_t l) = 0;
virtual SDO_API void setLong(const char* path, int64_t l) = 0;
virtual SDO_API void setLong(unsigned int propindex, int64_t l) = 0;
virtual SDO_API void setLong(const Property& p, int64_t l) = 0;
@@ -368,10 +388,12 @@
* reachable from it, as identified by the specified path.
*/
+ virtual SDO_API short getShort(const SDOString& path) = 0;
virtual SDO_API short getShort(const char* path) = 0;
virtual SDO_API short getShort(unsigned int propindex) = 0;
virtual SDO_API short getShort(const Property& p) = 0;
+ virtual SDO_API void setShort(const SDOString& path, short s) = 0;
virtual SDO_API void setShort(const char* path, short s) = 0;
virtual SDO_API void setShort(unsigned int propindex, short s) = 0;
virtual SDO_API void setShort(const Property& p, short s) = 0;
@@ -384,12 +406,17 @@
*/
virtual SDO_API const char* getCString(const char* path) = 0;
+ virtual SDO_API const char* getCString(const SDOString& path) = 0;
virtual SDO_API const char* getCString(unsigned int propertyIndex) = 0;
virtual SDO_API const char* getCString(const Property& prop) = 0;
virtual SDO_API void setCString(const char* path, const char* value) = 0;
virtual SDO_API void setCString(unsigned int propertyIndex, const char* value) = 0;
virtual SDO_API void setCString (const Property& prop, const char* value) = 0;
+
+ virtual SDO_API void setCString(const SDOString& path, const SDOString& value) = 0;
+ virtual SDO_API void setCString(unsigned int propertyIndex, const SDOString& value) = 0;
+ virtual SDO_API void setCString (const Property& prop, const SDOString& value) = 0;
/** setNull sets a data object value to null.
@@ -402,10 +429,12 @@
*/
virtual SDO_API void setNull(const char* path) = 0;
+ virtual SDO_API void setNull(const SDOString& path) = 0;
virtual SDO_API void setNull(unsigned int propertyIndex) = 0;
virtual SDO_API void setNull(const Property& prop) = 0;
virtual SDO_API bool isNull(const char* path) = 0;
+ virtual SDO_API bool isNull(const SDOString& path) = 0;
virtual SDO_API bool isNull(unsigned int propertyIndex) = 0;
virtual SDO_API bool isNull(const Property& prop) = 0;
@@ -417,6 +446,7 @@
*/
virtual SDO_API bool isSet(const char* path) = 0;
+ virtual SDO_API bool isSet(const SDOString& path) = 0;
virtual SDO_API bool isSet(unsigned int propertyIndex) = 0;
virtual SDO_API bool isSet(const Property& property) = 0;
@@ -429,6 +459,7 @@
*/
virtual SDO_API bool isValid(const char* path) = 0;
+ virtual SDO_API bool isValid(const SDOString& path) = 0;
virtual SDO_API bool isValid(unsigned int propertyIndex) = 0;
virtual SDO_API bool isValid(const Property& property ) =0;
@@ -439,6 +470,7 @@
*/
virtual SDO_API void unset(const char* path) = 0;
+ virtual SDO_API void unset(const SDOString& path) = 0;
virtual SDO_API void unset(unsigned int propertyIndex) = 0;
virtual SDO_API void unset(const Property& property) = 0;
@@ -450,10 +482,12 @@
*/
virtual SDO_API void setUserData(const char* path,void* value) = 0;
+ virtual SDO_API void setUserData(const SDOString& path, void* value) = 0;
virtual SDO_API void setUserData(unsigned int propertyIndex, void* value) = 0;
virtual SDO_API void setUserData(const Property& property, void* value) = 0;
virtual SDO_API void setUserData(void* value) = 0;
virtual SDO_API void* getUserData(const char* path) = 0;
+ virtual SDO_API void* getUserData(const SDOString& path) = 0;
virtual SDO_API void* getUserData(unsigned int propertyIndex) = 0;
virtual SDO_API void* getUserData(const Property& property) = 0;
virtual SDO_API void* getUserData() = 0;
@@ -467,6 +501,7 @@
virtual SDO_API SequencePtr getSequence() = 0;
virtual SDO_API SequencePtr getSequence(const char* path) = 0;
+ virtual SDO_API SequencePtr getSequence(const SDOString& path) = 0;
virtual SDO_API SequencePtr getSequence(unsigned int propertyIndex) = 0;
virtual SDO_API SequencePtr getSequence(const Property& property) = 0;
@@ -482,7 +517,9 @@
* list, otherwise it sets the value, removing any old value.
*/
+
virtual SDO_API DataObjectPtr createDataObject(const char* propertyName) = 0;
+ virtual SDO_API DataObjectPtr createDataObject(const SDOString& propertyName) = 0;
virtual SDO_API DataObjectPtr createDataObject(unsigned int propertyIndex) = 0;
virtual SDO_API DataObjectPtr createDataObject(const Property& property) = 0;
@@ -515,6 +552,7 @@
*/
virtual SDO_API DataObjectList& getList(const char* path) = 0;
+ virtual SDO_API DataObjectList& getList(const SDOString& path) = 0;
virtual SDO_API DataObjectList& getList(unsigned int propIndex) = 0;
virtual SDO_API DataObjectList& getList(const Property& p) = 0;
virtual DataObjectList& getList() = 0;
@@ -531,6 +569,7 @@
virtual SDO_SPI ChangeSummaryPtr getChangeSummary() = 0;
virtual SDO_SPI ChangeSummaryPtr getChangeSummary(const char* path) = 0;
+ virtual SDO_SPI ChangeSummaryPtr getChangeSummary(const SDOString& path) = 0;
virtual SDO_SPI ChangeSummaryPtr getChangeSummary(unsigned int propIndex) = 0;
virtual SDO_SPI ChangeSummaryPtr getChangeSummary(const Property& prop) = 0;
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?rev=436758&r1=436757&r2=436758&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.cpp Fri Aug 25 04:20:50 2006
@@ -290,6 +290,55 @@
}\
}
+#define setPrimitiveFromPathUsingSDOString(primval,setval,platval)\
+ void DataObjectImpl::set ##primval (const SDOString& path, setval value)\
+ {\
+ DataObjectImpl *d;\
+ SDOString spath;\
+ SDOString prop;\
+ try {\
+ DataObjectImpl::stripPath(path, spath);\
+ prop = findPropertyContainer(spath,&d);\
+ if (d != 0)\
+ {\
+ if (prop.empty()) {\
+ d->set ##primval (value);\
+ }\
+ else {\
+ const PropertyImpl* p = d->getPropertyImpl(prop);\
+ if (p == 0 && d->getType().isOpenType()) \
+ {\
+ p = d->define ##primval (prop);\
+ }\
+ if (p == 0)\
+ {\
+ string msg("Set value - path not found");\
+ SDO_THROW_EXCEPTION("setter", SDOPathNotFoundException,\
+ msg.c_str());\
+ }\
+ if (p->isMany()|| p->getTypeImpl()->isFromList())\
+ {\
+ long l;\
+ DataObjectList& dol = d->getList((Property&)*p);\
+ DataObjectImpl* doi = d->findDataObject(prop,&l);\
+ if (doi != 0) {\
+ doi->set ## primval (value);\
+ }\
+ else {\
+ dol.append(( platval) value);\
+ }\
+ }\
+ else {\
+ d->set ##primval ((Property&)*p,value);\
+ }\
+ }\
+ }\
+ }\
+ catch (SDORuntimeException e) {\
+ SDO_RETHROW_EXCEPTION("setter",e);\
+ }\
+ }
+
#define getPrimitiveFromPathUsingSDOString(primval, retval, defval)\
retval DataObjectImpl::get ##primval (const SDOString& path)\
{\
@@ -404,7 +453,52 @@
}\
}
-
+#define getCharsFromPathUsingSDOString(primval, retval, defval)\
+ unsigned int DataObjectImpl::get ##primval (const SDOString& path, retval valptr , unsigned int max)\
+ {\
+ DataObjectImpl* d;\
+ SDOString spath;\
+ SDOString prop;\
+ try {\
+ DataObjectImpl::stripPath(path, spath);\
+ prop = findPropertyContainer(spath, &d);\
+ if (d != 0) {\
+ if (prop.length() == 0) {\
+ return d->get ##primval ( valptr , max);\
+ }\
+ else {\
+ PropertyImpl* p = d->getPropertyImpl(prop);\
+ if (p != 0)\
+ {\
+ if (p->isMany() || p->getTypeImpl()->isFromList())\
+ {\
+ long l;\
+ DataObjectImpl* doi = d->findDataObject(prop,&l);\
+ if (doi != 0) {\
+ return doi->get ## primval (valptr, max);\
+ }\
+ string msg("Get value - index out of range");\
+ msg += path;\
+ SDO_THROW_EXCEPTION("getChars", SDOIndexOutOfRangeException,\
+ msg.c_str());\
+ }\
+ else { \
+ if (!d->isSet(*p)) {\
+ return p->get ##primval ##Default( valptr , max );\
+ }\
+ return d->get ##primval (*p, valptr , max);\
+ }\
+ }\
+ }\
+ }\
+ string msg("Get value - path not found");\
+ SDO_THROW_EXCEPTION("getCString", SDOPathNotFoundException,\
+ msg.c_str());\
+ }\
+ catch (SDORuntimeException e) {\
+ SDO_RETHROW_EXCEPTION("character getter", e);\
+ }\
+ }
/** @def setPrimitiveFromPath
*
@@ -542,8 +636,54 @@
}\
}
-
-
+#define setCharsFromPathUsingSDOString(primval,setval)\
+ void DataObjectImpl::set ##primval (const SDOString& path, setval value, unsigned int len)\
+ {\
+ DataObjectImpl *d;\
+ SDOString spath;\
+ SDOString prop;\
+ try {\
+ DataObjectImpl::stripPath(path, spath);\
+ prop = findPropertyContainer(spath, &d);\
+ if (d != 0)\
+ {\
+ if (prop.length() == 0) {\
+ d->set ##primval (value, len);\
+ }\
+ else {\
+ const PropertyImpl* p = d->getPropertyImpl(prop);\
+ if (p == 0 && d->getType().isOpenType())\
+ {\
+ p = d->define ##primval (prop);\
+ }\
+ if (p == 0)\
+ {\
+ string msg("Set value - path not found");\
+ SDO_THROW_EXCEPTION("setter", SDOPathNotFoundException,\
+ msg.c_str());\
+ }\
+ if (p->isMany()|| p->getTypeImpl()->isFromList())\
+ {\
+ long l;\
+ DataObjectList& dol = d->getList((Property&)*p);\
+ DataObjectImpl* doi = d->findDataObject(prop,&l);\
+ if (doi != 0) {\
+ doi->set ## primval (value, len);\
+ }\
+ else {\
+ dol.append(value,len);\
+ }\
+ }\
+ else { \
+ d->set ##primval ((Property&)*p,value, len);\
+ }\
+ }\
+ }\
+ }\
+ catch (SDORuntimeException e) {\
+ SDO_RETHROW_EXCEPTION("setter",e);\
+ }\
+ }
/** @def getPrimitiveFromProperty
*
@@ -637,10 +777,12 @@
// setters and getters from a path specification
- getCharsFromPath(String, wchar_t* , 0);
- getCharsFromPath(Bytes, char* , 0);
+ getCharsFromPathUsingSDOString(String, wchar_t* , 0);
+ getCharsFromPathUsingSDOString(Bytes, char* , 0);
setCharsFromPath(String, const wchar_t*);
+ setCharsFromPathUsingSDOString(String, const wchar_t*);
setCharsFromPath(Bytes, const char*);
+ setCharsFromPathUsingSDOString(Bytes, const char*);
getCharsFromProperty(String,wchar_t*);
getCharsFromProperty(Bytes,char*);
setCharsFromProperty(String,const wchar_t*);
@@ -650,6 +792,20 @@
setCharsBasic(String,const wchar_t*,"String");
setCharsBasic(Bytes,const char*,"Bytes");
+ unsigned int DataObjectImpl::getBytes(const char* path, char* valptr , unsigned int max)
+ {
+ const SDOString pathObject(path);
+ unsigned int result = getBytes(pathObject, valptr, max);
+ return result;
+ }
+
+ unsigned int DataObjectImpl::getString(const char* path, wchar_t* buf, unsigned int max)
+ {
+ return getString(SDOString(path), buf, max);
+ }
+
+
+
// Convenience methods for string/bytes length
@@ -742,41 +898,233 @@
}
}
- unsigned int DataObjectImpl::getLength(unsigned int index)
+ unsigned int DataObjectImpl::getLength(const SDOString& path)
{
- return getLength(getProperty(index));
+ DataObjectImpl* d;
+ SDOString spath;
+ DataObjectImpl::stripPath(path, spath);
+ SDOString prop = findPropertyContainer(spath, &d);
+ if (d != 0) {
+ if (prop.length() == 0) {
+ return 0;
+ }
+ else
+ {
+ const Property& p = d->getProperty(prop);
+ return getLength(p);
+ }
+ }
+ else
+ {
+ if (prop.length())
+ {
+ const Property& p = getProperty(prop);
+ return getLength(p);
+ }
+ else
+ {
+ return 0;
+ }
+ }
}
- bool DataObjectImpl::getBoolean(const char* path)
- {
- return getBoolean(SDOString(path));
- }
+ unsigned int DataObjectImpl::getLength(unsigned int index)
+ {
+ return getLength(getProperty(index));
+ }
+
+ // +++
+ // Provide implementations for the getXXX(const char* path) methods.
+ // These are implemented by delegating the call
+ // to the corresponding getXXX(const SDOString& path) method.
+
+ // getPrimitiveFromPath(Boolean,bool,false);
+ bool DataObjectImpl::getBoolean(const char* path)
+ {
+ return getBoolean(SDOString(path));
+ }
+
+ // getPrimitiveFromPath(Short,short,0);
+ short DataObjectImpl::getShort(const char* path)
+ {
+ return getShort(SDOString(path));
+ }
+
+ // getPrimitiveFromPath(Byte,char,0);
+ char DataObjectImpl::getByte(const char* path)
+ {
+ return getByte(SDOString(path));
+ }
+
+ // getPrimitiveFromPath(Character,wchar_t,0);
+ wchar_t DataObjectImpl::getCharacter(const char* path)
+ {
+ return getCharacter(SDOString(path));
+ }
+
+ // getPrimitiveFromPath(Date,const SDODate,0);
+ const SDODate DataObjectImpl::getDate(const char* path)
+ {
+ return getDate(SDOString(path));
+ }
+
+ // getPrimitiveFromPath(Double,long double,0.0);
+ long double DataObjectImpl::getDouble(const char* path)
+ {
+ return getDouble(SDOString(path));
+ }
+
+ // getPrimitiveFromPath(Float,float,0.0);
+ float DataObjectImpl::getFloat(const char* path)
+ {
+ return getFloat(SDOString(path));
+ }
- // getPrimitiveFromPath(Boolean,bool,false); // Provides DataObjectImpl::getBoolean(const char*)
- getPrimitiveFromPathUsingSDOString(Boolean,bool,false); // Provides DataObjectImpl::getBoolean(const SDOString&)
- getPrimitiveFromPath(Byte,char,0);
- getPrimitiveFromPath(Character,wchar_t,0);
- getPrimitiveFromPath(Short,short,0);
- getPrimitiveFromPath(Integer,long,0);
- getPrimitiveFromPath(Long,int64_t,0L);
- getPrimitiveFromPath(Double,long double,0.0);
- getPrimitiveFromPath(Float,float,0.0);
- getPrimitiveFromPath(Date,const SDODate,0);
+ // getPrimitiveFromPath(Integer,long,0);
+ long DataObjectImpl::getInteger(const char* path)
+ {
+ return getInteger(SDOString(path));
+ }
+
+ // getPrimitiveFromPath(Long,int64_t,0L);
+ int64_t DataObjectImpl::getLong(const char* path)
+ {
+ return getLong(SDOString(path));
+ }
+
+ // End of implementations for the getXXX(const char* path) methods.
+ // ---
+
+
+ // +++
+ // Provide implementations for the getXXX(const SDOString& path) methods.
+ // These are implemented by macro expansion. The comment before each one
+ // shows the signature of the method being defined.
+
+ // DataObjectImpl::getBoolean(const SDOString&)
+ getPrimitiveFromPathUsingSDOString(Boolean, bool, false);
+
+ // DataObjectImpl::getByte(const SDOString&)
+ getPrimitiveFromPathUsingSDOString(Byte, char, 0);
+
+ // DataObjectImpl::getCharacter(const SDOString&)
+ getPrimitiveFromPathUsingSDOString(Character, wchar_t, 0);
+
+ // DataObjectImpl::getShort(const SDOString&)
+ getPrimitiveFromPathUsingSDOString(Short,short,0);
+
+ getPrimitiveFromPathUsingSDOString(Integer,long,0);
+
+ getPrimitiveFromPathUsingSDOString(Long,int64_t,0L);
+
+ getPrimitiveFromPathUsingSDOString(Double,long double,0.0);
+
+ getPrimitiveFromPathUsingSDOString(Float,float,0.0);
+
+ getPrimitiveFromPathUsingSDOString(Date,const SDODate,0);
+
+ // End of implementations for the getXXX(const SDOString& path) methods.
+ // ---
+
+
+ // +++
+ // Provide implementations for the setXXX(const char* path, XXX) methods.
+ // These are implemented by delegating the call
+ // to the corresponding setXXX(const SDOString& path, XXX) method.
+
+ // setPrimitiveFromPath(Boolean,bool, bool);
+ void DataObjectImpl::setBoolean(const char* path, bool b)
+ {
+ setBoolean(SDOString(path), b);
+ }
+
+ // setPrimitiveFromPath(Short,short, short);
+ void DataObjectImpl::setShort(const char* path, short s)
+ {
+ setShort(SDOString(path), s);
+ }
+
+ // setPrimitiveFromPath(Byte,char, char);
+ void DataObjectImpl::setByte(const char* path, char c)
+ {
+ setByte(SDOString(path), c);
+ }
+
+ // setPrimitiveFromPath(Character,wchar_t, wchar_t);
+ void DataObjectImpl::setCharacter(const char* path, wchar_t c)
+ {
+ setCharacter(SDOString(path), c);
+ }
+
+ // setPrimitiveFromPath(Date,const SDODate, const SDODate);
+ void DataObjectImpl::setDate(const char* path, const SDODate d)
+ {
+ setDate(SDOString(path), d);
+ }
+
+ // setPrimitiveFromPath(Double,long double, long double);
+ void DataObjectImpl::setDouble(const char* path, long double d)
+ {
+ setDouble(SDOString(path), d);
+ }
+
+ // setPrimitiveFromPath(Float,float, float);
+ void DataObjectImpl::setFloat(const char* path, float f)
+ {
+ setFloat(SDOString(path), f);
+ }
+
+ // setPrimitiveFromPath(Integer,long, int64_t);
+ void DataObjectImpl::setInteger(const char* path, long i)
+ {
+ setInteger(SDOString(path), i);
+ }
+
+ // setPrimitiveFromPath(Long,int64_t, int64_t);
+ // setPrimitiveFromPath(Integer,long, long);
+ // Depends on wordsize, see SDOString& variant below.
+ void DataObjectImpl::setLong(const char* path, /*long long*/ int64_t l)
+ {
+ setLong(SDOString(path), l);
+ }
+
+ // End of implementations for the setXXX(const char* path, XXX) methods.
+ // ---
- setPrimitiveFromPath(Boolean,bool, bool);
- setPrimitiveFromPath(Byte,char, char);
- setPrimitiveFromPath(Character,wchar_t, wchar_t);
- setPrimitiveFromPath(Short,short, short);
+ // +++
+ // Provide implementations for the setXXX(const SDOString& path, XXX) methods.
+ // These are implemented by macro expansion. The comment before each one
+ // shows the signature of the method being defined.
+
+ // void DataObjectImpl::setBoolean(const SDOString& path, bool b);
+ setPrimitiveFromPathUsingSDOString(Boolean, bool, bool);
+
+ // void DataObjectImpl::setByte(const SDOString& path, char c);
+ setPrimitiveFromPathUsingSDOString(Byte, char, char);
+
+ // void DataObjectImpl::setCharacter(const SDOString& path, wchar_t c);
+ setPrimitiveFromPathUsingSDOString(Character, wchar_t, wchar_t);
+
+ // void DataObjectImpl::setShort(const SDOString& path, short s);
+ setPrimitiveFromPathUsingSDOString(Short,short, short);
+
#if __WORDSIZE ==64
- setPrimitiveFromPath(Integer,long, int64_t);
+ setPrimitiveFromPathUsingSDOString(Integer,long, int64_t);
#else
- setPrimitiveFromPath(Integer,long, long);
+ setPrimitiveFromPathUsingSDOString(Integer,long, long);
#endif
- setPrimitiveFromPath(Long,int64_t, int64_t);
- setPrimitiveFromPath(Float,float, float);
- setPrimitiveFromPath(Double,long double, long double);
- setPrimitiveFromPath(Date,const SDODate, const SDODate);
+
+ setPrimitiveFromPathUsingSDOString(Long,int64_t, int64_t);
+
+ setPrimitiveFromPathUsingSDOString(Float,float, float);
+
+ setPrimitiveFromPathUsingSDOString(Double,long double, long double);
+
+ setPrimitiveFromPathUsingSDOString(Date,const SDODate, const SDODate);
+
+ // ---
+ // End of implementations for the setXXX(const SDOString& path, XXX) methods.
getPrimitiveFromProperty(Boolean,bool);
@@ -912,61 +1260,122 @@
return defineProperty(propname,t);
}
+ 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)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Byte");
return defineProperty(propname,t);
}
+ 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)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Character");
return defineProperty(propname,t);
}
+ 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)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "String");
return defineProperty(propname,t);
}
+ 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)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Bytes");
return defineProperty(propname,t);
}
+ 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)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Short");
return defineProperty(propname,t);
}
+ 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)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Integer");
return defineProperty(propname,t);
}
+ 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)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Long");
return defineProperty(propname,t);
}
+ 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)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Float");
return defineProperty(propname,t);
}
+ 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)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Double");
return defineProperty(propname,t);
}
+ 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)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Date");
return defineProperty(propname,t);
}
+ 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)
{
const Type& t = factory->getType(Type::SDOTypeNamespaceURI, "Bytes");
return defineProperty(propname,t);
}
+ 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)
{
@@ -1057,73 +1466,97 @@
return;
}
+ void DataObjectImpl::setCString (unsigned int propertyIndex, const SDOString& value)
+ {
+ validateIndex(propertyIndex);
+ PropertyValueMap::iterator i;
+ if ((getProperty(propertyIndex).isMany())
+ || getPropertyImpl(propertyIndex)->getTypeImpl()->isFromList())
+ {
+ string msg("Set value not available on many valued property:");
+ msg += getProperty(propertyIndex).getName();
+ SDO_THROW_EXCEPTION("setString", SDOUnsupportedOperationException,
+ msg.c_str());
+ }
+ for (i = PropertyValues.begin(); i != PropertyValues.end(); ++i)
+ {
+ if ((*i).first == propertyIndex)
+ {
+ logChange(propertyIndex);
+ (*i).second->unsetNull();
+ (*i).second->setCString(value);
+ return;
+ }
+ }
+ DataFactory* df = getDataFactory();
+ DataObjectImpl* b = new DataObjectImpl(df, df->getType(Type::SDOTypeNamespaceURI,"String"));
+ b->setContainer(this);
+ b->setApplicableChangeSummary();
+ logChange(propertyIndex);
+ PropertyValues.insert(PropertyValues.end(),rdo(propertyIndex,b));
+ b->setCString(value);
+ return;
+ }
+
const char* DataObjectImpl::getCString (const char* path)
{
- DataObjectImpl* d = 0;
- char* spath = 0;
- char *prop = 0;
- try {
- spath = DataObjectImpl::stripPath(path);
- prop = findPropertyContainer(spath,&d);
- if (spath) {
- delete spath;
- spath = 0;
- }
- if (d != 0) {
- if (prop == 0 || (strlen(prop) == 0)) {
- return d->getCString();
- }
- else {
- PropertyImpl* p = d->getPropertyImpl(prop);
- if (p != 0)
- {
- if (p->isMany()|| p->getTypeImpl()->isFromList())
- {
- long l;
- DataObjectImpl* doi = d->findDataObject(prop,&l);
- delete prop;
- prop = 0;
- if (doi != 0) {
- return doi->getCString();
- }
- string msg("Get CString - index out of range");
- msg += path;
- SDO_THROW_EXCEPTION("getter", SDOIndexOutOfRangeException,
- msg.c_str());
- }
- else {
- delete prop;
- prop = 0;
- if (!d->isSet(*p)) {
- //if (p->isDefaulted())
- //{
- return p->getCStringDefault();
- //}
- //else
- //{
- // handlePropertyNotSet(p->getName());
- //}
- }
- return d->getCString(*p);
- }
- }
- }
+ return getCString(SDOString(path));
+ }
+
+ const char* DataObjectImpl::getCString (const SDOString& path)
+ {
+ DataObjectImpl* d = 0;
+ SDOString spath;
+ SDOString prop;
+ try {
+ DataObjectImpl::stripPath(path, spath);
+ // It is possible for findPropertyContainer to return a 0 which caues an accvio.
+ prop = findPropertyContainer(spath, &d);
+ if (d != 0) {
+ if (prop.length() == 0) {
+ return d->getCString();
}
- if (prop){
- delete prop;
- prop = 0;
+ else {
+ PropertyImpl* p = d->getPropertyImpl(prop);
+ if (p != 0)
+ {
+ if (p->isMany()|| p->getTypeImpl()->isFromList())
+ {
+ long l;
+ DataObjectImpl* doi = d->findDataObject(prop,&l);
+ if (doi != 0) {
+ return doi->getCString();
+ }
+ string msg("Get CString - index out of range");
+ msg += path;
+ SDO_THROW_EXCEPTION("getter", SDOIndexOutOfRangeException,
+ msg.c_str());
+ }
+ else {
+ if (!d->isSet(*p)) {
+ //if (p->isDefaulted())
+ //{
+ return p->getCStringDefault();
+ //}
+ //else
+ //{
+ // handlePropertyNotSet(p->getName());
+ //}
+ }
+ return d->getCString(*p);
+ }
+ }
}
- string msg("Get CString - object not found");
- SDO_THROW_EXCEPTION("getCString", SDOPathNotFoundException,
- msg.c_str());
- }
- catch (SDORuntimeException e) {
- if (spath) delete spath;
- if (prop) delete prop;
- SDO_RETHROW_EXCEPTION("getCString",e);
- }
- }
+ }
+ string msg("Get CString - object not found");
+ SDO_THROW_EXCEPTION("getCString", SDOPathNotFoundException,
+ msg.c_str());
+ }
+ catch (SDORuntimeException e) {
+ SDO_RETHROW_EXCEPTION("getCString",e);
+ }
+ }
@@ -1185,6 +1618,53 @@
}
+ void DataObjectImpl::setCString(const SDOString& path, const SDOString& value)
+ {
+ DataObjectImpl *d = 0;
+
+ SDOString spath;
+ SDOString prop;
+ try {
+ DataObjectImpl::stripPath(path, spath);
+ prop = findPropertyContainer(spath, &d);
+
+ if (d != 0) {
+ if (prop.length() == 0) {
+ d->setCString(value);
+ }
+ else {
+ const PropertyImpl* p = d->getPropertyImpl(prop);
+ if (p == 0 && d->getType().isOpenType())
+ {
+ p = d->defineBytes(prop);
+ }
+ if (p != 0)
+ {
+ if (p->isMany()|| p->getTypeImpl()->isFromList()) {
+ long l;
+ DataObjectList& dol = d->getList((Property&)*p);
+ DataObjectImpl* doi = d->findDataObject(prop,&l);
+ if (doi != 0)
+ {
+ doi->setCString(value);
+ }
+ else
+ {
+ dol.append(value);
+ }
+ }
+ else {
+ d->setCString((Property&)*p,value);
+ }
+ }
+ }
+ }
+ }
+ catch (SDORuntimeException e) {
+ SDO_RETHROW_EXCEPTION("setCString",e);
+ }
+ }
+
const char* DataObjectImpl::getCString (const Property& property)
{
@@ -1197,6 +1677,11 @@
setCString(getPropertyIndex(property),value);
}
+ void DataObjectImpl::setCString(const Property& property, const SDOString& value)
+ {
+ setCString(getPropertyIndex(property), value);
+ }
+
// null support
bool DataObjectImpl::isNull(const unsigned int propertyIndex)
@@ -1257,7 +1742,34 @@
SDO_RETHROW_EXCEPTION("isNull",e);
}
- }
+ }
+
+ bool DataObjectImpl::isNull(const SDOString& path)
+ {
+ DataObjectImpl *d = 0;
+ SDOString spath;
+ SDOString prop;
+ // char* spath = 0;
+ // char* prop = 0;
+ try {
+ DataObjectImpl::stripPath(path, spath);
+ prop = findPropertyContainer(spath, &d);
+ if (d != 0) {
+ if (prop.length() == 0) {
+ return d->isNull();
+ }
+ else {
+ const Property& p = d->getProperty(prop);
+ return d->isNull(p);
+ }
+ }
+ return false;
+ }
+ catch (SDORuntimeException e) {
+ SDO_RETHROW_EXCEPTION("isNull",e);
+ }
+ }
+
void DataObjectImpl::setNull(const unsigned int propertyIndex)
{
validateIndex(propertyIndex);
@@ -1363,41 +1875,109 @@
}
+ void DataObjectImpl::setNull(const SDOString& path)
+ {
+ DataObjectImpl *d = 0;
+ SDOString spath;
+ SDOString prop;
+ size_t pc;
+
+ try {
+ DataObjectImpl::stripPath(path, spath);
+ prop = findPropertyContainer(spath, &d);
+ if (d != 0) {
+ if (prop.length() == 0) {
+ try {
+ DataObjectImpl* cont = d->getContainerImpl();
+ if (cont != 0)
+ {
+ pc = path.rfind('/'); // Find the last '/' in the path
+ if (pc != string::npos)
+ pc++; // pc is the index of the first character following the /
+ }
+ const Property& pcont = cont->getProperty(path.substr(pc));
+ cont->logChange(pcont);
+ }
+ catch (SDORuntimeException&)
+ {
+ }
+ d->setNull();
+ }
+ else {
+ const PropertyImpl* p = d->getPropertyImpl(prop);
+ if (p == 0)
+ {
+ if(d->getType().isOpenType())
+ {
+ string msg("Cannot set unassigned open property to null:");
+ msg += prop;
+ SDO_THROW_EXCEPTION("setNull", SDOUnsupportedOperationException,
+ msg.c_str());
+ }
+ else
+ {
+ string msg("Property Not Found:");
+ msg += prop;
+ SDO_THROW_EXCEPTION("setNull", SDOPropertyNotFoundException,
+ msg.c_str());
+ }
+ }
+ d->setNull((Property&)*p);
+ return;
+ }
+ }
+ return;
+ }
+ catch (SDORuntimeException e) {
+ SDO_RETHROW_EXCEPTION("setNull",e);
+ }
+ }
// getters and setters for a List data object
DataObjectList& DataObjectImpl::getList(const char* path)
{
- DataObjectImpl *d;
- char* spath = DataObjectImpl::stripPath(path);
- char* prop = findPropertyContainer(spath,&d);
- if (spath) delete spath;
- if (d != 0) {
- if (prop == 0 || (strlen(prop) == 0)) {
- return d->getList();
- }
- else {
- const PropertyImpl* p = d->getPropertyImpl(prop);
- if (p == 0 && d->getType().isOpenType())
- {
- p = d->defineList(prop);
- }
- if (p != 0)
- {
- delete prop;
- return d->getList((Property&)*p);
- }
- }
- }
- if (prop) delete prop;
+ // Can path really be a null pointer?
+ if (path == 0)
+ {
+ return(getList(SDOString()));
+ }
+ else
+ {
+ return(getList(SDOString(path)));
+ }
+ }
- string msg("Invalid path:");
- msg += path;
- SDO_THROW_EXCEPTION("getList",SDOPathNotFoundException, msg.c_str());
+ DataObjectList& DataObjectImpl::getList(const SDOString& path)
+ {
+ DataObjectImpl *d;
+ SDOString spath;
- }
+ DataObjectImpl::stripPath(path, spath);
+ SDOString prop = findPropertyContainer(spath, &d);
+
+ if (d != 0) {
+ if (prop.length() == 0) {
+ return d->getList();
+ }
+ else {
+ const PropertyImpl* p = d->getPropertyImpl(prop);
+ if (p == 0 && d->getType().isOpenType())
+ {
+ p = d->defineList(prop.c_str());
+ }
+ if (p != 0)
+ {
+ return d->getList((Property&)*p);
+ }
+ }
+ }
+ string msg("Invalid path:");
+ msg += path;
+ SDO_THROW_EXCEPTION("getList",SDOPathNotFoundException, msg.c_str());
+ }
DataObjectList& DataObjectImpl::getList(unsigned int propIndex)
@@ -1919,11 +2499,10 @@
}
// We did find an "=" sign.
- // *eq = 0;
- SDOString PropertyName = token.substr(breaker, (eq - breaker));
+ SDOString PropertyName = breakerStr.substr(0, eq);
// breaker is now propname
eq++;
- SDOString PropertyValue = token.substr(eq, (endbrace - eq));
+ SDOString PropertyValue = breakerStr.substr(eq);
// eq is now propval
DataObjectList& list = getList(p);
@@ -2188,7 +2767,6 @@
SDOString DataObjectImpl::findPropertyContainer(const SDOString& path, DataObjectImpl** din)
{
// initially check for "#/" which indicates that we need to find the root object first
- if (path.empty()) return 0;
if (path.length() <= 2)
{
@@ -2259,7 +2837,7 @@
}
/* Give up - no container */
*din = 0;
- return 0;
+ return SDOString();
}
/* Try to find a property ....*/
@@ -2271,7 +2849,7 @@
/* Give up its not in the tree */
*din = 0;
- return 0;
+ return SDOString();
}
@@ -2373,6 +2951,13 @@
return 0;
}
+ SequencePtr DataObjectImpl::getSequence(const SDOString& path)
+ {
+ DataObject* d = (DataObject*)getDataObject(path);
+ if (d) return d->getSequence();
+ return 0;
+ }
+
SequencePtr DataObjectImpl::getSequence(unsigned int propertyIndex)
{
DataObject* d = (DataObject*)getDataObject(propertyIndex);
@@ -2391,6 +2976,19 @@
ChangeSummaryPtr DataObjectImpl::getChangeSummary(const char* path)
{
+ // Can path really be a null pointer?
+ if (path == 0)
+ {
+ return(getChangeSummary(SDOString()));
+ }
+ else
+ {
+ return(getChangeSummary(SDOString(path)));
+ }
+ }
+
+ ChangeSummaryPtr DataObjectImpl::getChangeSummary(const SDOString& path)
+ {
DataObjectImpl* d = getDataObjectImpl(path);
return d->getChangeSummary();
}
@@ -2856,49 +3454,69 @@
return;
}
-
bool DataObjectImpl::isValid(const char* path)
{
- DataObjectImpl* d;
- char* prop = findPropertyContainer(path,&d);
- if (d != 0) {
- if (prop != 0) {
- const Property& p = d->getProperty(prop);
- delete prop;
- return d->isValid(p);
- }
- }
- if (prop != 0)delete prop;
- string msg("Invalid path:");
- msg += path;
- SDO_THROW_EXCEPTION("isSet" ,SDOPathNotFoundException,
- msg.c_str());
- }
+ // Can path really be a null pointer?
+ if (path == 0)
+ {
+ return(isValid(SDOString()));
+ }
+ else
+ {
+ return(isValid(SDOString(path)));
+ }
+ }
+bool DataObjectImpl::isValid(const SDOString& path)
+{
+ DataObjectImpl* d;
+ SDOString prop = findPropertyContainer(path, &d);
+ if (d != 0) {
+ if (!prop.empty()) {
+ const Property& p = d->getProperty(prop);
+ return d->isValid(p);
+ }
+ }
+ string msg("Invalid path:");
+ msg += path;
+ SDO_THROW_EXCEPTION("isSet" ,SDOPathNotFoundException,
+ msg.c_str());
+}
// Returns whether a property of either this object or an object reachable
// from it, as identified by the specified path,
// is considered to be set.
// @param path the path to a valid Object* and property.
-
+
bool DataObjectImpl::isSet(const char* path)
{
- DataObjectImpl* d;
- char* prop = findPropertyContainer(path,&d);
- if (d != 0) {
- if (prop != 0) {
- const Property& p = d->getProperty(prop);
- delete prop;
- return d->isSet(p);
- }
- }
- if (prop != 0)delete prop;
- string msg("Invalid path:");
- msg += path;
- SDO_THROW_EXCEPTION("isSet" ,SDOPathNotFoundException,
- msg.c_str());
+ // Can path really be a null pointer?
+ if (path == 0)
+ {
+ return(isSet(SDOString()));
+ }
+ else
+ {
+ return(isSet(SDOString(path)));
+ }
}
+bool DataObjectImpl::isSet(const SDOString& path)
+{
+ DataObjectImpl* d;
+ SDOString prop = findPropertyContainer(path, &d);
+ if (d != 0) {
+ if (!prop.empty()) {
+ const Property& p = d->getProperty(prop);
+ return d->isSet(p);
+ }
+ }
+ string msg("Invalid path:");
+ msg += path;
+ SDO_THROW_EXCEPTION("isSet" ,SDOPathNotFoundException,
+ msg.c_str());
+}
+
bool DataObjectImpl::isValid(unsigned int propertyIndex)
{
return isValid(getProperty(propertyIndex));
@@ -2949,50 +3567,64 @@
void DataObjectImpl::unset(const char* path)
{
-
- DataObjectImpl* d;
- char* prop = findPropertyContainer(path,&d);
- if (d != 0)
- {
- if (prop != 0){
- const Property& p = d->getProperty(prop);
- if (p.isMany())
- {
- char *c;
- if ((c = strchr(prop,'[')) != 0)
- {
- char *c1 = strchr(c,']');
- if (c1 != 0)*c1 = 0;
- unsigned int i = atoi(++c);
- if (i > 0){
- i--;
- DataObjectList& li = d->getList(p);
- li.remove(i);
- }
- delete prop;
- return;
- }
- if ((c = strchr(prop,'.')) != 0)
- {
- unsigned int i = atoi(++c);
- DataObjectList& li = d->getList(p);
- li.remove(i);
- delete prop;
- return;
- }
- }
- delete prop;
- d->unset(p);
- return;
+ // Can path really be a null pointer?
+ if (path == 0)
+ {
+ unset(SDOString());
+ }
+ else
+ {
+ unset(SDOString(path));
+ }
+ }
+
+void DataObjectImpl::unset(const SDOString& path)
+{
+ DataObjectImpl* d;
+ SDOString prop = findPropertyContainer(path, &d);
+ if (d != 0)
+ {
+ if (!prop.empty())
+ {
+ const Property& p = d->getProperty(prop);
+ if (p.isMany())
+ {
+ SDOString subscript;
+ size_t beginbrace = prop.find('[');
+ if (beginbrace != string::npos)
+ {
+ size_t endbrace = prop.find(']', ++beginbrace);
+ if (endbrace != string::npos) {
+ subscript =
+ prop.substr(beginbrace, (endbrace - beginbrace));
+ }
+ unsigned int i = atoi(subscript.c_str());
+ if (i > 0) {
+ i--;
+ DataObjectList& li = d->getList(p);
+ li.remove(i);
+ }
+ return;
}
- }
- if (prop != 0) delete prop;
+ size_t firstdot = prop.find('.');
+ if (firstdot != string::npos) {
+ subscript = prop.substr(++firstdot);
+ unsigned int i = atoi(subscript.c_str());
+ DataObjectList& li = d->getList(p);
+ li.remove(i);
+ return;
+ }
+ }
+ d->unset(p);
+ return;
+ }
+ }
- string msg("Invalid path:");
- msg += path;
- SDO_THROW_EXCEPTION("unset", SDOPathNotFoundException,
- msg.c_str());
- }
+ string msg("Invalid path:");
+ msg += path;
+ SDO_THROW_EXCEPTION("unset", SDOPathNotFoundException,
+ msg.c_str());
+}
void DataObjectImpl::unset(unsigned int propertyIndex)
{
@@ -3147,8 +3779,6 @@
msg.c_str());
}
- // +++
-
DataObjectImpl* DataObjectImpl::getDataObjectImpl(const SDOString& path)
{
@@ -3190,7 +3820,6 @@
msg.c_str());
}
- // ---
RefCountingPointer<DataObject> DataObjectImpl::getDataObject(unsigned int propertyIndex)
{
@@ -3235,12 +3864,11 @@
-
// Returns a new DataObject contained by this Object using the specified property,
// which must be a containment property.
// The type of the created Object is the declared type of the specified property.
- RefCountingPointer<DataObject> DataObjectImpl::createDataObject(const char* propertyName)
+ RefCountingPointer<DataObject> DataObjectImpl::createDataObject(const SDOString& propertyName)
{
// Throws runtime exception for type or property not found
@@ -3248,6 +3876,23 @@
return createDataObject(p);
}
+ // Returns a new DataObject contained by this Object using the specified property,
+ // which must be a containment property.
+ // The type of the created Object is the declared type of the specified property.
+
+ RefCountingPointer<DataObject> DataObjectImpl::createDataObject(const char* propertyName)
+ {
+ // Can propertyName really be a null pointer?
+ if (propertyName == 0)
+ {
+ return(createDataObject(SDOString()));
+ }
+ else
+ {
+ return(createDataObject(SDOString(propertyName)));
+ }
+ }
+
// Returns a new DataObject contained by this Object using the specified property,
// which must be a containment property.
// The type of the created Object is the declared type of the specified property.
@@ -3759,6 +4404,12 @@
return;
}
+ void DataObjectImpl::setCString(const SDOString& invalue)
+ {
+ valuelength = getTypeImpl().convert(&value, invalue);
+ return;
+ }
+
void DataObjectImpl::setDate(const SDODate invalue)
{
valuelength = getTypeImpl().convertDate(&value,invalue); /* time_t == long*/
@@ -4145,49 +4796,50 @@
// user data support...
void* DataObjectImpl::getUserData(const char* path)
{
- DataObjectImpl *d;
- void* v = 0;
- char *spath = 0;
- char* prop = 0;
- try {
- spath = DataObjectImpl::stripPath(path);
- prop = findPropertyContainer(spath,&d);
- if (spath)
- {
- delete spath;
- spath = 0;
- }
- if (d != 0)
+ // Can path really be a null pointer?
+ if (path == 0)
+ {
+ return(getUserData(SDOString()));
+ }
+ else
+ {
+ return(getUserData(SDOString(path)));
+ }
+ }
+
+void* DataObjectImpl::getUserData(const SDOString& path)
+{
+ DataObjectImpl *d;
+ void* v = 0;
+ SDOString spath;
+ SDOString prop;
+ try {
+ DataObjectImpl::stripPath(path, spath);
+ prop = findPropertyContainer(spath, &d);
+ if (d != 0)
+ {
+ if (!prop.empty())
+ {
+ const Property& p = d->getProperty(prop);
+ if (p.getType().isDataType()) return 0;
+ if (p.isMany())
{
- if (prop != 0)
- {
- const Property& p = d->getProperty(prop);
- if (p.getType().isDataType()) return 0;
- if (p.isMany())
- {
- DataObjectImpl* d2 = d->getDataObjectImpl(prop);
- if (d2) v = d2->getUserData();
- delete prop;
- prop = 0;
- return v;
- }
- v = d->getUserData(p);
- delete prop;
- prop = 0;
- return v;
- }
- return d->getUserData();
+ DataObjectImpl* d2 = d->getDataObjectImpl(prop);
+ if (d2) v = d2->getUserData();
+ return v;
}
- return 0;
- }
- catch (SDORuntimeException e)
- {
- if (prop) delete prop;
- if (spath) delete spath;
- return 0;
- }
-
- }
+ v = d->getUserData(p);
+ return v;
+ }
+ return d->getUserData();
+ }
+ return 0;
+ }
+ catch (SDORuntimeException e)
+ {
+ return 0;
+ }
+}
void* DataObjectImpl::getUserData(unsigned int propertyIndex)
{
@@ -4226,48 +4878,51 @@
void DataObjectImpl::setUserData(const char* path, void* value)
{
- char *spath = 0;
- char* prop = 0;
- DataObjectImpl *d;
- try {
- spath = DataObjectImpl::stripPath(path);
- prop = findPropertyContainer(spath,&d);
- if (spath)
- {
- delete spath;
- spath = 0;
- }
- if (d != 0)
- {
- if (prop != 0)
- {
- const Property& p = d->getProperty(prop);
- if (p.getType().isDataType()) return;
- if (p.isMany())
- {
- DataObjectImpl* d2 = d->getDataObjectImpl(prop);
- if (d2) d2->setUserData(value);
- delete prop;
- prop = 0;
- return;
- }
- d->setUserData(p,value);
- delete prop;
- prop = 0;
- return;
- }
- d->setUserData(value);
- return;
+ // Can path really be a null pointer?
+ if (path == 0)
+ {
+ setUserData(SDOString(), value);
+ }
+ else
+ {
+ setUserData(SDOString(path), value);
+ }
+ }
+
+void DataObjectImpl::setUserData(const SDOString& path, void* value)
+{
+ SDOString spath;
+ SDOString prop;
+ DataObjectImpl *d;
+ try {
+ DataObjectImpl::stripPath(path, spath);
+ prop = findPropertyContainer(spath, &d);
+ if (d != 0)
+ {
+ if (!prop.empty())
+ {
+ const Property& p = d->getProperty(prop);
+ if (p.getType().isDataType())
+ return;
+ if (p.isMany())
+ {
+ DataObjectImpl* d2 = d->getDataObjectImpl(prop);
+ if (d2) d2->setUserData(value);
+ return;
}
- }
- catch (SDORuntimeException e)
- {
- if (prop) delete prop;
- if (spath) delete spath;
+ d->setUserData(p, value);
return;
- }
+ }
+ d->setUserData(value);
+ return;
+ }
+ }
+ catch (SDORuntimeException e)
+ {
+ return;
+ }
- }
+}
void DataObjectImpl::setUserData(unsigned int propertyIndex, void* value)
{
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?rev=436758&r1=436757&r2=436758&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.h Fri Aug 25 04:20:50 2006
@@ -230,103 +230,130 @@
virtual bool getBoolean(const SDOString& path);
virtual bool getBoolean(unsigned int propindex);
virtual bool getBoolean(const Property& p);
-
+
virtual void setBoolean(const char* path, bool b);
+ virtual void setBoolean(const SDOString& path, bool b);
virtual void setBoolean(unsigned int propindex, bool b);
virtual void setBoolean(const Property& p, bool b);
virtual char getByte(const char* path);
+ virtual char getByte(const SDOString& path);
virtual char getByte(unsigned int propindex);
virtual char getByte(const Property& p);
virtual void setByte(const char* path, char c);
+ virtual void setByte(const SDOString& path, char c);
virtual void setByte(unsigned int propindex, char c);
virtual void setByte(const Property& p, char c);
virtual wchar_t getCharacter(const char* path);
+ virtual wchar_t getCharacter(const SDOString& path);
virtual wchar_t getCharacter(unsigned int propindex);
virtual wchar_t getCharacter(const Property& p);
-
+
virtual void setCharacter(const char* path, wchar_t c);
+ virtual void setCharacter(const SDOString& path, wchar_t c);
virtual void setCharacter(unsigned int propindex, wchar_t c);
virtual void setCharacter(const Property& p, wchar_t c);
+ virtual unsigned int getLength(const SDOString& path) ;
virtual unsigned int getLength(const char* path) ;
virtual unsigned int getLength(unsigned int propindex) ;
virtual unsigned int getLength(const Property& p) ;
virtual unsigned int getLength() ;
virtual unsigned int getBytes(const char* path, char* buf, unsigned int max) ;
+ virtual unsigned int getBytes(const SDOString& path, char* buf, unsigned int max) ;
virtual unsigned int getBytes(unsigned int propindex, char* buf, unsigned int max) ;
virtual unsigned int getBytes(const Property& p, char* buf, unsigned int max) ;
-
+
virtual void setBytes(const char* path, const char* c, unsigned int len) ;
+ virtual void setBytes(const SDOString& path, const char* c, unsigned int len) ;
virtual void setBytes(unsigned int propindex, const char* c,unsigned int len) ;
virtual void setBytes(const Property& p, const char* c,unsigned int len) ;
+ virtual unsigned int getString(const SDOString& path, wchar_t* buf, unsigned int max);
virtual unsigned int getString(const char* path, wchar_t* buf, unsigned int max) ;
virtual unsigned int getString(unsigned int propindex,wchar_t* buf, unsigned int max) ;
virtual unsigned int getString(const Property& p,wchar_t* buf, unsigned int max) ;
+ virtual void setString(const SDOString& path, const wchar_t* c,unsigned int len);
virtual void setString(const char* path, const wchar_t* c,unsigned int len) ;
virtual void setString(unsigned int propindex, const wchar_t* c,unsigned int len) ;
virtual void setString(const Property& p, const wchar_t* c,unsigned int len) ;
+ virtual const SDODate getDate(const SDOString& path);
virtual const SDODate getDate(const char* path);
virtual const SDODate getDate(unsigned int propindex);
virtual const SDODate getDate(const Property& p);
-
+
+ virtual void setDate(const SDOString& path, const SDODate d);
virtual void setDate(const char* path, const SDODate d);
virtual void setDate(unsigned int propindex, const SDODate d);
virtual void setDate(const Property& p, const SDODate d);
+ virtual long double getDouble(const SDOString& path);
virtual long double getDouble(const char* path);
virtual long double getDouble(unsigned int propindex);
virtual long double getDouble(const Property& p);
+ virtual void setDouble(const SDOString& path, long double d);
virtual void setDouble(const char* path, long double d);
virtual void setDouble(unsigned int propindex, long double d);
virtual void setDouble(const Property& p, long double d);
+ virtual float getFloat(const SDOString& path);
virtual float getFloat(const char* path);
virtual float getFloat(unsigned int propindex);
virtual float getFloat(const Property& p);
-
+
+ virtual void setFloat(const SDOString& path, float f);
virtual void setFloat(const char* path, float f);
virtual void setFloat(unsigned int propindex, float f);
virtual void setFloat(const Property& p, float f);
+ virtual long getInteger(const SDOString& path);
virtual long getInteger(const char* path);
virtual long getInteger(unsigned int propindex);
virtual long getInteger(const Property& p);
+ virtual void setInteger(const SDOString& path, long i);
virtual void setInteger(const char* path, long i);
virtual void setInteger(unsigned int propindex, long i);
virtual void setInteger(const Property& p, long i);
+ virtual /*long long*/ int64_t getLong(const SDOString& path);
virtual /*long long*/ int64_t getLong(const char* path);
virtual /*long long*/ int64_t getLong(unsigned int propindex);
virtual /*long long*/ int64_t getLong(const Property& p);
-
+
+ virtual void setLong(const SDOString& path, /*long long*/ int64_t l);
virtual void setLong(const char* path, /*long long*/ int64_t l);
virtual void setLong(unsigned int propindex, /*long long*/ int64_t l);
virtual void setLong(const Property& p, /*long long*/ int64_t l);
+ virtual short getShort(const SDOString& path);
virtual short getShort(const char* path);
virtual short getShort(unsigned int propindex);
virtual short getShort(const Property& p);
-
+
+ virtual void setShort(const SDOString& path, short s);
virtual void setShort(const char* path, short s);
virtual void setShort(unsigned int propindex, short s);
virtual void setShort(const Property& p, short s);
- virtual const char* getCString(const char* path);
+ virtual const char* getCString(const char* path);
+ virtual const char* getCString(const SDOString& path);
virtual const char* getCString(unsigned int propertyIndex);
virtual const char* getCString(const Property& prop);
virtual void setCString(const char* path, const char* value);
virtual void setCString(unsigned int propertyIndex, const char* value);
virtual void setCString (const Property& prop, const char* value);
+
+ virtual void setCString(const SDOString& path, const SDOString& value);
+ virtual void setCString(unsigned int propertyIndex, const SDOString& value);
+ virtual void setCString (const Property& prop, const SDOString& value);
/** setNull sets a data object value to null.
*
@@ -337,23 +364,28 @@
* been set to zero, or it could be null. Use isNull() to verify.
*/
+ virtual void setNull(const SDOString& path);
virtual void setNull(const char* path);
virtual void setNull(unsigned int propertyIndex);
virtual void setNull(const Property& prop);
+ virtual bool isNull(const SDOString& path);
virtual bool isNull(const char* path);
virtual bool isNull(unsigned int propertyIndex);
virtual bool isNull(const Property& prop);
virtual bool isSet(const char* path);
+ virtual bool isSet(const SDOString& path);
virtual bool isSet(unsigned int propertyIndex);
virtual bool isSet(const Property& property);
+ virtual bool isValid(const SDOString& path);
virtual bool isValid(const char* path);
virtual bool isValid(unsigned int propertyIndex);
virtual bool isValid(const Property& property);
virtual void unset(const char* path);
+ virtual void unset(const SDOString& path);
virtual void unset(unsigned int propertyIndex);
virtual void unset(const Property& property);
@@ -371,6 +403,7 @@
virtual SequenceImpl* getSequenceImpl();
virtual SequencePtr getSequence();
virtual SequencePtr getSequence(const char* path);
+ virtual SequencePtr getSequence(const SDOString& path);
virtual SequencePtr getSequence(unsigned int propertyIndex);
virtual SequencePtr getSequence(const Property& property);
@@ -390,6 +423,7 @@
*/
virtual DataObjectPtr createDataObject(const char* propertyName);
+ virtual DataObjectPtr createDataObject(const SDOString& propertyName);
virtual DataObjectPtr createDataObject(unsigned int propertyIndex);
virtual DataObjectPtr createDataObject(const Property& property);
@@ -421,6 +455,7 @@
*/
virtual DataObjectList& getList(const char* path);
+ virtual DataObjectList& getList(const SDOString& path);
virtual DataObjectList& getList(unsigned int propIndex);
virtual DataObjectList& getList(const Property& p);
virtual DataObjectList& getList();
@@ -442,6 +477,7 @@
*/
virtual SDO_API ChangeSummaryPtr getChangeSummary(const char* path);
+ virtual SDO_API ChangeSummaryPtr getChangeSummary(const SDOString& path);
virtual SDO_API ChangeSummaryPtr getChangeSummary(unsigned int propIndex);
virtual SDO_API ChangeSummaryPtr getChangeSummary(const Property& prop);
virtual SDO_API ChangeSummaryPtr getChangeSummary();
@@ -471,6 +507,7 @@
virtual void setDate(const SDODate d);
virtual const char* getCString();
virtual void setCString(const char* s);
+ virtual void setCString(const SDOString& s);
virtual DataObjectImpl* getDataObject();
virtual void setDataObject(DataObject* d);
@@ -493,10 +530,12 @@
// user data support
virtual void setUserData(const char* path,void* value);
+ virtual void setUserData(const SDOString& path, void* value);
virtual void setUserData(unsigned int propertyIndex, void* value);
virtual void setUserData(const Property& property, void* value);
virtual void setUserData(void* value);
virtual void* getUserData(const char* path);
+ virtual void* getUserData(const SDOString& path);
virtual void* getUserData(unsigned int propertyIndex);
virtual void* getUserData(const Property& property);
virtual void* getUserData();
@@ -536,17 +575,29 @@
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* 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,
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectList.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectList.h?rev=436758&r1=436757&r2=436758&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectList.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectList.h Fri Aug 25 04:20:50 2006
@@ -138,6 +138,7 @@
virtual SDO_API void insert (unsigned int index, const char* d) = 0;
virtual SDO_API void append (const char* d) = 0;
+ virtual SDO_API void append (const SDOString& d) = 0;
virtual SDO_API void insert (unsigned int index, short d) = 0;
virtual SDO_API void append (short d) = 0;
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp?rev=436758&r1=436757&r2=436758&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp Fri Aug 25 04:20:50 2006
@@ -637,6 +637,18 @@
append( dol);
}
+void DataObjectListImpl::append (const SDOString& d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(Type::SDOTypeNamespaceURI, BytesLiteral);
+
+ RefCountingPointer<DataObject> dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = dol;
+ ((DataObjectImpl*)dob)->setCString(d);
+ append( dol);
+}
+
void DataObjectListImpl::insert (unsigned int index, short d)
{
if (theFactory == 0) return;
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.h?rev=436758&r1=436757&r2=436758&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.h Fri Aug 25 04:20:50 2006
@@ -118,6 +118,7 @@
virtual void insert (unsigned int index, const char* d) ;
virtual void append (const char* d) ;
+ virtual void append (const SDOString& d) ;
virtual void insert (unsigned int index, short d) ;
virtual void append (short d) ;
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Logger.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Logger.cpp?rev=436758&r1=436757&r2=436758&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Logger.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Logger.cpp Fri Aug 25 04:20:50 2006
@@ -62,7 +62,7 @@
int Logger::setLogging()
{
char* loggingVar = 0;
- loggingVar = getenv("SDO4CPP_LOGGING");
+ loggingVar = getenv("TUSCANY_SDOCPP_LOGGING");
if (loggingVar == 0)
return 0;
else
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?rev=436758&r1=436757&r2=436758&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.cpp Fri Aug 25 04:20:50 2006
@@ -2392,6 +2392,7 @@
unsigned int max) const
{
unsigned int i;
+ outval.erase();
switch (typeEnum)
{
case BytesType:
@@ -2419,7 +2420,7 @@
// into one byte of the target array eg H_E_L_P -> HELP
for (i = 0; (i < count); i++)
{
- outval[i] = (char)(tempPtr[i]);
+ outval += (char)(tempPtr[i]);
}
return count;
}
@@ -2445,7 +2446,7 @@
if (value == 0) return 0;
const long tmp = *(const long*)value;
- outval[0] = (char)(tmp&0xFF);
+ outval += (char)(tmp&0xFF);
return 1;
}
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?rev=436758&r1=436757&r2=436758&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XpathHelper.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XpathHelper.cpp Fri Aug 25 04:20:50 2006
@@ -38,10 +38,45 @@
const bool XpathHelper::isIndexed(const char* path)
{
- const char * c = strrchr(path,'/');
- if (c == 0)c = path;
- if (strchr(c,'[')) return true;
- if (strchr(c,'.')) return true;
+ if (path == 0)
+ {
+ return false;
+ }
+ else
+ {
+ return isIndexed(SDOString(path));
+ }
+}
+
+const bool XpathHelper::isIndexed(const SDOString& path)
+{
+ size_t lastSlash = path.rfind('/');
+
+ if (lastSlash == string::npos)
+ {
+ // Search from start of path
+ if (path.find('[') != string::npos)
+ {
+ return true;
+ }
+ if (path.find('.') != string::npos)
+ {
+ return true;
+ }
+ }
+ else
+ {
+ // Search from lastSlash
+ if (path.find('[', lastSlash) != string::npos)
+ {
+ return true;
+ }
+ if (path.find('.', lastSlash) != string::npos)
+ {
+ return true;
+ }
+ }
+
return false;
}
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XpathHelper.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XpathHelper.h?rev=436758&r1=436757&r2=436758&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XpathHelper.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XpathHelper.h Fri Aug 25 04:20:50 2006
@@ -21,6 +21,7 @@
#define XPATH_HELPER_H
#include "commonj/sdo/export.h"
+#include "commonj/sdo/SDOString.h"
namespace commonj{
namespace sdo{
@@ -43,6 +44,7 @@
*/
static SDO_API const bool isIndexed(const char * path);
+ static SDO_API const bool isIndexed(const SDOString& path);
};
};
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org