cvs: pecl /sdo/commonj/sdo ChangeSummaryBuilder.cpp ChangeSummaryImpl.cpp ChangedDataObjectList.h ChangedDataObjectListImpl.cpp
ChangedDataObjectListImpl.h CopyHelper.cpp CopyHelper.h DataFactoryImpl.cpp DataFactoryImpl.h DataObjectImpl.cpp DataObjectImpl.h DataObjectList.h
DataObjectListImpl.cpp DataObjectListImpl.h EqualityHelper.cpp PropertyDefinition.cpp PropertyDefinition.h PropertyImpl.cpp PropertyList.cpp
PropertyList.h PropertySetting.cpp PropertySetting.h SAX2Attributes.cpp SAX2Parser.cpp SDOSAX2Parser.cpp SDOSchemaSAX2Parser.cpp SDOUtils.cpp
SDOUtils.h SDOXMLString.cpp SDOXMLWriter.cpp SDOXSDWriter.cpp SequenceImpl.cpp TypeList.cpp TypeList.h XMLHelper.h XMLHelperImpl.cpp XMLHelperImpl.h
XSDHelper.h XSDHelperImpl.cpp XSDHelperImpl.h
| From: | Caroline Maynard | Date: | Thu, 07 Dec 2006 12:38:34 +0000 |
| Subject: | cvs: pecl /sdo/commonj/sdo ChangeSummaryBuilder.cpp ChangeSummaryImpl.cpp ChangedDataObjectList.h ChangedDataObjectListImpl.cpp ChangedDataObjectListImpl.h CopyHelper.cpp CopyHelper.h DataFactoryImpl.cpp DataFactoryImpl.h DataObjectImpl.cpp DataObjectImpl.h DataObjectList.h DataObjectListImpl.cpp DataObjectListImpl.h EqualityHelper.cpp PropertyDefinition.cpp PropertyDefinition.h PropertyImpl.cpp PropertyList.cpp PropertyList.h PropertySetting.cpp PropertySetting.h SAX2Attributes.cpp SAX2Parser.cpp SDOSAX2Parser.cpp SDOSchemaSAX2Parser.cpp SDOUtils.cpp SDOUtils.h SDOXMLString.cpp SDOXMLWriter.cpp SDOXSDWriter.cpp SequenceImpl.cpp TypeList.cpp TypeList.h XMLHelper.h XMLHelperImpl.cpp XMLHelperImpl.h XSDHelper.h XSDHelperImpl.cpp XSDHelperImpl.h |
||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-6764@lists.php.net to get a copy of this message | ||
cem Thu Dec 7 12:38:34 2006 UTC
Modified files:
/pecl/sdo/commonj/sdo ChangeSummaryBuilder.cpp
ChangeSummaryImpl.cpp ChangedDataObjectList.h
ChangedDataObjectListImpl.cpp
ChangedDataObjectListImpl.h CopyHelper.cpp
CopyHelper.h DataFactoryImpl.cpp
DataFactoryImpl.h DataObjectImpl.cpp
DataObjectImpl.h DataObjectList.h
DataObjectListImpl.cpp DataObjectListImpl.h
EqualityHelper.cpp PropertyDefinition.cpp
PropertyDefinition.h PropertyImpl.cpp
PropertyList.cpp PropertyList.h
PropertySetting.cpp PropertySetting.h
SAX2Attributes.cpp SAX2Parser.cpp
SDOSAX2Parser.cpp SDOSchemaSAX2Parser.cpp
SDOUtils.cpp SDOUtils.h SDOXMLString.cpp
SDOXMLWriter.cpp SDOXSDWriter.cpp
SequenceImpl.cpp TypeList.cpp TypeList.h
XMLHelper.h XMLHelperImpl.cpp XMLHelperImpl.h
XSDHelper.h XSDHelperImpl.cpp XSDHelperImpl.h
Log:
Tuscany revision level 483149 fixes a number of problems with sequenced and open types
http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/ChangeSummaryBuilder.cpp?r1=1.6&r2=1.7&diff_format=u Index: pecl/sdo/commonj/sdo/ChangeSummaryBuilder.cpp diff -u pecl/sdo/commonj/sdo/ChangeSummaryBuilder.cpp:1.6 pecl/sdo/commonj/sdo/ChangeSummaryBuilder.cpp:1.7 --- pecl/sdo/commonj/sdo/ChangeSummaryBuilder.cpp:1.6 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/ChangeSummaryBuilder.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/ChangeSummaryBuilder.h" @@ -95,7 +95,7 @@ if ((*elementsiter).isDeletion) { - for (int i = 0; i < deletions.size(); i++) + for (unsigned int i = 0; i < deletions.size(); i++) { if (value.equals (deletions[i].reference)) { @@ -249,7 +249,7 @@ } // it could be a deletion which has not been processed yet - for (int i = 0; i < deletions.size(); i++) + for (unsigned int i = 0; i < deletions.size(); i++) { if (contpath.equals (deletions[i].reference)) { @@ -302,7 +302,7 @@ SDOXMLString refstring = createDeletes[index].value.substring(0,pos); pos = atoi((const char*)(createDeletes[index].value.substring(pos+1))); - for (int k=index+1;k<createDeletes.size();k++) + for (unsigned int k=index+1;k<createDeletes.size();k++) { if (createDeletes[k].type.equals("create")) continue; @@ -329,7 +329,7 @@ { LOGENTRY(INFO,"CSBuilder:buildChangeSummary"); - int i; + unsigned int i; try { if (changeSummaryDO == 0) @@ -395,7 +395,7 @@ else { // its a deletion - match it. - for (int j = 0; j < deletions.size(); j++) + for (unsigned int j = 0; j < deletions.size(); j++) { if (deletions[j].completedprocessing)continue; @@ -421,7 +421,7 @@ std::list<changeAttribute>::iterator a; std::list<changeElement>::iterator e; - for (i = 0; i< changes.size(); i++) + for (unsigned i = 0; i< changes.size(); i++) { DataObjectPtr dob; if (changes[i].reference.isNull()) @@ -451,7 +451,7 @@ } else { - for (int j = 0; j < deletions.size(); j++) + for (unsigned int j = 0; j < deletions.size(); j++) { if ((*a).value.equals (deletions[j].reference)) { @@ -473,7 +473,7 @@ LOGINFO_1(INFO,"CSBuilder Change was a deletion of:%s", (const char*)((*e).path)); - for (int j = 0; j < deletions.size(); j++) + for (unsigned int j = 0; j < deletions.size(); j++) { if ((*e).path.equals (deletions[j].reference)) { @@ -635,7 +635,7 @@ if (currentLocation.size() > 0) { - for (int pi = 0; pi < currentLocation.size()-1; pi++) + for (unsigned int pi = 0; pi < currentLocation.size()-1; pi++) { curr_loc = curr_loc + currentLocation[pi]; curr_loc = curr_loc + "/"; @@ -674,7 +674,7 @@ bool isDelete = false; - for (int i = 0; i < createDeletes.size(); i++) + for (unsigned int i = 0; i < createDeletes.size(); i++) { if (createDeletes[i].type.equals("delete")) { @@ -768,7 +768,7 @@ SDOXMLString curr_loc = ""; if (currentLocation.size() > 0) { - for (int pi = 0; pi < currentLocation.size()-1; pi++) + for (unsigned int pi = 0; pi < currentLocation.size()-1; pi++) { curr_loc = curr_loc + currentLocation[pi]; curr_loc = curr_loc + "/"; @@ -783,7 +783,7 @@ // can we match the current path to a known deletion? bool isDelete = false; - for (int i = 0; i < createDeletes.size(); i++) + for (unsigned int i = 0; i < createDeletes.size(); i++) { if (createDeletes[i].type.equals("delete")) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/ChangeSummaryImpl.cpp?r1=1.8&r2=1.9&diff_format=u Index: pecl/sdo/commonj/sdo/ChangeSummaryImpl.cpp diff -u pecl/sdo/commonj/sdo/ChangeSummaryImpl.cpp:1.8 pecl/sdo/commonj/sdo/ChangeSummaryImpl.cpp:1.9 --- pecl/sdo/commonj/sdo/ChangeSummaryImpl.cpp:1.8 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/ChangeSummaryImpl.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/ChangeSummaryImpl.h" @@ -148,7 +148,7 @@ // find any properties which are data objects, log their // deletion first. - int i; + unsigned int i; // Trace for change summaries @@ -173,7 +173,7 @@ if (changeLogIter != changedMap.end()) { // would hope there was an entry - int index; + unsigned int index; if (prop.isMany()) { DataObjectList& dl = container->getList(prop); @@ -377,7 +377,7 @@ // need to be created too PropertyList pl = ob->getInstanceProperties(); - for (int p=0;p<pl.size();p++) + for (unsigned int p=0;p<pl.size();p++) { Property& thisprop = pl[p]; if (!thisprop.getType().isDataType()) @@ -389,7 +389,7 @@ if (thisprop.isMany()) { DataObjectList& dol = ob->getList(thisprop); - for (int ds = 0; ds < dol.size(); ds++) + for (unsigned int ds = 0; ds < dol.size(); ds++) { dp = dol[ds]; if (!dp) continue; @@ -837,7 +837,7 @@ slist.append(new Setting(false,false,0,0,prop,0)); return; } - for (int i=0;i< dol.size(); i++) + for (unsigned int i=0;i< dol.size(); i++) { DataObject* dob = dol[i]; if (prop.getType().isDataType()) { @@ -1275,7 +1275,7 @@ { char* vw = new char[(strlen(c)+1)*sizeof(wchar_t)]; wchar_t* pvw = (wchar_t*)vw; - for (int i=0;i< strlen(c);i++) + for (unsigned int i=0;i< strlen(c);i++) { pvw[i] = (wchar_t)c[i]; } @@ -1287,7 +1287,7 @@ case Type::BytesType: { char* vc = new char[strlen(c)+1]; - for (int i=0;i< strlen(c);i++) + for (unsigned int i=0;i< strlen(c);i++) { vc[i] = (char)c[i]; } http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/ChangedDataObjectList.h?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/ChangedDataObjectList.h diff -u pecl/sdo/commonj/sdo/ChangedDataObjectList.h:1.5 pecl/sdo/commonj/sdo/ChangedDataObjectList.h:1.6 --- pecl/sdo/commonj/sdo/ChangedDataObjectList.h:1.5 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/ChangedDataObjectList.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _CHANGEDDATAOBJECTLIST_H_ #define _CHANGEDDATAOBJECTLIST_H_ @@ -68,15 +68,15 @@ * * Gets the nth element of a list */ - virtual SDO_API DataObjectPtr operator[] (int pos) = 0; - virtual SDO_API const DataObjectPtr operator[] (int pos) const = 0; + virtual SDO_API DataObjectPtr operator[] (unsigned int pos) = 0; + virtual SDO_API const DataObjectPtr operator[] (unsigned int pos) const = 0; /** size() returns the number of list elements. * * Returns the number of list elements */ - virtual SDO_API int size () const = 0; + virtual SDO_API unsigned int size () const = 0; /** getType() returns the type of a list element. * http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.cpp?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.cpp diff -u pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.cpp:1.5 pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.cpp:1.6 --- pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.cpp:1.5 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/ChangedDataObjectListImpl.h" @@ -128,7 +128,7 @@ * */ - RefCountingPointer<DataObject> ChangedDataObjectListImpl::operator[] (int pos) + RefCountingPointer<DataObject> ChangedDataObjectListImpl::operator[] (unsigned int pos) { validateIndex(pos); return plist[pos].getObject(); @@ -139,7 +139,7 @@ * */ - const RefCountingPointer<DataObject> ChangedDataObjectListImpl::operator[] (int pos) const + const RefCountingPointer<DataObject> ChangedDataObjectListImpl::operator[] (unsigned int pos) const { validateIndex(pos); return plist[pos].getObject(); @@ -160,7 +160,7 @@ * */ - int ChangedDataObjectListImpl::size () const + unsigned int ChangedDataObjectListImpl::size () const { return plist.size(); } @@ -229,7 +229,7 @@ * checks that the index is in range. */ - void ChangedDataObjectListImpl::validateIndex(int index) const + void ChangedDataObjectListImpl::validateIndex(unsigned int index) const { if ((index < 0) || (index >= size())) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.h?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.h diff -u pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.h:1.5 pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.h:1.6 --- pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.h:1.5 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _ChangedDataObjectListImplIMPL_H_ #define _ChangedDataObjectListImplIMPL_H_ @@ -71,13 +71,13 @@ ChangedDataObjectListImpl(); virtual ~ChangedDataObjectListImpl(); - virtual DataObjectPtr operator[] (int pos); - virtual const DataObjectPtr operator[] (int pos) const; + virtual DataObjectPtr operator[] (unsigned int pos); + virtual const DataObjectPtr operator[] (unsigned int pos) const; virtual DataObject* get(unsigned int pos); virtual ChangedDataObjectList::ChangeType getType(unsigned int pos); - virtual int size () const; + virtual unsigned int size () const; virtual void insert (unsigned int index, DataObject *d, ChangedDataObjectList::ChangeType type); @@ -92,7 +92,7 @@ CHANGEDDATAOBJECT_VECTOR plist; CHANGEDDATAOBJECT_VECTOR getVec() const; - void validateIndex(int index) const; + void validateIndex(unsigned int index) const; }; }; }; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/CopyHelper.cpp?r1=1.7&r2=1.8&diff_format=u Index: pecl/sdo/commonj/sdo/CopyHelper.cpp diff -u pecl/sdo/commonj/sdo/CopyHelper.cpp:1.7 pecl/sdo/commonj/sdo/CopyHelper.cpp:1.8 --- pecl/sdo/commonj/sdo/CopyHelper.cpp:1.7 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/CopyHelper.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483011 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/Property.h" #include "commonj/sdo/Type.h" @@ -29,6 +29,8 @@ #include "commonj/sdo/CopyHelper.h" +#include <iostream> +using namespace std; namespace commonj{ namespace sdo{ @@ -105,7 +107,7 @@ void CopyHelper::transferlist(DataObjectList& to, DataObjectList& from, Type::Types t) { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { switch (t) { @@ -177,6 +179,71 @@ } // for } // method + + + void CopyHelper::transfersequenceitem(Sequence *to, Sequence *from, const Property& p, int index) + { + switch (p.getTypeEnum()) + { + case Type::BooleanType: + to->addBoolean( p, from->getBooleanValue(index)); + break; + case Type::ByteType: + to->addByte( p, from->getByteValue(index)); + break; + case Type::CharacterType: + to->addCharacter( p, from->getCharacterValue(index)); + break; + case Type::IntegerType: + to->addInteger( p, from->getIntegerValue(index)); + break; + case Type::ShortType: + to->addShort( p,from->getShortValue(index)); + break; + case Type::DoubleType: + to->addDouble( p, from->getDoubleValue(index)); + break; + case Type::FloatType: + to->addFloat( p, from->getFloatValue(index)); + break; + case Type::LongType: + to->addLong( p, from->getLongValue(index)); + break; + case Type::DateType: + to->addDate( p, from->getDateValue(index)); + break; + case Type::BigDecimalType: + case Type::BigIntegerType: + case Type::UriType: + case Type::StringType: + { + unsigned int siz = from->getLength(index); + if (siz > 0) + { + wchar_t * buf = new wchar_t[siz]; + from->getStringValue(index, buf, siz); + to->addString(p, buf, siz); + delete buf; + } + } + break; + case Type::BytesType: + { + unsigned int siz = from->getLength(index); + if (siz > 0) + { + char * buf = new char[siz]; + from->getBytesValue(index, buf, siz); + to->addBytes(p, buf, siz); + delete buf; + } + } + break; + default: + break; + } // switch + } + /** CopyHelper provides static copying helper functions. * * copyShallow() copies the DataType members of the data object. @@ -197,7 +264,9 @@ */ DataObjectPtr CopyHelper::copy(DataObjectPtr dataObject) { - return internalCopy(dataObject, true); + DataObjectPtr newob = internalCopy(dataObject, true); + resolveReferences(dataObject, newob); + return newob; } DataObjectPtr CopyHelper::internalCopy(DataObjectPtr dataObject, @@ -212,54 +281,273 @@ DataObjectPtr newob = fac->create(t); if (!newob) return 0; - PropertyList pl = dataObject->getInstanceProperties(); - for (int i=0;i < pl.size(); i++) + if ( dataObject->getType().isSequencedType() ) + { + Sequence* fromSequence = dataObject->getSequence(); + int sequence_length = fromSequence->size(); + + Sequence* toSequence = newob->getSequence(); + + for (int i=0;i < sequence_length; i++) + { + if ( fromSequence->isText(i) ) + { + const char *text = fromSequence->getCStringValue(i); + toSequence->addText(i, text); + } + else + { + const Property& seqProperty = fromSequence->getProperty(i); + SDOXMLString seqPropertyName = seqProperty.getName(); + const Type& seqPropertyType = seqProperty.getType(); + + if (seqPropertyType.isDataObjectType()) + { + if (!fullCopy) + { + continue; + } + else + { + DataObjectPtr dob; + + // retrieve the data object to be copied + if (seqProperty.isMany()) + { + int index = fromSequence->getListIndex(i); + dob = dataObject->getList(seqProperty)[index]; + } + else + { + dob = dataObject->getDataObject(seqProperty); + } + + // do the copying of referencing + if (dob) + { + // Handle non-containment reference to DataObject + if (seqProperty.isReference()) + { + // add just the reference into the sequence + // This will be resolved to a new reference later + // This is really bad but we need to add something to the + // sequence here to maintain the ordering + toSequence->addDataObject(seqProperty, 0); + } + else + { + // make a copy of the data object itself + // and add it to the sequence + toSequence->addDataObject(seqProperty, + internalCopy(dob, + true)); + } + } + } + } + else + { + // Sequence member is a primitive + transfersequenceitem(toSequence, + fromSequence, + seqProperty, + i); + + } + } // is it a text element + } // for all elements in sequence + } + else { - if (dataObject->isSet(pl[i])) + PropertyList pl = dataObject->getInstanceProperties(); + for (unsigned int i=0;i < pl.size(); i++) { - // data objects are only copied in the deep copy case - if (pl[i].getType().isDataObjectType()) + if (dataObject->isSet(pl[i])) { - if (!fullCopy) + // data objects are only copied in the deep copy case + if (pl[i].getType().isDataObjectType()) { - continue; + if (!fullCopy) + { + continue; + } + else + { + if (pl[i].isMany()) + { + DataObjectList& dolold = dataObject->getList(pl[i]); + DataObjectList& dolnew = newob->getList(pl[i]); + for (unsigned int li=0;li< dolold.size(); li++) + { + // references are maintained to the old object if it + // is outside of the copy tree + if (pl[i].isReference()) + { + // have to resolve references in a 2nd pass + } + else + { + dolnew.append(internalCopy(dolold[li],true)); + } + } + } + else + { + DataObjectPtr dob = dataObject->getDataObject(pl[i]); + if (pl[i].isReference()) + { + // have to resolve references in a 2nd pass + } + else + { + newob->setDataObject(pl[i],internalCopy(dob,true)); + } + } + } } - else + else { if (pl[i].isMany()) { DataObjectList& dolold = dataObject->getList(pl[i]); DataObjectList& dolnew = newob->getList(pl[i]); - for (int i=0;i< dolold.size(); i++) + transferlist(dolnew,dolold, pl[i].getTypeEnum()); + } + else + { + transferitem(newob,dataObject, pl[i]); + } + } // else + } + } + } + + return newob; + } + + void CopyHelper::resolveReferences(DataObjectPtr oldDO, DataObjectPtr newDO) + { + // Iterate through the properties to find references. + // If the reference is to a DataObject with the copied tree then we can + // set it to reference the DO in the new tree, otherwise it is left unset. + + findReferences(oldDO, newDO, oldDO, newDO); + + } + + void CopyHelper::findReferences(DataObjectPtr oldDO, DataObjectPtr newDO, + DataObjectPtr obj, DataObjectPtr newObj) + { + if ( obj->getType().isSequencedType() ) + { + Sequence* fromSequence = obj->getSequence(); + int sequence_length = fromSequence->size(); + + Sequence* toSequence = newObj->getSequence(); + + for (int i=0;i < sequence_length; i++) + { + if (!fromSequence->isText(i) ) + { + const Property& seqProperty = fromSequence->getProperty(i); + SDOXMLString seqPropertyName = seqProperty.getName(); + const Type& seqPropertyType = seqProperty.getType(); + + if (seqProperty.isReference()) + { + DataObjectPtr ref = findReference(oldDO, newDO, fromSequence->getDataObjectValue(i)); + if (ref) + { + if (seqProperty.isMany()) { - dolnew.append(internalCopy(dolold[i],true)); + int index = fromSequence->getListIndex(i); + newObj->getList(seqProperty).setDataObject(index, ref); } + else + { + toSequence->setDataObjectValue(i, ref); + } + } - else + } + else if (seqPropertyType.isDataObjectType()) + { + findReferences(oldDO, newDO, fromSequence->getDataObjectValue(i), toSequence->getDataObjectValue(i)); + } + } + + } // for all elements in sequence + + } + else + { + PropertyList pl = obj->getInstanceProperties(); + for (unsigned int i=0;i < pl.size(); i++) + { + if (!obj->isSet(pl[i])) + continue; + + if (!pl[i].getType().isDataObjectType()) + continue; + + if (pl[i].isMany()) + { + DataObjectList& dolold = obj->getList(pl[i]); + DataObjectList& dolnew = newObj->getList(pl[i]); + for (unsigned int li=0;li< dolold.size(); li++) + { + if (pl[i].isReference()) + { + DataObjectPtr ref = findReference(oldDO, newDO, dolold[li]); + if (ref) + { + dolnew.setDataObject(li, ref); + } + } + else { - DataObjectPtr dob = dataObject->getDataObject(pl[i]); - newob->setDataObject(pl[i],internalCopy(dob,true)); + findReferences(oldDO, newDO, dolold[li], dolnew[li]); } } } else { - if (pl[i].isMany()) + if (pl[i].isReference()) { - DataObjectList& dolold = dataObject->getList(pl[i]); - DataObjectList& dolnew = newob->getList(pl[i]); - transferlist(dolnew,dolold, pl[i].getTypeEnum()); + DataObjectPtr ref = findReference(oldDO, newDO, obj->getDataObject(pl[i])); + if (ref) + { + newObj->setDataObject(pl[i], ref); + } } - else + else { - transferitem(newob,dataObject, pl[i]); + findReferences(oldDO, newDO, obj->getDataObject(pl[i]), newObj->getDataObject(pl[i])); } - } // else - } - } - return newob; + } + } + } + } + + DataObjectPtr CopyHelper::findReference(DataObjectPtr oldDO, DataObjectPtr newDO, DataObjectPtr ref) + { + SDOString rootXPath = oldDO->objectToXPath(); + SDOString refXPath = ref->objectToXPath(); + + DataObjectPtr newRef; + if (refXPath.find(refXPath) == 0) + { + SDOString relXPath = refXPath.substr(rootXPath.length()); + if (relXPath == "") + newRef = newDO; + if (relXPath.find("/") == 0) + relXPath = relXPath.substr(1); + newRef = newDO->getDataObject(relXPath); + } + + return newRef; } - + } }; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/CopyHelper.h?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/CopyHelper.h diff -u pecl/sdo/commonj/sdo/CopyHelper.h:1.5 pecl/sdo/commonj/sdo/CopyHelper.h:1.6 --- pecl/sdo/commonj/sdo/CopyHelper.h:1.5 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/CopyHelper.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483011 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _COPYHELPER_H_ #define _COPYHELPER_H_ @@ -62,7 +62,12 @@ private: static void transferlist(DataObjectList& to, DataObjectList& from, Type::Types t); static void transferitem(DataObjectPtr to, DataObjectPtr from, const Property& p); + static void transfersequenceitem(Sequence *to, Sequence *from, const Property& p, int index); + static DataObjectPtr internalCopy(DataObjectPtr dataObject, bool fullCopy); + static void resolveReferences(DataObjectPtr oldDO, DataObjectPtr newDO); + static void findReferences(DataObjectPtr oldDO, DataObjectPtr newDO, DataObjectPtr obj, DataObjectPtr newObj); + static DataObjectPtr findReference(DataObjectPtr oldDO, DataObjectPtr newDO, DataObjectPtr ref); }; }; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataFactoryImpl.cpp?r1=1.13&r2=1.14&diff_format=u Index: pecl/sdo/commonj/sdo/DataFactoryImpl.cpp diff -u pecl/sdo/commonj/sdo/DataFactoryImpl.cpp:1.13 pecl/sdo/commonj/sdo/DataFactoryImpl.cpp:1.14 --- pecl/sdo/commonj/sdo/DataFactoryImpl.cpp:1.13 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataFactoryImpl.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 472054 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483416 $ $Date: 2006/12/07 12:38:33 $ */ ////////////////////////////////////////////////////////////////////// // DataFactoryImpl.cpp: implementation of the DataFactory class. @@ -98,7 +98,7 @@ } } - rootElementName.erase(); + rootElementName.erase(); } @@ -166,7 +166,7 @@ if ((typeIter->second)->getAliasCount() > 0) { - for (int j=0;j<(typeIter->second)->getAliasCount();j++) + for (unsigned int j=0;j<(typeIter->second)->getAliasCount();j++) { (typeIter2->second)->setAlias( (typeIter->second)->getAlias()); @@ -176,7 +176,7 @@ // Now add all the properties PropertyList props = typeIter->second->getProperties(); - for (int i=0; i < props.size(); i++) + for (unsigned int i=0; i < props.size(); i++) { // Ensure the properties type is added const Type& propType = props[i].getType(); @@ -200,7 +200,7 @@ getPropertyImpl(props[i].getName()); if (p != 0) { - for (int j=0;j<p->getAliasCount();j++) + for (unsigned int j=0;j<p->getAliasCount();j++) { p->setAlias(props[i].getAlias(j)); } @@ -267,7 +267,7 @@ bool isData, bool isFromList) { - addType(uri.c_str(), inTypeName.c_str(), isSeq, isOp, isAbs, isData, isFromList); + addType(uri.c_str(), inTypeName.c_str(), isSeq, isOp, isAbs, isData, isFromList); } // =================================================================== @@ -286,7 +286,7 @@ PropertyList pl = cs->getProperties(); - for (int i=0 ; i < pl.size() ; i++ ) + for (unsigned int i=0 ; i < pl.size() ; i++ ) { if (recursiveCheck((TypeImpl*)&(pl[i].getType()), t)) return true; } @@ -309,7 +309,7 @@ } if (cstypes.size() > 0) { - for (int i = 0 ;i < cstypes.size(); i++) + for (unsigned int i = 0 ;i < cstypes.size(); i++) { if (recursiveCheck(cstypes[i], t)) { @@ -724,7 +724,7 @@ const Type& DataFactoryImpl::getType(const SDOString& uri, const SDOString& inTypeName) const { - return getType(uri.c_str(), inTypeName.c_str()); + return getType(uri.c_str(), inTypeName.c_str()); } // =================================================================== @@ -778,16 +778,16 @@ } void DataFactoryImpl::setBaseType(const SDOString& typeuri, - const SDOString& typenam, - const SDOString& baseuri, - const SDOString& basename, - bool isRestriction) -{ - setBaseType(typeuri.c_str(), - typenam.c_str(), - baseuri.c_str(), - basename.c_str(), - isRestriction); + const SDOString& typenam, + const SDOString& baseuri, + const SDOString& basename, + bool isRestriction) +{ + setBaseType(typeuri.c_str(), + typenam.c_str(), + baseuri.c_str(), + basename.c_str(), + isRestriction); } @@ -1302,7 +1302,7 @@ const SDOString& typenam, const SDOString& alias) { - setAlias(typeuri.c_str(), typenam.c_str(), alias.c_str()); + setAlias(typeuri.c_str(), typenam.c_str(), alias.c_str()); } // =================================================================== @@ -1325,7 +1325,7 @@ const SDOString& propname, const SDOString& alias) { - setAlias(typeuri.c_str(), typenam.c_str(), propname.c_str(), alias.c_str()); + setAlias(typeuri.c_str(), typenam.c_str(), propname.c_str(), alias.c_str()); } // =================================================================== @@ -1651,67 +1651,6 @@ return getDASValue(typeuri.c_str(), typenam.c_str(), propertyName.c_str(), name.c_str()); } -bool DataFactoryImpl::compareTypes(const TypeImpl* t1, const Type& t2) -{ - PropertyList pl = t2.getProperties(); - for (int i=0;i<pl.size();i++) - { - PropertyImpl* p = t1->getPropertyImpl(i); - if (p == 0) return false; - if (p->isMany() != pl[i].isMany()) return false; - if (p->isContainment() != pl[i].isContainment()) return false; - if (strcmp( p->getType().getURI(), - pl[i].getType().getURI())) return false; - if (strcmp( p->getType().getName(), - pl[i].getType().getName())) return false; - } - return true; - -} -bool DataFactoryImpl::checkType(const Type& t) -{ - const TypeImpl* t2 = findTypeImpl(t.getURI(), - t.getName()); - - if (t2 == 0) return false; - - if (!compareTypes(t2,t)) return false; - - PropertyList pl = t.getProperties(); - for (int i=0;i<pl.size();i++) - { - if (pl[i].getType().isDataObjectType()) - { - if (!checkType(pl[i].getType())) return false; - } - } - return true; -} - - -// only checks the tree dirctly descended from this object if the -// object is specified, otherwise validates the whole factory - -bool DataFactoryImpl::isCompatible(DataFactory* df, DataObject* d) -{ - if (d == 0) - { - TypeList tl = df->getTypes(); - for (int j=0;j<tl.size();j++) - { - const TypeImpl* t = findTypeImpl(tl[j].getURI(), - tl[j].getName()); - - if (t == 0) return false; - if (!compareTypes(t,tl[j]))return false; - } - return true; - } - else - { - return checkType(d->getType()); - } -} bool DataFactoryImpl::generateInterface(const char* fileroot, const char* factoryname) { @@ -1776,7 +1715,7 @@ fprintf(header," * Forward declarations and smart pointers *\n"); fprintf(header," *******************************************/\n\n\n"); - int i; + unsigned int i; for (i=0;i<tl.size();i++) { nscount = 0; @@ -1846,7 +1785,7 @@ { the_uri = new char[2 * strlen(uri) + 1]; int jj=0; - for (int ii=0;ii<strlen(uri);ii++) + for (unsigned int ii=0;ii<strlen(uri);ii++) { if (uri[ii] == '.') { @@ -1949,7 +1888,7 @@ PropertyList pl = tl[i].getProperties(); - for (int j=0;j<pl.size();j++) + for (unsigned int j=0;j<pl.size();j++) { const char* pname = pl[j].getName(); @@ -2176,7 +2115,7 @@ bool DataFactoryImpl::generateInterface(const SDOString& fileroot, const SDOString& factoryname) { - return generateInterface(fileroot.c_str(), factoryname.c_str()); + return generateInterface(fileroot.c_str(), factoryname.c_str()); } std::ostream& DataFactoryImpl::printSelf(std::ostream &os) http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataFactoryImpl.h?r1=1.9&r2=1.10&diff_format=u Index: pecl/sdo/commonj/sdo/DataFactoryImpl.h diff -u pecl/sdo/commonj/sdo/DataFactoryImpl.h:1.9 pecl/sdo/commonj/sdo/DataFactoryImpl.h:1.10 --- pecl/sdo/commonj/sdo/DataFactoryImpl.h:1.9 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataFactoryImpl.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 472054 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483416 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _DataFactoryIMPL_H_ #define _DataFactoryIMPL_H_ @@ -663,9 +663,6 @@ virtual const TypeImpl& getTypeImpl(const SDOString& uri, const SDOString& inTypeName) const; virtual const SDOString& getRootElementName() const; 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); http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataObjectImpl.cpp?r1=1.14&r2=1.15&diff_format=u Index: pecl/sdo/commonj/sdo/DataObjectImpl.cpp diff -u pecl/sdo/commonj/sdo/DataObjectImpl.cpp:1.14 pecl/sdo/commonj/sdo/DataObjectImpl.cpp:1.15 --- pecl/sdo/commonj/sdo/DataObjectImpl.cpp:1.14 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataObjectImpl.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 478191 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483416 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/disable_warn.h" #include "commonj/sdo/DataObjectImpl.h" @@ -944,8 +944,9 @@ void DataObjectImpl::undefineProperty(unsigned int index) { - int point = index - openBase; - if (point < 0 || point >= openProperties.size()) return; + if (index < openBase) return; + unsigned int point = index - openBase; + if (point >= openProperties.size()) return; // downgrade all the property settings above this one @@ -967,7 +968,7 @@ std::list<PropertyImpl>::iterator it = openProperties.begin(); - for (int i=0;i<point;i++)++it; /* there must be a better way */ + for (unsigned int i=0;i<point;i++)++it; /* there must be a better way */ DataFactory* df = factory; ((DataFactoryImpl*)df)->removeOpenProperty((*it).getName()); @@ -1510,7 +1511,7 @@ } } - int propIndex = getPropertyIndex(p); + int propIndex = getPropertyIndexInternal(p); DataObjectImpl* d = getDataObjectImpl(propIndex); if (d == 0) { // There is no list yet, so we need to create an @@ -1563,7 +1564,7 @@ { PropertyList props = getType().getProperties(); - for (int i = 0; i < props.size() ; ++i) + for (unsigned int i = 0; i < props.size() ; ++i) { if (!strcmp(props[i].getName(),p.getName()) ) { @@ -1591,43 +1592,56 @@ } /** - * This method is used internally to find the index of a - * property. If differs from the public getPropertyIndex method - * in that if the type of the containing object is open a new - * index is created. In the public version and error is thrown - */ + * This method is used internally to find the index of a + * property. If differs from the public getPropertyIndex method + * in that if the type of the containing object is open a new + * index is created. In the public version and error is thrown + */ unsigned int DataObjectImpl::getPropertyIndexInternal(const Property& p) { - unsigned int index; + unsigned int index; - try - { + try + { index = getPropertyIndex(p); - } - catch ( SDOPropertyNotFoundException e ) - { - // this could mean that this data object has an open - // type. getPropertyIndex fails in this case because it - // tries to access the index of the property - // and it doesn't exist because it hasn't been created yet. - // This new method is used where properties are being set - // based on existing property objects. This is like to - // occur when a data object is being copied. In this case - // we want properties that are open to be copied also - // so we need to create the property and provide the index - if ( this->getType().isOpenType() ) - { - const Property *prop = defineProperty(p.getName(), p.getType()); - index = getPropertyIndex(p); - } - else - { - throw e; - } - } + } + catch ( SDOPropertyNotFoundException e ) + { + // this could mean that this data object has an open + // type. getPropertyIndex fails in this case because it + // tries to access the index of the property + // and it doesn't exist because it hasn't been created yet. + // This new method is used where properties are being set + // based on existing property objects. This is likely to + // occur when a data object is being copied. In this case + // we want properties that are open to be copied also + // so we need to create the property and provide the index + if ( this->getType().isOpenType() ) + { + const Property *prop = NULL; + + // need to treat many valued properties specially + // because the property is a list rather than + // a single value + if ( p.isMany() ) + { + prop = defineList(p.getName()); + } + else + { + prop = defineProperty(p.getName(), p.getType()); + } + + index = getPropertyIndex(p); + } + else + { + throw e; + } + } - return index; - } + return index; + } const Property& DataObjectImpl::getProperty(unsigned int index) @@ -1672,7 +1686,7 @@ if (index >= openBase && index - openBase < openProperties.size()) { std::list<PropertyImpl>::iterator j; - int val = 0; + unsigned int val = 0; j = openProperties.begin(); while (val < index-openBase && j != openProperties.end()) { @@ -1703,7 +1717,7 @@ s = new char[strlen(path)+1]; - for (int i=0;i < strlen(path); i++) + for (unsigned int i=0;i < strlen(path); i++) { if (strchr(templateString,path[i]) != 0) { s[pos++] = path[i]; @@ -1783,7 +1797,7 @@ if (eq == string::npos) { // There is no "=" sign - int val = atoi(breakerStr.c_str()); + unsigned int val = atoi(breakerStr.c_str()); DataObjectList& list = getList(p); // The spec says that depts[1] is the first element, as is depts.0 @@ -1807,7 +1821,7 @@ // eq is now propval DataObjectList& list = getList(p); - for (int li = 0 ; li < list.size() ; ++li) + for (unsigned int li = 0 ; li < list.size() ; ++li) { // TODO comparison for double not ok @@ -2064,7 +2078,7 @@ { std::vector<PropertyImpl*> theVec; PropertyList propList = getType().getProperties(); - for (int i = 0 ; i < propList.size() ; ++i) + for (unsigned int i = 0 ; i < propList.size() ; ++i) { Property& p = propList[i]; theVec.insert(theVec.end(),(PropertyImpl*)&p); @@ -2263,13 +2277,16 @@ if (p->isMany()) { DataObjectList& dol = d->getList((Property&)*p); - long index; - DataObjectImpl* dx = d->findDataObject(prop,&index); + long idx; + DataObjectImpl* dx = d->findDataObject(prop,&idx); + // fix this. This is the only place the 2nd parm to findDataObject + // is used. Need a better way to do this + unsigned int index = (unsigned int)idx; if (index >= 0) { if(index < dol.size()) { - dol.setDataObject((unsigned int)index,value); + dol.setDataObject(index,value); } else { @@ -2319,48 +2336,6 @@ } } - void DataObjectImpl::transferChildren(DataObject* d, DataFactory* f) - { - bool isData = false; - PropertyList pl = d->getInstanceProperties(); - for (int i=0;i<pl.size();i++) - { - // even primitives need their DF fixed up - if (pl[i].getType().isDataType()) - { - isData = true; - } - - if (!d->isSet(pl[i]) || d->isNull(pl[i])) - { - continue; - } - if (pl[i].isMany()) - { - DataObjectList& dl = d->getList(pl[i]); - for (int j=0;j<dl.size();j++) - { - - DataObject* d2 = dl[j]; - if (d2) { - ((DataObjectImpl*)d2)->setDataFactory(f); - if (!isData)transferChildren(d2,f); - } - } - } - else - { - DataObject* d3 = d->getDataObject(pl[i]); - if (d3) - { - ((DataObjectImpl*)d3)->setDataFactory(f); - if (!isData)transferChildren(d3,f); - } - } - } - } - - void DataObjectImpl::checkFactory(DataObjectPtr dob, unsigned int propertyIndex) @@ -2370,13 +2345,6 @@ if (d->getDataFactory() == getDataFactory()) return; - // Temporary alteration to test the feasibility and - // problems associated with allowing data object 'migration' - // lets move this one and all its children to the factory of the - // new parent if the factories are compatible. - - DataFactoryImpl* f = (DataFactoryImpl*)getDataFactory(); - if (d->getContainer() != 0) { string msg("Insertion of object from another factory is only allowed if the parent is null: "); @@ -2394,29 +2362,6 @@ msg.c_str()); } - if (f->isCompatible(d->getDataFactory(),d)) - { - d->setDataFactory(getDataFactory()); - transferChildren(d,getDataFactory()); - return; - } - - - // This is the default position.... - - string msg("Insertion from incompatible factory "); - const Type& t = d->getType(); - msg += t.getURI(); - msg += "#"; - msg += t.getName(); - msg += " into property "; - msg += getProperty(propertyIndex).getName(); - msg += " of "; - msg += getType().getURI(); - msg += "#"; - msg += getType().getName(); - SDO_THROW_EXCEPTION("checkFactory", SDOInvalidConversionException, - msg.c_str()); } @@ -2445,7 +2390,7 @@ if (pi != 0) { unsigned int subcount = pi->getSubstitutionCount(); - for (int i=0;i<subcount;i++) + for (unsigned int i=0;i<subcount;i++) { const Type* tsub = pi->getSubstitutionType(i); if (tsub != 0 && tsub->equals(objectType)) return; @@ -3116,7 +3061,7 @@ if (prop.isMany()) { DataObjectList& dol = ((*i).second)->getList(); - for (int j=0;j< dol.size(); j++) + for (unsigned int j=0;j< dol.size(); j++) { if (dol[j] == indol) { @@ -3192,7 +3137,7 @@ if (getProperty((*i).first).isMany()) { DataObjectList& dl = ((*i).second)->getList(); - for (int j = 0 ; j < dl.size(); j++) + for (unsigned int j = 0 ; j < dl.size(); j++) { if (dl[j] == ob) { @@ -3748,7 +3693,7 @@ { LOGINFO_1(INFO,"ChangeSummary:Unsetting a reference to %s",prop.getName()); - for (int i=0;i< refs.size();i++) + for (unsigned int i=0;i< refs.size();i++) { if (refs[i]->getDataObject() == dol) { @@ -3765,7 +3710,7 @@ void DataObjectImpl::clearReferences() { - for (int i=0;i<refs.size();i++) + for (unsigned int i=0;i<refs.size();i++) { // Note - no loop as the referer must be of type reference refs[i]->getDataObject()->unset(refs[i]->getProperty()); @@ -3789,7 +3734,7 @@ if (p.isMany()) { DataObjectList& dol = dob->getList(p); - for (int i=0;i<dol.size();i++) + for (unsigned int i=0;i<dol.size();i++) { if (dol[i] == thisob) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataObjectImpl.h?r1=1.12&r2=1.13&diff_format=u Index: pecl/sdo/commonj/sdo/DataObjectImpl.h diff -u pecl/sdo/commonj/sdo/DataObjectImpl.h:1.12 pecl/sdo/commonj/sdo/DataObjectImpl.h:1.13 --- pecl/sdo/commonj/sdo/DataObjectImpl.h:1.12 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataObjectImpl.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 477820 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483416 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _DATAOBJECTIMPL_H_ #define _DATAOBJECTIMPL_H_ @@ -591,7 +591,6 @@ virtual const PropertyImpl* defineList(const char* propname); virtual void undefineProperty(unsigned int index); virtual const TypeImpl& getTypeImpl(); - virtual void transferChildren(DataObject* d, DataFactory* f); virtual void setDataFactory(DataFactory *df); virtual std::ostream& printSelf(std::ostream &os); @@ -662,7 +661,7 @@ // Support for open types - int openBase; + unsigned int openBase; std::list<PropertyImpl> openProperties; static const char* emptyString; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataObjectList.h?r1=1.7&r2=1.8&diff_format=u Index: pecl/sdo/commonj/sdo/DataObjectList.h diff -u pecl/sdo/commonj/sdo/DataObjectList.h:1.7 pecl/sdo/commonj/sdo/DataObjectList.h:1.8 --- pecl/sdo/commonj/sdo/DataObjectList.h:1.7 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataObjectList.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _DATAOBJECTLIST_H_ #define _DATAOBJECTLIST_H_ @@ -55,15 +55,15 @@ * with their correct type using the list getInteger(index) api. */ - virtual SDO_API DataObjectPtr operator[] (int pos) = 0; - virtual SDO_API const DataObjectPtr operator[] (int pos) const = 0; + virtual SDO_API DataObjectPtr operator[] (unsigned int pos) = 0; + virtual SDO_API const DataObjectPtr operator[] (unsigned int pos) const = 0; /** size returns the number of elements. * * The size method returns the number of elements in the list */ - virtual SDO_API int size () const = 0; + virtual SDO_API unsigned int size () const = 0; /** getBoolean returns a boolean at an index * http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataObjectListImpl.cpp?r1=1.11&r2=1.12&diff_format=u Index: pecl/sdo/commonj/sdo/DataObjectListImpl.cpp diff -u pecl/sdo/commonj/sdo/DataObjectListImpl.cpp:1.11 pecl/sdo/commonj/sdo/DataObjectListImpl.cpp:1.12 --- pecl/sdo/commonj/sdo/DataObjectListImpl.cpp:1.11 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataObjectListImpl.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483416 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/DataObjectListImpl.h" @@ -140,13 +140,13 @@ } } -RefCountingPointer<DataObject> DataObjectListImpl::operator[] (int pos) +RefCountingPointer<DataObject> DataObjectListImpl::operator[] (unsigned int pos) { validateIndex(pos); return plist[pos]; } -const RefCountingPointer<DataObject> DataObjectListImpl::operator[] (int pos) const +const RefCountingPointer<DataObject> DataObjectListImpl::operator[] (unsigned int pos) const { validateIndex(pos); RefCountingPointer<DataObjectImpl> d = plist[pos]; @@ -155,7 +155,7 @@ } -int DataObjectListImpl::size () const +unsigned int DataObjectListImpl::size () const { return plist.size(); } @@ -203,7 +203,7 @@ { container->logChange(pindex); } - for (int i=0;i < plist.size(); i++) + for (unsigned int i=0;i < plist.size(); i++) { if (plist[i] == d) { @@ -280,13 +280,6 @@ if (d->getDataFactory() == theFactory) return; - // temporary experiment with allowing data objects - // to move from factory to factory if the type is - // nominally present, and the type systems match - - DataFactoryImpl* f = (DataFactoryImpl*)theFactory; - - if (d->getContainer() != 0) { std::string msg("Insertion of object into list from another factory is only allowed if the parent is null: "); @@ -304,31 +297,6 @@ SDO_THROW_EXCEPTION("checkFactory", SDOInvalidConversionException, msg.c_str()); } - - if (f->isCompatible(d->getDataFactory(),d)) - { - d->setDataFactory(theFactory); - // we will also need to transfer any children - assuming they - // are ok in the new factory!! - d->transferChildren(d,theFactory); - return; - } - - std::string msg("Insertion into list from incompatible factory:"); - - const Type& t = d->getType(); - msg += t.getURI(); - msg += "#"; - msg += t.getName(); - msg += " into property "; - msg += container->getProperty(pindex).getName(); - msg += " of type "; - msg += typeURI; - msg += "#"; - msg += typeName; - SDO_THROW_EXCEPTION("checkFactory", SDOInvalidConversionException, - msg.c_str()); - } @@ -355,7 +323,7 @@ if (pi != 0) { unsigned int subcount = pi->getSubstitutionCount(); - for (int i=0;i<subcount;i++) + for (unsigned int i=0;i<subcount;i++) { const Type* tsub = pi->getSubstitutionType(i); if (tsub != 0 && tsub->equals(objectType)) return; @@ -438,7 +406,7 @@ container->logChange(pindex); } - for (int i=0;i < plist.size(); i++) + for (unsigned int i=0;i < plist.size(); i++) { if (plist[i] == d) { @@ -619,7 +587,7 @@ { if (theFactory == 0) return; - if (typeUnset)setType(Type::SDOTypeNamespaceURI, BytesLiteral); + if (typeUnset)setType(Type::SDOTypeNamespaceURI, StringLiteral); RefCountingPointer<DataObject> dol = theFactory->create(typeURI, typeName); DataObject* dob = dol; @@ -630,7 +598,7 @@ { if (theFactory == 0) return; - if (typeUnset)setType(Type::SDOTypeNamespaceURI, BytesLiteral); + if (typeUnset)setType(Type::SDOTypeNamespaceURI, StringLiteral); RefCountingPointer<DataObject> dol = theFactory->create(typeURI, typeName); DataObject* dob = dol; @@ -642,7 +610,7 @@ { if (theFactory == 0) return; - if (typeUnset)setType(Type::SDOTypeNamespaceURI, BytesLiteral); + if (typeUnset)setType(Type::SDOTypeNamespaceURI, StringLiteral); RefCountingPointer<DataObject> dol = theFactory->create(typeURI, typeName); DataObject* dob = dol; @@ -654,7 +622,7 @@ { if (theFactory == 0) return; - if (typeUnset)setType(Type::SDOTypeNamespaceURI, BytesLiteral); + if (typeUnset)setType(Type::SDOTypeNamespaceURI, StringLiteral); RefCountingPointer<DataObject> dol = theFactory->create(typeURI, typeName); DataObject* dob = dol; @@ -841,7 +809,7 @@ return d; } -void DataObjectListImpl::validateIndex(int index) const +void DataObjectListImpl::validateIndex(unsigned int index) const { if ((index < 0) || (index >= size())) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataObjectListImpl.h?r1=1.8&r2=1.9&diff_format=u Index: pecl/sdo/commonj/sdo/DataObjectListImpl.h diff -u pecl/sdo/commonj/sdo/DataObjectListImpl.h:1.8 pecl/sdo/commonj/sdo/DataObjectListImpl.h:1.9 --- pecl/sdo/commonj/sdo/DataObjectListImpl.h:1.8 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataObjectListImpl.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _DATAOBJECTLISTIMPL_H_ #define _DATAOBJECTLISTIMPL_H_ @@ -62,8 +62,8 @@ // open type support virtual void decrementPindex(); - virtual DataObjectPtr operator[] (int pos); - virtual const DataObjectPtr operator[] (int pos) const; + virtual DataObjectPtr operator[] (unsigned int pos); + virtual const DataObjectPtr operator[] (unsigned int pos) const; // set/get primitive values virtual bool getBoolean(unsigned int index) const; @@ -99,7 +99,7 @@ virtual unsigned int getLength(unsigned int index) const; - virtual int size () const; + virtual unsigned int size () const; virtual void insert (unsigned int index, DataObjectPtr d); virtual void append (DataObjectPtr d); @@ -192,7 +192,7 @@ unsigned int pindex; bool isReference; - void validateIndex(int index) const; + void validateIndex(unsigned int index) const; static const SDOString BooleanLiteral; static const SDOString ByteLiteral; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/EqualityHelper.cpp?r1=1.6&r2=1.7&diff_format=u Index: pecl/sdo/commonj/sdo/EqualityHelper.cpp diff -u pecl/sdo/commonj/sdo/EqualityHelper.cpp:1.6 pecl/sdo/commonj/sdo/EqualityHelper.cpp:1.7 --- pecl/sdo/commonj/sdo/EqualityHelper.cpp:1.6 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/EqualityHelper.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/Property.h" #include "commonj/sdo/Type.h" @@ -69,7 +69,7 @@ wchar_t * buft = new wchar_t[siz]; from->getString(p, buff, siz); to->getString(p, buft, siz); - for (int i=0;i< siz; i++) + for (unsigned int i=0;i< siz; i++) { if (buff[i] != buft[i]) { @@ -94,7 +94,7 @@ char * buft = new char[siz]; from->getBytes(p, buff, siz); to->getBytes(p, buft, siz); - for (int i=0;i< siz; i++) + for (unsigned int i=0;i< siz; i++) { if (buff[i] != buft[i]) { @@ -119,7 +119,7 @@ { case Type::BooleanType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getBoolean(i) != from.getBoolean(i)) { @@ -131,7 +131,7 @@ case Type::ByteType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getByte(i) != from.getByte(i)) { @@ -143,7 +143,7 @@ case Type::CharacterType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getCharacter(i) != from.getCharacter(i)) { @@ -155,7 +155,7 @@ case Type::IntegerType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getInteger(i) != from.getInteger(i)) { @@ -167,7 +167,7 @@ case Type::ShortType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getShort(i) != from.getShort(i)) { @@ -178,7 +178,7 @@ } case Type::DoubleType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getDouble(i) != from.getDouble(i)) { @@ -190,7 +190,7 @@ case Type::FloatType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getFloat(i) != from.getFloat(i)) { @@ -202,7 +202,7 @@ case Type::LongType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getLong(i) != from.getLong(i)) { @@ -214,7 +214,7 @@ case Type::DateType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getDate(i).getTime() != from.getDate(i).getTime()) { @@ -229,7 +229,7 @@ case Type::UriType: case Type::StringType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { unsigned int siz = from.getLength(i); if (siz != to.getLength(i)) return false; @@ -240,7 +240,7 @@ wchar_t * buft = new wchar_t[siz]; from.getString(i,buff,siz); to.getString(i,buft,siz); - for (int j=0;j<siz;j++) + for (unsigned int j=0;j<siz;j++) { if (buff[j] != buft[j]) { @@ -258,7 +258,7 @@ case Type::BytesType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { unsigned int siz = from.getLength(i); if (siz != to.getLength(i)) return false; @@ -269,7 +269,7 @@ char * buft = new char[siz]; from.getBytes(i,buff,siz); to.getBytes(i,buft,siz); - for (int j=0;j<siz;j++) + for (unsigned int j=0;j<siz;j++) { if (buff[j] != buft[j]) { @@ -310,7 +310,7 @@ PropertyList pl = dataObject1->getInstanceProperties(); - for (int i=0;i < pl.size(); i++) + for (unsigned int i=0;i < pl.size(); i++) { // data objects are only compared the deep equality case if (pl[i].getType().isDataObjectType()) @@ -327,7 +327,7 @@ DataObjectList& dolnew = dataObject2->getList(pl[i]); if (dolnew.size() != dolold.size()) return false; - for (int i=0;i< dolold.size(); i++) + for (unsigned int i=0;i< dolold.size(); i++) { if (!internalEqual(dolold[i], dolnew[i], true)) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertyDefinition.cpp?r1=1.6&r2=1.7&diff_format=u Index: pecl/sdo/commonj/sdo/PropertyDefinition.cpp diff -u pecl/sdo/commonj/sdo/PropertyDefinition.cpp:1.6 pecl/sdo/commonj/sdo/PropertyDefinition.cpp:1.7 --- pecl/sdo/commonj/sdo/PropertyDefinition.cpp:1.6 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertyDefinition.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/PropertyDefinition.h" #include "commonj/sdo/PropertyDefinitionImpl.h" @@ -105,7 +105,7 @@ return propertydefinition->substituteNames.size(); } - const char* PropertyDefinition::getSubstituteNames(int index) const + const char* PropertyDefinition::getSubstituteNames(unsigned int index) const { if (index >= 0 && index < propertydefinition->substituteNames.size()) { @@ -114,7 +114,7 @@ return 0; } - const char* PropertyDefinition::getSubstituteLocalNames(int index) const + const char* PropertyDefinition::getSubstituteLocalNames(unsigned int index) const { if (index >= 0 && index < propertydefinition->substituteLocalNames.size()) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertyDefinition.h?r1=1.6&r2=1.7&diff_format=u Index: pecl/sdo/commonj/sdo/PropertyDefinition.h diff -u pecl/sdo/commonj/sdo/PropertyDefinition.h:1.6 pecl/sdo/commonj/sdo/PropertyDefinition.h:1.7 --- pecl/sdo/commonj/sdo/PropertyDefinition.h:1.6 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertyDefinition.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _PROPERTYDefinition_H_ #define _PROPERTYDefinition_H_ @@ -73,8 +73,8 @@ /*SDO_API*/ void addSubstitute(const SDOString& name, const SDOString& localname); /*SDO_API*/ int getSubstituteCount() const; - /*SDO_API*/ const char* getSubstituteNames(int index) const; - /*SDO_API*/ const char* getSubstituteLocalNames(int index) const; + /*SDO_API*/ const char* getSubstituteNames(unsigned int index) const; + /*SDO_API*/ const char* getSubstituteLocalNames(unsigned int index) const; /*SDO_API*/ void setAliases(const char* aliases); http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertyImpl.cpp?r1=1.10&r2=1.11&diff_format=u Index: pecl/sdo/commonj/sdo/PropertyImpl.cpp diff -u pecl/sdo/commonj/sdo/PropertyImpl.cpp:1.10 pecl/sdo/commonj/sdo/PropertyImpl.cpp:1.11 --- pecl/sdo/commonj/sdo/PropertyImpl.cpp:1.10 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertyImpl.cpp Thu Dec 7 12:38:33 2006 @@ -17,16 +17,13 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 482678 $ $Date: 2006/12/07 12:38:33 $ */ + +#include "commonj/sdo/export.h" #include <iostream> using namespace std; -#ifndef SDO_EXPORTS -#define SDO_EXPORTS -#endif -#include "commonj/sdo/export.h" - #include "commonj/sdo/Sequence.h" #include "commonj/sdo/DataObject.h" @@ -266,7 +263,7 @@ /////////////////////////////////////////////////////////////////////////// const Type* PropertyImpl::getSubstitutionType(const char* inname) const { - for (int i=0;i<substitutions.size();i++) + for (unsigned int i=0;i<substitutions.size();i++) { if (!strcmp(inname, substitutions[i].name.c_str())) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertyList.cpp?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/PropertyList.cpp diff -u pecl/sdo/commonj/sdo/PropertyList.cpp:1.5 pecl/sdo/commonj/sdo/PropertyList.cpp:1.6 --- pecl/sdo/commonj/sdo/PropertyList.cpp:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertyList.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef SDO_EXPORTS #define SDO_EXPORTS @@ -74,7 +74,7 @@ return *(plist[pos]); } -SDO_API int PropertyList::size () +SDO_API unsigned int PropertyList::size () { return plist.size(); } http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertyList.h?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/PropertyList.h diff -u pecl/sdo/commonj/sdo/PropertyList.h:1.5 pecl/sdo/commonj/sdo/PropertyList.h:1.6 --- pecl/sdo/commonj/sdo/PropertyList.h:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertyList.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _PROPERTYLIST_H_ #define _PROPERTYLIST_H_ @@ -71,7 +71,7 @@ * size() returns the number of elements in the list. */ - SDO_API int size (); + SDO_API unsigned int size (); /** insert adds an element to the list * http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertySetting.cpp?r1=1.6&r2=1.7&diff_format=u Index: pecl/sdo/commonj/sdo/PropertySetting.cpp diff -u pecl/sdo/commonj/sdo/PropertySetting.cpp:1.6 pecl/sdo/commonj/sdo/PropertySetting.cpp:1.7 --- pecl/sdo/commonj/sdo/PropertySetting.cpp:1.6 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertySetting.cpp Thu Dec 7 12:38:33 2006 @@ -17,19 +17,17 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 482588 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/PropertySetting.h" #include "SDOString.h" +#include "SDOUtils.h" namespace commonj { namespace sdo { - const char *PropertySetting::CDataStartMarker = "XXXCDATA@STARTXXX"; - const char *PropertySetting::XMLCDataStartMarker = "<![CDATA["; - const char *PropertySetting::CDataEndMarker = "XXXCDATA@ENDX"; - const char *PropertySetting::XMLCDataEndMarker = "]]>"; + PropertySetting::PropertySetting() : dataObject(NULL), isNULL(false), isIDREF(false), pendingUnknownType(false) @@ -47,42 +45,6 @@ { } - /* - * A local utility function that replaces one string with and another within a - * host string and adjusts the lenght of the host string accordingly. - */ - SDOString replace(SDOString hostString, const char *fromString, const char *toString) - { - SDOString returnString(""); - - // find and replace all occurances of fromString with toString. The start, end - // and length variables are used to indicate the start, end and length - // of the text sections to be copied from the host string to the return - // string. toString is appended in between these copied sections because the - // string is broken whenever fronString is found - std::string::size_type start = 0; - std::string::size_type end = hostString.find(fromString, 0); - std::string::size_type length = 0; - - while ( end != std::string::npos ) - { - // copy all the text up to the fromString - length = end - start; - returnString.append(hostString.substr(start, length)); - - // add in the toString - returnString.append(toString); - - // find the next fromString - start = end + strlen(fromString); - end = hostString.find(fromString, start); - } - - // copy any text left at the end of the host string - returnString.append(hostString.substr(start)); - - return returnString; - } /* * The value that PropertySetting uses to hold values passing from @@ -96,8 +58,8 @@ { SDOString valueString((const char*)value); - SDOString returnString = replace(valueString, CDataStartMarker, XMLCDataStartMarker); - returnString = replace(returnString, CDataEndMarker, XMLCDataEndMarker); + SDOString returnString = SDOUtils::replace(valueString, SDOUtils::CDataStartMarker, SDOUtils::XMLCDataStartMarker); + returnString = SDOUtils::replace(returnString, SDOUtils::CDataEndMarker, SDOUtils::XMLCDataEndMarker); return returnString; } http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertySetting.h?r1=1.6&r2=1.7&diff_format=u Index: pecl/sdo/commonj/sdo/PropertySetting.h diff -u pecl/sdo/commonj/sdo/PropertySetting.h:1.6 pecl/sdo/commonj/sdo/PropertySetting.h:1.7 --- pecl/sdo/commonj/sdo/PropertySetting.h:1.6 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertySetting.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 482588 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _PROPERTYSETTING_H_ #define _PROPERTYSETTING_H_ @@ -56,16 +56,6 @@ bool isIDREF; bool isNULL; bool pendingUnknownType; - - /* - * Markers used to represent the start and end of CDATA sections in the - * settings value. The noew XML CDATA markers are not used here because the - * XML string processing URL encodes parts of the markers - */ - static SDO_API const char *CDataStartMarker; - static SDO_API const char *XMLCDataStartMarker; - static SDO_API const char *CDataEndMarker; - static SDO_API const char *XMLCDataEndMarker; }; } // End - namespace sdo http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SAX2Attributes.cpp?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/SAX2Attributes.cpp diff -u pecl/sdo/commonj/sdo/SAX2Attributes.cpp:1.5 pecl/sdo/commonj/sdo/SAX2Attributes.cpp:1.6 --- pecl/sdo/commonj/sdo/SAX2Attributes.cpp:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SAX2Attributes.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/SAX2Attributes.h" @@ -61,7 +61,7 @@ const SAX2Attribute* SAX2Attributes::getAttribute(const SDOXMLString& attributeName) const { - for (int i=0; i < attributes.size(); i++) + for (unsigned int i=0; i < attributes.size(); i++) { if (attributes[i].getName().equalsIgnoreCase(attributeName)) { @@ -73,7 +73,7 @@ void SAX2Attributes::addAttribute(const SAX2Attribute& attr) { - for (int i=0; i < attributes.size(); i++) + for (unsigned int i=0; i < attributes.size(); i++) { if (attributes[i].getUri().equals(attr.getUri())) { @@ -95,7 +95,7 @@ const SDOXMLString& attributeUri, const SDOXMLString& attributeName) const { - for (int i=0; i < attributes.size(); i++) + for (unsigned int i=0; i < attributes.size(); i++) { if (attributes[i].getUri().equalsIgnoreCase(attributeUri)) { @@ -112,7 +112,7 @@ const SDOXMLString& SAX2Attributes::getValue( const SDOXMLString& attributeName) const { - for (int i=0; i < attributes.size(); i++) + for (unsigned int i=0; i < attributes.size(); i++) { if (attributes[i].getName().equalsIgnoreCase(attributeName)) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SAX2Parser.cpp?r1=1.6&r2=1.7&diff_format=u Index: pecl/sdo/commonj/sdo/SAX2Parser.cpp diff -u pecl/sdo/commonj/sdo/SAX2Parser.cpp:1.6 pecl/sdo/commonj/sdo/SAX2Parser.cpp:1.7 --- pecl/sdo/commonj/sdo/SAX2Parser.cpp:1.6 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SAX2Parser.cpp Thu Dec 7 12:38:33 2006 @@ -17,12 +17,12 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 482588 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/SAX2Parser.h" #include "libxml/SAX2.h" #include "commonj/sdo/SDORuntimeException.h" -#include "commonj/sdo/PropertySetting.h" +#include "commonj/sdo/SDOUtils.h" using namespace commonj::sdo; /** @@ -172,9 +172,9 @@ { SDOXMLString valueAsString(value, 0, len); - SDOXMLString cdata(PropertySetting::CDataStartMarker); + SDOXMLString cdata(SDOUtils::CDataStartMarker); cdata = cdata + valueAsString; - cdata = cdata + PropertySetting::CDataEndMarker; + cdata = cdata + SDOUtils::CDataEndMarker; ((SAX2Parser*)ctx)->characters(cdata); } @@ -500,7 +500,7 @@ ctxt = xmlCreatePushParserCtxt(handler, this, bctx, bcount, NULL); - for (int i=0;i<buffer_vec.size();i++) + for (unsigned int i=0;i<buffer_vec.size();i++) { if (buffer_vec[i].len > 0) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOSAX2Parser.cpp?r1=1.8&r2=1.9&diff_format=u Index: pecl/sdo/commonj/sdo/SDOSAX2Parser.cpp diff -u pecl/sdo/commonj/sdo/SDOSAX2Parser.cpp:1.8 pecl/sdo/commonj/sdo/SDOSAX2Parser.cpp:1.9 --- pecl/sdo/commonj/sdo/SDOSAX2Parser.cpp:1.8 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SDOSAX2Parser.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 477891 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 482588 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/SDOSAX2Parser.h" @@ -32,6 +32,7 @@ #include "commonj/sdo/TypeImpl.h" #include "commonj/sdo/DataObjectImpl.h" #include "commonj/sdo/DataFactoryImpl.h" +#include "commonj/sdo/SDOUtils.h" #include <stdio.h> using namespace std; @@ -1334,11 +1335,18 @@ DataObject* dob = currentDataObject; if ((dob != 0) && ((DataObjectImpl*)dob)->getTypeImpl().isFromList()) { - // this is a list,so we need to split it up + // this is a list,so we need to split it up DataObjectList& dl = currentDataObject->getList( (const char *)"values"); const char* str = (const char*)chars; + + // Convert any synthetic CDATA markers back to the real thing + SDOString valueString(str); + SDOString tmpString = SDOUtils::replace(valueString, SDOUtils::CDataStartMarker, SDOUtils::XMLCDataStartMarker); + tmpString = SDOUtils::replace(tmpString, SDOUtils::CDataEndMarker, SDOUtils::XMLCDataEndMarker); + str = (const char*)tmpString.c_str(); + char* buf = new char[strlen(str)+1]; if (!buf) return; @@ -1371,12 +1379,20 @@ // then add this as text to the sequence if (currentDataObject && currentDataObjectType->isSequencedType()) { + // Convert any synthetic CDATA markers back to the real thing + const char* str = (const char*)chars; + + SDOString valueString(str); + SDOString tmpString = SDOUtils::replace(valueString, SDOUtils::CDataStartMarker, SDOUtils::XMLCDataStartMarker); + tmpString = SDOUtils::replace(tmpString, SDOUtils::CDataEndMarker, SDOUtils::XMLCDataEndMarker); + str = tmpString.c_str(); + SequencePtr seq = currentDataObject->getSequence(); if (seq) { if (newSequence == true) { - seq->addText(chars); + seq->addText(str); newSequence = false; } else @@ -1390,20 +1406,20 @@ if (s) { char *combi = - new char[strlen(s)+strlen(chars) + 2]; + new char[strlen(s)+strlen(str) + 2]; strcpy(combi,s); - strcat(combi,chars); + strcat(combi,str); seq->setText(k,(const char*)combi); delete combi; } else { - seq->setText(k,chars); + seq->setText(k,str); } return; } } - seq->addText(chars); + seq->addText(str); } return; } @@ -1451,7 +1467,7 @@ */ PropertyList pl = type.getProperties(); - for (int i = 0; i < pl.size(); i++) + for (unsigned int i = 0; i < pl.size(); i++) { XSDPropertyInfo* pi = (XSDPropertyInfo*)((DASProperty*)&pl[i])->getDASValue("XMLDAS::PropertyInfo"); if (pi) @@ -1460,7 +1476,7 @@ if (localName .equals(propdef.localname)) return propdef.name; - for (int j=0;j< propdef.substituteNames.size();j++) + for (unsigned int j=0;j< propdef.substituteNames.size();j++) { if (propdef.substituteLocalNames[j].equals(localName)) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOSchemaSAX2Parser.cpp?r1=1.12&r2=1.13&diff_format=u Index: pecl/sdo/commonj/sdo/SDOSchemaSAX2Parser.cpp diff -u pecl/sdo/commonj/sdo/SDOSchemaSAX2Parser.cpp:1.12 pecl/sdo/commonj/sdo/SDOSchemaSAX2Parser.cpp:1.13 --- pecl/sdo/commonj/sdo/SDOSchemaSAX2Parser.cpp:1.12 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SDOSchemaSAX2Parser.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 478193 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 483102 $ $Date: 2006/12/07 12:38:33 $ */ #include "libxml/uri.h" #include "commonj/sdo/SDOSchemaSAX2Parser.h" @@ -94,7 +94,7 @@ bool isGroup, const SAX2Attributes& groupAttributes) { - for (int i=0;i< groupList.size(); i++) + for (unsigned int i=0;i< groupList.size(); i++) { if (groupList[i].isAttributeGroup != isGroup) { @@ -117,7 +117,7 @@ int level = 0; - for (int j=0;j< groupList[i].events.size();j++) + for (unsigned int j=0;j< groupList[i].events.size();j++) { if (groupList[i].events[j].isStartEvent) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOUtils.cpp?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/SDOUtils.cpp diff -u pecl/sdo/commonj/sdo/SDOUtils.cpp:1.5 pecl/sdo/commonj/sdo/SDOUtils.cpp:1.6 --- pecl/sdo/commonj/sdo/SDOUtils.cpp:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SDOUtils.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 483011 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/SDOUtils.h" #include <stdio.h> @@ -29,6 +29,11 @@ namespace commonj { namespace sdo { + + const char *SDOUtils::CDataStartMarker = "XXXCDATA@STARTXXX"; + const char *SDOUtils::XMLCDataStartMarker = "<![CDATA["; + const char *SDOUtils::CDataEndMarker = "XXXCDATA@ENDX"; + const char *SDOUtils::XMLCDataEndMarker = "]]>"; ////////////////////////////////////////////////////////////////////////// // Conversions @@ -118,7 +123,7 @@ void SDOUtils::printTabs(ostream& out, unsigned int incr) { - for (int ind=0; ind < incr; ind++) + for (unsigned int ind=0; ind < incr; ind++) { out << " "; } @@ -155,7 +160,7 @@ // Iterate over all the properties ////////////////////////////////////////////////////////////// PropertyList pl = dataObject->getInstanceProperties(); - for (int i = 0; i < pl.size(); i++) + for (unsigned int i = 0; i < pl.size(); i++) { printTabs(out, incr); out << "Property: " << pl[i].getName() << endl; @@ -179,7 +184,7 @@ incr++; DataObjectList& dol = dataObject->getList(pl[i]); char cc[20]; - for (int j = 0; j <dol.size(); j++) + for (unsigned int j = 0; j <dol.size(); j++) { printTabs(out, incr); // seems to be a bug in ostream? Will not print j @@ -189,7 +194,15 @@ out << cc; out << endl; incr++; - printDataObject(out, dol[j],incr); + if (pl[i].isReference()) + { + printTabs(out, incr); + out << "Reference Value: " << dol[j]->objectToXPath() <<endl; + } + else + { + printDataObject(out, dol[j],incr); + } incr--; out << endl; } @@ -212,7 +225,15 @@ else { incr++; - printDataObject(out, dataObject->getDataObject(pl[i]),incr); + if (pl[i].isReference()) + { + printTabs(out, incr); + out << "Reference Value: " << dataObject->getDataObject(pl[i])->objectToXPath() <<endl; + } + else + { + printDataObject(out, dataObject->getDataObject(pl[i]),incr); + } incr--; } } @@ -231,13 +252,13 @@ void SDOUtils::printTypes(std::ostream& out, DataFactoryPtr df) { TypeList tl = df->getTypes(); - for (int i = 0; i < tl.size(); i++) + for (unsigned int i = 0; i < tl.size(); i++) { out << "Type: " << tl[i].getURI()<< "#" << tl[i].getName() << " isOpen: " << tl[i].isOpenType() << " isSequenced: " << tl[i].isSequencedType() << endl; PropertyList pl = tl[i].getProperties(); - for (int j = 0; j < pl.size(); j++) + for (unsigned int j = 0; j < pl.size(); j++) { out << "\tProperty: " << pl[j].getName() << " type: " <<pl[j].getType().getURI()<<"#"<<pl[j].getType().getName()<< @@ -247,6 +268,44 @@ } } + + /* + * A local utility function that replaces one string with and another within a + * host string and adjusts the lenght of the host string accordingly. + */ + SDOString SDOUtils::replace(SDOString hostString, const char *fromString, const char *toString) + { + SDOString returnString(""); + + // find and replace all occurances of fromString with toString. The start, end + // and length variables are used to indicate the start, end and length + // of the text sections to be copied from the host string to the return + // string. toString is appended in between these copied sections because the + // string is broken whenever fromString is found + std::string::size_type start = 0; + std::string::size_type end = hostString.find(fromString, 0); + std::string::size_type length = 0; + + while ( end != std::string::npos ) + { + // copy all the text up to the fromString + length = end - start; + returnString.append(hostString.substr(start, length)); + + // add in the toString + returnString.append(toString); + + // find the next fromString + start = end + strlen(fromString); + end = hostString.find(fromString, start); + } + + // copy any text left at the end of the host string + returnString.append(hostString.substr(start)); + + return returnString; + } + }; }; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOUtils.h?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/SDOUtils.h diff -u pecl/sdo/commonj/sdo/SDOUtils.h:1.5 pecl/sdo/commonj/sdo/SDOUtils.h:1.6 --- pecl/sdo/commonj/sdo/SDOUtils.h:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SDOUtils.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 482588 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _SDOUTILS_H_ #define _SDOUTILS_H_ @@ -46,6 +46,17 @@ static SDO_API const char* SDOToXSD(const char* sdoname); static SDO_API const char* XSDToSDO(const char* xsdname); static void printTypes(std::ostream& out, DataFactoryPtr df); + static SDOString replace(SDOString hostString, const char *fromString, const char *toString); + + /* + * Markers used to represent the start and end of CDATA sections in the + * settings value. The noew XML CDATA markers are not used here because the + * XML string processing URL encodes parts of the markers + */ + static SDO_API const char *CDataStartMarker; + static SDO_API const char *XMLCDataStartMarker; + static SDO_API const char *CDataEndMarker; + static SDO_API const char *XMLCDataEndMarker; private: http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOXMLString.cpp?r1=1.7&r2=1.8&diff_format=u Index: pecl/sdo/commonj/sdo/SDOXMLString.cpp diff -u pecl/sdo/commonj/sdo/SDOXMLString.cpp:1.7 pecl/sdo/commonj/sdo/SDOXMLString.cpp:1.8 --- pecl/sdo/commonj/sdo/SDOXMLString.cpp:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SDOXMLString.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 462804 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/SDOXMLString.h" #include <iostream> @@ -174,7 +174,7 @@ { char* newString = new char[strlen(*this)+1]; strcpy(newString, *this); - for (int i = start; (i<=(strlen(newString)) && i < length); i++) + for (unsigned int i = start; (i<=(strlen(newString)) && i < length); i++) { newString[i] = tolower(newString[i]); } http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOXMLWriter.cpp?r1=1.10&r2=1.11&diff_format=u Index: pecl/sdo/commonj/sdo/SDOXMLWriter.cpp diff -u pecl/sdo/commonj/sdo/SDOXMLWriter.cpp:1.10 pecl/sdo/commonj/sdo/SDOXMLWriter.cpp:1.11 --- pecl/sdo/commonj/sdo/SDOXMLWriter.cpp:1.10 Fri Dec 1 15:27:42 2006 +++ pecl/sdo/commonj/sdo/SDOXMLWriter.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 477891 $ $Date: 2006/12/01 15:27:42 $ */ +/* $Rev: 482667 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/SDOXMLWriter.h" #include "commonj/sdo/SDOXMLString.h" @@ -497,7 +497,7 @@ const SDOXMLString& elementName, ChangeSummaryPtr cs) { - int i; + unsigned int i; int rc; ChangedDataObjectList& changedDOs = cs->getChangedDataObjects(); @@ -587,7 +587,7 @@ } PropertyList pl = dob->getInstanceProperties(); - for (int i = 0; i < pl.size(); i++) + for (unsigned int i = 0; i < pl.size(); i++) { if (!dob->isSet(pl[i]))continue; @@ -596,7 +596,7 @@ if (!pl[i].getType().isDataType()) { DataObjectList& dl = dob->getList(pl[i]); - for (int k=0;k< dl.size() ;k++) + for (unsigned int k=0;k< dl.size() ;k++) { DataObjectImpl* d = (DataObjectImpl*)(DataObject*)dl[k]; if (d != 0)addToNamespaces(d); @@ -678,9 +678,7 @@ // Don't write the element URI if the element is a child of an open type // and not one of the declared properties SDOXMLString uri = elementURI; -/* ------------------------------------ - Patch for bug 9498 - if (!isRoot && !writeXSIType) +/* if (!isRoot && !writeXSIType) { DataObject* dob = dataObject; DataObjectImpl* cont = @@ -695,9 +693,8 @@ } } } - } - Patch for bug 9498 - ------------------------------------ */ + } */ + //SDOXMLString uri; //if (!elementURI.equals(namespaceUriStack.top())) //{ @@ -730,6 +727,7 @@ } else { + /* Use our wrapper function just in case the element has CDATA in it */ writeXMLElement(writer, elementName, dataObject->getCString("")); @@ -901,31 +899,35 @@ // (const unsigned char*)value.c_str()); //} //else - //{ + //{ if (cont->getTypeImpl().getPropertyImpl(elementName) == 0) { const SDOXMLString& typeURI = dataObject->getType().getURI(); const SDOXMLString& typeName = dataObject->getType().getName(); - - SDOXMLString theName=typeName; - -/* Patch for bug9498 if (!typeURI.isNull() && !typeURI.equals(tnsURI) && !typeURI.equals("")) */ - if (!typeURI.isNull() && !typeURI.equals(uri) && !typeURI.equals("")) + + // Supress the writing of xsi:type as well for DataObjects of type + // commonj.sdo#OpenDataObject + if (!(typeURI.equals("commonj.sdo") && typeName.equals("OpenDataObject"))) { - std::map<SDOXMLString,SDOXMLString>::iterator it = namespaceMap.find(typeURI); - if (it != namespaceMap.end()) + SDOXMLString theName=typeName; + + if (!typeURI.isNull() && !typeURI.equals(uri) && !typeURI.equals("")) { - theName = (*it).second; - theName += ":"; - theName += typeName; + std::map<SDOXMLString,SDOXMLString>::iterator it = namespaceMap.find(typeURI); + if (it != namespaceMap.end()) + { + theName = (*it).second; + theName += ":"; + theName += typeName; + } } - } - - rc = xmlTextWriterWriteAttribute(writer, - (const unsigned char*)"xsi:type", - (const unsigned char*)theName); - writeXmlnsXsi(); + rc = xmlTextWriterWriteAttribute(writer, + (const unsigned char*)"xsi:type", + (const unsigned char*)theName); + + writeXmlnsXsi(); + } } } } @@ -945,8 +947,8 @@ ////////////////////////////////////////////////////////////////////////// // Iterate over all the properties to find attributes ////////////////////////////////////////////////////////////////////////// - int i; - int j = 1; + unsigned int i; + unsigned int j = 1; PropertyList pl = dataObject->getInstanceProperties(); for (i = 0; i < pl.size(); i++) { @@ -1051,7 +1053,9 @@ if (sequence->isText(i)) { - rc = xmlTextWriterWriteString( + // This is a raw write rather than xmlTextWriterWriteString + // just in case the text has a CDATA section in it + rc = xmlTextWriterWriteRaw( writer, SDOXMLString(sequence->getCStringValue(i))); continue; @@ -1061,6 +1065,14 @@ SDOXMLString seqPropName = seqProp.getName(); const Type& seqPropType = seqProp.getType(); + // Do not write attributes as members of the sequence + XSDPropertyInfo* pi = getPropertyInfo(dataObjectType, seqProp); + PropertyDefinitionImpl propdef; + if (pi && !(pi->getPropertyDefinition().isElement)) + { + continue; + } + if (seqPropType.isDataObjectType()) { DataObjectPtr doValue; @@ -1092,10 +1104,20 @@ else { // Sequence member is a primitive + // Only write a primitive as an element if defined by the schema or if it's + // many-valued. + if (!pi && !seqProp.isMany()) continue; + + /* Use our wrapper function just in case the element has CDATA in it */ + writeXMLElement(writer, + seqPropName, + sequence->getCStringValue(i)); + /* xmlTextWriterWriteElement( writer, seqPropName, SDOXMLString(sequence->getCStringValue(i))); + */ } // end DataType } // end - iterate over sequence @@ -1132,7 +1154,7 @@ if (pl[i].isMany()) { DataObjectList& dol = dataObject->getList(pl[i]); - for (int j = 0; j <dol.size(); j++) + for (unsigned int j = 0; j <dol.size(); j++) { // Handle non-containment reference to DataObject if (pl[i].isReference() ) @@ -1294,7 +1316,7 @@ /** * A wrapper for the libxml2 function xmlTextWriterWriteElement - * it detects CDATA sections before wrting out element contents + * it detects CDATA sections before writing out element contents */ int SDOXMLWriter::writeXMLElement(xmlTextWriterPtr writer, const xmlChar *name, @@ -1305,6 +1327,8 @@ rc = xmlTextWriterWriteRaw(writer, SDOXMLString(content)); rc = xmlTextWriterEndElement(writer); /* A more complex version that doesn't work! + * I've left it here just in case we need to go back and separate out + * CDATA from text. This might provide a starting point SDOString contentString(content); // write the start of the element. we could write a mixture of http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOXSDWriter.cpp?r1=1.7&r2=1.8&diff_format=u Index: pecl/sdo/commonj/sdo/SDOXSDWriter.cpp diff -u pecl/sdo/commonj/sdo/SDOXSDWriter.cpp:1.7 pecl/sdo/commonj/sdo/SDOXSDWriter.cpp:1.8 --- pecl/sdo/commonj/sdo/SDOXSDWriter.cpp:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SDOXSDWriter.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/SDOXSDWriter.h" #include "iostream" @@ -163,7 +163,7 @@ int SDOXSDWriter::write(const TypeList& types, const SDOXMLString& targetNamespaceURI, const propertyMap& openprops, int indent) { - int i; + unsigned int i; if (writer == NULL) { // Throw exception @@ -309,7 +309,7 @@ { unsigned int j = type.getAliasCount(); SDOXMLString value = ""; - for (int i=0;i<j-1;i++) + for (unsigned int i=0;i<j-1;i++) { value = value + type.getAlias(i); value = value + " "; @@ -380,7 +380,7 @@ { unsigned int j = type.getAliasCount(); SDOXMLString value = ""; - for (int i=0;i<j-1;i++) + for (unsigned int i=0;i<j-1;i++) { value = value + type.getAlias(i); value = value + " "; @@ -421,7 +421,7 @@ // Create <element> definitions // ------------------------------------------------------- - int j; + unsigned int j; for (j = 0; j < pl.size(); j++) { const Property& prop = pl[j]; @@ -513,7 +513,7 @@ { unsigned int j = prop.getAliasCount(); SDOXMLString value = ""; - for (int i=0;i<j-1;i++) + for (unsigned int i=0;i<j-1;i++) { value = value + prop.getAlias(i); value = value + " "; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SequenceImpl.cpp?r1=1.8&r2=1.9&diff_format=u Index: pecl/sdo/commonj/sdo/SequenceImpl.cpp diff -u pecl/sdo/commonj/sdo/SequenceImpl.cpp:1.8 pecl/sdo/commonj/sdo/SequenceImpl.cpp:1.9 --- pecl/sdo/commonj/sdo/SequenceImpl.cpp:1.8 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SequenceImpl.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/disable_warn.h" #include "commonj/sdo/Property.h" @@ -639,7 +639,7 @@ {\ SEQUENCE_ITEM_LIST::iterator i;\ SEQUENCE_ITEM_LIST::iterator i2 = the_list.end();\ - int j;\ + unsigned int j;\ if (index >= the_list.size()) {\ return add##primtype(p,v);\ }\ @@ -701,7 +701,7 @@ {\ SEQUENCE_ITEM_LIST::iterator i;\ SEQUENCE_ITEM_LIST::iterator i2 = the_list.end();\ - int j;\ + unsigned int j;\ if (index >= the_list.size()) {\ return add##primtype(p,v);\ }\ @@ -837,7 +837,7 @@ msg.c_str()); } SEQUENCE_ITEM_LIST::iterator i; - int j = 0; + unsigned int j = 0; for (i=the_list.begin();(j < index) && (i != the_list.end()) ; ++i) { j++; @@ -890,7 +890,7 @@ SEQUENCE_ITEM_LIST::iterator i1, i2 = the_list.end(), i3 = the_list.end(); - int j = 0; + unsigned int j = 0; for (i3 = the_list.begin(); j < toIndex && j < fromIndex && i3 != the_list.end() ; ++i3); @@ -932,7 +932,7 @@ return false; } SEQUENCE_ITEM_LIST::iterator i; - int j = 0; + unsigned int j = 0; for (i= the_list.begin(); (j < index) && (i != the_list.end()); ++i) { j++; @@ -952,7 +952,7 @@ } SEQUENCE_ITEM_LIST::iterator i; - int j = 0; + unsigned int j = 0; for (i= the_list.begin(); (j < index) && (i != the_list.end()); ++i) { j++; @@ -973,7 +973,7 @@ } SEQUENCE_ITEM_LIST::iterator i; - int j = 0; + unsigned int j = 0; for (i= the_list.begin(); (j < index) && (i != the_list.end()); ++i) { j++; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/TypeList.cpp?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/TypeList.cpp diff -u pecl/sdo/commonj/sdo/TypeList.cpp:1.5 pecl/sdo/commonj/sdo/TypeList.cpp:1.6 --- pecl/sdo/commonj/sdo/TypeList.cpp:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/TypeList.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef SDO_EXPORTS #define SDO_EXPORTS @@ -61,12 +61,12 @@ } -SDO_API const Type& TypeList::operator[] (int pos) const +SDO_API const Type& TypeList::operator[] (unsigned int pos) const { return *plist[pos]; } -SDO_API int TypeList::size () const +SDO_API unsigned int TypeList::size () const { return plist.size(); } http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/TypeList.h?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/TypeList.h diff -u pecl/sdo/commonj/sdo/TypeList.h:1.5 pecl/sdo/commonj/sdo/TypeList.h:1.6 --- pecl/sdo/commonj/sdo/TypeList.h:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/TypeList.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _TYPELIST_H_ #define _TYPELIST_H_ @@ -48,8 +48,8 @@ SDO_API TypeList(std::vector<const Type*> p); SDO_API TypeList(); virtual SDO_API ~TypeList(); - SDO_API const Type& operator[] (int pos) const; - SDO_API int size () const; + SDO_API const Type& operator[] (unsigned int pos) const; + SDO_API unsigned int size () const; SDO_API void insert (const Type* t); }; }; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/XMLHelper.h?r1=1.7&r2=1.8&diff_format=u Index: pecl/sdo/commonj/sdo/XMLHelper.h diff -u pecl/sdo/commonj/sdo/XMLHelper.h:1.7 pecl/sdo/commonj/sdo/XMLHelper.h:1.8 --- pecl/sdo/commonj/sdo/XMLHelper.h:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/XMLHelper.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _XMLHELPER_H_ #define _XMLHELPER_H_ @@ -166,7 +166,7 @@ * may be errors to report or handle. */ - virtual int getErrorCount() const = 0; + virtual unsigned int getErrorCount() const = 0; /** getErrorMessage gets the nth error message * @@ -174,7 +174,7 @@ * in which the parser error occurred. */ - virtual const char* getErrorMessage(int errnum) const = 0; + virtual const char* getErrorMessage(unsigned int errnum) const = 0; }; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/XMLHelperImpl.cpp?r1=1.7&r2=1.8&diff_format=u Index: pecl/sdo/commonj/sdo/XMLHelperImpl.cpp diff -u pecl/sdo/commonj/sdo/XMLHelperImpl.cpp:1.7 pecl/sdo/commonj/sdo/XMLHelperImpl.cpp:1.8 --- pecl/sdo/commonj/sdo/XMLHelperImpl.cpp:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/XMLHelperImpl.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/SDOXMLFileWriter.h" // Include first to avoid libxml compile problems! #include "commonj/sdo/SDOXMLStreamWriter.h" // Include first to avoid libxml compile problems! @@ -134,7 +134,7 @@ } const TypeList& tl = df->getTypes(); - for (int i = 0; i < tl.size(); i++) + for (unsigned int i = 0; i < tl.size(); i++) { if (!strcmp("RootType", tl[i].getName())) { @@ -448,13 +448,13 @@ indent); } - int XMLHelperImpl::getErrorCount() const + unsigned int XMLHelperImpl::getErrorCount() const { return parseErrors.size(); } - const char* XMLHelperImpl::getErrorMessage(int errnum) const + const char* XMLHelperImpl::getErrorMessage(unsigned int errnum) const { if (errnum >= 0 && errnum < parseErrors.size()) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/XMLHelperImpl.h?r1=1.7&r2=1.8&diff_format=u Index: pecl/sdo/commonj/sdo/XMLHelperImpl.h diff -u pecl/sdo/commonj/sdo/XMLHelperImpl.h:1.7 pecl/sdo/commonj/sdo/XMLHelperImpl.h:1.8 --- pecl/sdo/commonj/sdo/XMLHelperImpl.h:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/XMLHelperImpl.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _XMLHELPERIMPL_H_ #define _XMLHELPERIMPL_H_ @@ -54,8 +54,8 @@ // Destructor virtual ~XMLHelperImpl(); - virtual int getErrorCount() const; - virtual const char* getErrorMessage(int errnum) const; + virtual unsigned int getErrorCount() const; + virtual const char* getErrorMessage(unsigned int errnum) const; virtual void setError(const char* error); http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/XSDHelper.h?r1=1.7&r2=1.8&diff_format=u Index: pecl/sdo/commonj/sdo/XSDHelper.h diff -u pecl/sdo/commonj/sdo/XSDHelper.h:1.7 pecl/sdo/commonj/sdo/XSDHelper.h:1.8 --- pecl/sdo/commonj/sdo/XSDHelper.h:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/XSDHelper.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _XSDHELPER_H_ #define _XSDHELPER_H_ @@ -122,7 +122,7 @@ * may be errors to report or handle. */ - virtual int getErrorCount() const = 0; + virtual unsigned int getErrorCount() const = 0; /** getErrorMessage gets the nth error message * @@ -130,7 +130,7 @@ * in which the parser error occurred. */ - virtual const char* getErrorMessage(int errnum) const = 0; + virtual const char* getErrorMessage(unsigned int errnum) const = 0; /** * http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/XSDHelperImpl.cpp?r1=1.8&r2=1.9&diff_format=u Index: pecl/sdo/commonj/sdo/XSDHelperImpl.cpp diff -u pecl/sdo/commonj/sdo/XSDHelperImpl.cpp:1.8 pecl/sdo/commonj/sdo/XSDHelperImpl.cpp:1.9 --- pecl/sdo/commonj/sdo/XSDHelperImpl.cpp:1.8 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/XSDHelperImpl.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/SDOXMLFileWriter.h" // Include first to avoid libxml compile problems! #include "commonj/sdo/SDOXMLStreamWriter.h" // Include first to avoid libxml compile problems! @@ -141,7 +141,7 @@ prop.typeUri : prop.substituteUri; const Type& rootType = dataFactory->getType(typeUri, entryName); PropertyList pl = rootType.getProperties(); - for (int j = 0; j < pl.size(); j++) + for (unsigned int j = 0; j < pl.size(); j++) { if (!pl[j].getType().isDataType() && strcmp(pl[j].getType().getURI(),Type::SDOTypeNamespaceURI.c_str())) @@ -188,7 +188,7 @@ const Type* rootType = df->findType(typeUri,"RootType"); if (rootType == 0) return; PropertyList pl = rootType->getProperties(); - for (int j = 0; j < pl.size(); j++) + for (unsigned int j = 0; j < pl.size(); j++) { XSDPropertyInfo* pi = (XSDPropertyInfo*) ((DASProperty*)&pl[j])->getDASValue("XMLDAS::PropertyInfo"); @@ -342,7 +342,7 @@ (const char*)ty.name, (const char*)ty.parentTypeUri, (const char*)ty.parentTypeName, - (const char*)ty.isRestriction); + ty.isRestriction); } catch (SDORuntimeException& e) { @@ -395,7 +395,7 @@ const Type& rootType = dataFactory->getType(prop.typeUri, "RootType"); PropertyList pl = rootType.getProperties(); - for (int j = 0; j < pl.size(); j++) + for (unsigned int j = 0; j < pl.size(); j++) { XSDPropertyInfo* pi = (XSDPropertyInfo*) @@ -444,9 +444,9 @@ (const char*)prop.name, (const char*)prop.typeUri, (const char*)prop.typeName, - (const char*)prop.isMany, - (const char*)prop.isReadOnly, - (const char*)prop.isContainment); + prop.isMany, + prop.isReadOnly, + prop.isContainment); LOGINFO_1(INFO,"XSDHelper adds property %s",(const char*)(prop.name)); @@ -611,13 +611,13 @@ return retString; } - int XSDHelperImpl::getErrorCount() const + unsigned int XSDHelperImpl::getErrorCount() const { return parseErrors.size(); } - const char* XSDHelperImpl::getErrorMessage(int errnum) const + const char* XSDHelperImpl::getErrorMessage(unsigned int errnum) const { if (errnum >= 0 && errnum < parseErrors.size()) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/XSDHelperImpl.h?r1=1.7&r2=1.8&diff_format=u Index: pecl/sdo/commonj/sdo/XSDHelperImpl.h diff -u pecl/sdo/commonj/sdo/XSDHelperImpl.h:1.7 pecl/sdo/commonj/sdo/XSDHelperImpl.h:1.8 --- pecl/sdo/commonj/sdo/XSDHelperImpl.h:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/XSDHelperImpl.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _XSDHELPERIMPL_H_ #define _XSDHELPERIMPL_H_ @@ -77,7 +77,7 @@ * may be errors to report or handle. */ - virtual int getErrorCount() const; + virtual unsigned int getErrorCount() const; /** getErrorMessage gets the nth error message * @@ -85,7 +85,7 @@ * in which the parser error occurred. */ - virtual const char* getErrorMessage(int errnum) const; + virtual const char* getErrorMessage(unsigned int errnum) const; virtual void setError(const char* error); /** generate buildsXSD from types/properties
http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/ChangeSummaryBuilder.cpp?r1=1.6&r2=1.7&diff_format=u Index: pecl/sdo/commonj/sdo/ChangeSummaryBuilder.cpp diff -u pecl/sdo/commonj/sdo/ChangeSummaryBuilder.cpp:1.6 pecl/sdo/commonj/sdo/ChangeSummaryBuilder.cpp:1.7 --- pecl/sdo/commonj/sdo/ChangeSummaryBuilder.cpp:1.6 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/ChangeSummaryBuilder.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/ChangeSummaryBuilder.h" @@ -95,7 +95,7 @@ if ((*elementsiter).isDeletion) { - for (int i = 0; i < deletions.size(); i++) + for (unsigned int i = 0; i < deletions.size(); i++) { if (value.equals (deletions[i].reference)) { @@ -249,7 +249,7 @@ } // it could be a deletion which has not been processed yet - for (int i = 0; i < deletions.size(); i++) + for (unsigned int i = 0; i < deletions.size(); i++) { if (contpath.equals (deletions[i].reference)) { @@ -302,7 +302,7 @@ SDOXMLString refstring = createDeletes[index].value.substring(0,pos); pos = atoi((const char*)(createDeletes[index].value.substring(pos+1))); - for (int k=index+1;k<createDeletes.size();k++) + for (unsigned int k=index+1;k<createDeletes.size();k++) { if (createDeletes[k].type.equals("create")) continue; @@ -329,7 +329,7 @@ { LOGENTRY(INFO,"CSBuilder:buildChangeSummary"); - int i; + unsigned int i; try { if (changeSummaryDO == 0) @@ -395,7 +395,7 @@ else { // its a deletion - match it. - for (int j = 0; j < deletions.size(); j++) + for (unsigned int j = 0; j < deletions.size(); j++) { if (deletions[j].completedprocessing)continue; @@ -421,7 +421,7 @@ std::list<changeAttribute>::iterator a; std::list<changeElement>::iterator e; - for (i = 0; i< changes.size(); i++) + for (unsigned i = 0; i< changes.size(); i++) { DataObjectPtr dob; if (changes[i].reference.isNull()) @@ -451,7 +451,7 @@ } else { - for (int j = 0; j < deletions.size(); j++) + for (unsigned int j = 0; j < deletions.size(); j++) { if ((*a).value.equals (deletions[j].reference)) { @@ -473,7 +473,7 @@ LOGINFO_1(INFO,"CSBuilder Change was a deletion of:%s", (const char*)((*e).path)); - for (int j = 0; j < deletions.size(); j++) + for (unsigned int j = 0; j < deletions.size(); j++) { if ((*e).path.equals (deletions[j].reference)) { @@ -635,7 +635,7 @@ if (currentLocation.size() > 0) { - for (int pi = 0; pi < currentLocation.size()-1; pi++) + for (unsigned int pi = 0; pi < currentLocation.size()-1; pi++) { curr_loc = curr_loc + currentLocation[pi]; curr_loc = curr_loc + "/"; @@ -674,7 +674,7 @@ bool isDelete = false; - for (int i = 0; i < createDeletes.size(); i++) + for (unsigned int i = 0; i < createDeletes.size(); i++) { if (createDeletes[i].type.equals("delete")) { @@ -768,7 +768,7 @@ SDOXMLString curr_loc = ""; if (currentLocation.size() > 0) { - for (int pi = 0; pi < currentLocation.size()-1; pi++) + for (unsigned int pi = 0; pi < currentLocation.size()-1; pi++) { curr_loc = curr_loc + currentLocation[pi]; curr_loc = curr_loc + "/"; @@ -783,7 +783,7 @@ // can we match the current path to a known deletion? bool isDelete = false; - for (int i = 0; i < createDeletes.size(); i++) + for (unsigned int i = 0; i < createDeletes.size(); i++) { if (createDeletes[i].type.equals("delete")) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/ChangeSummaryImpl.cpp?r1=1.8&r2=1.9&diff_format=u Index: pecl/sdo/commonj/sdo/ChangeSummaryImpl.cpp diff -u pecl/sdo/commonj/sdo/ChangeSummaryImpl.cpp:1.8 pecl/sdo/commonj/sdo/ChangeSummaryImpl.cpp:1.9 --- pecl/sdo/commonj/sdo/ChangeSummaryImpl.cpp:1.8 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/ChangeSummaryImpl.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/ChangeSummaryImpl.h" @@ -148,7 +148,7 @@ // find any properties which are data objects, log their // deletion first. - int i; + unsigned int i; // Trace for change summaries @@ -173,7 +173,7 @@ if (changeLogIter != changedMap.end()) { // would hope there was an entry - int index; + unsigned int index; if (prop.isMany()) { DataObjectList& dl = container->getList(prop); @@ -377,7 +377,7 @@ // need to be created too PropertyList pl = ob->getInstanceProperties(); - for (int p=0;p<pl.size();p++) + for (unsigned int p=0;p<pl.size();p++) { Property& thisprop = pl[p]; if (!thisprop.getType().isDataType()) @@ -389,7 +389,7 @@ if (thisprop.isMany()) { DataObjectList& dol = ob->getList(thisprop); - for (int ds = 0; ds < dol.size(); ds++) + for (unsigned int ds = 0; ds < dol.size(); ds++) { dp = dol[ds]; if (!dp) continue; @@ -837,7 +837,7 @@ slist.append(new Setting(false,false,0,0,prop,0)); return; } - for (int i=0;i< dol.size(); i++) + for (unsigned int i=0;i< dol.size(); i++) { DataObject* dob = dol[i]; if (prop.getType().isDataType()) { @@ -1275,7 +1275,7 @@ { char* vw = new char[(strlen(c)+1)*sizeof(wchar_t)]; wchar_t* pvw = (wchar_t*)vw; - for (int i=0;i< strlen(c);i++) + for (unsigned int i=0;i< strlen(c);i++) { pvw[i] = (wchar_t)c[i]; } @@ -1287,7 +1287,7 @@ case Type::BytesType: { char* vc = new char[strlen(c)+1]; - for (int i=0;i< strlen(c);i++) + for (unsigned int i=0;i< strlen(c);i++) { vc[i] = (char)c[i]; } http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/ChangedDataObjectList.h?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/ChangedDataObjectList.h diff -u pecl/sdo/commonj/sdo/ChangedDataObjectList.h:1.5 pecl/sdo/commonj/sdo/ChangedDataObjectList.h:1.6 --- pecl/sdo/commonj/sdo/ChangedDataObjectList.h:1.5 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/ChangedDataObjectList.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _CHANGEDDATAOBJECTLIST_H_ #define _CHANGEDDATAOBJECTLIST_H_ @@ -68,15 +68,15 @@ * * Gets the nth element of a list */ - virtual SDO_API DataObjectPtr operator[] (int pos) = 0; - virtual SDO_API const DataObjectPtr operator[] (int pos) const = 0; + virtual SDO_API DataObjectPtr operator[] (unsigned int pos) = 0; + virtual SDO_API const DataObjectPtr operator[] (unsigned int pos) const = 0; /** size() returns the number of list elements. * * Returns the number of list elements */ - virtual SDO_API int size () const = 0; + virtual SDO_API unsigned int size () const = 0; /** getType() returns the type of a list element. * http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.cpp?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.cpp diff -u pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.cpp:1.5 pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.cpp:1.6 --- pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.cpp:1.5 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/ChangedDataObjectListImpl.h" @@ -128,7 +128,7 @@ * */ - RefCountingPointer<DataObject> ChangedDataObjectListImpl::operator[] (int pos) + RefCountingPointer<DataObject> ChangedDataObjectListImpl::operator[] (unsigned int pos) { validateIndex(pos); return plist[pos].getObject(); @@ -139,7 +139,7 @@ * */ - const RefCountingPointer<DataObject> ChangedDataObjectListImpl::operator[] (int pos) const + const RefCountingPointer<DataObject> ChangedDataObjectListImpl::operator[] (unsigned int pos) const { validateIndex(pos); return plist[pos].getObject(); @@ -160,7 +160,7 @@ * */ - int ChangedDataObjectListImpl::size () const + unsigned int ChangedDataObjectListImpl::size () const { return plist.size(); } @@ -229,7 +229,7 @@ * checks that the index is in range. */ - void ChangedDataObjectListImpl::validateIndex(int index) const + void ChangedDataObjectListImpl::validateIndex(unsigned int index) const { if ((index < 0) || (index >= size())) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.h?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.h diff -u pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.h:1.5 pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.h:1.6 --- pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.h:1.5 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _ChangedDataObjectListImplIMPL_H_ #define _ChangedDataObjectListImplIMPL_H_ @@ -71,13 +71,13 @@ ChangedDataObjectListImpl(); virtual ~ChangedDataObjectListImpl(); - virtual DataObjectPtr operator[] (int pos); - virtual const DataObjectPtr operator[] (int pos) const; + virtual DataObjectPtr operator[] (unsigned int pos); + virtual const DataObjectPtr operator[] (unsigned int pos) const; virtual DataObject* get(unsigned int pos); virtual ChangedDataObjectList::ChangeType getType(unsigned int pos); - virtual int size () const; + virtual unsigned int size () const; virtual void insert (unsigned int index, DataObject *d, ChangedDataObjectList::ChangeType type); @@ -92,7 +92,7 @@ CHANGEDDATAOBJECT_VECTOR plist; CHANGEDDATAOBJECT_VECTOR getVec() const; - void validateIndex(int index) const; + void validateIndex(unsigned int index) const; }; }; }; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/CopyHelper.cpp?r1=1.7&r2=1.8&diff_format=u Index: pecl/sdo/commonj/sdo/CopyHelper.cpp diff -u pecl/sdo/commonj/sdo/CopyHelper.cpp:1.7 pecl/sdo/commonj/sdo/CopyHelper.cpp:1.8 --- pecl/sdo/commonj/sdo/CopyHelper.cpp:1.7 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/CopyHelper.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483011 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/Property.h" #include "commonj/sdo/Type.h" @@ -29,6 +29,8 @@ #include "commonj/sdo/CopyHelper.h" +#include <iostream> +using namespace std; namespace commonj{ namespace sdo{ @@ -105,7 +107,7 @@ void CopyHelper::transferlist(DataObjectList& to, DataObjectList& from, Type::Types t) { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { switch (t) { @@ -177,6 +179,71 @@ } // for } // method + + + void CopyHelper::transfersequenceitem(Sequence *to, Sequence *from, const Property& p, int index) + { + switch (p.getTypeEnum()) + { + case Type::BooleanType: + to->addBoolean( p, from->getBooleanValue(index)); + break; + case Type::ByteType: + to->addByte( p, from->getByteValue(index)); + break; + case Type::CharacterType: + to->addCharacter( p, from->getCharacterValue(index)); + break; + case Type::IntegerType: + to->addInteger( p, from->getIntegerValue(index)); + break; + case Type::ShortType: + to->addShort( p,from->getShortValue(index)); + break; + case Type::DoubleType: + to->addDouble( p, from->getDoubleValue(index)); + break; + case Type::FloatType: + to->addFloat( p, from->getFloatValue(index)); + break; + case Type::LongType: + to->addLong( p, from->getLongValue(index)); + break; + case Type::DateType: + to->addDate( p, from->getDateValue(index)); + break; + case Type::BigDecimalType: + case Type::BigIntegerType: + case Type::UriType: + case Type::StringType: + { + unsigned int siz = from->getLength(index); + if (siz > 0) + { + wchar_t * buf = new wchar_t[siz]; + from->getStringValue(index, buf, siz); + to->addString(p, buf, siz); + delete buf; + } + } + break; + case Type::BytesType: + { + unsigned int siz = from->getLength(index); + if (siz > 0) + { + char * buf = new char[siz]; + from->getBytesValue(index, buf, siz); + to->addBytes(p, buf, siz); + delete buf; + } + } + break; + default: + break; + } // switch + } + /** CopyHelper provides static copying helper functions. * * copyShallow() copies the DataType members of the data object. @@ -197,7 +264,9 @@ */ DataObjectPtr CopyHelper::copy(DataObjectPtr dataObject) { - return internalCopy(dataObject, true); + DataObjectPtr newob = internalCopy(dataObject, true); + resolveReferences(dataObject, newob); + return newob; } DataObjectPtr CopyHelper::internalCopy(DataObjectPtr dataObject, @@ -212,54 +281,273 @@ DataObjectPtr newob = fac->create(t); if (!newob) return 0; - PropertyList pl = dataObject->getInstanceProperties(); - for (int i=0;i < pl.size(); i++) + if ( dataObject->getType().isSequencedType() ) + { + Sequence* fromSequence = dataObject->getSequence(); + int sequence_length = fromSequence->size(); + + Sequence* toSequence = newob->getSequence(); + + for (int i=0;i < sequence_length; i++) + { + if ( fromSequence->isText(i) ) + { + const char *text = fromSequence->getCStringValue(i); + toSequence->addText(i, text); + } + else + { + const Property& seqProperty = fromSequence->getProperty(i); + SDOXMLString seqPropertyName = seqProperty.getName(); + const Type& seqPropertyType = seqProperty.getType(); + + if (seqPropertyType.isDataObjectType()) + { + if (!fullCopy) + { + continue; + } + else + { + DataObjectPtr dob; + + // retrieve the data object to be copied + if (seqProperty.isMany()) + { + int index = fromSequence->getListIndex(i); + dob = dataObject->getList(seqProperty)[index]; + } + else + { + dob = dataObject->getDataObject(seqProperty); + } + + // do the copying of referencing + if (dob) + { + // Handle non-containment reference to DataObject + if (seqProperty.isReference()) + { + // add just the reference into the sequence + // This will be resolved to a new reference later + // This is really bad but we need to add something to the + // sequence here to maintain the ordering + toSequence->addDataObject(seqProperty, 0); + } + else + { + // make a copy of the data object itself + // and add it to the sequence + toSequence->addDataObject(seqProperty, + internalCopy(dob, + true)); + } + } + } + } + else + { + // Sequence member is a primitive + transfersequenceitem(toSequence, + fromSequence, + seqProperty, + i); + + } + } // is it a text element + } // for all elements in sequence + } + else { - if (dataObject->isSet(pl[i])) + PropertyList pl = dataObject->getInstanceProperties(); + for (unsigned int i=0;i < pl.size(); i++) { - // data objects are only copied in the deep copy case - if (pl[i].getType().isDataObjectType()) + if (dataObject->isSet(pl[i])) { - if (!fullCopy) + // data objects are only copied in the deep copy case + if (pl[i].getType().isDataObjectType()) { - continue; + if (!fullCopy) + { + continue; + } + else + { + if (pl[i].isMany()) + { + DataObjectList& dolold = dataObject->getList(pl[i]); + DataObjectList& dolnew = newob->getList(pl[i]); + for (unsigned int li=0;li< dolold.size(); li++) + { + // references are maintained to the old object if it + // is outside of the copy tree + if (pl[i].isReference()) + { + // have to resolve references in a 2nd pass + } + else + { + dolnew.append(internalCopy(dolold[li],true)); + } + } + } + else + { + DataObjectPtr dob = dataObject->getDataObject(pl[i]); + if (pl[i].isReference()) + { + // have to resolve references in a 2nd pass + } + else + { + newob->setDataObject(pl[i],internalCopy(dob,true)); + } + } + } } - else + else { if (pl[i].isMany()) { DataObjectList& dolold = dataObject->getList(pl[i]); DataObjectList& dolnew = newob->getList(pl[i]); - for (int i=0;i< dolold.size(); i++) + transferlist(dolnew,dolold, pl[i].getTypeEnum()); + } + else + { + transferitem(newob,dataObject, pl[i]); + } + } // else + } + } + } + + return newob; + } + + void CopyHelper::resolveReferences(DataObjectPtr oldDO, DataObjectPtr newDO) + { + // Iterate through the properties to find references. + // If the reference is to a DataObject with the copied tree then we can + // set it to reference the DO in the new tree, otherwise it is left unset. + + findReferences(oldDO, newDO, oldDO, newDO); + + } + + void CopyHelper::findReferences(DataObjectPtr oldDO, DataObjectPtr newDO, + DataObjectPtr obj, DataObjectPtr newObj) + { + if ( obj->getType().isSequencedType() ) + { + Sequence* fromSequence = obj->getSequence(); + int sequence_length = fromSequence->size(); + + Sequence* toSequence = newObj->getSequence(); + + for (int i=0;i < sequence_length; i++) + { + if (!fromSequence->isText(i) ) + { + const Property& seqProperty = fromSequence->getProperty(i); + SDOXMLString seqPropertyName = seqProperty.getName(); + const Type& seqPropertyType = seqProperty.getType(); + + if (seqProperty.isReference()) + { + DataObjectPtr ref = findReference(oldDO, newDO, fromSequence->getDataObjectValue(i)); + if (ref) + { + if (seqProperty.isMany()) { - dolnew.append(internalCopy(dolold[i],true)); + int index = fromSequence->getListIndex(i); + newObj->getList(seqProperty).setDataObject(index, ref); } + else + { + toSequence->setDataObjectValue(i, ref); + } + } - else + } + else if (seqPropertyType.isDataObjectType()) + { + findReferences(oldDO, newDO, fromSequence->getDataObjectValue(i), toSequence->getDataObjectValue(i)); + } + } + + } // for all elements in sequence + + } + else + { + PropertyList pl = obj->getInstanceProperties(); + for (unsigned int i=0;i < pl.size(); i++) + { + if (!obj->isSet(pl[i])) + continue; + + if (!pl[i].getType().isDataObjectType()) + continue; + + if (pl[i].isMany()) + { + DataObjectList& dolold = obj->getList(pl[i]); + DataObjectList& dolnew = newObj->getList(pl[i]); + for (unsigned int li=0;li< dolold.size(); li++) + { + if (pl[i].isReference()) + { + DataObjectPtr ref = findReference(oldDO, newDO, dolold[li]); + if (ref) + { + dolnew.setDataObject(li, ref); + } + } + else { - DataObjectPtr dob = dataObject->getDataObject(pl[i]); - newob->setDataObject(pl[i],internalCopy(dob,true)); + findReferences(oldDO, newDO, dolold[li], dolnew[li]); } } } else { - if (pl[i].isMany()) + if (pl[i].isReference()) { - DataObjectList& dolold = dataObject->getList(pl[i]); - DataObjectList& dolnew = newob->getList(pl[i]); - transferlist(dolnew,dolold, pl[i].getTypeEnum()); + DataObjectPtr ref = findReference(oldDO, newDO, obj->getDataObject(pl[i])); + if (ref) + { + newObj->setDataObject(pl[i], ref); + } } - else + else { - transferitem(newob,dataObject, pl[i]); + findReferences(oldDO, newDO, obj->getDataObject(pl[i]), newObj->getDataObject(pl[i])); } - } // else - } - } - return newob; + } + } + } + } + + DataObjectPtr CopyHelper::findReference(DataObjectPtr oldDO, DataObjectPtr newDO, DataObjectPtr ref) + { + SDOString rootXPath = oldDO->objectToXPath(); + SDOString refXPath = ref->objectToXPath(); + + DataObjectPtr newRef; + if (refXPath.find(refXPath) == 0) + { + SDOString relXPath = refXPath.substr(rootXPath.length()); + if (relXPath == "") + newRef = newDO; + if (relXPath.find("/") == 0) + relXPath = relXPath.substr(1); + newRef = newDO->getDataObject(relXPath); + } + + return newRef; } - + } }; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/CopyHelper.h?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/CopyHelper.h diff -u pecl/sdo/commonj/sdo/CopyHelper.h:1.5 pecl/sdo/commonj/sdo/CopyHelper.h:1.6 --- pecl/sdo/commonj/sdo/CopyHelper.h:1.5 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/CopyHelper.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483011 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _COPYHELPER_H_ #define _COPYHELPER_H_ @@ -62,7 +62,12 @@ private: static void transferlist(DataObjectList& to, DataObjectList& from, Type::Types t); static void transferitem(DataObjectPtr to, DataObjectPtr from, const Property& p); + static void transfersequenceitem(Sequence *to, Sequence *from, const Property& p, int index); + static DataObjectPtr internalCopy(DataObjectPtr dataObject, bool fullCopy); + static void resolveReferences(DataObjectPtr oldDO, DataObjectPtr newDO); + static void findReferences(DataObjectPtr oldDO, DataObjectPtr newDO, DataObjectPtr obj, DataObjectPtr newObj); + static DataObjectPtr findReference(DataObjectPtr oldDO, DataObjectPtr newDO, DataObjectPtr ref); }; }; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataFactoryImpl.cpp?r1=1.13&r2=1.14&diff_format=u Index: pecl/sdo/commonj/sdo/DataFactoryImpl.cpp diff -u pecl/sdo/commonj/sdo/DataFactoryImpl.cpp:1.13 pecl/sdo/commonj/sdo/DataFactoryImpl.cpp:1.14 --- pecl/sdo/commonj/sdo/DataFactoryImpl.cpp:1.13 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataFactoryImpl.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 472054 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483416 $ $Date: 2006/12/07 12:38:33 $ */ ////////////////////////////////////////////////////////////////////// // DataFactoryImpl.cpp: implementation of the DataFactory class. @@ -98,7 +98,7 @@ } } - rootElementName.erase(); + rootElementName.erase(); } @@ -166,7 +166,7 @@ if ((typeIter->second)->getAliasCount() > 0) { - for (int j=0;j<(typeIter->second)->getAliasCount();j++) + for (unsigned int j=0;j<(typeIter->second)->getAliasCount();j++) { (typeIter2->second)->setAlias( (typeIter->second)->getAlias()); @@ -176,7 +176,7 @@ // Now add all the properties PropertyList props = typeIter->second->getProperties(); - for (int i=0; i < props.size(); i++) + for (unsigned int i=0; i < props.size(); i++) { // Ensure the properties type is added const Type& propType = props[i].getType(); @@ -200,7 +200,7 @@ getPropertyImpl(props[i].getName()); if (p != 0) { - for (int j=0;j<p->getAliasCount();j++) + for (unsigned int j=0;j<p->getAliasCount();j++) { p->setAlias(props[i].getAlias(j)); } @@ -267,7 +267,7 @@ bool isData, bool isFromList) { - addType(uri.c_str(), inTypeName.c_str(), isSeq, isOp, isAbs, isData, isFromList); + addType(uri.c_str(), inTypeName.c_str(), isSeq, isOp, isAbs, isData, isFromList); } // =================================================================== @@ -286,7 +286,7 @@ PropertyList pl = cs->getProperties(); - for (int i=0 ; i < pl.size() ; i++ ) + for (unsigned int i=0 ; i < pl.size() ; i++ ) { if (recursiveCheck((TypeImpl*)&(pl[i].getType()), t)) return true; } @@ -309,7 +309,7 @@ } if (cstypes.size() > 0) { - for (int i = 0 ;i < cstypes.size(); i++) + for (unsigned int i = 0 ;i < cstypes.size(); i++) { if (recursiveCheck(cstypes[i], t)) { @@ -724,7 +724,7 @@ const Type& DataFactoryImpl::getType(const SDOString& uri, const SDOString& inTypeName) const { - return getType(uri.c_str(), inTypeName.c_str()); + return getType(uri.c_str(), inTypeName.c_str()); } // =================================================================== @@ -778,16 +778,16 @@ } void DataFactoryImpl::setBaseType(const SDOString& typeuri, - const SDOString& typenam, - const SDOString& baseuri, - const SDOString& basename, - bool isRestriction) -{ - setBaseType(typeuri.c_str(), - typenam.c_str(), - baseuri.c_str(), - basename.c_str(), - isRestriction); + const SDOString& typenam, + const SDOString& baseuri, + const SDOString& basename, + bool isRestriction) +{ + setBaseType(typeuri.c_str(), + typenam.c_str(), + baseuri.c_str(), + basename.c_str(), + isRestriction); } @@ -1302,7 +1302,7 @@ const SDOString& typenam, const SDOString& alias) { - setAlias(typeuri.c_str(), typenam.c_str(), alias.c_str()); + setAlias(typeuri.c_str(), typenam.c_str(), alias.c_str()); } // =================================================================== @@ -1325,7 +1325,7 @@ const SDOString& propname, const SDOString& alias) { - setAlias(typeuri.c_str(), typenam.c_str(), propname.c_str(), alias.c_str()); + setAlias(typeuri.c_str(), typenam.c_str(), propname.c_str(), alias.c_str()); } // =================================================================== @@ -1651,67 +1651,6 @@ return getDASValue(typeuri.c_str(), typenam.c_str(), propertyName.c_str(), name.c_str()); } -bool DataFactoryImpl::compareTypes(const TypeImpl* t1, const Type& t2) -{ - PropertyList pl = t2.getProperties(); - for (int i=0;i<pl.size();i++) - { - PropertyImpl* p = t1->getPropertyImpl(i); - if (p == 0) return false; - if (p->isMany() != pl[i].isMany()) return false; - if (p->isContainment() != pl[i].isContainment()) return false; - if (strcmp( p->getType().getURI(), - pl[i].getType().getURI())) return false; - if (strcmp( p->getType().getName(), - pl[i].getType().getName())) return false; - } - return true; - -} -bool DataFactoryImpl::checkType(const Type& t) -{ - const TypeImpl* t2 = findTypeImpl(t.getURI(), - t.getName()); - - if (t2 == 0) return false; - - if (!compareTypes(t2,t)) return false; - - PropertyList pl = t.getProperties(); - for (int i=0;i<pl.size();i++) - { - if (pl[i].getType().isDataObjectType()) - { - if (!checkType(pl[i].getType())) return false; - } - } - return true; -} - - -// only checks the tree dirctly descended from this object if the -// object is specified, otherwise validates the whole factory - -bool DataFactoryImpl::isCompatible(DataFactory* df, DataObject* d) -{ - if (d == 0) - { - TypeList tl = df->getTypes(); - for (int j=0;j<tl.size();j++) - { - const TypeImpl* t = findTypeImpl(tl[j].getURI(), - tl[j].getName()); - - if (t == 0) return false; - if (!compareTypes(t,tl[j]))return false; - } - return true; - } - else - { - return checkType(d->getType()); - } -} bool DataFactoryImpl::generateInterface(const char* fileroot, const char* factoryname) { @@ -1776,7 +1715,7 @@ fprintf(header," * Forward declarations and smart pointers *\n"); fprintf(header," *******************************************/\n\n\n"); - int i; + unsigned int i; for (i=0;i<tl.size();i++) { nscount = 0; @@ -1846,7 +1785,7 @@ { the_uri = new char[2 * strlen(uri) + 1]; int jj=0; - for (int ii=0;ii<strlen(uri);ii++) + for (unsigned int ii=0;ii<strlen(uri);ii++) { if (uri[ii] == '.') { @@ -1949,7 +1888,7 @@ PropertyList pl = tl[i].getProperties(); - for (int j=0;j<pl.size();j++) + for (unsigned int j=0;j<pl.size();j++) { const char* pname = pl[j].getName(); @@ -2176,7 +2115,7 @@ bool DataFactoryImpl::generateInterface(const SDOString& fileroot, const SDOString& factoryname) { - return generateInterface(fileroot.c_str(), factoryname.c_str()); + return generateInterface(fileroot.c_str(), factoryname.c_str()); } std::ostream& DataFactoryImpl::printSelf(std::ostream &os) http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataFactoryImpl.h?r1=1.9&r2=1.10&diff_format=u Index: pecl/sdo/commonj/sdo/DataFactoryImpl.h diff -u pecl/sdo/commonj/sdo/DataFactoryImpl.h:1.9 pecl/sdo/commonj/sdo/DataFactoryImpl.h:1.10 --- pecl/sdo/commonj/sdo/DataFactoryImpl.h:1.9 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataFactoryImpl.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 472054 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483416 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _DataFactoryIMPL_H_ #define _DataFactoryIMPL_H_ @@ -663,9 +663,6 @@ virtual const TypeImpl& getTypeImpl(const SDOString& uri, const SDOString& inTypeName) const; virtual const SDOString& getRootElementName() const; 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); http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataObjectImpl.cpp?r1=1.14&r2=1.15&diff_format=u Index: pecl/sdo/commonj/sdo/DataObjectImpl.cpp diff -u pecl/sdo/commonj/sdo/DataObjectImpl.cpp:1.14 pecl/sdo/commonj/sdo/DataObjectImpl.cpp:1.15 --- pecl/sdo/commonj/sdo/DataObjectImpl.cpp:1.14 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataObjectImpl.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 478191 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483416 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/disable_warn.h" #include "commonj/sdo/DataObjectImpl.h" @@ -944,8 +944,9 @@ void DataObjectImpl::undefineProperty(unsigned int index) { - int point = index - openBase; - if (point < 0 || point >= openProperties.size()) return; + if (index < openBase) return; + unsigned int point = index - openBase; + if (point >= openProperties.size()) return; // downgrade all the property settings above this one @@ -967,7 +968,7 @@ std::list<PropertyImpl>::iterator it = openProperties.begin(); - for (int i=0;i<point;i++)++it; /* there must be a better way */ + for (unsigned int i=0;i<point;i++)++it; /* there must be a better way */ DataFactory* df = factory; ((DataFactoryImpl*)df)->removeOpenProperty((*it).getName()); @@ -1510,7 +1511,7 @@ } } - int propIndex = getPropertyIndex(p); + int propIndex = getPropertyIndexInternal(p); DataObjectImpl* d = getDataObjectImpl(propIndex); if (d == 0) { // There is no list yet, so we need to create an @@ -1563,7 +1564,7 @@ { PropertyList props = getType().getProperties(); - for (int i = 0; i < props.size() ; ++i) + for (unsigned int i = 0; i < props.size() ; ++i) { if (!strcmp(props[i].getName(),p.getName()) ) { @@ -1591,43 +1592,56 @@ } /** - * This method is used internally to find the index of a - * property. If differs from the public getPropertyIndex method - * in that if the type of the containing object is open a new - * index is created. In the public version and error is thrown - */ + * This method is used internally to find the index of a + * property. If differs from the public getPropertyIndex method + * in that if the type of the containing object is open a new + * index is created. In the public version and error is thrown + */ unsigned int DataObjectImpl::getPropertyIndexInternal(const Property& p) { - unsigned int index; + unsigned int index; - try - { + try + { index = getPropertyIndex(p); - } - catch ( SDOPropertyNotFoundException e ) - { - // this could mean that this data object has an open - // type. getPropertyIndex fails in this case because it - // tries to access the index of the property - // and it doesn't exist because it hasn't been created yet. - // This new method is used where properties are being set - // based on existing property objects. This is like to - // occur when a data object is being copied. In this case - // we want properties that are open to be copied also - // so we need to create the property and provide the index - if ( this->getType().isOpenType() ) - { - const Property *prop = defineProperty(p.getName(), p.getType()); - index = getPropertyIndex(p); - } - else - { - throw e; - } - } + } + catch ( SDOPropertyNotFoundException e ) + { + // this could mean that this data object has an open + // type. getPropertyIndex fails in this case because it + // tries to access the index of the property + // and it doesn't exist because it hasn't been created yet. + // This new method is used where properties are being set + // based on existing property objects. This is likely to + // occur when a data object is being copied. In this case + // we want properties that are open to be copied also + // so we need to create the property and provide the index + if ( this->getType().isOpenType() ) + { + const Property *prop = NULL; + + // need to treat many valued properties specially + // because the property is a list rather than + // a single value + if ( p.isMany() ) + { + prop = defineList(p.getName()); + } + else + { + prop = defineProperty(p.getName(), p.getType()); + } + + index = getPropertyIndex(p); + } + else + { + throw e; + } + } - return index; - } + return index; + } const Property& DataObjectImpl::getProperty(unsigned int index) @@ -1672,7 +1686,7 @@ if (index >= openBase && index - openBase < openProperties.size()) { std::list<PropertyImpl>::iterator j; - int val = 0; + unsigned int val = 0; j = openProperties.begin(); while (val < index-openBase && j != openProperties.end()) { @@ -1703,7 +1717,7 @@ s = new char[strlen(path)+1]; - for (int i=0;i < strlen(path); i++) + for (unsigned int i=0;i < strlen(path); i++) { if (strchr(templateString,path[i]) != 0) { s[pos++] = path[i]; @@ -1783,7 +1797,7 @@ if (eq == string::npos) { // There is no "=" sign - int val = atoi(breakerStr.c_str()); + unsigned int val = atoi(breakerStr.c_str()); DataObjectList& list = getList(p); // The spec says that depts[1] is the first element, as is depts.0 @@ -1807,7 +1821,7 @@ // eq is now propval DataObjectList& list = getList(p); - for (int li = 0 ; li < list.size() ; ++li) + for (unsigned int li = 0 ; li < list.size() ; ++li) { // TODO comparison for double not ok @@ -2064,7 +2078,7 @@ { std::vector<PropertyImpl*> theVec; PropertyList propList = getType().getProperties(); - for (int i = 0 ; i < propList.size() ; ++i) + for (unsigned int i = 0 ; i < propList.size() ; ++i) { Property& p = propList[i]; theVec.insert(theVec.end(),(PropertyImpl*)&p); @@ -2263,13 +2277,16 @@ if (p->isMany()) { DataObjectList& dol = d->getList((Property&)*p); - long index; - DataObjectImpl* dx = d->findDataObject(prop,&index); + long idx; + DataObjectImpl* dx = d->findDataObject(prop,&idx); + // fix this. This is the only place the 2nd parm to findDataObject + // is used. Need a better way to do this + unsigned int index = (unsigned int)idx; if (index >= 0) { if(index < dol.size()) { - dol.setDataObject((unsigned int)index,value); + dol.setDataObject(index,value); } else { @@ -2319,48 +2336,6 @@ } } - void DataObjectImpl::transferChildren(DataObject* d, DataFactory* f) - { - bool isData = false; - PropertyList pl = d->getInstanceProperties(); - for (int i=0;i<pl.size();i++) - { - // even primitives need their DF fixed up - if (pl[i].getType().isDataType()) - { - isData = true; - } - - if (!d->isSet(pl[i]) || d->isNull(pl[i])) - { - continue; - } - if (pl[i].isMany()) - { - DataObjectList& dl = d->getList(pl[i]); - for (int j=0;j<dl.size();j++) - { - - DataObject* d2 = dl[j]; - if (d2) { - ((DataObjectImpl*)d2)->setDataFactory(f); - if (!isData)transferChildren(d2,f); - } - } - } - else - { - DataObject* d3 = d->getDataObject(pl[i]); - if (d3) - { - ((DataObjectImpl*)d3)->setDataFactory(f); - if (!isData)transferChildren(d3,f); - } - } - } - } - - void DataObjectImpl::checkFactory(DataObjectPtr dob, unsigned int propertyIndex) @@ -2370,13 +2345,6 @@ if (d->getDataFactory() == getDataFactory()) return; - // Temporary alteration to test the feasibility and - // problems associated with allowing data object 'migration' - // lets move this one and all its children to the factory of the - // new parent if the factories are compatible. - - DataFactoryImpl* f = (DataFactoryImpl*)getDataFactory(); - if (d->getContainer() != 0) { string msg("Insertion of object from another factory is only allowed if the parent is null: "); @@ -2394,29 +2362,6 @@ msg.c_str()); } - if (f->isCompatible(d->getDataFactory(),d)) - { - d->setDataFactory(getDataFactory()); - transferChildren(d,getDataFactory()); - return; - } - - - // This is the default position.... - - string msg("Insertion from incompatible factory "); - const Type& t = d->getType(); - msg += t.getURI(); - msg += "#"; - msg += t.getName(); - msg += " into property "; - msg += getProperty(propertyIndex).getName(); - msg += " of "; - msg += getType().getURI(); - msg += "#"; - msg += getType().getName(); - SDO_THROW_EXCEPTION("checkFactory", SDOInvalidConversionException, - msg.c_str()); } @@ -2445,7 +2390,7 @@ if (pi != 0) { unsigned int subcount = pi->getSubstitutionCount(); - for (int i=0;i<subcount;i++) + for (unsigned int i=0;i<subcount;i++) { const Type* tsub = pi->getSubstitutionType(i); if (tsub != 0 && tsub->equals(objectType)) return; @@ -3116,7 +3061,7 @@ if (prop.isMany()) { DataObjectList& dol = ((*i).second)->getList(); - for (int j=0;j< dol.size(); j++) + for (unsigned int j=0;j< dol.size(); j++) { if (dol[j] == indol) { @@ -3192,7 +3137,7 @@ if (getProperty((*i).first).isMany()) { DataObjectList& dl = ((*i).second)->getList(); - for (int j = 0 ; j < dl.size(); j++) + for (unsigned int j = 0 ; j < dl.size(); j++) { if (dl[j] == ob) { @@ -3748,7 +3693,7 @@ { LOGINFO_1(INFO,"ChangeSummary:Unsetting a reference to %s",prop.getName()); - for (int i=0;i< refs.size();i++) + for (unsigned int i=0;i< refs.size();i++) { if (refs[i]->getDataObject() == dol) { @@ -3765,7 +3710,7 @@ void DataObjectImpl::clearReferences() { - for (int i=0;i<refs.size();i++) + for (unsigned int i=0;i<refs.size();i++) { // Note - no loop as the referer must be of type reference refs[i]->getDataObject()->unset(refs[i]->getProperty()); @@ -3789,7 +3734,7 @@ if (p.isMany()) { DataObjectList& dol = dob->getList(p); - for (int i=0;i<dol.size();i++) + for (unsigned int i=0;i<dol.size();i++) { if (dol[i] == thisob) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataObjectImpl.h?r1=1.12&r2=1.13&diff_format=u Index: pecl/sdo/commonj/sdo/DataObjectImpl.h diff -u pecl/sdo/commonj/sdo/DataObjectImpl.h:1.12 pecl/sdo/commonj/sdo/DataObjectImpl.h:1.13 --- pecl/sdo/commonj/sdo/DataObjectImpl.h:1.12 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataObjectImpl.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 477820 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483416 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _DATAOBJECTIMPL_H_ #define _DATAOBJECTIMPL_H_ @@ -591,7 +591,6 @@ virtual const PropertyImpl* defineList(const char* propname); virtual void undefineProperty(unsigned int index); virtual const TypeImpl& getTypeImpl(); - virtual void transferChildren(DataObject* d, DataFactory* f); virtual void setDataFactory(DataFactory *df); virtual std::ostream& printSelf(std::ostream &os); @@ -662,7 +661,7 @@ // Support for open types - int openBase; + unsigned int openBase; std::list<PropertyImpl> openProperties; static const char* emptyString; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataObjectList.h?r1=1.7&r2=1.8&diff_format=u Index: pecl/sdo/commonj/sdo/DataObjectList.h diff -u pecl/sdo/commonj/sdo/DataObjectList.h:1.7 pecl/sdo/commonj/sdo/DataObjectList.h:1.8 --- pecl/sdo/commonj/sdo/DataObjectList.h:1.7 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataObjectList.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _DATAOBJECTLIST_H_ #define _DATAOBJECTLIST_H_ @@ -55,15 +55,15 @@ * with their correct type using the list getInteger(index) api. */ - virtual SDO_API DataObjectPtr operator[] (int pos) = 0; - virtual SDO_API const DataObjectPtr operator[] (int pos) const = 0; + virtual SDO_API DataObjectPtr operator[] (unsigned int pos) = 0; + virtual SDO_API const DataObjectPtr operator[] (unsigned int pos) const = 0; /** size returns the number of elements. * * The size method returns the number of elements in the list */ - virtual SDO_API int size () const = 0; + virtual SDO_API unsigned int size () const = 0; /** getBoolean returns a boolean at an index * http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataObjectListImpl.cpp?r1=1.11&r2=1.12&diff_format=u Index: pecl/sdo/commonj/sdo/DataObjectListImpl.cpp diff -u pecl/sdo/commonj/sdo/DataObjectListImpl.cpp:1.11 pecl/sdo/commonj/sdo/DataObjectListImpl.cpp:1.12 --- pecl/sdo/commonj/sdo/DataObjectListImpl.cpp:1.11 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataObjectListImpl.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483416 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/DataObjectListImpl.h" @@ -140,13 +140,13 @@ } } -RefCountingPointer<DataObject> DataObjectListImpl::operator[] (int pos) +RefCountingPointer<DataObject> DataObjectListImpl::operator[] (unsigned int pos) { validateIndex(pos); return plist[pos]; } -const RefCountingPointer<DataObject> DataObjectListImpl::operator[] (int pos) const +const RefCountingPointer<DataObject> DataObjectListImpl::operator[] (unsigned int pos) const { validateIndex(pos); RefCountingPointer<DataObjectImpl> d = plist[pos]; @@ -155,7 +155,7 @@ } -int DataObjectListImpl::size () const +unsigned int DataObjectListImpl::size () const { return plist.size(); } @@ -203,7 +203,7 @@ { container->logChange(pindex); } - for (int i=0;i < plist.size(); i++) + for (unsigned int i=0;i < plist.size(); i++) { if (plist[i] == d) { @@ -280,13 +280,6 @@ if (d->getDataFactory() == theFactory) return; - // temporary experiment with allowing data objects - // to move from factory to factory if the type is - // nominally present, and the type systems match - - DataFactoryImpl* f = (DataFactoryImpl*)theFactory; - - if (d->getContainer() != 0) { std::string msg("Insertion of object into list from another factory is only allowed if the parent is null: "); @@ -304,31 +297,6 @@ SDO_THROW_EXCEPTION("checkFactory", SDOInvalidConversionException, msg.c_str()); } - - if (f->isCompatible(d->getDataFactory(),d)) - { - d->setDataFactory(theFactory); - // we will also need to transfer any children - assuming they - // are ok in the new factory!! - d->transferChildren(d,theFactory); - return; - } - - std::string msg("Insertion into list from incompatible factory:"); - - const Type& t = d->getType(); - msg += t.getURI(); - msg += "#"; - msg += t.getName(); - msg += " into property "; - msg += container->getProperty(pindex).getName(); - msg += " of type "; - msg += typeURI; - msg += "#"; - msg += typeName; - SDO_THROW_EXCEPTION("checkFactory", SDOInvalidConversionException, - msg.c_str()); - } @@ -355,7 +323,7 @@ if (pi != 0) { unsigned int subcount = pi->getSubstitutionCount(); - for (int i=0;i<subcount;i++) + for (unsigned int i=0;i<subcount;i++) { const Type* tsub = pi->getSubstitutionType(i); if (tsub != 0 && tsub->equals(objectType)) return; @@ -438,7 +406,7 @@ container->logChange(pindex); } - for (int i=0;i < plist.size(); i++) + for (unsigned int i=0;i < plist.size(); i++) { if (plist[i] == d) { @@ -619,7 +587,7 @@ { if (theFactory == 0) return; - if (typeUnset)setType(Type::SDOTypeNamespaceURI, BytesLiteral); + if (typeUnset)setType(Type::SDOTypeNamespaceURI, StringLiteral); RefCountingPointer<DataObject> dol = theFactory->create(typeURI, typeName); DataObject* dob = dol; @@ -630,7 +598,7 @@ { if (theFactory == 0) return; - if (typeUnset)setType(Type::SDOTypeNamespaceURI, BytesLiteral); + if (typeUnset)setType(Type::SDOTypeNamespaceURI, StringLiteral); RefCountingPointer<DataObject> dol = theFactory->create(typeURI, typeName); DataObject* dob = dol; @@ -642,7 +610,7 @@ { if (theFactory == 0) return; - if (typeUnset)setType(Type::SDOTypeNamespaceURI, BytesLiteral); + if (typeUnset)setType(Type::SDOTypeNamespaceURI, StringLiteral); RefCountingPointer<DataObject> dol = theFactory->create(typeURI, typeName); DataObject* dob = dol; @@ -654,7 +622,7 @@ { if (theFactory == 0) return; - if (typeUnset)setType(Type::SDOTypeNamespaceURI, BytesLiteral); + if (typeUnset)setType(Type::SDOTypeNamespaceURI, StringLiteral); RefCountingPointer<DataObject> dol = theFactory->create(typeURI, typeName); DataObject* dob = dol; @@ -841,7 +809,7 @@ return d; } -void DataObjectListImpl::validateIndex(int index) const +void DataObjectListImpl::validateIndex(unsigned int index) const { if ((index < 0) || (index >= size())) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataObjectListImpl.h?r1=1.8&r2=1.9&diff_format=u Index: pecl/sdo/commonj/sdo/DataObjectListImpl.h diff -u pecl/sdo/commonj/sdo/DataObjectListImpl.h:1.8 pecl/sdo/commonj/sdo/DataObjectListImpl.h:1.9 --- pecl/sdo/commonj/sdo/DataObjectListImpl.h:1.8 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataObjectListImpl.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _DATAOBJECTLISTIMPL_H_ #define _DATAOBJECTLISTIMPL_H_ @@ -62,8 +62,8 @@ // open type support virtual void decrementPindex(); - virtual DataObjectPtr operator[] (int pos); - virtual const DataObjectPtr operator[] (int pos) const; + virtual DataObjectPtr operator[] (unsigned int pos); + virtual const DataObjectPtr operator[] (unsigned int pos) const; // set/get primitive values virtual bool getBoolean(unsigned int index) const; @@ -99,7 +99,7 @@ virtual unsigned int getLength(unsigned int index) const; - virtual int size () const; + virtual unsigned int size () const; virtual void insert (unsigned int index, DataObjectPtr d); virtual void append (DataObjectPtr d); @@ -192,7 +192,7 @@ unsigned int pindex; bool isReference; - void validateIndex(int index) const; + void validateIndex(unsigned int index) const; static const SDOString BooleanLiteral; static const SDOString ByteLiteral; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/EqualityHelper.cpp?r1=1.6&r2=1.7&diff_format=u Index: pecl/sdo/commonj/sdo/EqualityHelper.cpp diff -u pecl/sdo/commonj/sdo/EqualityHelper.cpp:1.6 pecl/sdo/commonj/sdo/EqualityHelper.cpp:1.7 --- pecl/sdo/commonj/sdo/EqualityHelper.cpp:1.6 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/EqualityHelper.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/Property.h" #include "commonj/sdo/Type.h" @@ -69,7 +69,7 @@ wchar_t * buft = new wchar_t[siz]; from->getString(p, buff, siz); to->getString(p, buft, siz); - for (int i=0;i< siz; i++) + for (unsigned int i=0;i< siz; i++) { if (buff[i] != buft[i]) { @@ -94,7 +94,7 @@ char * buft = new char[siz]; from->getBytes(p, buff, siz); to->getBytes(p, buft, siz); - for (int i=0;i< siz; i++) + for (unsigned int i=0;i< siz; i++) { if (buff[i] != buft[i]) { @@ -119,7 +119,7 @@ { case Type::BooleanType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getBoolean(i) != from.getBoolean(i)) { @@ -131,7 +131,7 @@ case Type::ByteType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getByte(i) != from.getByte(i)) { @@ -143,7 +143,7 @@ case Type::CharacterType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getCharacter(i) != from.getCharacter(i)) { @@ -155,7 +155,7 @@ case Type::IntegerType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getInteger(i) != from.getInteger(i)) { @@ -167,7 +167,7 @@ case Type::ShortType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getShort(i) != from.getShort(i)) { @@ -178,7 +178,7 @@ } case Type::DoubleType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getDouble(i) != from.getDouble(i)) { @@ -190,7 +190,7 @@ case Type::FloatType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getFloat(i) != from.getFloat(i)) { @@ -202,7 +202,7 @@ case Type::LongType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getLong(i) != from.getLong(i)) { @@ -214,7 +214,7 @@ case Type::DateType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getDate(i).getTime() != from.getDate(i).getTime()) { @@ -229,7 +229,7 @@ case Type::UriType: case Type::StringType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { unsigned int siz = from.getLength(i); if (siz != to.getLength(i)) return false; @@ -240,7 +240,7 @@ wchar_t * buft = new wchar_t[siz]; from.getString(i,buff,siz); to.getString(i,buft,siz); - for (int j=0;j<siz;j++) + for (unsigned int j=0;j<siz;j++) { if (buff[j] != buft[j]) { @@ -258,7 +258,7 @@ case Type::BytesType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { unsigned int siz = from.getLength(i); if (siz != to.getLength(i)) return false; @@ -269,7 +269,7 @@ char * buft = new char[siz]; from.getBytes(i,buff,siz); to.getBytes(i,buft,siz); - for (int j=0;j<siz;j++) + for (unsigned int j=0;j<siz;j++) { if (buff[j] != buft[j]) { @@ -310,7 +310,7 @@ PropertyList pl = dataObject1->getInstanceProperties(); - for (int i=0;i < pl.size(); i++) + for (unsigned int i=0;i < pl.size(); i++) { // data objects are only compared the deep equality case if (pl[i].getType().isDataObjectType()) @@ -327,7 +327,7 @@ DataObjectList& dolnew = dataObject2->getList(pl[i]); if (dolnew.size() != dolold.size()) return false; - for (int i=0;i< dolold.size(); i++) + for (unsigned int i=0;i< dolold.size(); i++) { if (!internalEqual(dolold[i], dolnew[i], true)) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertyDefinition.cpp?r1=1.6&r2=1.7&diff_format=u Index: pecl/sdo/commonj/sdo/PropertyDefinition.cpp diff -u pecl/sdo/commonj/sdo/PropertyDefinition.cpp:1.6 pecl/sdo/commonj/sdo/PropertyDefinition.cpp:1.7 --- pecl/sdo/commonj/sdo/PropertyDefinition.cpp:1.6 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertyDefinition.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/PropertyDefinition.h" #include "commonj/sdo/PropertyDefinitionImpl.h" @@ -105,7 +105,7 @@ return propertydefinition->substituteNames.size(); } - const char* PropertyDefinition::getSubstituteNames(int index) const + const char* PropertyDefinition::getSubstituteNames(unsigned int index) const { if (index >= 0 && index < propertydefinition->substituteNames.size()) { @@ -114,7 +114,7 @@ return 0; } - const char* PropertyDefinition::getSubstituteLocalNames(int index) const + const char* PropertyDefinition::getSubstituteLocalNames(unsigned int index) const { if (index >= 0 && index < propertydefinition->substituteLocalNames.size()) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertyDefinition.h?r1=1.6&r2=1.7&diff_format=u Index: pecl/sdo/commonj/sdo/PropertyDefinition.h diff -u pecl/sdo/commonj/sdo/PropertyDefinition.h:1.6 pecl/sdo/commonj/sdo/PropertyDefinition.h:1.7 --- pecl/sdo/commonj/sdo/PropertyDefinition.h:1.6 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertyDefinition.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _PROPERTYDefinition_H_ #define _PROPERTYDefinition_H_ @@ -73,8 +73,8 @@ /*SDO_API*/ void addSubstitute(const SDOString& name, const SDOString& localname); /*SDO_API*/ int getSubstituteCount() const; - /*SDO_API*/ const char* getSubstituteNames(int index) const; - /*SDO_API*/ const char* getSubstituteLocalNames(int index) const; + /*SDO_API*/ const char* getSubstituteNames(unsigned int index) const; + /*SDO_API*/ const char* getSubstituteLocalNames(unsigned int index) const; /*SDO_API*/ void setAliases(const char* aliases); http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertyImpl.cpp?r1=1.10&r2=1.11&diff_format=u Index: pecl/sdo/commonj/sdo/PropertyImpl.cpp diff -u pecl/sdo/commonj/sdo/PropertyImpl.cpp:1.10 pecl/sdo/commonj/sdo/PropertyImpl.cpp:1.11 --- pecl/sdo/commonj/sdo/PropertyImpl.cpp:1.10 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertyImpl.cpp Thu Dec 7 12:38:33 2006 @@ -17,16 +17,13 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 482678 $ $Date: 2006/12/07 12:38:33 $ */ + +#include "commonj/sdo/export.h" #include <iostream> using namespace std; -#ifndef SDO_EXPORTS -#define SDO_EXPORTS -#endif -#include "commonj/sdo/export.h" - #include "commonj/sdo/Sequence.h" #include "commonj/sdo/DataObject.h" @@ -266,7 +263,7 @@ /////////////////////////////////////////////////////////////////////////// const Type* PropertyImpl::getSubstitutionType(const char* inname) const { - for (int i=0;i<substitutions.size();i++) + for (unsigned int i=0;i<substitutions.size();i++) { if (!strcmp(inname, substitutions[i].name.c_str())) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertyList.cpp?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/PropertyList.cpp diff -u pecl/sdo/commonj/sdo/PropertyList.cpp:1.5 pecl/sdo/commonj/sdo/PropertyList.cpp:1.6 --- pecl/sdo/commonj/sdo/PropertyList.cpp:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertyList.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef SDO_EXPORTS #define SDO_EXPORTS @@ -74,7 +74,7 @@ return *(plist[pos]); } -SDO_API int PropertyList::size () +SDO_API unsigned int PropertyList::size () { return plist.size(); } http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertyList.h?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/PropertyList.h diff -u pecl/sdo/commonj/sdo/PropertyList.h:1.5 pecl/sdo/commonj/sdo/PropertyList.h:1.6 --- pecl/sdo/commonj/sdo/PropertyList.h:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertyList.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _PROPERTYLIST_H_ #define _PROPERTYLIST_H_ @@ -71,7 +71,7 @@ * size() returns the number of elements in the list. */ - SDO_API int size (); + SDO_API unsigned int size (); /** insert adds an element to the list * http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertySetting.cpp?r1=1.6&r2=1.7&diff_format=u Index: pecl/sdo/commonj/sdo/PropertySetting.cpp diff -u pecl/sdo/commonj/sdo/PropertySetting.cpp:1.6 pecl/sdo/commonj/sdo/PropertySetting.cpp:1.7 --- pecl/sdo/commonj/sdo/PropertySetting.cpp:1.6 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertySetting.cpp Thu Dec 7 12:38:33 2006 @@ -17,19 +17,17 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 482588 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/PropertySetting.h" #include "SDOString.h" +#include "SDOUtils.h" namespace commonj { namespace sdo { - const char *PropertySetting::CDataStartMarker = "XXXCDATA@STARTXXX"; - const char *PropertySetting::XMLCDataStartMarker = "<![CDATA["; - const char *PropertySetting::CDataEndMarker = "XXXCDATA@ENDX"; - const char *PropertySetting::XMLCDataEndMarker = "]]>"; + PropertySetting::PropertySetting() : dataObject(NULL), isNULL(false), isIDREF(false), pendingUnknownType(false) @@ -47,42 +45,6 @@ { } - /* - * A local utility function that replaces one string with and another within a - * host string and adjusts the lenght of the host string accordingly. - */ - SDOString replace(SDOString hostString, const char *fromString, const char *toString) - { - SDOString returnString(""); - - // find and replace all occurances of fromString with toString. The start, end - // and length variables are used to indicate the start, end and length - // of the text sections to be copied from the host string to the return - // string. toString is appended in between these copied sections because the - // string is broken whenever fronString is found - std::string::size_type start = 0; - std::string::size_type end = hostString.find(fromString, 0); - std::string::size_type length = 0; - - while ( end != std::string::npos ) - { - // copy all the text up to the fromString - length = end - start; - returnString.append(hostString.substr(start, length)); - - // add in the toString - returnString.append(toString); - - // find the next fromString - start = end + strlen(fromString); - end = hostString.find(fromString, start); - } - - // copy any text left at the end of the host string - returnString.append(hostString.substr(start)); - - return returnString; - } /* * The value that PropertySetting uses to hold values passing from @@ -96,8 +58,8 @@ { SDOString valueString((const char*)value); - SDOString returnString = replace(valueString, CDataStartMarker, XMLCDataStartMarker); - returnString = replace(returnString, CDataEndMarker, XMLCDataEndMarker); + SDOString returnString = SDOUtils::replace(valueString, SDOUtils::CDataStartMarker, SDOUtils::XMLCDataStartMarker); + returnString = SDOUtils::replace(returnString, SDOUtils::CDataEndMarker, SDOUtils::XMLCDataEndMarker); return returnString; } http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertySetting.h?r1=1.6&r2=1.7&diff_format=u Index: pecl/sdo/commonj/sdo/PropertySetting.h diff -u pecl/sdo/commonj/sdo/PropertySetting.h:1.6 pecl/sdo/commonj/sdo/PropertySetting.h:1.7 --- pecl/sdo/commonj/sdo/PropertySetting.h:1.6 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertySetting.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 482588 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _PROPERTYSETTING_H_ #define _PROPERTYSETTING_H_ @@ -56,16 +56,6 @@ bool isIDREF; bool isNULL; bool pendingUnknownType; - - /* - * Markers used to represent the start and end of CDATA sections in the - * settings value. The noew XML CDATA markers are not used here because the - * XML string processing URL encodes parts of the markers - */ - static SDO_API const char *CDataStartMarker; - static SDO_API const char *XMLCDataStartMarker; - static SDO_API const char *CDataEndMarker; - static SDO_API const char *XMLCDataEndMarker; }; } // End - namespace sdo http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SAX2Attributes.cpp?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/SAX2Attributes.cpp diff -u pecl/sdo/commonj/sdo/SAX2Attributes.cpp:1.5 pecl/sdo/commonj/sdo/SAX2Attributes.cpp:1.6 --- pecl/sdo/commonj/sdo/SAX2Attributes.cpp:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SAX2Attributes.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/SAX2Attributes.h" @@ -61,7 +61,7 @@ const SAX2Attribute* SAX2Attributes::getAttribute(const SDOXMLString& attributeName) const { - for (int i=0; i < attributes.size(); i++) + for (unsigned int i=0; i < attributes.size(); i++) { if (attributes[i].getName().equalsIgnoreCase(attributeName)) { @@ -73,7 +73,7 @@ void SAX2Attributes::addAttribute(const SAX2Attribute& attr) { - for (int i=0; i < attributes.size(); i++) + for (unsigned int i=0; i < attributes.size(); i++) { if (attributes[i].getUri().equals(attr.getUri())) { @@ -95,7 +95,7 @@ const SDOXMLString& attributeUri, const SDOXMLString& attributeName) const { - for (int i=0; i < attributes.size(); i++) + for (unsigned int i=0; i < attributes.size(); i++) { if (attributes[i].getUri().equalsIgnoreCase(attributeUri)) { @@ -112,7 +112,7 @@ const SDOXMLString& SAX2Attributes::getValue( const SDOXMLString& attributeName) const { - for (int i=0; i < attributes.size(); i++) + for (unsigned int i=0; i < attributes.size(); i++) { if (attributes[i].getName().equalsIgnoreCase(attributeName)) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SAX2Parser.cpp?r1=1.6&r2=1.7&diff_format=u Index: pecl/sdo/commonj/sdo/SAX2Parser.cpp diff -u pecl/sdo/commonj/sdo/SAX2Parser.cpp:1.6 pecl/sdo/commonj/sdo/SAX2Parser.cpp:1.7 --- pecl/sdo/commonj/sdo/SAX2Parser.cpp:1.6 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SAX2Parser.cpp Thu Dec 7 12:38:33 2006 @@ -17,12 +17,12 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 482588 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/SAX2Parser.h" #include "libxml/SAX2.h" #include "commonj/sdo/SDORuntimeException.h" -#include "commonj/sdo/PropertySetting.h" +#include "commonj/sdo/SDOUtils.h" using namespace commonj::sdo; /** @@ -172,9 +172,9 @@ { SDOXMLString valueAsString(value, 0, len); - SDOXMLString cdata(PropertySetting::CDataStartMarker); + SDOXMLString cdata(SDOUtils::CDataStartMarker); cdata = cdata + valueAsString; - cdata = cdata + PropertySetting::CDataEndMarker; + cdata = cdata + SDOUtils::CDataEndMarker; ((SAX2Parser*)ctx)->characters(cdata); } @@ -500,7 +500,7 @@ ctxt = xmlCreatePushParserCtxt(handler, this, bctx, bcount, NULL); - for (int i=0;i<buffer_vec.size();i++) + for (unsigned int i=0;i<buffer_vec.size();i++) { if (buffer_vec[i].len > 0) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOSAX2Parser.cpp?r1=1.8&r2=1.9&diff_format=u Index: pecl/sdo/commonj/sdo/SDOSAX2Parser.cpp diff -u pecl/sdo/commonj/sdo/SDOSAX2Parser.cpp:1.8 pecl/sdo/commonj/sdo/SDOSAX2Parser.cpp:1.9 --- pecl/sdo/commonj/sdo/SDOSAX2Parser.cpp:1.8 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SDOSAX2Parser.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 477891 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 482588 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/SDOSAX2Parser.h" @@ -32,6 +32,7 @@ #include "commonj/sdo/TypeImpl.h" #include "commonj/sdo/DataObjectImpl.h" #include "commonj/sdo/DataFactoryImpl.h" +#include "commonj/sdo/SDOUtils.h" #include <stdio.h> using namespace std; @@ -1334,11 +1335,18 @@ DataObject* dob = currentDataObject; if ((dob != 0) && ((DataObjectImpl*)dob)->getTypeImpl().isFromList()) { - // this is a list,so we need to split it up + // this is a list,so we need to split it up DataObjectList& dl = currentDataObject->getList( (const char *)"values"); const char* str = (const char*)chars; + + // Convert any synthetic CDATA markers back to the real thing + SDOString valueString(str); + SDOString tmpString = SDOUtils::replace(valueString, SDOUtils::CDataStartMarker, SDOUtils::XMLCDataStartMarker); + tmpString = SDOUtils::replace(tmpString, SDOUtils::CDataEndMarker, SDOUtils::XMLCDataEndMarker); + str = (const char*)tmpString.c_str(); + char* buf = new char[strlen(str)+1]; if (!buf) return; @@ -1371,12 +1379,20 @@ // then add this as text to the sequence if (currentDataObject && currentDataObjectType->isSequencedType()) { + // Convert any synthetic CDATA markers back to the real thing + const char* str = (const char*)chars; + + SDOString valueString(str); + SDOString tmpString = SDOUtils::replace(valueString, SDOUtils::CDataStartMarker, SDOUtils::XMLCDataStartMarker); + tmpString = SDOUtils::replace(tmpString, SDOUtils::CDataEndMarker, SDOUtils::XMLCDataEndMarker); + str = tmpString.c_str(); + SequencePtr seq = currentDataObject->getSequence(); if (seq) { if (newSequence == true) { - seq->addText(chars); + seq->addText(str); newSequence = false; } else @@ -1390,20 +1406,20 @@ if (s) { char *combi = - new char[strlen(s)+strlen(chars) + 2]; + new char[strlen(s)+strlen(str) + 2]; strcpy(combi,s); - strcat(combi,chars); + strcat(combi,str); seq->setText(k,(const char*)combi); delete combi; } else { - seq->setText(k,chars); + seq->setText(k,str); } return; } } - seq->addText(chars); + seq->addText(str); } return; } @@ -1451,7 +1467,7 @@ */ PropertyList pl = type.getProperties(); - for (int i = 0; i < pl.size(); i++) + for (unsigned int i = 0; i < pl.size(); i++) { XSDPropertyInfo* pi = (XSDPropertyInfo*)((DASProperty*)&pl[i])->getDASValue("XMLDAS::PropertyInfo"); if (pi) @@ -1460,7 +1476,7 @@ if (localName .equals(propdef.localname)) return propdef.name; - for (int j=0;j< propdef.substituteNames.size();j++) + for (unsigned int j=0;j< propdef.substituteNames.size();j++) { if (propdef.substituteLocalNames[j].equals(localName)) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOSchemaSAX2Parser.cpp?r1=1.12&r2=1.13&diff_format=u Index: pecl/sdo/commonj/sdo/SDOSchemaSAX2Parser.cpp diff -u pecl/sdo/commonj/sdo/SDOSchemaSAX2Parser.cpp:1.12 pecl/sdo/commonj/sdo/SDOSchemaSAX2Parser.cpp:1.13 --- pecl/sdo/commonj/sdo/SDOSchemaSAX2Parser.cpp:1.12 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SDOSchemaSAX2Parser.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 478193 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 483102 $ $Date: 2006/12/07 12:38:33 $ */ #include "libxml/uri.h" #include "commonj/sdo/SDOSchemaSAX2Parser.h" @@ -94,7 +94,7 @@ bool isGroup, const SAX2Attributes& groupAttributes) { - for (int i=0;i< groupList.size(); i++) + for (unsigned int i=0;i< groupList.size(); i++) { if (groupList[i].isAttributeGroup != isGroup) { @@ -117,7 +117,7 @@ int level = 0; - for (int j=0;j< groupList[i].events.size();j++) + for (unsigned int j=0;j< groupList[i].events.size();j++) { if (groupList[i].events[j].isStartEvent) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOUtils.cpp?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/SDOUtils.cpp diff -u pecl/sdo/commonj/sdo/SDOUtils.cpp:1.5 pecl/sdo/commonj/sdo/SDOUtils.cpp:1.6 --- pecl/sdo/commonj/sdo/SDOUtils.cpp:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SDOUtils.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 483011 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/SDOUtils.h" #include <stdio.h> @@ -29,6 +29,11 @@ namespace commonj { namespace sdo { + + const char *SDOUtils::CDataStartMarker = "XXXCDATA@STARTXXX"; + const char *SDOUtils::XMLCDataStartMarker = "<![CDATA["; + const char *SDOUtils::CDataEndMarker = "XXXCDATA@ENDX"; + const char *SDOUtils::XMLCDataEndMarker = "]]>"; ////////////////////////////////////////////////////////////////////////// // Conversions @@ -118,7 +123,7 @@ void SDOUtils::printTabs(ostream& out, unsigned int incr) { - for (int ind=0; ind < incr; ind++) + for (unsigned int ind=0; ind < incr; ind++) { out << " "; } @@ -155,7 +160,7 @@ // Iterate over all the properties ////////////////////////////////////////////////////////////// PropertyList pl = dataObject->getInstanceProperties(); - for (int i = 0; i < pl.size(); i++) + for (unsigned int i = 0; i < pl.size(); i++) { printTabs(out, incr); out << "Property: " << pl[i].getName() << endl; @@ -179,7 +184,7 @@ incr++; DataObjectList& dol = dataObject->getList(pl[i]); char cc[20]; - for (int j = 0; j <dol.size(); j++) + for (unsigned int j = 0; j <dol.size(); j++) { printTabs(out, incr); // seems to be a bug in ostream? Will not print j @@ -189,7 +194,15 @@ out << cc; out << endl; incr++; - printDataObject(out, dol[j],incr); + if (pl[i].isReference()) + { + printTabs(out, incr); + out << "Reference Value: " << dol[j]->objectToXPath() <<endl; + } + else + { + printDataObject(out, dol[j],incr); + } incr--; out << endl; } @@ -212,7 +225,15 @@ else { incr++; - printDataObject(out, dataObject->getDataObject(pl[i]),incr); + if (pl[i].isReference()) + { + printTabs(out, incr); + out << "Reference Value: " << dataObject->getDataObject(pl[i])->objectToXPath() <<endl; + } + else + { + printDataObject(out, dataObject->getDataObject(pl[i]),incr); + } incr--; } } @@ -231,13 +252,13 @@ void SDOUtils::printTypes(std::ostream& out, DataFactoryPtr df) { TypeList tl = df->getTypes(); - for (int i = 0; i < tl.size(); i++) + for (unsigned int i = 0; i < tl.size(); i++) { out << "Type: " << tl[i].getURI()<< "#" << tl[i].getName() << " isOpen: " << tl[i].isOpenType() << " isSequenced: " << tl[i].isSequencedType() << endl; PropertyList pl = tl[i].getProperties(); - for (int j = 0; j < pl.size(); j++) + for (unsigned int j = 0; j < pl.size(); j++) { out << "\tProperty: " << pl[j].getName() << " type: " <<pl[j].getType().getURI()<<"#"<<pl[j].getType().getName()<< @@ -247,6 +268,44 @@ } } + + /* + * A local utility function that replaces one string with and another within a + * host string and adjusts the lenght of the host string accordingly. + */ + SDOString SDOUtils::replace(SDOString hostString, const char *fromString, const char *toString) + { + SDOString returnString(""); + + // find and replace all occurances of fromString with toString. The start, end + // and length variables are used to indicate the start, end and length + // of the text sections to be copied from the host string to the return + // string. toString is appended in between these copied sections because the + // string is broken whenever fromString is found + std::string::size_type start = 0; + std::string::size_type end = hostString.find(fromString, 0); + std::string::size_type length = 0; + + while ( end != std::string::npos ) + { + // copy all the text up to the fromString + length = end - start; + returnString.append(hostString.substr(start, length)); + + // add in the toString + returnString.append(toString); + + // find the next fromString + start = end + strlen(fromString); + end = hostString.find(fromString, start); + } + + // copy any text left at the end of the host string + returnString.append(hostString.substr(start)); + + return returnString; + } + }; }; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOUtils.h?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/SDOUtils.h diff -u pecl/sdo/commonj/sdo/SDOUtils.h:1.5 pecl/sdo/commonj/sdo/SDOUtils.h:1.6 --- pecl/sdo/commonj/sdo/SDOUtils.h:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SDOUtils.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 482588 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _SDOUTILS_H_ #define _SDOUTILS_H_ @@ -46,6 +46,17 @@ static SDO_API const char* SDOToXSD(const char* sdoname); static SDO_API const char* XSDToSDO(const char* xsdname); static void printTypes(std::ostream& out, DataFactoryPtr df); + static SDOString replace(SDOString hostString, const char *fromString, const char *toString); + + /* + * Markers used to represent the start and end of CDATA sections in the + * settings value. The noew XML CDATA markers are not used here because the + * XML string processing URL encodes parts of the markers + */ + static SDO_API const char *CDataStartMarker; + static SDO_API const char *XMLCDataStartMarker; + static SDO_API const char *CDataEndMarker; + static SDO_API const char *XMLCDataEndMarker; private: http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOXMLString.cpp?r1=1.7&r2=1.8&diff_format=u Index: pecl/sdo/commonj/sdo/SDOXMLString.cpp diff -u pecl/sdo/commonj/sdo/SDOXMLString.cpp:1.7 pecl/sdo/commonj/sdo/SDOXMLString.cpp:1.8 --- pecl/sdo/commonj/sdo/SDOXMLString.cpp:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SDOXMLString.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 462804 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/SDOXMLString.h" #include <iostream> @@ -174,7 +174,7 @@ { char* newString = new char[strlen(*this)+1]; strcpy(newString, *this); - for (int i = start; (i<=(strlen(newString)) && i < length); i++) + for (unsigned int i = start; (i<=(strlen(newString)) && i < length); i++) { newString[i] = tolower(newString[i]); } http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOXMLWriter.cpp?r1=1.10&r2=1.11&diff_format=u Index: pecl/sdo/commonj/sdo/SDOXMLWriter.cpp diff -u pecl/sdo/commonj/sdo/SDOXMLWriter.cpp:1.10 pecl/sdo/commonj/sdo/SDOXMLWriter.cpp:1.11 --- pecl/sdo/commonj/sdo/SDOXMLWriter.cpp:1.10 Fri Dec 1 15:27:42 2006 +++ pecl/sdo/commonj/sdo/SDOXMLWriter.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 477891 $ $Date: 2006/12/01 15:27:42 $ */ +/* $Rev: 482667 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/SDOXMLWriter.h" #include "commonj/sdo/SDOXMLString.h" @@ -497,7 +497,7 @@ const SDOXMLString& elementName, ChangeSummaryPtr cs) { - int i; + unsigned int i; int rc; ChangedDataObjectList& changedDOs = cs->getChangedDataObjects(); @@ -587,7 +587,7 @@ } PropertyList pl = dob->getInstanceProperties(); - for (int i = 0; i < pl.size(); i++) + for (unsigned int i = 0; i < pl.size(); i++) { if (!dob->isSet(pl[i]))continue; @@ -596,7 +596,7 @@ if (!pl[i].getType().isDataType()) { DataObjectList& dl = dob->getList(pl[i]); - for (int k=0;k< dl.size() ;k++) + for (unsigned int k=0;k< dl.size() ;k++) { DataObjectImpl* d = (DataObjectImpl*)(DataObject*)dl[k]; if (d != 0)addToNamespaces(d); @@ -678,9 +678,7 @@ // Don't write the element URI if the element is a child of an open type // and not one of the declared properties SDOXMLString uri = elementURI; -/* ------------------------------------ - Patch for bug 9498 - if (!isRoot && !writeXSIType) +/* if (!isRoot && !writeXSIType) { DataObject* dob = dataObject; DataObjectImpl* cont = @@ -695,9 +693,8 @@ } } } - } - Patch for bug 9498 - ------------------------------------ */ + } */ + //SDOXMLString uri; //if (!elementURI.equals(namespaceUriStack.top())) //{ @@ -730,6 +727,7 @@ } else { + /* Use our wrapper function just in case the element has CDATA in it */ writeXMLElement(writer, elementName, dataObject->getCString("")); @@ -901,31 +899,35 @@ // (const unsigned char*)value.c_str()); //} //else - //{ + //{ if (cont->getTypeImpl().getPropertyImpl(elementName) == 0) { const SDOXMLString& typeURI = dataObject->getType().getURI(); const SDOXMLString& typeName = dataObject->getType().getName(); - - SDOXMLString theName=typeName; - -/* Patch for bug9498 if (!typeURI.isNull() && !typeURI.equals(tnsURI) && !typeURI.equals("")) */ - if (!typeURI.isNull() && !typeURI.equals(uri) && !typeURI.equals("")) + + // Supress the writing of xsi:type as well for DataObjects of type + // commonj.sdo#OpenDataObject + if (!(typeURI.equals("commonj.sdo") && typeName.equals("OpenDataObject"))) { - std::map<SDOXMLString,SDOXMLString>::iterator it = namespaceMap.find(typeURI); - if (it != namespaceMap.end()) + SDOXMLString theName=typeName; + + if (!typeURI.isNull() && !typeURI.equals(uri) && !typeURI.equals("")) { - theName = (*it).second; - theName += ":"; - theName += typeName; + std::map<SDOXMLString,SDOXMLString>::iterator it = namespaceMap.find(typeURI); + if (it != namespaceMap.end()) + { + theName = (*it).second; + theName += ":"; + theName += typeName; + } } - } - - rc = xmlTextWriterWriteAttribute(writer, - (const unsigned char*)"xsi:type", - (const unsigned char*)theName); - writeXmlnsXsi(); + rc = xmlTextWriterWriteAttribute(writer, + (const unsigned char*)"xsi:type", + (const unsigned char*)theName); + + writeXmlnsXsi(); + } } } } @@ -945,8 +947,8 @@ ////////////////////////////////////////////////////////////////////////// // Iterate over all the properties to find attributes ////////////////////////////////////////////////////////////////////////// - int i; - int j = 1; + unsigned int i; + unsigned int j = 1; PropertyList pl = dataObject->getInstanceProperties(); for (i = 0; i < pl.size(); i++) { @@ -1051,7 +1053,9 @@ if (sequence->isText(i)) { - rc = xmlTextWriterWriteString( + // This is a raw write rather than xmlTextWriterWriteString + // just in case the text has a CDATA section in it + rc = xmlTextWriterWriteRaw( writer, SDOXMLString(sequence->getCStringValue(i))); continue; @@ -1061,6 +1065,14 @@ SDOXMLString seqPropName = seqProp.getName(); const Type& seqPropType = seqProp.getType(); + // Do not write attributes as members of the sequence + XSDPropertyInfo* pi = getPropertyInfo(dataObjectType, seqProp); + PropertyDefinitionImpl propdef; + if (pi && !(pi->getPropertyDefinition().isElement)) + { + continue; + } + if (seqPropType.isDataObjectType()) { DataObjectPtr doValue; @@ -1092,10 +1104,20 @@ else { // Sequence member is a primitive + // Only write a primitive as an element if defined by the schema or if it's + // many-valued. + if (!pi && !seqProp.isMany()) continue; + + /* Use our wrapper function just in case the element has CDATA in it */ + writeXMLElement(writer, + seqPropName, + sequence->getCStringValue(i)); + /* xmlTextWriterWriteElement( writer, seqPropName, SDOXMLString(sequence->getCStringValue(i))); + */ } // end DataType } // end - iterate over sequence @@ -1132,7 +1154,7 @@ if (pl[i].isMany()) { DataObjectList& dol = dataObject->getList(pl[i]); - for (int j = 0; j <dol.size(); j++) + for (unsigned int j = 0; j <dol.size(); j++) { // Handle non-containment reference to DataObject if (pl[i].isReference() ) @@ -1294,7 +1316,7 @@ /** * A wrapper for the libxml2 function xmlTextWriterWriteElement - * it detects CDATA sections before wrting out element contents + * it detects CDATA sections before writing out element contents */ int SDOXMLWriter::writeXMLElement(xmlTextWriterPtr writer, const xmlChar *name, @@ -1305,6 +1327,8 @@ rc = xmlTextWriterWriteRaw(writer, SDOXMLString(content)); rc = xmlTextWriterEndElement(writer); /* A more complex version that doesn't work! + * I've left it here just in case we need to go back and separate out + * CDATA from text. This might provide a starting point SDOString contentString(content); // write the start of the element. we could write a mixture of http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOXSDWriter.cpp?r1=1.7&r2=1.8&diff_format=u Index: pecl/sdo/commonj/sdo/SDOXSDWriter.cpp diff -u pecl/sdo/commonj/sdo/SDOXSDWriter.cpp:1.7 pecl/sdo/commonj/sdo/SDOXSDWriter.cpp:1.8 --- pecl/sdo/commonj/sdo/SDOXSDWriter.cpp:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SDOXSDWriter.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/SDOXSDWriter.h" #include "iostream" @@ -163,7 +163,7 @@ int SDOXSDWriter::write(const TypeList& types, const SDOXMLString& targetNamespaceURI, const propertyMap& openprops, int indent) { - int i; + unsigned int i; if (writer == NULL) { // Throw exception @@ -309,7 +309,7 @@ { unsigned int j = type.getAliasCount(); SDOXMLString value = ""; - for (int i=0;i<j-1;i++) + for (unsigned int i=0;i<j-1;i++) { value = value + type.getAlias(i); value = value + " "; @@ -380,7 +380,7 @@ { unsigned int j = type.getAliasCount(); SDOXMLString value = ""; - for (int i=0;i<j-1;i++) + for (unsigned int i=0;i<j-1;i++) { value = value + type.getAlias(i); value = value + " "; @@ -421,7 +421,7 @@ // Create <element> definitions // ------------------------------------------------------- - int j; + unsigned int j; for (j = 0; j < pl.size(); j++) { const Property& prop = pl[j]; @@ -513,7 +513,7 @@ { unsigned int j = prop.getAliasCount(); SDOXMLString value = ""; - for (int i=0;i<j-1;i++) + for (unsigned int i=0;i<j-1;i++) { value = value + prop.getAlias(i); value = value + " "; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SequenceImpl.cpp?r1=1.8&r2=1.9&diff_format=u Index: pecl/sdo/commonj/sdo/SequenceImpl.cpp diff -u pecl/sdo/commonj/sdo/SequenceImpl.cpp:1.8 pecl/sdo/commonj/sdo/SequenceImpl.cpp:1.9 --- pecl/sdo/commonj/sdo/SequenceImpl.cpp:1.8 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SequenceImpl.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/disable_warn.h" #include "commonj/sdo/Property.h" @@ -639,7 +639,7 @@ {\ SEQUENCE_ITEM_LIST::iterator i;\ SEQUENCE_ITEM_LIST::iterator i2 = the_list.end();\ - int j;\ + unsigned int j;\ if (index >= the_list.size()) {\ return add##primtype(p,v);\ }\ @@ -701,7 +701,7 @@ {\ SEQUENCE_ITEM_LIST::iterator i;\ SEQUENCE_ITEM_LIST::iterator i2 = the_list.end();\ - int j;\ + unsigned int j;\ if (index >= the_list.size()) {\ return add##primtype(p,v);\ }\ @@ -837,7 +837,7 @@ msg.c_str()); } SEQUENCE_ITEM_LIST::iterator i; - int j = 0; + unsigned int j = 0; for (i=the_list.begin();(j < index) && (i != the_list.end()) ; ++i) { j++; @@ -890,7 +890,7 @@ SEQUENCE_ITEM_LIST::iterator i1, i2 = the_list.end(), i3 = the_list.end(); - int j = 0; + unsigned int j = 0; for (i3 = the_list.begin(); j < toIndex && j < fromIndex && i3 != the_list.end() ; ++i3); @@ -932,7 +932,7 @@ return false; } SEQUENCE_ITEM_LIST::iterator i; - int j = 0; + unsigned int j = 0; for (i= the_list.begin(); (j < index) && (i != the_list.end()); ++i) { j++; @@ -952,7 +952,7 @@ } SEQUENCE_ITEM_LIST::iterator i; - int j = 0; + unsigned int j = 0; for (i= the_list.begin(); (j < index) && (i != the_list.end()); ++i) { j++; @@ -973,7 +973,7 @@ } SEQUENCE_ITEM_LIST::iterator i; - int j = 0; + unsigned int j = 0; for (i= the_list.begin(); (j < index) && (i != the_list.end()); ++i) { j++; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/TypeList.cpp?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/TypeList.cpp diff -u pecl/sdo/commonj/sdo/TypeList.cpp:1.5 pecl/sdo/commonj/sdo/TypeList.cpp:1.6 --- pecl/sdo/commonj/sdo/TypeList.cpp:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/TypeList.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef SDO_EXPORTS #define SDO_EXPORTS @@ -61,12 +61,12 @@ } -SDO_API const Type& TypeList::operator[] (int pos) const +SDO_API const Type& TypeList::operator[] (unsigned int pos) const { return *plist[pos]; } -SDO_API int TypeList::size () const +SDO_API unsigned int TypeList::size () const { return plist.size(); } http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/TypeList.h?r1=1.5&r2=1.6&diff_format=u Index: pecl/sdo/commonj/sdo/TypeList.h diff -u pecl/sdo/commonj/sdo/TypeList.h:1.5 pecl/sdo/commonj/sdo/TypeList.h:1.6 --- pecl/sdo/commonj/sdo/TypeList.h:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/TypeList.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _TYPELIST_H_ #define _TYPELIST_H_ @@ -48,8 +48,8 @@ SDO_API TypeList(std::vector<const Type*> p); SDO_API TypeList(); virtual SDO_API ~TypeList(); - SDO_API const Type& operator[] (int pos) const; - SDO_API int size () const; + SDO_API const Type& operator[] (unsigned int pos) const; + SDO_API unsigned int size () const; SDO_API void insert (const Type* t); }; }; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/XMLHelper.h?r1=1.7&r2=1.8&diff_format=u Index: pecl/sdo/commonj/sdo/XMLHelper.h diff -u pecl/sdo/commonj/sdo/XMLHelper.h:1.7 pecl/sdo/commonj/sdo/XMLHelper.h:1.8 --- pecl/sdo/commonj/sdo/XMLHelper.h:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/XMLHelper.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _XMLHELPER_H_ #define _XMLHELPER_H_ @@ -166,7 +166,7 @@ * may be errors to report or handle. */ - virtual int getErrorCount() const = 0; + virtual unsigned int getErrorCount() const = 0; /** getErrorMessage gets the nth error message * @@ -174,7 +174,7 @@ * in which the parser error occurred. */ - virtual const char* getErrorMessage(int errnum) const = 0; + virtual const char* getErrorMessage(unsigned int errnum) const = 0; }; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/XMLHelperImpl.cpp?r1=1.7&r2=1.8&diff_format=u Index: pecl/sdo/commonj/sdo/XMLHelperImpl.cpp diff -u pecl/sdo/commonj/sdo/XMLHelperImpl.cpp:1.7 pecl/sdo/commonj/sdo/XMLHelperImpl.cpp:1.8 --- pecl/sdo/commonj/sdo/XMLHelperImpl.cpp:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/XMLHelperImpl.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/SDOXMLFileWriter.h" // Include first to avoid libxml compile problems! #include "commonj/sdo/SDOXMLStreamWriter.h" // Include first to avoid libxml compile problems! @@ -134,7 +134,7 @@ } const TypeList& tl = df->getTypes(); - for (int i = 0; i < tl.size(); i++) + for (unsigned int i = 0; i < tl.size(); i++) { if (!strcmp("RootType", tl[i].getName())) { @@ -448,13 +448,13 @@ indent); } - int XMLHelperImpl::getErrorCount() const + unsigned int XMLHelperImpl::getErrorCount() const { return parseErrors.size(); } - const char* XMLHelperImpl::getErrorMessage(int errnum) const + const char* XMLHelperImpl::getErrorMessage(unsigned int errnum) const { if (errnum >= 0 && errnum < parseErrors.size()) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/XMLHelperImpl.h?r1=1.7&r2=1.8&diff_format=u Index: pecl/sdo/commonj/sdo/XMLHelperImpl.h diff -u pecl/sdo/commonj/sdo/XMLHelperImpl.h:1.7 pecl/sdo/commonj/sdo/XMLHelperImpl.h:1.8 --- pecl/sdo/commonj/sdo/XMLHelperImpl.h:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/XMLHelperImpl.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _XMLHELPERIMPL_H_ #define _XMLHELPERIMPL_H_ @@ -54,8 +54,8 @@ // Destructor virtual ~XMLHelperImpl(); - virtual int getErrorCount() const; - virtual const char* getErrorMessage(int errnum) const; + virtual unsigned int getErrorCount() const; + virtual const char* getErrorMessage(unsigned int errnum) const; virtual void setError(const char* error); http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/XSDHelper.h?r1=1.7&r2=1.8&diff_format=u Index: pecl/sdo/commonj/sdo/XSDHelper.h diff -u pecl/sdo/commonj/sdo/XSDHelper.h:1.7 pecl/sdo/commonj/sdo/XSDHelper.h:1.8 --- pecl/sdo/commonj/sdo/XSDHelper.h:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/XSDHelper.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _XSDHELPER_H_ #define _XSDHELPER_H_ @@ -122,7 +122,7 @@ * may be errors to report or handle. */ - virtual int getErrorCount() const = 0; + virtual unsigned int getErrorCount() const = 0; /** getErrorMessage gets the nth error message * @@ -130,7 +130,7 @@ * in which the parser error occurred. */ - virtual const char* getErrorMessage(int errnum) const = 0; + virtual const char* getErrorMessage(unsigned int errnum) const = 0; /** * http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/XSDHelperImpl.cpp?r1=1.8&r2=1.9&diff_format=u Index: pecl/sdo/commonj/sdo/XSDHelperImpl.cpp diff -u pecl/sdo/commonj/sdo/XSDHelperImpl.cpp:1.8 pecl/sdo/commonj/sdo/XSDHelperImpl.cpp:1.9 --- pecl/sdo/commonj/sdo/XSDHelperImpl.cpp:1.8 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/XSDHelperImpl.cpp Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #include "commonj/sdo/SDOXMLFileWriter.h" // Include first to avoid libxml compile problems! #include "commonj/sdo/SDOXMLStreamWriter.h" // Include first to avoid libxml compile problems! @@ -141,7 +141,7 @@ prop.typeUri : prop.substituteUri; const Type& rootType = dataFactory->getType(typeUri, entryName); PropertyList pl = rootType.getProperties(); - for (int j = 0; j < pl.size(); j++) + for (unsigned int j = 0; j < pl.size(); j++) { if (!pl[j].getType().isDataType() && strcmp(pl[j].getType().getURI(),Type::SDOTypeNamespaceURI.c_str())) @@ -188,7 +188,7 @@ const Type* rootType = df->findType(typeUri,"RootType"); if (rootType == 0) return; PropertyList pl = rootType->getProperties(); - for (int j = 0; j < pl.size(); j++) + for (unsigned int j = 0; j < pl.size(); j++) { XSDPropertyInfo* pi = (XSDPropertyInfo*) ((DASProperty*)&pl[j])->getDASValue("XMLDAS::PropertyInfo"); @@ -342,7 +342,7 @@ (const char*)ty.name, (const char*)ty.parentTypeUri, (const char*)ty.parentTypeName, - (const char*)ty.isRestriction); + ty.isRestriction); } catch (SDORuntimeException& e) { @@ -395,7 +395,7 @@ const Type& rootType = dataFactory->getType(prop.typeUri, "RootType"); PropertyList pl = rootType.getProperties(); - for (int j = 0; j < pl.size(); j++) + for (unsigned int j = 0; j < pl.size(); j++) { XSDPropertyInfo* pi = (XSDPropertyInfo*) @@ -444,9 +444,9 @@ (const char*)prop.name, (const char*)prop.typeUri, (const char*)prop.typeName, - (const char*)prop.isMany, - (const char*)prop.isReadOnly, - (const char*)prop.isContainment); + prop.isMany, + prop.isReadOnly, + prop.isContainment); LOGINFO_1(INFO,"XSDHelper adds property %s",(const char*)(prop.name)); @@ -611,13 +611,13 @@ return retString; } - int XSDHelperImpl::getErrorCount() const + unsigned int XSDHelperImpl::getErrorCount() const { return parseErrors.size(); } - const char* XSDHelperImpl::getErrorMessage(int errnum) const + const char* XSDHelperImpl::getErrorMessage(unsigned int errnum) const { if (errnum >= 0 && errnum < parseErrors.size()) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/XSDHelperImpl.h?r1=1.7&r2=1.8&diff_format=u Index: pecl/sdo/commonj/sdo/XSDHelperImpl.h diff -u pecl/sdo/commonj/sdo/XSDHelperImpl.h:1.7 pecl/sdo/commonj/sdo/XSDHelperImpl.h:1.8 --- pecl/sdo/commonj/sdo/XSDHelperImpl.h:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/XSDHelperImpl.h Thu Dec 7 12:38:33 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:38:33 $ */ #ifndef _XSDHELPERIMPL_H_ #define _XSDHELPERIMPL_H_ @@ -77,7 +77,7 @@ * may be errors to report or handle. */ - virtual int getErrorCount() const; + virtual unsigned int getErrorCount() const; /** getErrorMessage gets the nth error message * @@ -85,7 +85,7 @@ * in which the parser error occurred. */ - virtual const char* getErrorMessage(int errnum) const; + virtual const char* getErrorMessage(unsigned int errnum) const; virtual void setError(const char* error); /** generate buildsXSD from types/properties